Every application has to prepend it's own abbreviation to an option name, e.g. "wbb_thread_enable_marking_as_done" ("wbb_"). This is no longer done by WCF itself!
Fixes #997
* @return array<wcf\data\option\Option>
*/
public static function getOptions() {
- $sql = "SELECT option_table.*, package.package, package.isApplication
- FROM wcf".WCF_N."_option option_table
- LEFT JOIN wcf".WCF_N."_package package
- ON (package.packageID = option_table.packageID)";
+ $sql = "SELECT *
+ FROM wcf".WCF_N."_option";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute();
+
+ $options = array();
while ($row = $statement->fetchArray()) {
$option = new Option(null, $row);
$options[$option->getConstantName()] = $option;
* @return string
*/
public function getConstantName() {
- $prefix = '';
- if ($this->package && $this->isApplication && $this->package != 'com.woltlab.wcf') {
- $prefix = Package::getAbbreviation($this->package) . '_';
- }
-
- return strtoupper($prefix.$this->optionName);
+ return strtoupper($this->optionName);
}
}
* Installs, updates and deletes options.
*
* @author Benjamin Kunz
- * @copyright 2001-2012 WoltLab GmbH
+ * @copyright 2001-2013 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.package.plugin
// try to find an existing option for updating
$sql = "SELECT *
FROM wcf".WCF_N."_".$this->tableName."
- WHERE optionName = ?
- AND packageID = ?";
+ WHERE optionName = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array(
- $optionName,
- $this->installation->getPackageID()
+ $optionName
));
$row = $statement->fetchArray();
OptionEditor::create($data);
}
else {
+ // editing an option from a different package
+ if ($row['packageID'] != $this->installation->getPackageID()) {
+ throw new SystemException("Option '".$optionName."' already exists, but is owned by a different package");
+ }
+
// update existing item
$optionObj = new Option(null, $row);
$optionEditor = new OptionEditor($optionObj);
supportI18n TINYINT(1) NOT NULL DEFAULT 0,
requireI18n TINYINT(1) NOT NULL DEFAULT 0,
additionalData MEDIUMTEXT,
- UNIQUE KEY optionName (optionName, packageID)
+
+ UNIQUE KEY optionName (optionName)
);
DROP TABLE IF EXISTS wcf1_option_category;