Adds nice value for template listeners
authorMatthias Schmidt <gravatronics@live.com>
Sun, 23 Mar 2014 22:06:36 +0000 (23:06 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 23 Mar 2014 22:06:36 +0000 (23:06 +0100)
wcfsetup/install/files/lib/system/cache/builder/TemplateListenerCodeCacheBuilder.class.php
wcfsetup/install/files/lib/system/package/plugin/TemplateListenerPackageInstallationPlugin.class.php
wcfsetup/setup/db/install.sql

index f067d50d819fdc70f294e39c19c1fd1c83b133e4..20e81cf276b5d257a9168de9dc1beeb9360dd781 100644 (file)
@@ -20,6 +20,7 @@ class TemplateListenerCodeCacheBuilder extends AbstractCacheBuilder {
                // get template codes for specified template
                $templateListenerList = new TemplateListenerList();
                $templateListenerList->getConditionBuilder()->add("template_listener.environment = ?", array($parameters['environment']));
+               $templateListenerList->sqlOrderBy = 'template_listener.niceValue ASC, template_listener.listenerID ASC';
                $templateListenerList->readObjects();
                
                $data = array();
index ce1197f72c301a00bb7a37bfc9c4707aa5428eb2..80699b13ab905fc6e12dfd509448a52f80600444 100644 (file)
@@ -45,9 +45,18 @@ class TemplateListenerPackageInstallationPlugin extends AbstractXMLPackageInstal
         * @see \wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::prepareImport()
         */
        protected function prepareImport(array $data) {
+               $niceValue = isset($data['elements']['nice']) ? intval($data['elements']['nice']) : 0;
+               if ($niceValue < -128) {
+                       $niceValue = -128;
+               }
+               else if ($niceValue > 127) {
+                       $niceValue = 127;
+               }
+               
                return array(
                        'environment' => $data['elements']['environment'],
                        'eventName' => $data['elements']['eventname'],
+                       'niceValue' => $niceValue,
                        'name' => $data['attributes']['name'],
                        'templateCode' => $data['elements']['templatecode'],
                        'templateName' => $data['elements']['templatename']
index 1648aa969b5361fb86186836bce8aeecceaf93b6..fe09ea57c43310982be9e9b4300de874d1fe99cc 100644 (file)
@@ -930,6 +930,7 @@ CREATE TABLE wcf1_template_listener (
        templateName VARCHAR(80) NOT NULL DEFAULT '',
        eventName VARCHAR(50) NOT NULL DEFAULT '',
        templateCode TEXT NOT NULL,
+       niceValue TINYINT(3) NOT NULL DEFAULT 0,
        KEY templateName (environment, templateName)
 );