From da84cf755031c0b7713c870ddd3724dc8154e5fb Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 23 Mar 2014 23:06:36 +0100 Subject: [PATCH] Adds nice value for template listeners --- .../builder/TemplateListenerCodeCacheBuilder.class.php | 1 + .../TemplateListenerPackageInstallationPlugin.class.php | 9 +++++++++ wcfsetup/setup/db/install.sql | 1 + 3 files changed, 11 insertions(+) diff --git a/wcfsetup/install/files/lib/system/cache/builder/TemplateListenerCodeCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/TemplateListenerCodeCacheBuilder.class.php index f067d50d81..20e81cf276 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/TemplateListenerCodeCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/TemplateListenerCodeCacheBuilder.class.php @@ -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(); diff --git a/wcfsetup/install/files/lib/system/package/plugin/TemplateListenerPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/TemplateListenerPackageInstallationPlugin.class.php index ce1197f72c..80699b13ab 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/TemplateListenerPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/TemplateListenerPackageInstallationPlugin.class.php @@ -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'] diff --git a/wcfsetup/setup/db/install.sql b/wcfsetup/setup/db/install.sql index 1648aa969b..fe09ea57c4 100644 --- a/wcfsetup/setup/db/install.sql +++ b/wcfsetup/setup/db/install.sql @@ -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) ); -- 2.20.1