Renamed column according to PIP, added missing (foreign) keys and cache builders.
--- /dev/null
+<?php
+namespace wcf\system\cache\builder;
+use wcf\data\clipboard\action\ClipboardActionList;
+use wcf\system\package\PackageDependencyHandler;
+
+/**
+ * Caches clipboard actions.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2011 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.cache.builder
+ * @category Community Framework
+ */
+class ClipboardActionCacheBuilder implements ICacheBuilder {
+ /**
+ * @see wcf\system\cache\ICacheBuilder::getData()
+ */
+ public function getData(array $cacheResource) {
+ $actionList = new ClipboardActionList();
+ $actionList->getConditionBuilder()->add("packageID IN (?)", array(PackageDependencyHandler::getDependencies()));
+ $actionList->sqlLimit = 0;
+ $actionList->readObjects();
+
+ return $actionList->getObjects();
+ }
+}
--- /dev/null
+<?php
+namespace wcf\system\cache\builder;
+use wcf\data\clipboard\item\type\ClipboardItemTypeList;
+use wcf\system\package\PackageDependencyHandler;
+
+/**
+ * Caches clipboard item types.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2011 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.cache.builder
+ * @category Community Framework
+ */
+class ClipboardItemTypeCacheBuilder implements ICacheBuilder {
+ /**
+ * @see wcf\system\cache\ICacheBuilder::getData()
+ */
+ public function getData(array $cacheResource) {
+ $typeList = new ClipboardItemTypeList();
+ $typeList->getConditionBuilder()->add("clipboard_item_type.packageID IN (?)", array(PackageDependencyHandler::getDependencies()));
+ $typeList->sqlLimit = 0;
+ $typeList->readObjects();
+
+ $data = array(
+ 'typeNames' => array(),
+ 'types' => array()
+ );
+ foreach ($typeList->getObjects() as $typeID => $type) {
+ $data['typeNames'][$type->typeName] = $typeID;
+ $data['types'][$typeID] = $type;
+ }
+
+ return $data;
+ }
+}
--- /dev/null
+<?php
+namespace wcf\system\cache\builder;
+use wcf\system\database\util\PreparedStatementConditionBuilder;
+use wcf\system\package\PackageDependencyHandler;
+use wcf\system\WCF;
+
+/**
+ * Caches clipboard pages.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2011 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.cache.builder
+ * @category Community Framework
+ */
+class ClipboardPageCacheBuilder implements ICacheBuilder {
+ /**
+ * @see wcf\system\cache\ICacheBuilder::getData()
+ */
+ public function getData(array $cacheResource) {
+ $conditions = new PreparedStatementConditionBuilder();
+ $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getDependencies()));
+
+ $sql = "SELECT pageClassName, actionID
+ FROM wcf".WCF_N."_clipboard_page
+ ".$conditions;
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute($conditions->getParameters());
+
+ $data = array();
+ while ($row = $statement->fetchArray()) {
+ if (!isset($data[$row['pageClassName']])) {
+ $data[$row['pageClassName']] = array();
+ }
+
+ $data[$row['pageClassName']][] = $row['actionID'];
+ }
+
+ return $data;
+ }
+}
if (!isset($data[$type->typeName])) {
$data[$type->typeName] = array(
- 'className' => $type->className,
+ 'className' => $type->listClassName,
'objectIDs' => array()
);
}
*/
public function getEditorItems($page) {
// ignore unknown pages
- if (!isset($this->pageCache[$page])) die('page '.$page.' is unknown');
- #return null;
+ if (!isset($this->pageCache[$page])) return null;
// get objects
$objects = $this->getMarkedItems();
packageID INT(10) NOT NULL DEFAULT 0,
actionName VARCHAR(50) NOT NULL DEFAULT '',
actionClassName VARCHAR(200) NOT NULL DEFAULT '',
- sortOrder INT(10) NOT NULL DEFAULT 0
+ sortOrder INT(10) NOT NULL DEFAULT 0,
+ UNIQUE KEY actionName (packageID, actionName)
);
DROP TABLE IF EXISTS wcf1_clipboard_item;
typeID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
packageID INT(10) NOT NULL DEFAULT 0,
typeName VARCHAR(80) NOT NULL DEFAULT '',
- className VARCHAR(200) NOT NULL DEFAULT ''
+ listClassName VARCHAR(200) NOT NULL DEFAULT '',
+ UNIQUE KEY typeName (typeName)
);
DROP TABLE IF EXISTS wcf1_clipboard_page;
ALTER TABLE wcf1_cleanup_log ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
+ALTER TABLE wcf1_clipboard_action ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
+
+ALTER TABLE wcf1_clipboard_item ADD FOREIGN KEY (typeID) REFERENCES wcf1_clipboard_item_type (typeID) ON DELETE CASCADE;
+
+ALTER TABLE wcf1_clipboard_item_type ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
+
+ALTER TABLE wcf1_clipboard_page ADD FOREIGN KEY (actionID) REFERENCES wcf1_clipboard_action (actionID) ON DELETE CASCADE;
+ALTER TABLE wcf1_clipboard_page ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
+
ALTER TABLE wcf1_core_object ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
ALTER TABLE wcf1_cronjob ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;