From: Matthias Schmidt Date: Fri, 28 Dec 2012 18:01:33 +0000 (+0100) Subject: Replaces disabled and active with isDisabled X-Git-Tag: 2.0.0_Beta_1~656^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8f08c7d03b68c8ed8bd2e37cbacb8c3ea26b013a;p=GitHub%2FWoltLab%2FWCF.git Replaces disabled and active with isDisabled `disabled` is renamed to `isDisabled` and cronjob's `active` is replaced with `isDisabled`. Also adds missing `wcf\data\IToggleAction` to `wcf\data\language\server\LanguageServerAction`. `wcf\system\style\handler\StyleHandler` still uses `disabled` as an array key at two points (cf. WoltLab/WCF#1031). --- diff --git a/XSD/cronjob.xsd b/XSD/cronjob.xsd index 7c319fef76..5088dd0e2e 100644 --- a/XSD/cronjob.xsd +++ b/XSD/cronjob.xsd @@ -41,7 +41,7 @@ - + \ No newline at end of file diff --git a/wcfsetup/install/files/acp/templates/cronjobList.tpl b/wcfsetup/install/files/acp/templates/cronjobList.tpl index 35ad80c218..31e88f1081 100644 --- a/wcfsetup/install/files/acp/templates/cronjobList.tpl +++ b/wcfsetup/install/files/acp/templates/cronjobList.tpl @@ -75,9 +75,9 @@ {if $cronjob->canBeDisabled()} - + {else} - {if $cronjob->active} + {if !$cronjob->isDisabled} {else} @@ -111,7 +111,7 @@ {/if} - {if $cronjob->active && $cronjob->nextExec != 1} + {if !$cronjob->isDisabled && $cronjob->nextExec != 1}

{@$cronjob->nextExec|plainTime}

{/if} diff --git a/wcfsetup/install/files/acp/templates/updateServerList.tpl b/wcfsetup/install/files/acp/templates/updateServerList.tpl index 24ed0f35e5..a1c13113ee 100644 --- a/wcfsetup/install/files/acp/templates/updateServerList.tpl +++ b/wcfsetup/install/files/acp/templates/updateServerList.tpl @@ -56,10 +56,10 @@ {foreach from=$objects item=updateServer} - + - + {event name='buttons'}

{@$updateServer->packageUpdateServerID}

@@ -68,7 +68,7 @@

{@$updateServer->status}

{@$updateServer->errorMessage|truncate:"30"}

{if $updateServer->lastUpdateTime}{@$updateServer->lastUpdateTime|time}{/if}

- + {event name='columns'} {/foreach} diff --git a/wcfsetup/install/files/lib/data/cronjob/CronjobAction.class.php b/wcfsetup/install/files/lib/data/cronjob/CronjobAction.class.php index c2daee1b50..5094a8012c 100644 --- a/wcfsetup/install/files/lib/data/cronjob/CronjobAction.class.php +++ b/wcfsetup/install/files/lib/data/cronjob/CronjobAction.class.php @@ -88,8 +88,7 @@ class CronjobAction extends AbstractDatabaseObjectAction implements IToggleActio */ public function toggle() { foreach ($this->objects as $cronjob) { - $newStatus = ($cronjob->active) ? 0 : 1; - $cronjob->update(array('active' => $newStatus)); + $cronjob->update(array('isDisabled' => 1 - $cronjob->isDisabled)); } } diff --git a/wcfsetup/install/files/lib/data/language/server/LanguageServerAction.class.php b/wcfsetup/install/files/lib/data/language/server/LanguageServerAction.class.php index 13b8461a91..b4cbc09abc 100644 --- a/wcfsetup/install/files/lib/data/language/server/LanguageServerAction.class.php +++ b/wcfsetup/install/files/lib/data/language/server/LanguageServerAction.class.php @@ -1,6 +1,7 @@ objects as $serverEditor) { + $serverEditor->update(array( + 'isDisabled' => 1 - $serverEditor->isDisabled + )); + } + } + + /** + * @see wcf\data\IToggleAction::validateToggle() + */ + public function validateToggle() { + $this->validateUpdate(); + } } diff --git a/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServer.class.php b/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServer.class.php index ce70eaeaa9..8d0d8531f9 100644 --- a/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServer.class.php +++ b/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServer.class.php @@ -33,7 +33,7 @@ class PackageUpdateServer extends DatabaseObject { public static function getActiveUpdateServers(array $packageUpdateServerIDs = array()) { $list = new PackageUpdateServerList(); $list->sqlLimit = 0; - $list->getConditionBuilder()->add("disabled = ?", array(0)); + $list->getConditionBuilder()->add("isDisabled = ?", array(0)); if (!empty($packageUpdateServerIDs)) { $list->getConditionBuilder()->add("packageUpdateServerID IN (?)", array($packageUpdateServerIDs)); } diff --git a/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServerAction.class.php b/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServerAction.class.php index 2d36da98f0..bda6e520ed 100644 --- a/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServerAction.class.php +++ b/wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServerAction.class.php @@ -46,7 +46,7 @@ class PackageUpdateServerAction extends AbstractDatabaseObjectAction implements */ public function toggle() { foreach ($this->objects as $server) { - $server->update(array('disabled' => ($server->disabled) ? 0 : 1)); + $server->update(array('isDisabled' => ($server->isDisabled) ? 0 : 1)); } } } diff --git a/wcfsetup/install/files/lib/data/style/StyleAction.class.php b/wcfsetup/install/files/lib/data/style/StyleAction.class.php index 7c2096fd68..b4a11a8b89 100644 --- a/wcfsetup/install/files/lib/data/style/StyleAction.class.php +++ b/wcfsetup/install/files/lib/data/style/StyleAction.class.php @@ -391,7 +391,7 @@ class StyleAction extends AbstractDatabaseObjectAction { 'packageID' => PACKAGE_ID, 'styleName' => $styleName, 'templateGroupID' => $this->styleEditor->templateGroupID, - 'disabled' => 1, // newly created styles are disabled by default + 'isDisabled' => 1, // newly created styles are disabled by default 'styleDescription' => $this->styleEditor->styleDescription, 'styleVersion' => $this->styleEditor->styleVersion, 'styleDate' => $this->styleEditor->styleDate, @@ -454,8 +454,8 @@ class StyleAction extends AbstractDatabaseObjectAction { */ public function toggle() { foreach ($this->objects as $style) { - $disabled = ($style->disabled) ? 0 : 1; - $style->update(array('disabled' => $disabled)); + $isDisabled = ($style->isDisabled) ? 0 : 1; + $style->update(array('isDisabled' => $isDisabled)); } } @@ -464,7 +464,7 @@ class StyleAction extends AbstractDatabaseObjectAction { */ public function validateChangeStyle() { $this->style = $this->getSingleObject(); - if ($this->style->disabled && !WCF::getSession()->getPermission('admin.style.canUseDisabledStyle')) { + if ($this->style->isDisabled && !WCF::getSession()->getPermission('admin.style.canUseDisabledStyle')) { throw new PermissionDeniedException(); } } @@ -500,7 +500,7 @@ class StyleAction extends AbstractDatabaseObjectAction { public function getStyleChooser() { $styleList = new StyleList(); if (!WCF::getSession()->getPermission('admin.style.canUseDisabledStyle')) { - $styleList->getConditionBuilder()->add("style.disabled = ?", array(0)); + $styleList->getConditionBuilder()->add("style.isDisabled = ?", array(0)); } $styleList->sqlOrderBy = "style.styleName ASC"; $styleList->readObjects(); diff --git a/wcfsetup/install/files/lib/data/style/StyleEditor.class.php b/wcfsetup/install/files/lib/data/style/StyleEditor.class.php index d845c8f87f..e1509d6e78 100644 --- a/wcfsetup/install/files/lib/data/style/StyleEditor.class.php +++ b/wcfsetup/install/files/lib/data/style/StyleEditor.class.php @@ -103,7 +103,7 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject // set new default $this->update(array( 'isDefault' => 1, - 'disabled' => 0 + 'isDisabled' => 0 )); self::resetCache(); diff --git a/wcfsetup/install/files/lib/data/user/option/UserOptionEditor.class.php b/wcfsetup/install/files/lib/data/user/option/UserOptionEditor.class.php index e9ee004415..6048d546f5 100644 --- a/wcfsetup/install/files/lib/data/user/option/UserOptionEditor.class.php +++ b/wcfsetup/install/files/lib/data/user/option/UserOptionEditor.class.php @@ -82,7 +82,7 @@ class UserOptionEditor extends DatabaseObjectEditor { $value = intval(!$enable); $sql = "UPDATE wcf".WCF_N."_user_option - SET disabled = ? + SET isDisabled = ? WHERE optionID = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array($value, $this->optionID)); diff --git a/wcfsetup/install/files/lib/system/cronjob/CronjobScheduler.class.php b/wcfsetup/install/files/lib/system/cronjob/CronjobScheduler.class.php index a59aa98d3b..dd17649513 100644 --- a/wcfsetup/install/files/lib/system/cronjob/CronjobScheduler.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/CronjobScheduler.class.php @@ -105,14 +105,14 @@ class CronjobScheduler extends SingletonFactory { $sql = "SELECT * FROM wcf".WCF_N."_cronjob cronjob WHERE (cronjob.nextExec <= ? OR cronjob.afterNextExec <= ?) - AND cronjob.active = ? + AND cronjob.isDisabled = ? AND cronjob.failCount < ? AND cronjob.state = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array( TIME_NOW, TIME_NOW, - 1, + 0, Cronjob::MAX_FAIL_COUNT, Cronjob::READY )); @@ -132,7 +132,7 @@ class CronjobScheduler extends SingletonFactory { // disable cronjob if ($failCount == 3) { - $data['active'] = 0; + $data['isDisabled'] = 1; $executeCronjob = false; } } diff --git a/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php b/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php index 5ef52f0d4c..7dfffe5b2b 100644 --- a/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php +++ b/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php @@ -162,7 +162,7 @@ class UserOptionHandler extends OptionHandler { * @see wcf\system\option\OptionHandler::checkVisibility() */ protected function checkVisibility(Option $option) { - if ($option->disabled) { + if ($option->isDisabled) { return false; } diff --git a/wcfsetup/install/files/lib/system/package/plugin/CronjobPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/CronjobPackageInstallationPlugin.class.php index bbe34e1282..d275e2fe0d 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/CronjobPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/CronjobPackageInstallationPlugin.class.php @@ -56,11 +56,11 @@ class CronjobPackageInstallationPlugin extends AbstractXMLPackageInstallationPlu */ protected function prepareImport(array $data) { return array( - 'active' => (isset($data['elements']['active'])) ? intval($data['elements']['active']) : 1, 'canBeDisabled' => (isset($data['elements']['canbedisabled'])) ? intval($data['elements']['canbedisabled']) : 1, 'canBeEdited' => (isset($data['elements']['canbeedited'])) ? intval($data['elements']['canbeedited']) : 1, 'className' => (isset($data['elements']['classname'])) ? $data['elements']['classname'] : '', 'description' => (isset($data['elements']['description'])) ? $data['elements']['description'] : '', + 'isDisabled' => (isset($data['elements']['isdisabled'])) ? intval($data['elements']['isdisabled']) : 0, 'startDom' => $data['elements']['startdom'], 'startDow' => $data['elements']['startdow'], 'startHour' => $data['elements']['starthour'], diff --git a/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php index 213ee90a2c..23677bac6d 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php @@ -28,7 +28,7 @@ class UserOptionPackageInstallationPlugin extends AbstractOptionPackageInstallat * list of names of tags which aren't considered as additional data * @var array */ - public static $reservedTags = array('name', 'optiontype', 'defaultvalue', 'validationpattern', 'required', 'editable', 'visible', 'searchable', 'showorder', 'outputclass', 'selectoptions', 'enableoptions', 'disabled', 'categoryname', 'permissions', 'options', 'attrs', 'cdata'); + public static $reservedTags = array('name', 'optiontype', 'defaultvalue', 'validationpattern', 'required', 'editable', 'visible', 'searchable', 'showorder', 'outputclass', 'selectoptions', 'enableoptions', 'isdisabled', 'categoryname', 'permissions', 'options', 'attrs', 'cdata'); /** * @see wcf\system\package\plugin\AbstractOptionPackageInstallationPlugin::saveCategory() @@ -63,7 +63,7 @@ class UserOptionPackageInstallationPlugin extends AbstractOptionPackageInstallat protected function saveOption($option, $categoryName, $existingOptionID = 0) { // default values $optionName = $optionType = $validationPattern = $outputClass = $selectOptions = $enableOptions = $permissions = $options = ''; - $required = $editable = $visible = $searchable = $disabled = $askDuringRegistration = 0; + $required = $editable = $visible = $searchable = $isDisabled = $askDuringRegistration = 0; $defaultValue = $showOrder = null; // get values @@ -80,7 +80,7 @@ class UserOptionPackageInstallationPlugin extends AbstractOptionPackageInstallat if (isset($option['outputclass'])) $outputClass = $option['outputclass']; if (isset($option['selectoptions'])) $selectOptions = $option['selectoptions']; if (isset($option['enableoptions'])) $enableOptions = $option['enableoptions']; - if (isset($option['disabled'])) $disabled = intval($option['disabled']); + if (isset($option['isdisabled'])) $isDisabled = intval($option['isdisabled']); $showOrder = $this->getShowOrder($showOrder, $categoryName, 'categoryName'); if (isset($option['permissions'])) $permissions = $option['permissions']; if (isset($option['options'])) $options = $option['options']; @@ -124,7 +124,7 @@ class UserOptionPackageInstallationPlugin extends AbstractOptionPackageInstallat 'outputClass' => $outputClass, 'searchable' => $searchable, 'showOrder' => $showOrder, - 'disabled' => $disabled, + 'isDisabled' => $isDisabled, 'permissions' => $permissions, 'options' => $options, 'additionalData' => serialize($additionalData) diff --git a/wcfsetup/install/files/lib/system/style/StyleHandler.class.php b/wcfsetup/install/files/lib/system/style/StyleHandler.class.php index 2951d33a52..bac726d53f 100644 --- a/wcfsetup/install/files/lib/system/style/StyleHandler.class.php +++ b/wcfsetup/install/files/lib/system/style/StyleHandler.class.php @@ -53,7 +53,7 @@ class StyleHandler extends SingletonFactory { $styles = array(); foreach ($this->cache['styles'] as $styleID => $style) { - if ((!$style->disabled && empty($this->cache['packages'][PACKAGE_ID]['disabled'][$styleID])) || WCF::getSession()->getPermission('admin.style.canUseDisabledStyle')) { + if ((!$style->isDisabled && empty($this->cache['packages'][PACKAGE_ID]['disabled'][$styleID])) || WCF::getSession()->getPermission('admin.style.canUseDisabledStyle')) { $styles[$styleID] = $style; } } @@ -84,7 +84,7 @@ class StyleHandler extends SingletonFactory { // check permission if (!$ignorePermissions) { if (isset($this->cache['styles'][$styleID])) { - if (($this->cache['styles'][$styleID]->disabled || !empty($this->cache['packages'][PACKAGE_ID]['disabled'][$styleID])) && !WCF::getSession()->getPermission('admin.style.canUseDisabledStyle')) { + if (($this->cache['styles'][$styleID]->isDisabled || !empty($this->cache['packages'][PACKAGE_ID]['disabled'][$styleID])) && !WCF::getSession()->getPermission('admin.style.canUseDisabledStyle')) { $styleID = 0; } } diff --git a/wcfsetup/setup/db/install.sql b/wcfsetup/setup/db/install.sql index e46458b30d..c729996143 100644 --- a/wcfsetup/setup/db/install.sql +++ b/wcfsetup/setup/db/install.sql @@ -166,7 +166,7 @@ CREATE TABLE wcf1_cronjob ( lastExec INT(10) NOT NULL DEFAULT 0, nextExec INT(10) NOT NULL DEFAULT 0, afterNextExec INT(10) NOT NULL DEFAULT 0, - active TINYINT(1) NOT NULL DEFAULT 1, + isDisabled TINYINT(1) NOT NULL DEFAULT 0, canBeEdited TINYINT(1) NOT NULL DEFAULT 1, canBeDisabled TINYINT(1) NOT NULL DEFAULT 1, state TINYINT(1) NOT NULL DEFAULT 0, @@ -232,7 +232,7 @@ DROP TABLE IF EXISTS wcf1_language_server; CREATE TABLE wcf1_language_server ( languageServerID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, serverURL VARCHAR(255) NOT NULL DEFAULT '', - disabled TINYINT(1) NOT NULL DEFAULT 0 + isDisabled TINYINT(1) NOT NULL DEFAULT 0 ); DROP TABLE IF EXISTS wcf1_modification_log; @@ -446,7 +446,7 @@ CREATE TABLE wcf1_package_update_server ( serverURL VARCHAR(255) NOT NULL DEFAULT '', loginUsername VARCHAR(255) NOT NULL DEFAULT '', loginPassword VARCHAR(255) NOT NULL DEFAULT '', - disabled TINYINT(1) NOT NULL DEFAULT 0, + isDisabled TINYINT(1) NOT NULL DEFAULT 0, lastUpdateTime INT(10) NOT NULL DEFAULT 0, status ENUM('online', 'offline') NOT NULL DEFAULT 'online', errorMessage TEXT @@ -537,7 +537,7 @@ CREATE TABLE wcf1_style ( styleName VARCHAR(255) NOT NULL DEFAULT '', templateGroupID INT(10) NOT NULL DEFAULT 0, isDefault TINYINT(1) NOT NULL DEFAULT 0, - disabled TINYINT(1) NOT NULL DEFAULT 0, + isDisabled TINYINT(1) NOT NULL DEFAULT 0, styleDescription TEXT, styleVersion VARCHAR(255) NOT NULL DEFAULT '', styleDate CHAR(10) NOT NULL DEFAULT '0000-00-00', @@ -685,7 +685,7 @@ CREATE TABLE wcf1_user_option ( outputClass VARCHAR(255) NOT NULL DEFAULT '', searchable TINYINT(1) NOT NULL DEFAULT 0, showOrder INT(10) NOT NULL DEFAULT 0, - disabled TINYINT(1) NOT NULL DEFAULT 0, + isDisabled TINYINT(1) NOT NULL DEFAULT 0, permissions TEXT, options TEXT, additionalData MEDIUMTEXT, @@ -880,8 +880,8 @@ INSERT INTO wcf1_user_group_option_value (groupID, optionID, optionValue) VALUES INSERT INTO wcf1_user_group_option_value (groupID, optionID, optionValue) VALUES (4, 3, '1'); -- Administrators -- default update servers -INSERT INTO wcf1_package_update_server (serverURL, status, disabled, errorMessage, lastUpdateTime, loginUsername, loginPassword) VALUES ('http://update.woltlab.com/maelstrom/', 'online', 0, NULL, 0, '', ''); -INSERT INTO wcf1_package_update_server (serverURL, status, disabled, errorMessage, lastUpdateTime, loginUsername, loginPassword) VALUES ('http://store.woltlab.com/maelstrom/', 'online', 0, NULL, 0, '', ''); +INSERT INTO wcf1_package_update_server (serverURL, status, isDisabled, errorMessage, lastUpdateTime, loginUsername, loginPassword) VALUES ('http://update.woltlab.com/maelstrom/', 'online', 0, NULL, 0, '', ''); +INSERT INTO wcf1_package_update_server (serverURL, status, isDisabled, errorMessage, lastUpdateTime, loginUsername, loginPassword) VALUES ('http://store.woltlab.com/maelstrom/', 'online', 0, NULL, 0, '', ''); -- style default values INSERT INTO wcf1_style_variable (variableName, defaultValue) VALUES ('wcfContentBackgroundColor', 'rgba(255, 255, 255, 1)');