Code formatting
authorKiv4h <jeffrey.reichardt@googlemail.com>
Fri, 14 Dec 2012 11:28:23 +0000 (12:28 +0100)
committerKiv4h <jeffrey.reichardt@googlemail.com>
Fri, 14 Dec 2012 11:28:23 +0000 (12:28 +0100)
wcfsetup/install/files/lib/data/VersionableDatabaseObjectEditor.class.php
wcfsetup/install/files/lib/system/database/editor/MySQLDatabaseEditor.class.php
wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php
wcfsetup/install/files/lib/system/package/PackageUninstallationDispatcher.class.php
wcfsetup/install/files/lib/system/version/VersionHandler.class.php

index 2cbd931fc97ae11edfd522a30aca1314ee0bc9b2..cafca1b7749623be08235d8b5a04e4405f29a101 100644 (file)
@@ -63,7 +63,7 @@ abstract class VersionableDatabaseObjectEditor extends DatabaseObjectEditor {
 
                WCF::getDB()->beginTransaction();
                foreach ($objectIDs as $objectID) {
-                       $statement->executeUnbuffered(array($objectID));
+                       $statement->execute(array($objectID));
                }
                WCF::getDB()->commitTransaction();
                
index e5fe929582d4a259d2cd7aeb073880986931f083..80804e3325074fab3c1051cd1e855d7bcf3b5152 100644 (file)
@@ -37,18 +37,18 @@ class MySQLDatabaseEditor extends DatabaseEditor {
                $statement = $this->dbObj->prepareStatement($sql);
                $statement->execute();
                while ($row = $statement->fetchArray()) {
-                               $typeMatches = Regex::compile('([a-z]+)\(([0-9]+)\)', Regex::CASE_INSENSITIVE)->match($row['Type']);
-                               
-                       $columns[] = array('name' => $row['Field'], 
-                                                                       'data' => array(
-                                                                                               'type' => $typeMatches[1], 
-                                                                                               'length' => $typeMatches[2],
-                                                                                               'notNull' => (($row['Null'] == 'YES') ? true : false), 
-                                                                                               'key' => (($row['Key'] == 'PRI') ? 'PRIMARY' : (($row['Key'] == 'UNI') ? 'UNIQUE' : '')),
-                                                                                               'default' => $row['Default'], 
-                                                                                               'autoIncrement' => ($row['Extra'] == 'auto_increment' ? true : false)
-                                                                                       )
-                                                               );
+                       $typeMatches = Regex::compile('([a-z]+)\(([0-9]+)\)', Regex::CASE_INSENSITIVE)->match($row['Type']);
+
+               $columns[] = array('name' => $row['Field'], 
+                                                               'data' => array(
+                                                                                       'type' => $typeMatches[1], 
+                                                                                       'length' => $typeMatches[2],
+                                                                                       'notNull' => (($row['Null'] == 'YES') ? true : false), 
+                                                                                       'key' => (($row['Key'] == 'PRI') ? 'PRIMARY' : (($row['Key'] == 'UNI') ? 'UNIQUE' : '')),
+                                                                                       'default' => $row['Default'], 
+                                                                                       'autoIncrement' => ($row['Extra'] == 'auto_increment' ? true : false)
+                                                                               )
+                                                       );
                }
                return $columns;
        }
index 7f6485dab9e5948b484b8b522d0c4ea93a29760d..79f1d68d26578a3ef960ecc8402eaa6ca62dac9d 100644 (file)
@@ -22,6 +22,9 @@ use wcf\system\form\element;
 use wcf\system\form\FormDocument;
 use wcf\system\form;
 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\WCF;
@@ -450,11 +453,11 @@ class PackageInstallationDispatcher {
                
                $plugin = new $className($this, $nodeData);
                
-               if (!($plugin instanceof \wcf\system\package\plugin\IPackageInstallationPlugin)) {
+               if (!($plugin instanceof IPackageInstallationPlugin)) {
                        throw new SystemException("'".$className."' does not implement 'wcf\system\package\plugin\IPackageInstallationPlugin'");
                }
                
-               if ($plugin instanceof \wcf\system\package\plugin\SQLPackageInstallationPlugin || $plugin instanceof \wcf\system\package\plugin\ObjectTypePackageInstallationPlugin) {
+               if ($plugin instanceof SQLPackageInstallationPlugin || $plugin instanceof ObjectTypePackageInstallationPlugin) {
                        $this->requireRestructureVersionTables = true;
                }
                
@@ -956,7 +959,7 @@ class PackageInstallationDispatcher {
                        return;
                }
                
-               //base structure of version tables
+               // base structure of version tables
                $versionTableBaseColumns = array();
                $versionTableBaseColumns[] = array('name' => 'versionID', 'data' => array('type' => 'INT', 'key' => 'PRIMARY', 'autoIncrement' => 'AUTO_INCREMENT'));
                $versionTableBaseColumns[] = array('name' => 'versionUserID', 'data' => array('type' => 'INT'));
@@ -964,9 +967,9 @@ class PackageInstallationDispatcher {
                $versionTableBaseColumns[] = array('name' => 'versionTime', 'data' => array('type' => 'INT'));
        
                foreach ($objectTypes as $objectTypeID => $objectType) {                                                
-                       //get structure of base table
+                       // get structure of base table
                        $baseTableColumns = WCF::getDB()->getEditor()->getColumns($objectType::getDatabaseTableName());
-                       //get structure of version table
+                       // get structure of version table
                        $versionTableColumns = WCF::getDB()->getEditor()->getColumns($objectType::getDatabaseVersionTableName());
                        
                        if (empty($versionTableColumns)){
@@ -975,18 +978,18 @@ class PackageInstallationDispatcher {
                                WCF::getDB()->getEditor()->createTable($objectType::getDatabaseVersionTableName(), $columns);
                        }
                        else {
-                               //check garbage columns in versioned table
+                               // check garbage columns in versioned table
                                foreach ($versionTableColumns as $columnData) {
                                        if (!array_search($columnData['name'], $baseTableColumns, true)) {
-                                               //delete column
+                                               // delete column
                                                WCF::getDB()->getEditor()->dropColumn($objectType::getDatabaseVersionTableName(), $columnData['name']);
                                        }
                                }
                                
-                               //check new columns for versioned table
+                               // check new columns for versioned table
                                foreach ($baseTableColumns as $columnData) {
                                        if (!array_search($columnData['name'], $versionTableColumns, true)) {
-                                               //add colum
+                                               // add colum
                                                WCF::getDB()->getEditor()->addColumn($objectType::getDatabaseVersionTableName(), $columnData['name'], $columnData['data']);
                                        }
                                }
index e26427ea87bb62724985eae6cb49d6d83be82337..b371812ea8ca0584f71557ea00ffb63391f0f5bc 100644 (file)
@@ -10,6 +10,8 @@ use wcf\system\cache\CacheHandler;
 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\WCF;
@@ -107,10 +109,10 @@ class PackageUninstallationDispatcher extends PackageInstallationDispatcher {
        /**
         * @see wcf\system\package\PackageInstallationDispatcher::executePIP()
         */
-       protected function executePIP(array $nodeData) {        
+       protected function executePIP(array $nodeData) {
                $pip = new $nodeData['className']($this);
                
-               if ($pip instanceof \wcf\system\package\plugin\SQLPackageInstallationPlugin || $pip instanceof \wcf\system\package\plugin\ObjectTypePackageInstallationPlugin) {
+               if ($pip instanceof SQLPackageInstallationPlugin || $pip instanceof ObjectTypePackageInstallationPlugin) {
                        $this->requireRestructureVersionTables = true;
                }               
                
index f1cf53152e99c5bd42e1e32f05641c0aa2e8973f..cbbc617f84f6e3c5ebc51c881f7ca94de2f170b9 100644 (file)
@@ -6,48 +6,50 @@ use wcf\data\object\type\ObjectTypeCache;
 use wcf\system\cache\CacheHandler;
 
 /**
-* Handles versions of DatabaseObjects.
-*
-* @author              Jeffrey Reichardt
-* @copyright   2001-2012 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
-*/
+ * Handles versions of DatabaseObjects.
+ *
+ * @author             Jeffrey Reichardt
+ * @copyright  2001-2012 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 categories
-       * @var array<wcf\data\VersionableDatabaseObject>
-       */
+        * 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>
-       */
+        * 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>
-       */
+        * 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>
-       */
+        * 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>
-       */
+        * 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];
@@ -57,13 +59,12 @@ class VersionHandler extends SingletonFactory {
        }
 
        /**
-       * Returns the category object with the given category id.
-       *
-       * @param integer $objectTypeID
-       * @param integer $versionID
-       *
-       * @return wcf\data\VersionableDatabaseObject
-       */
+        * 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];
@@ -73,12 +74,11 @@ class VersionHandler extends SingletonFactory {
        }
 
        /**
-       * Gets the object type with the given id.
-       *
-       * @param integer $objectTypeID
-       *
-       * @return wcf\data\object\type\ObjectType
-       */
+        * Gets 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]);
@@ -88,12 +88,11 @@ class VersionHandler extends SingletonFactory {
        }
 
        /**
-       * Gets the object type with the given name.
-       *
-       * @param string $objectTypeName
-       *
-       * @return wcf\data\object\type\ObjectType
-       */
+        * Gets 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];
@@ -103,8 +102,8 @@ class VersionHandler extends SingletonFactory {
        }
 
        /**
-       * @see wcf\system\SingletonFactory::init()
-       */
+        * @see wcf\system\SingletonFactory::init()
+        */
        protected function init() {
                $this->objectTypes = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.versionableObject');
                
@@ -119,8 +118,8 @@ class VersionHandler extends SingletonFactory {
        }
 
        /**
-       * Reloads the version cache.
-       */
+        * Reloads the version cache.
+        */
        public function reloadCache() {
                CacheHandler::getInstance()->clearResource('version');