From 824d9e903e4d73eed0ed169dd956157d736bea96 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 20 May 2013 20:48:20 +0200 Subject: [PATCH] Fixes for package update --- com.woltlab.wcf/package.xml | 2 +- wcfsetup/install/files/acp/js/WCF.ACP.js | 16 ++++++++++--- .../templates/packageInstallationConfirm.tpl | 3 ++- .../acp/action/InstallPackageAction.class.php | 5 ++-- .../PackageInstallationDispatcher.class.php | 24 +++++++++++++++++++ .../PackageInstallationNodeBuilder.class.php | 17 +++++++++++++ wcfsetup/install/lang/de.xml | 3 +++ wcfsetup/install/lang/en.xml | 3 +++ 8 files changed, 66 insertions(+), 7 deletions(-) diff --git a/com.woltlab.wcf/package.xml b/com.woltlab.wcf/package.xml index 93df9c57bc..b2c2660ac7 100644 --- a/com.woltlab.wcf/package.xml +++ b/com.woltlab.wcf/package.xml @@ -42,7 +42,7 @@ acpMenu.xml clipboardAction.xml coreObject.xml - languages/*.xml + language/*.xml option.xml userGroupOption.xml diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.js b/wcfsetup/install/files/acp/js/WCF.ACP.js index 48d92835ef..ed06114492 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.js @@ -385,9 +385,19 @@ WCF.ACP.Package.Installation = Class.extend({ this._allowRollback = (allowRollback === true) ? true : false; this._queueID = queueID; - this._dialogTitle = 'wcf.acp.package.installation.title'; - if (actionName == 'UninstallPackage') { - this._dialogTitle = 'wcf.acp.package.uninstallation.title'; + switch (actionName) { + case 'InstallPackage': + if (allowRollback) { + this._dialogTitle = 'wcf.acp.package.installation.title'; + } + else { + this._dialogTitle = 'wcf.acp.package.update.title'; + } + break; + + case 'UninstallPackage': + this._dialogTitle = 'wcf.acp.package.uninstallation.title'; + break; } this._initProxy(); diff --git a/wcfsetup/install/files/acp/templates/packageInstallationConfirm.tpl b/wcfsetup/install/files/acp/templates/packageInstallationConfirm.tpl index 9daa38e8e6..41e41a0ac0 100644 --- a/wcfsetup/install/files/acp/templates/packageInstallationConfirm.tpl +++ b/wcfsetup/install/files/acp/templates/packageInstallationConfirm.tpl @@ -5,7 +5,8 @@ $(function() { WCF.Language.addObject({ 'wcf.acp.package.installation.title': '{lang}wcf.acp.package.installation.title{/lang}', - 'wcf.acp.package.uninstallation.title': '{lang}wcf.acp.package.uninstallation.title{/lang}' + 'wcf.acp.package.uninstallation.title': '{lang}wcf.acp.package.uninstallation.title{/lang}', + 'wcf.acp.package.update.title': '{lang}wcf.acp.package.update.title{/lang}' }); new WCF.ACP.Package.Installation({@$queue->queueID}, undefined, {if $queue->action == 'install'}true{else}false{/if}); }); diff --git a/wcfsetup/install/files/lib/acp/action/InstallPackageAction.class.php b/wcfsetup/install/files/lib/acp/action/InstallPackageAction.class.php index ad7b32c8c3..681e70ea13 100755 --- a/wcfsetup/install/files/lib/acp/action/InstallPackageAction.class.php +++ b/wcfsetup/install/files/lib/acp/action/InstallPackageAction.class.php @@ -208,12 +208,13 @@ class InstallPackageAction extends AbstractDialogAction { protected function getCurrentAction($queueID) { if ($queueID === null) { // success message - $currentAction = WCF::getLanguage()->get('wcf.acp.package.installation.step.install.success'); + $currentAction = WCF::getLanguage()->get('wcf.acp.package.installation.step.' . $this->queue->action . '.success'); } else { // build package name $packageName = $this->installation->nodeBuilder->getPackageNameByQueue($queueID); - $currentAction = WCF::getLanguage()->getDynamicVariable('wcf.acp.package.installation.step.install', array('packageName' => $packageName)); + $installationType = $this->installation->nodeBuilder->getInstallationTypeByQueue($queueID); + $currentAction = WCF::getLanguage()->getDynamicVariable('wcf.acp.package.installation.step.'.$installationType, array('packageName' => $packageName)); } return $currentAction; diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php index 486705b80c..045aae2b36 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php @@ -184,7 +184,31 @@ class PackageInstallationDispatcher { // clear user storage UserStorageHandler::getInstance()->clear(); + // rebuild config files for affected applications + $sql = "SELECT package.packageID + FROM wcf1_package_installation_queue queue, + wcf1_package package + WHERE queue.processNo = ? + AND package.packageID = queue.packageID + AND package.packageID <> ? + AND package.isApplication = ?"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array( + $this->queue->processNo, + 1, + 1 + )); + while ($row = $statement->fetchArray()) { + Package::writeConfigFile($row['packageID']); + } + EventHandler::getInstance()->fireAction($this, 'postInstall'); + + // remove queues with the same process no + $sql = "DELETE FROM wcf".WCF_N."_package_installation_queue + WHERE processNo = ?"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array($this->queue->processNo)); } if ($this->requireRestructureVersionTables) { diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php index 66ec2b3557..420d541bb9 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php @@ -136,6 +136,23 @@ class PackageInstallationNodeBuilder { return $row['packageName']; } + /** + * Returns installation type by queue id. + * + * @param integer $queueID + * @return string + */ + public function getInstallationTypeByQueue($queueID) { + $sql = "SELECT action + FROM wcf".WCF_N."_package_installation_queue + WHERE queueID = ?"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array($queueID)); + $row = $statement->fetchArray(); + + return $row['action']; + } + /** * Returns data for current node. * diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 3095d13f34..91269a723a 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -492,6 +492,8 @@ + + @@ -535,6 +537,7 @@ + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 42128f8943..61a55e8516 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -492,6 +492,8 @@ + + @@ -535,6 +537,7 @@ + -- 2.20.1