From: Alexander Ebert Date: Wed, 22 Feb 2012 14:37:24 +0000 (+0100) Subject: Resolved some TODOs X-Git-Tag: 2.0.0_Beta_1~1320 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8e2c12f56880c8478d703e26acff2f0e9efb9f63;p=GitHub%2FWoltLab%2FWCF.git Resolved some TODOs --- diff --git a/wcfsetup/install/files/lib/acp/form/PackageUpdateAuthForm.class.php b/wcfsetup/install/files/lib/acp/form/PackageUpdateAuthForm.class.php index 01df233d85..a7fbdf31b4 100755 --- a/wcfsetup/install/files/lib/acp/form/PackageUpdateAuthForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/PackageUpdateAuthForm.class.php @@ -138,6 +138,7 @@ class PackageUpdateAuthForm extends ACPForm { } /** + * @todo This whole page is carzy, it's manipulating the requested page, but RequestHandler does not work this way * @see wcf\page\IPage::readParameters() */ public function readParameters() { diff --git a/wcfsetup/install/files/lib/acp/page/PackagePage.class.php b/wcfsetup/install/files/lib/acp/page/PackagePage.class.php index b7114fb286..684e505325 100755 --- a/wcfsetup/install/files/lib/acp/page/PackagePage.class.php +++ b/wcfsetup/install/files/lib/acp/page/PackagePage.class.php @@ -12,6 +12,7 @@ use wcf\system\WCFACP; * Handles all request on the package.php script * and executes the requested action. * TODO: split this page into separate pages / actions + * TODO: I would recommend removing this entire class, it's pretty nasty to use a page just for redirections * * @author Marcel Werk * @copyright 2001-2011 WoltLab GmbH @@ -69,9 +70,7 @@ class PackagePage extends AbstractPage { case 'rollback': // TODO die('ROLLBACK'); - WCF::getSession()->checkPermissions(array('admin.system.package.canInstallPackage')); - require_once(WCF_DIR.'lib/acp/package/PackageInstallationRollback.class.php'); - new PackageInstallationRollback($this->queueID); // TODO: undefined class PackageInstallationRollback + //WCF::getSession()->checkPermissions(array('admin.system.package.canInstallPackage')); break; case 'openQueue': diff --git a/wcfsetup/install/files/lib/data/language/LanguageEditor.class.php b/wcfsetup/install/files/lib/data/language/LanguageEditor.class.php index 7de4794ae7..c4b7cfa1e9 100644 --- a/wcfsetup/install/files/lib/data/language/LanguageEditor.class.php +++ b/wcfsetup/install/files/lib/data/language/LanguageEditor.class.php @@ -549,11 +549,10 @@ class LanguageEditor extends DatabaseObjectEditor { // search and replace $matches = 0; if ($useRegex) { - $newValue = preg_replace('~'.$search.'~s'.(!$caseSensitive ? 'i' : ''), $replace, ($row['languageCustomItemValue'] ? $row['languageCustomItemValue'] : $row['languageItemValue']), -1, $matches); //TODO: undefined variable + $newValue = preg_replace('~'.$search.'~s', $replace, ($row['languageCustomItemValue'] ? $row['languageCustomItemValue'] : $row['languageItemValue']), -1, $matches); } else { - if ($caseSensitive) $newValue = StringUtil::replace($search, $replace, ($row['languageCustomItemValue'] ? $row['languageCustomItemValue'] : $row['languageItemValue']), $matches); //TODO: undefined variable - else $newValue = StringUtil::replaceIgnoreCase($search, $replace, ($row['languageCustomItemValue'] ? $row['languageCustomItemValue'] : $row['languageItemValue']), $matches); + $newValue = StringUtil::replaceIgnoreCase($search, $replace, ($row['languageCustomItemValue'] ? $row['languageCustomItemValue'] : $row['languageItemValue']), $matches); } if ($matches > 0) { diff --git a/wcfsetup/install/files/lib/data/option/Option.class.php b/wcfsetup/install/files/lib/data/option/Option.class.php index 0620e69d9f..87dbb4cafc 100644 --- a/wcfsetup/install/files/lib/data/option/Option.class.php +++ b/wcfsetup/install/files/lib/data/option/Option.class.php @@ -49,7 +49,6 @@ class Option extends DatabaseObject { /** * Returns a list of options. - * TODO: move to optionlist * * @param integer $packageID * @return array diff --git a/wcfsetup/install/files/lib/data/package/PackageAction.class.php b/wcfsetup/install/files/lib/data/package/PackageAction.class.php index ffebd224fe..a8510c442d 100644 --- a/wcfsetup/install/files/lib/data/package/PackageAction.class.php +++ b/wcfsetup/install/files/lib/data/package/PackageAction.class.php @@ -1,6 +1,7 @@ parameters['activePage']) || !intval($this->parameters['activePage'])) { + throw new ValidateActionException("Missing or invalid parameter 'activePage'"); + } + } /** * Returns a list of plugins. diff --git a/wcfsetup/install/files/lib/data/template/Template.class.php b/wcfsetup/install/files/lib/data/template/Template.class.php index 7850c238d2..8f7cdc91bc 100644 --- a/wcfsetup/install/files/lib/data/template/Template.class.php +++ b/wcfsetup/install/files/lib/data/template/Template.class.php @@ -74,7 +74,6 @@ class Template extends DatabaseObject { /** * Searches in templates. - * TODO: move to template editor? * * @param string $search search query * @param string $replace 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 f101610a5d..bbd19786b4 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); // TODO: should this folder be deleted, too? + $folders = array(WCF_DIR . 'templates/' . $this->templateGroupFolderName); // 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 29c3cb1791..df27e792e3 100644 --- a/wcfsetup/install/files/lib/system/WCFSetup.class.php +++ b/wcfsetup/install/files/lib/system/WCFSetup.class.php @@ -1001,9 +1001,44 @@ class WCFSetup extends WCF { $archive->openArchive(); } catch (\Exception $e) { - // TODO: Maybe break the installation if archive is broken? - // this is a broken archive, skip it - continue; + // we've encountered a broken archive, revert everything and then fail + $sql = "SELECT queueID, parentQueueID + FROM wcf".WCF_N."_package_installation_queue"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(); + $queues = array(); + while ($row = $statement->fetchArray()) { + $queues[$row['queueID']] = $row['parentQueueID']; + } + + $queueIDs = array(); + $queueID = $queue->queueID; + while ($queueID) { + $queueIDs[] = $queueID; + + $queueID = (isset($queues[$queueID])) ?: 0; + } + + // remove previously created queues + if (!empty($queueIDs)) { + $sql = "DELETE FROM wcf".WCF_N."_package_installation_queue + WHERE queueID = ?"; + $statement = WCF::getDB()->prepareStatement($sql); + WCF::getDB()->beginTransaction(); + foreach ($queueIDs as $queueID) { + $statement->execute(array($queueID)); + } + WCF::getDB()->commitTransaction(); + } + + // remove package files + @unlink(TMP_DIR.'install/packages/'.$wcfPackageFile); + foreach ($otherPackages as $packageFile) { + @unlink(TMP_DIR.'install/packages/'.$packageFile); + } + + // throw exception again + throw new SystemException('', 0, '', $e); } $queue = PackageInstallationQueueEditor::create(array( @@ -1024,7 +1059,6 @@ class WCFSetup extends WCF { SessionHandler::getInstance()->register('masterPassword', 1); SessionHandler::getInstance()->update(); - // TODO: print message if delete fails $installPhpDeleted = @unlink('./install.php'); $testPhpDeleted = @unlink('./test.php'); $wcfSetupTarDeleted = @unlink('./WCFSetup.tar.gz'); diff --git a/wcfsetup/install/files/lib/system/clipboard/action/UserClipboardAction.class.php b/wcfsetup/install/files/lib/system/clipboard/action/UserClipboardAction.class.php index 54f3e668f0..6e410f0f5d 100644 --- a/wcfsetup/install/files/lib/system/clipboard/action/UserClipboardAction.class.php +++ b/wcfsetup/install/files/lib/system/clipboard/action/UserClipboardAction.class.php @@ -44,7 +44,7 @@ class UserClipboardAction implements IClipboardAction { } // TODO: use language variable - $item->addInternalData('confirmMessage', 'Delete '.$count.' users?'); + $item->addInternalData('confirmMessage', WCF::getLanguage()->getDynamicVariable('wcf.clipboard.user.confirmMessage', array('count' => $count))); $item->addParameter('actionName', 'delete'); $item->addParameter('className', 'wcf\data\user\UserAction'); $item->setName('user.delete'); @@ -131,15 +131,8 @@ class UserClipboardAction implements IClipboardAction { /** * @see wcf\system\clipboard\action\IClipboardAction::getEditorLabel() - * @todo use language variable */ public function getEditorLabel(array $objects) { - $count = count($objects); - if ($count == 1) { - return 'One user marked'; - } - else { - return $count . ' users marked'; - } + return WCF::getLanguage()->getDynamicVariable('wcf.clipboard.user.marked', array('count' => count($objects))); } } diff --git a/wcfsetup/install/files/lib/system/option/FileSizeOptionType.class.php b/wcfsetup/install/files/lib/system/option/FileSizeOptionType.class.php index f647c6b71e..fbff747d62 100644 --- a/wcfsetup/install/files/lib/system/option/FileSizeOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/FileSizeOptionType.class.php @@ -55,7 +55,6 @@ class FileSizeOptionType extends IntegerOptionType { * @see wcf\system\option\IOptionType::getFormElement() */ public function getFormElement(Option $option, $value) { - // TODO: Maybe show more digits after the comma? $value = FileUtil::formatFileSize($value); return parent::getFormElement($option, $value); } diff --git a/wcfsetup/install/files/lib/system/option/SelectOptionType.class.php b/wcfsetup/install/files/lib/system/option/SelectOptionType.class.php index e9285093d8..583a28e3c3 100644 --- a/wcfsetup/install/files/lib/system/option/SelectOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/SelectOptionType.class.php @@ -52,7 +52,7 @@ class SelectOptionType extends RadioButtonOptionType { $options = $option->parseMultipleEnableOptions(); foreach ($options as $key => $optionData) { - $tmp = explode(',', $optionData); // TODO: is either optionData an array or tmp? + $tmp = explode(',', $optionData); 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 22cea3aed7..e147b4fd0a 100644 --- a/wcfsetup/install/files/lib/system/package/PackageArchive.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageArchive.class.php @@ -231,7 +231,8 @@ class PackageArchive { throw new SystemException("package date '".$element->nodeValue."' is invalid, violating ISO-8601 date format."); } - $this->packageInfo['date'] = strtotime($element->nodeValue) + 43201; // TODO: Is this even neccessary? + // TODO: Is this even neccessary? + //$this->packageInfo['date'] = strtotime($element->nodeValue) + 43201; break; } } diff --git a/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php b/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php index aeb9cb42c1..0b7362810f 100644 --- a/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php +++ b/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php @@ -173,12 +173,6 @@ class TemplateScriptingCompiler { */ protected $staticIncludes = array(); - /** - * list of previously included namespaces - * @var array - */ - protected $includedNamespaces = array(); - /** * Creates a new TemplateScriptingCompiler object. * @@ -216,7 +210,7 @@ class TemplateScriptingCompiler { ); } else { - $this->includedNamespaces = $this->staticIncludes = array(); + $this->staticIncludes = array(); } // reset vars @@ -282,14 +276,6 @@ class TemplateScriptingCompiler { if (count($this->autoloadPlugins) > 0) { $compiledAutoloadPlugins = "autoloadPlugins as $className) { - // prevent multiple use on the same namespace - if (!in_array($className, $this->includedNamespaces)) { - // TODO: We're using the classes with prepended namespace, why should we first - // import them with "use" for no reason? - //$compiledAutoloadPlugins .= "use ".$className.";\n"; - $this->includedNamespaces[] = $className; - } - $compiledAutoloadPlugins .= "if (!isset(\$this->pluginObjects['$className'])) {\n"; $compiledAutoloadPlugins .= "\$this->pluginObjects['$className'] = new $className;\n"; $compiledAutoloadPlugins .= "}\n"; diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 9417383b4b..88c16baeed 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -1,5 +1,10 @@  + + + + + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index fa1ed57de7..9e2199cdf1 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -1,5 +1,10 @@ + + 1}s{/if}?]]> + 1}s{/if} marked]]> + +