* `wcf\system\cache\builder\EventListenerCacheBuilder` returns `wcf\data\event\listener\EventListener` objects instead of data arrays.
* `wcf\system\clipboard\action\UserExtendedClipboardAction` removed.
* `wcf\system\event\listener\PreParserAtUserListener` removed.
-* `wcf\action\AJAXProxyAction::getData()` remove.
+* `wcf\action\AJAXProxyAction::getData()` removed.
+* Version system removed.
<name>com.woltlab.wcf.modifiableContent</name>
</definition>
- <definition>
- <name>com.woltlab.wcf.versionableObject</name>
- </definition>
-
<definition>
<name>com.woltlab.wcf.attachment.objectType</name>
<interfacename><![CDATA[wcf\system\attachment\IAttachmentObjectType]]></interfacename>
+++ /dev/null
-<?php
-namespace wcf\data;
-use wcf\system\exception\SystemException;
-use wcf\system\version\VersionHandler;
-
-/**
- * Abstract class for all versionable data classes.
- *
- * @deprecated 2.1 - will be removed with WCF 2.2
- *
- * @author Jeffrey Reichardt
- * @copyright 2001-2015 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package com.woltlab.wcf
- * @subpackage data
- * @category Community Framework
- */
-abstract class VersionableDatabaseObject extends DatabaseObject {
- /**
- * name of the versionable object type
- * @var string
- */
- public $versionableObjectTypeName = '';
-
- /**
- * Returns suffix of the version database table.
- *
- * @return string
- */
- public static function getDatabaseVersionTableName() {
- return static::getDatabaseTableName().'_version';
- }
-
- /**
- * Returns name of index in version database table.
- *
- * @return string
- */
- public static function getDatabaseVersionTableIndexName() {
- return 'versionID';
- }
-
- /**
- * Returns all versions of this database object.
- *
- * @return array<\wcf\data\VersionableDatabaseObject>
- */
- public function getVersions() {
- $objectType = VersionHandler::getInstance()->getObjectTypeByName($this->versionableObjectTypeName);
-
- if ($objectType === null) {
- throw new SystemException("Unknown versionable object type with name '".$this->versionableObjectTypeName."'");
- }
-
- return VersionHandler::getInstance()->getVersions($objectType->objectTypeID, $this->getObjectID());
- }
-}
+++ /dev/null
-<?php
-namespace wcf\data;
-use wcf\system\version\VersionHandler;
-
-/**
- * Abstract class for all versionable data actions.
- *
- * @deprecated 2.1 - will be removed with WCF 2.2
- *
- * @author Jeffrey Reichardt
- * @copyright 2001-2015 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package com.woltlab.wcf
- * @subpackage data
- * @category Community Framework
- */
-abstract class VersionableDatabaseObjectAction extends AbstractDatabaseObjectAction {
- /**
- * Validates restoring a version.
- */
- public function validateRestoreRevision() {
- parent::validateUpdate();
- }
-
- /**
- * @see \wcf\data\IDeleteAction::delete()
- */
- public function delete() {
- if (empty($this->objects)) {
- $this->readObjects();
- }
-
- // get ids
- $objectIDs = array();
- foreach ($this->objects as $object) {
- $objectIDs[] = $object->getObjectID();
- }
-
- // execute action
- return call_user_func(array($this->className, 'deleteAll'), $objectIDs);
- }
-
- /**
- * @see \wcf\data\AbstractDatabaseObjectAction::update()
- */
- public function update() {
- if (empty($this->objects)) {
- $this->readObjects();
- }
-
- if (isset($this->parameters['data'])) {
- foreach ($this->objects as $object) {
- $object->update($this->parameters['data']);
- }
-
- // create revision retroactively
- $this->createRevision();
- }
- }
-
- /**
- * Creates a new revision.
- */
- protected function createRevision() {
- $indexName = call_user_func(array($this->className, 'getDatabaseTableIndexName'));
-
- foreach ($this->objects as $object) {
- call_user_func(array($this->className, 'createRevision'), array_merge($object->getDecoratedObject()->getData(), array($indexName => $object->getObjectID())));
- }
- }
-
- /**
- * Deletes a revision.
- */
- protected function deleteRevision() {
- if (empty($this->objects)) {
- $this->readObjects();
- }
-
- // get ids
- $objectIDs = array();
- foreach ($this->objects as $object) {
- $objectIDs[] = $object->getObjectID();
- }
-
- // execute action
- return call_user_func(array($this->className, 'deleteRevision'), $objectIDs);
- }
-
- /**
- * Restores a revision.
- */
- public function restoreRevision() {
- if (empty($this->objects)) {
- $this->readObjects();
- }
-
- // currently we only support restoring one version
- foreach ($this->objects as $object) {
- $objectType = VersionHandler::getInstance()->getObjectTypeByName($object->versionableObjectTypeName);
- $restoreObject = VersionHandler::getInstance()->getVersionByID($objectType->objectTypeID, $this->parameters['restoreObjectID']);
-
- $this->parameters['data'] = $restoreObject->getData();
- }
-
- $this->update();
- }
-}
+++ /dev/null
-<?php
-namespace wcf\data;
-use wcf\system\WCF;
-
-/**
- * Abstract class for all versionable editor classes.
- *
- * @deprecated 2.1 - will be removed with WCF 2.2
- *
- * @author Jeffrey Reichardt
- * @copyright 2001-2015 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package com.woltlab.wcf
- * @subpackage data
- * @category Community Framework
- */
-abstract class VersionableDatabaseObjectEditor extends DatabaseObjectEditor {
- /**
- * @see \wcf\data\IEditableObject::create()
- */
- public static function createRevision(array $parameters = array()) {
- $keys = $values = '';
- $statementParameters = array();
- foreach ($parameters as $key => $value) {
- if (!empty($keys)) {
- $keys .= ',';
- $values .= ',';
- }
-
- $keys .= $key;
- $values .= '?';
- $statementParameters[] = $value;
- }
-
- // save object
- $sql = "INSERT INTO ".static::getDatabaseVersionTableName()." (".$keys.")
- VALUES (".$values.")";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($statementParameters);
-
- // return new object
- $id = WCF::getDB()->getInsertID(static::getDatabaseVersionTableName(), static::getDatabaseVersionTableIndexName());
-
- return new static::$baseClass($id);
- }
-
- /**
- * @see \wcf\data\IEditableObject::delete()
- */
- public function deleteRevision(array $objectIDs = array()) {
- static::deleteAll(array($this->__get(static::getDatabaseVersionTableIndexName())));
- }
-
- /**
- * @see \wcf\data\IEditableObject::deleteAll()
- */
- public static function deleteAll(array $objectIDs = array()) {
- $affectedCount = static::deleteAll($objectIDs);
-
- // delete versions
- $sql = "DELETE FROM ".static::getDatabaseVersionTableName()."
- WHERE ".static::getDatabaseTableIndexName()." = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
-
- WCF::getDB()->beginTransaction();
- foreach ($objectIDs as $objectID) {
- $statement->execute(array($objectID));
- }
- WCF::getDB()->commitTransaction();
-
- return $affectedCount;
- }
-
- /**
- * @see \wcf\data\VersionableDatabaseObject::getDatabaseVersionTableName()
- */
- public static function getDatabaseVersionTableName() {
- return call_user_func(array(static::$baseClass, 'getDatabaseVersionTableName'));
- }
-
- /**
- * @see \wcf\data\VersionableDatabaseObject::getDatabaseVersionTableIndexName()
- */
- public static function getDatabaseVersionTableIndexName() {
- return call_user_func(array(static::$baseClass, 'getDatabaseVersionTableIndexName'));
- }
-}
+++ /dev/null
-<?php
-namespace wcf\system\cache\builder;
-use wcf\data\object\type\ObjectTypeCache;
-use wcf\system\WCF;
-
-/**
- * Caches the versions for a certain package and object type.
- *
- * @deprecated 2.1 - will be removed with WCF 2.2
- *
- * @author Jeffrey Reichardt
- * @copyright 2001-2015 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 VersionCacheBuilder extends AbstractCacheBuilder {
- /**
- * @see \wcf\system\cache\builder\AbstractCacheBuilder::rebuild()
- */
- public function rebuild(array $parameters) {
- // get object types
- $objectTypes = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.versionableObject');
-
- $data = array(
- 'versions' => array(),
- 'versionIDs' => array()
- );
-
- foreach ($objectTypes as $objectType) {
- $objectTypeID = $objectType->objectTypeID;
-
- $sql = "SELECT *
- FROM ". call_user_func(array($objectType->className, 'getDatabaseVersionTableName'));
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array());
-
- while ($row = $statement->fetchArray()) {
- $databaseIndexName = call_user_func(array($objectType->className, 'getDatabaseTableIndexName'));
- $databaseVersionTableIndexName = call_user_func(array($objectType->className, 'getDatabaseVersionTableIndexName'));
-
- $object = new $objectType->className(null, $row);
- $data['versions'][$objectTypeID][$object->$databaseIndexName][] = $object;
- $data['versionIDs'][$objectTypeID][$object->$databaseIndexName][] = $object->$databaseVersionTableIndexName;
- }
- }
-
- return $data;
- }
-}
use wcf\system\form\FormDocument;
use wcf\system\language\LanguageFactory;
use wcf\system\package\plugin\IPackageInstallationPlugin;
-use wcf\system\package\plugin\ObjectTypePackageInstallationPlugin;
-use wcf\system\package\plugin\SQLPackageInstallationPlugin;
use wcf\system\request\LinkHandler;
use wcf\system\request\RouteHandler;
use wcf\system\setup\Installer;
*/
const CONFIG_FILE = 'config.inc.php';
- /**
- * holds state of structuring version tables
- * @var boolean
- */
- protected $requireRestructureVersionTables = false;
-
/**
* data of previous package in queue
* @var array<string>
$statement->execute(array($this->queue->processNo));
}
- if ($this->requireRestructureVersionTables) {
- $this->restructureVersionTables();
- }
-
return $step;
}
throw new SystemException("'".$className."' does not implement 'wcf\system\package\plugin\IPackageInstallationPlugin'");
}
- if ($plugin instanceof SQLPackageInstallationPlugin || $plugin instanceof ObjectTypePackageInstallationPlugin) {
- $this->requireRestructureVersionTables = true;
- }
-
// execute PIP
$document = null;
try {
break;
}
}
-
- /**
- * Restructure version tables.
- *
- * @deprecated 2.1 - will be removed with WCF 2.2
- */
- protected function restructureVersionTables() {
- $objectTypes = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.versionableObject');
-
- if (empty($objectTypes)) {
- return;
- }
-
- // base structure of version tables
- $versionTableBaseColumns = array();
- $versionTableBaseColumns[] = array('name' => 'versionID', 'data' => array('type' => 'INT', 'length' => 10, 'key' => 'PRIMARY', 'autoIncrement' => 'AUTO_INCREMENT'));
- $versionTableBaseColumns[] = array('name' => 'versionUserID', 'data' => array('type' => 'INT', 'length' => 10));
- $versionTableBaseColumns[] = array('name' => 'versionUsername', 'data' => array('type' => 'VARCHAR', 'length' => 255));
- $versionTableBaseColumns[] = array('name' => 'versionTime', 'data' => array('type' => 'INT', 'length' => 10));
-
- foreach ($objectTypes as $objectType) {
- if (!class_exists($objectType->className)) {
- // versionable database object isn't available anymore
- // the object type gets deleted later on during the uninstallation
- continue;
- }
- $baseTableColumns = WCF::getDB()->getEditor()->getColumns(call_user_func(array($objectType->className, 'getDatabaseTableName')));
-
- // remove primary key from base table columns
- foreach ($baseTableColumns as $key => $column) {
- if ($column['data']['key'] == 'PRIMARY') {
- $baseTableColumns[$key]['data']['key'] = '';
- }
- $baseTableColumns[$key]['data']['autoIncrement'] = false;
- }
-
- // get structure of version table
- $versionTableColumns = array();
- try {
- $versionTableColumns = WCF::getDB()->getEditor()->getColumns(call_user_func(array($objectType->className, 'getDatabaseVersionTableName')));
- }
- catch (\Exception $e) { }
-
- if (empty($versionTableColumns)) {
- $columns = array_merge($versionTableBaseColumns, $baseTableColumns);
- WCF::getDB()->getEditor()->createTable(call_user_func(array($objectType->className, 'getDatabaseVersionTableName')), $columns);
-
- // add version table to plugin
- $sql = "INSERT INTO wcf".WCF_N."_package_installation_sql_log
- (packageID, sqlTable)
- VALUES (?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array(
- $this->queue->packageID,
- call_user_func(array($objectType->className, 'getDatabaseVersionTableName'))
- ));
- }
- else {
- $baseTableColumnNames = $versionTableColumnNames = $versionTableBaseColumnNames = array();
- foreach ($baseTableColumns as $column) {
- $baseTableColumnNames[] = $column['name'];
- }
- foreach ($versionTableColumns as $column) {
- $versionTableColumnNames[] = $column['name'];
- }
- foreach ($versionTableBaseColumns as $column) {
- $versionTableBaseColumnNames[] = $column['name'];
- }
-
- // check garbage columns in versioned table
- foreach ($versionTableColumns as $columnData) {
- if (!in_array($columnData['name'], $baseTableColumnNames) && !in_array($columnData['name'], $versionTableBaseColumnNames)) {
- // delete column
- WCF::getDB()->getEditor()->dropColumn(call_user_func(array($objectType->className, 'getDatabaseVersionTableName')), $columnData['name']);
- }
- }
-
- // check new columns for versioned table
- foreach ($baseTableColumns as $columnData) {
- if (!in_array($columnData['name'], $versionTableColumnNames)) {
- // add colum
- WCF::getDB()->getEditor()->addColumn(call_user_func(array($objectType->className, 'getDatabaseVersionTableName')), $columnData['name'], $columnData['data']);
- }
- }
- }
- }
- }
}
use wcf\system\exception\IllegalLinkException;
use wcf\system\exception\SystemException;
use wcf\system\language\LanguageFactory;
-use wcf\system\package\plugin\ObjectTypePackageInstallationPlugin;
-use wcf\system\package\plugin\SQLPackageInstallationPlugin;
use wcf\system\setup\Uninstaller;
use wcf\system\style\StyleHandler;
use wcf\system\user\storage\UserStorageHandler;
EventHandler::getInstance()->fireAction($this, 'postUninstall');
}
- if ($this->requireRestructureVersionTables) {
- $this->restructureVersionTables();
- }
-
// return next node
return $node;
}
protected function executePIP(array $nodeData) {
$pip = new $nodeData['className']($this);
- if ($pip instanceof SQLPackageInstallationPlugin || $pip instanceof ObjectTypePackageInstallationPlugin) {
- $this->requireRestructureVersionTables = true;
- }
-
$pip->uninstall();
}
+++ /dev/null
-<?php
-namespace wcf\system\version;
-use wcf\data\object\type\ObjectTypeCache;
-use wcf\system\cache\builder\VersionCacheBuilder;
-use wcf\system\SingletonFactory;
-
-/**
- * Handles versions of DatabaseObjects.
- *
- * @deprecated 2.1 - will be removed with WCF 2.2
- *
- * @author Jeffrey Reichardt
- * @copyright 2001-2015 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package com.woltlab.wcf
- * @subpackage system.version
- * @category Community Framework
- */
-class VersionHandler extends SingletonFactory {
- /**
- * cached versions
- * @var array<\wcf\data\VersionableDatabaseObject>
- */
- protected $versions = array();
-
- /**
- * maps each version id to its object type id and object type version id
- * @var array<array>
- */
- protected $versionIDs = array();
-
- /**
- * mapes the names of the version object types to the object type ids
- * @var array<integer>
- */
- protected $objectTypeIDs = array();
-
- /**
- * list of version object types
- * @var array<\wcf\data\object\type>
- */
- protected $objectTypes = array();
-
- /**
- * Returns all version of object with the given object type id and object id.
- *
- * @param integer $objectTypeID
- * @param integer $objectID
- * @return array<\wcf\data\VersionableDatabaseObject>
- */
- public function getVersions($objectTypeID, $objectID) {
- if (isset($this->versions[$objectTypeID][$objectID])) {
- return $this->versions[$objectTypeID][$objectID];
- }
-
- return array();
- }
-
- /**
- * Returns the database object with the given version id.
- *
- * @param integer $objectTypeID
- * @param integer $versionID
- * @return \wcf\data\VersionableDatabaseObject
- */
- public function getVersionByID($objectTypeID, $versionID) {
- if (isset($this->versionIDs[$objectTypeID][$versionID])) {
- return $this->versionIDs[$objectTypeID][$versionID];
- }
-
- return null;
- }
-
- /**
- * Returns the object type with the given id.
- *
- * @param integer $objectTypeID
- * @return \wcf\data\object\type\ObjectType
- */
- public function getObjectType($objectTypeID) {
- if (isset($this->objectTypeIDs[$objectTypeID])) {
- return $this->getObjectTypeByName($this->objectTypeIDs[$objectTypeID]);
- }
-
- return null;
- }
-
- /**
- * Returns the object type with the given name.
- *
- * @param string $objectTypeName
- * @return \wcf\data\object\type\ObjectType
- */
- public function getObjectTypeByName($objectTypeName) {
- if (isset($this->objectTypes[$objectTypeName])) {
- return $this->objectTypes[$objectTypeName];
- }
-
- return null;
- }
-
- /**
- * @see \wcf\system\SingletonFactory::init()
- */
- protected function init() {
- $this->objectTypes = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.versionableObject');
-
- foreach ($this->objectTypes as $objectType) {
- $this->objectTypeIDs[$objectType->objectTypeID] = $objectType->objectType;
- }
-
- $this->versions = VersionCacheBuilder::getInstance()->getData(array(), 'versions');
- $this->versionIDs = VersionCacheBuilder::getInstance()->getData(array(), 'versionIDs');
- }
-
- /**
- * Reloads the version cache.
- */
- public function reloadCache() {
- VersionCacheBuilder::getInstance()->reset();
-
- $this->init();
- }
-
- /**
- * Returns a list of object types
- *
- * @return array<\wcf\data\object\type\ObjectType>
- */
- public function getObjectTypes() {
- return $this->objectTypes;
- }
-}