From: Kiv4h Date: Fri, 14 Dec 2012 11:28:23 +0000 (+0100) Subject: Code formatting X-Git-Tag: 2.0.0_Beta_1~638^2~4 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4d4a5125ca3b3111243b41841cddeb5e6ccec789;p=GitHub%2FWoltLab%2FWCF.git Code formatting --- diff --git a/wcfsetup/install/files/lib/data/VersionableDatabaseObjectEditor.class.php b/wcfsetup/install/files/lib/data/VersionableDatabaseObjectEditor.class.php index 2cbd931fc9..cafca1b774 100644 --- a/wcfsetup/install/files/lib/data/VersionableDatabaseObjectEditor.class.php +++ b/wcfsetup/install/files/lib/data/VersionableDatabaseObjectEditor.class.php @@ -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(); diff --git a/wcfsetup/install/files/lib/system/database/editor/MySQLDatabaseEditor.class.php b/wcfsetup/install/files/lib/system/database/editor/MySQLDatabaseEditor.class.php index e5fe929582..80804e3325 100644 --- a/wcfsetup/install/files/lib/system/database/editor/MySQLDatabaseEditor.class.php +++ b/wcfsetup/install/files/lib/system/database/editor/MySQLDatabaseEditor.class.php @@ -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; } diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php index 7f6485dab9..79f1d68d26 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php @@ -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']); } } diff --git a/wcfsetup/install/files/lib/system/package/PackageUninstallationDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageUninstallationDispatcher.class.php index e26427ea87..b371812ea8 100644 --- a/wcfsetup/install/files/lib/system/package/PackageUninstallationDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageUninstallationDispatcher.class.php @@ -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; } diff --git a/wcfsetup/install/files/lib/system/version/VersionHandler.class.php b/wcfsetup/install/files/lib/system/version/VersionHandler.class.php index f1cf53152e..cbbc617f84 100644 --- a/wcfsetup/install/files/lib/system/version/VersionHandler.class.php +++ b/wcfsetup/install/files/lib/system/version/VersionHandler.class.php @@ -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 -* @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 + * @package com.woltlab.wcf + * @subpackage system.version + * @category Community Framework + */ class VersionHandler extends SingletonFactory { /** - * cached categories - * @var array - */ + * cached versions + * + * @var array + */ protected $versions = array(); /** - * maps each version id to its object type id and object type version id - * @var array - */ + * maps each version id to its object type id and object type version id + * @var array + */ protected $versionIDs = array(); /** - * mapes the names of the version object types to the object type ids - * @var array - */ + * mapes the names of the version object types to the object type ids + * + * @var array + */ protected $objectTypeIDs = array(); /** - * list of version object types - * @var array - */ + * list of version object types + * + * @var array + */ 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 - */ + * Returns all version of object with the given object type id and object id. + * + * @param integer $objectTypeID + * @param integer $objectID + * @return array + */ 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');