From 1de1854c4082d4921363f1793f04ac42546a3fe3 Mon Sep 17 00:00:00 2001 From: Torben Brodt Date: Mon, 30 Jan 2012 21:58:12 +0100 Subject: [PATCH] remove unused variables, fix styleeditor --- wcfsetup/install.php | 1 - wcfsetup/install/files/lib/acp/page/CacheListPage.class.php | 2 +- .../install/files/lib/data/cronjob/CronjobAction.class.php | 2 +- wcfsetup/install/files/lib/data/style/StyleEditor.class.php | 2 +- .../lib/data/template/group/TemplateGroupEditor.class.php | 2 +- wcfsetup/install/files/lib/system/WCFSetup.class.php | 1 - .../system/database/editor/PostgreSQLDatabaseEditor.class.php | 1 - .../lib/system/image/adapter/ImagickImageAdapter.class.php | 2 -- wcfsetup/install/files/lib/system/io/Tar.class.php | 1 - .../install/files/lib/system/option/SelectOptionType.class.php | 2 +- .../install/files/lib/system/package/PackageArchive.class.php | 1 - .../system/package/PackageInstallationNodeBuilder.class.php | 1 - .../lib/system/package/PackageInstallationSQLParser.class.php | 1 - .../plugin/StyleAttributePackageInstallationPlugin.class.php | 2 +- .../plugin/UserGroupOptionPackageInstallationPlugin.class.php | 3 --- .../plugin/UserOptionPackageInstallationPlugin.class.php | 1 - wcfsetup/install/files/lib/util/CronjobUtil.class.php | 3 +-- wcfsetup/install/files/lib/util/FileUtil.class.php | 2 -- 18 files changed, 7 insertions(+), 23 deletions(-) diff --git a/wcfsetup/install.php b/wcfsetup/install.php index 94a16960d0..85a75a44c2 100644 --- a/wcfsetup/install.php +++ b/wcfsetup/install.php @@ -295,7 +295,6 @@ class Tar { * @param string $archiveName */ public function __construct($archiveName) { - $match = array(); if (!is_file($archiveName)) { throw new SystemException("unable to find tar archive '".$archiveName."'"); } diff --git a/wcfsetup/install/files/lib/acp/page/CacheListPage.class.php b/wcfsetup/install/files/lib/acp/page/CacheListPage.class.php index 1572c0c98a..c1f6d353a0 100755 --- a/wcfsetup/install/files/lib/acp/page/CacheListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/CacheListPage.class.php @@ -138,7 +138,7 @@ class CacheListPage extends AbstractPage { ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); - $pattern = array(); + $packageNames = array(); while ($row = $statement->fetchArray()) { $packagePath = FileUtil::getRealPath(WCF_DIR.$row['packageDir']).'cache/'; diff --git a/wcfsetup/install/files/lib/data/cronjob/CronjobAction.class.php b/wcfsetup/install/files/lib/data/cronjob/CronjobAction.class.php index 42f14991d3..d7dcddeed2 100644 --- a/wcfsetup/install/files/lib/data/cronjob/CronjobAction.class.php +++ b/wcfsetup/install/files/lib/data/cronjob/CronjobAction.class.php @@ -96,7 +96,7 @@ class CronjobAction extends AbstractDatabaseObjectAction { * Executes cronjobs. */ public function execute() { - $cronjob = $return = array(); + $return = array(); foreach ($this->objects as $key => $cronjob) { // skip jobs that are already being processed diff --git a/wcfsetup/install/files/lib/data/style/StyleEditor.class.php b/wcfsetup/install/files/lib/data/style/StyleEditor.class.php index 153a0a69f2..513ef5bb93 100644 --- a/wcfsetup/install/files/lib/data/style/StyleEditor.class.php +++ b/wcfsetup/install/files/lib/data/style/StyleEditor.class.php @@ -254,7 +254,7 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject // create template group $templateGroupID = 0; if (!empty($data['templates'])) { - $originalTemplateGroupName = $templateGroupName = $data['name']; + $templateGroupName = $data['name']; $templateGroupFolderName = preg_replace('/[^a-z0-9_-]/i', '', $templateGroupName); if (empty($templateGroupFolderName)) $templateGroupFolderName = 'generic'.StringUtil::substring(StringUtil::getRandomID(), 0, 8); $originalTemplatePackFolderName = $templateGroupFolderName; diff --git a/wcfsetup/install/files/lib/data/template/group/TemplateGroupEditor.class.php b/wcfsetup/install/files/lib/data/template/group/TemplateGroupEditor.class.php index 4b8f6db3a8..d30c7864a4 100644 --- a/wcfsetup/install/files/lib/data/template/group/TemplateGroupEditor.class.php +++ b/wcfsetup/install/files/lib/data/template/group/TemplateGroupEditor.class.php @@ -81,7 +81,7 @@ class TemplateGroupEditor extends DatabaseObjectEditor { */ public function deleteFolders() { // default template dir - $folders = array(WCF_DIR . 'templates/' . $this->templateGroupFolderName); + $folders = array(WCF_DIR . 'templates/' . $this->templateGroupFolderName); // TODO: should this folder be deleted, too? // get package dirs $sql = "SELECT packageDir diff --git a/wcfsetup/install/files/lib/system/WCFSetup.class.php b/wcfsetup/install/files/lib/system/WCFSetup.class.php index b3716bb7e5..f3e05dedab 100644 --- a/wcfsetup/install/files/lib/system/WCFSetup.class.php +++ b/wcfsetup/install/files/lib/system/WCFSetup.class.php @@ -436,7 +436,6 @@ class WCFSetup extends WCF { */ protected function selectLanguages() { $errorField = $errorType = ''; - $illegalLanguages = array(); // skip step in developer mode // select all available languages automatically diff --git a/wcfsetup/install/files/lib/system/database/editor/PostgreSQLDatabaseEditor.class.php b/wcfsetup/install/files/lib/system/database/editor/PostgreSQLDatabaseEditor.class.php index 3e3b67cc71..c4e7561f97 100644 --- a/wcfsetup/install/files/lib/system/database/editor/PostgreSQLDatabaseEditor.class.php +++ b/wcfsetup/install/files/lib/system/database/editor/PostgreSQLDatabaseEditor.class.php @@ -237,7 +237,6 @@ class PostgreSQLDatabaseEditor extends DatabaseEditor { $indexName = $tableName.'_'.$indexName.'_key'; } - $sql = ''; if ($indexData['type'] == 'FULLTEXT') { $sql = "CREATE INDEX ".$indexName." ON ".$tableName." USING gin(to_tsvector('english', \"".implode('" || \' \' || "', $columns)."\"))"; } diff --git a/wcfsetup/install/files/lib/system/image/adapter/ImagickImageAdapter.class.php b/wcfsetup/install/files/lib/system/image/adapter/ImagickImageAdapter.class.php index 9db0a8dc31..6abc7e2746 100644 --- a/wcfsetup/install/files/lib/system/image/adapter/ImagickImageAdapter.class.php +++ b/wcfsetup/install/files/lib/system/image/adapter/ImagickImageAdapter.class.php @@ -75,8 +75,6 @@ class ImagickImageAdapter implements IImageAdapter { * @see wcf\system\image\adapter\IImageAdapter::createThumbnail() */ public function createThumbnail($maxWidth, $maxHeight, $obtainDimensions = true) { - $thumbnail = $this->imagick; - $thumbnail = $this->imagick; $thumbnail->cropThumbnailImage($maxWidth, $maxHeight); diff --git a/wcfsetup/install/files/lib/system/io/Tar.class.php b/wcfsetup/install/files/lib/system/io/Tar.class.php index 522a9eb201..7ac9596179 100644 --- a/wcfsetup/install/files/lib/system/io/Tar.class.php +++ b/wcfsetup/install/files/lib/system/io/Tar.class.php @@ -71,7 +71,6 @@ class Tar { * @param string $archiveName */ public function __construct($archiveName) { - $match = array(); if (!is_file($archiveName)) { throw new SystemException("unable to find tar archive '".$archiveName."'"); } diff --git a/wcfsetup/install/files/lib/system/option/SelectOptionType.class.php b/wcfsetup/install/files/lib/system/option/SelectOptionType.class.php index 14e1f74cbc..e6ca8bb6be 100644 --- a/wcfsetup/install/files/lib/system/option/SelectOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/SelectOptionType.class.php @@ -50,7 +50,7 @@ class SelectOptionType extends RadioButtonOptionType { $options = $option->parseMultipleEnableOptions(); foreach ($options as $key => $optionData) { - $tmp = explode(',', $optionData); + $tmp = explode(',', $optionData); // TODO: is either optionData an array or tmp? foreach ($optionData as $item) { if ($item{0} == '!') { diff --git a/wcfsetup/install/files/lib/system/package/PackageArchive.class.php b/wcfsetup/install/files/lib/system/package/PackageArchive.class.php index 7955c427db..4de0a75f27 100644 --- a/wcfsetup/install/files/lib/system/package/PackageArchive.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageArchive.class.php @@ -427,7 +427,6 @@ class PackageArchive { * @return string path to the dowloaded file */ public function downloadArchive() { - $parsedUrl = parse_url($this->archive); $prefix = 'package'; // file transfer via hypertext transfer protocol. diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php index 3340c5c0b6..7cd8f8dac3 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php @@ -408,7 +408,6 @@ class PackageInstallationNodeBuilder { * @return string */ protected function buildRequirementNodes() { - $packageNodes = array(); $queue = $this->installation->queue; // handle requirements diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationSQLParser.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationSQLParser.class.php index ff694f913b..d451552b95 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationSQLParser.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationSQLParser.class.php @@ -223,7 +223,6 @@ class PackageInstallationSQLParser extends SQLParser { WHERE packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array($this->package->packageID)); - $packages = array(); while ($row = $statement->fetchArray()) { $this->dependentPackageIDs[] = $row['dependency']; } diff --git a/wcfsetup/install/files/lib/system/package/plugin/StyleAttributePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/StyleAttributePackageInstallationPlugin.class.php index bb7c335484..ace898eb19 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/StyleAttributePackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/StyleAttributePackageInstallationPlugin.class.php @@ -138,7 +138,7 @@ class StyleAttributePackageInstallationPlugin extends AbstractXMLPackageInstalla foreach ($styleList->getObjects() as $style) { $styleEditor = new StyleEditor($style); - $style->writeStyleFile(); + $styleEditor->writeStyleFile(); } } } diff --git a/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php index dae644124f..78e6820322 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php @@ -100,9 +100,6 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst ); if (!empty($row['optionID'])) { - // update existing option - $optionID = $row['optionID']; - $groupOption = new UserGroupOption(null, $row); $groupOptionEditor = new UserGroupOptionEditor($groupOption); $groupOptionEditor->update($data); diff --git a/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php index 633d5d35dd..9e12ca7f33 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php @@ -162,7 +162,6 @@ class UserOptionPackageInstallationPlugin extends AbstractOptionPackageInstallat WHERE packageID = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array($this->installation->getPackageID())); - $optionIDs = array(); while ($row = $statement->fetchArray()) { WCF::getDB()->getEditor()->dropColumn('wcf'.WCF_N.'_user_option_value', 'userOption'.$row['optionID']); } diff --git a/wcfsetup/install/files/lib/util/CronjobUtil.class.php b/wcfsetup/install/files/lib/util/CronjobUtil.class.php index 3476aa7ca4..09fe7e6c71 100644 --- a/wcfsetup/install/files/lib/util/CronjobUtil.class.php +++ b/wcfsetup/install/files/lib/util/CronjobUtil.class.php @@ -140,8 +140,7 @@ abstract class CronjobUtil { * @param array $values */ protected static function calculateTime(array &$values) { - $timestamp = false; - + // calculation starts with month, thus start with // month of $time (if within values) $currentMonth = date('n', self::$timeBase); diff --git a/wcfsetup/install/files/lib/util/FileUtil.class.php b/wcfsetup/install/files/lib/util/FileUtil.class.php index 7dcfa6aca7..22cfb93be7 100644 --- a/wcfsetup/install/files/lib/util/FileUtil.class.php +++ b/wcfsetup/install/files/lib/util/FileUtil.class.php @@ -507,14 +507,12 @@ class FileUtil { } // put the bytestream's first three bytes to an array. - $workArray = array(); $workArray = unpack('C3', $sourceContent); if (!is_array($workArray)) { throw new SystemException("Unable to process bytestream."); } // detect the UTF-8 BOM. - $destinationContent = ''; if (($workArray['1'] == $firstByte) && ($workArray['2'] == $secondByte) && ($workArray['3'] == $thirdByte)) { $tmpname = FileUtil::getTemporaryFilename('stripBoms_'); $tmpStream = fopen($tmpname, 'w+'); -- 2.20.1