remove unused variables, fix styleeditor
authorTorben Brodt <t.brodt@gmail.com>
Mon, 30 Jan 2012 20:58:12 +0000 (21:58 +0100)
committerTorben Brodt <t.brodt@gmail.com>
Mon, 30 Jan 2012 20:58:12 +0000 (21:58 +0100)
18 files changed:
wcfsetup/install.php
wcfsetup/install/files/lib/acp/page/CacheListPage.class.php
wcfsetup/install/files/lib/data/cronjob/CronjobAction.class.php
wcfsetup/install/files/lib/data/style/StyleEditor.class.php
wcfsetup/install/files/lib/data/template/group/TemplateGroupEditor.class.php
wcfsetup/install/files/lib/system/WCFSetup.class.php
wcfsetup/install/files/lib/system/database/editor/PostgreSQLDatabaseEditor.class.php
wcfsetup/install/files/lib/system/image/adapter/ImagickImageAdapter.class.php
wcfsetup/install/files/lib/system/io/Tar.class.php
wcfsetup/install/files/lib/system/option/SelectOptionType.class.php
wcfsetup/install/files/lib/system/package/PackageArchive.class.php
wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php
wcfsetup/install/files/lib/system/package/PackageInstallationSQLParser.class.php
wcfsetup/install/files/lib/system/package/plugin/StyleAttributePackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/util/CronjobUtil.class.php
wcfsetup/install/files/lib/util/FileUtil.class.php

index 94a16960d0703e31e39f252877e313cc51f5be0a..85a75a44c23b6e51fdf35f99d45cedc710046403 100644 (file)
@@ -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."'");
                }
index 1572c0c98a1aeac522cdff4fb0e475fcd144ca6b..c1f6d353a0d64705866ddb747ec95e47b89fbca4 100755 (executable)
@@ -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/';
index 42f14991d305a43673bdc20724ce1390cf0fec57..d7dcddeed21a76b4d3425289024725948617e2cb 100644 (file)
@@ -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
index 153a0a69f2a6d290c9805728957c8c228518c110..513ef5bb93d4d80a677ccc228baf394b9434b7d0 100644 (file)
@@ -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;
index 4b8f6db3a8439c37fc12c198a2ce6e667fd5a747..d30c7864a4874387718cfd642c525ba574a8f19b 100644 (file)
@@ -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
index b3716bb7e510caeb9d92fd8e951d07e3092d363c..f3e05dedaba5a907137b58d0334e5c896a9c8c2c 100644 (file)
@@ -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
index 3e3b67cc71845496516d12a118bba12b63a12037..c4e7561f97c73969bd9a5a7782ee02bc5a2dd4fd 100644 (file)
@@ -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)."\"))";
                }
index 9db0a8dc311cc15f1c53518b41d7fb0f053c4b2a..6abc7e274688f32bc941f357292eb9990fafe1ea 100644 (file)
@@ -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);
                
index 522a9eb2018e83b5408e8b9545e38628ad9e0137..7ac9596179a37090f27d029424ffbe3aa14ccd4a 100644 (file)
@@ -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."'");
                }
index 14e1f74cbceb59d55a797bd65c6f6e4d0b9c8770..e6ca8bb6be27ae5954a51239fa12d8622dd9c934 100644 (file)
@@ -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} == '!') {
index 7955c427dbb1bbd10ccbafe2c5515961ea394b7c..4de0a75f27b72028d4d73fa2e811ffd2679cc7d1 100644 (file)
@@ -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.
index 3340c5c0b6dc7a3893afcdce5444f2ed79616d75..7cd8f8dac3feae3cbfdb96c406ba8d210b29a777 100644 (file)
@@ -408,7 +408,6 @@ class PackageInstallationNodeBuilder {
         * @return      string
         */
        protected function buildRequirementNodes() {
-               $packageNodes = array();
                $queue = $this->installation->queue;
                
                // handle requirements
index ff694f913b4d1b9c35236550bf08a5bd0fc802ae..d451552b95d5a39586953843c61eafd4447a075a 100644 (file)
@@ -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'];
                }
index bb7c335484db3c459ca33ea13a800cc51ba46563..ace898eb19e4c3794712269580864ce6b90e512e 100644 (file)
@@ -138,7 +138,7 @@ class StyleAttributePackageInstallationPlugin extends AbstractXMLPackageInstalla
                
                foreach ($styleList->getObjects() as $style) {
                        $styleEditor = new StyleEditor($style);
-                       $style->writeStyleFile();
+                       $styleEditor->writeStyleFile();
                }
        }
 }
index dae644124fc04249eef70fa536bb1e697459322e..78e68203225ffbefdbecddc7547a29609db4c68d 100644 (file)
@@ -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);
index 633d5d35ddf83633eca12d856f85fd709ad608f4..9e12ca7f33f63934c5d45dcc161072e716740ca7 100644 (file)
@@ -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']);
                }
index 3476aa7ca404b7a5cb762216efac53b0436723f4..09fe7e6c71a7927e5df054569c086ac8edfb0256 100644 (file)
@@ -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);
index 7dcfa6aca732cc3627c9ce67a330109f34df2889..22cfb93be7550592e680cd4aaa0155dd6109a260 100644 (file)
@@ -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+');