From f5c58eeda32a2a4182fed0c0239ea66aa45cf5d5 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 9 Feb 2012 14:11:12 +0100 Subject: [PATCH] Fixed broken redirect after uninstallation --- .../action/UninstallPackageAction.class.php | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/wcfsetup/install/files/lib/acp/action/UninstallPackageAction.class.php b/wcfsetup/install/files/lib/acp/action/UninstallPackageAction.class.php index 205c9efd2b..654dd4604a 100644 --- a/wcfsetup/install/files/lib/acp/action/UninstallPackageAction.class.php +++ b/wcfsetup/install/files/lib/acp/action/UninstallPackageAction.class.php @@ -111,9 +111,38 @@ class UninstallPackageAction extends InstallPackageAction { // remove node data $this->installation->nodeBuilder->purgeNodes(); + // redirect to application if not already within one + if (PACKAGE_ID == 1) { + // select first installed application + $sql = "SELECT packageID + FROM wcf".WCF_N."_package + WHERE packageID <> 1 + AND isApplication = 1 + ORDER BY installDate ASC"; + $statement = WCF::getDB()->prepareStatement($sql, 1); + $statement->execute(); + $row = $statement->fetchArray(); + $packageID = ($row === false) ? 1 : $row['packageID']; + } + else { + $packageID = PACKAGE_ID; + } + + // get domain path + $sql = "SELECT domainName, domainPath + FROM wcf".WCF_N."_application + WHERE packageID = ?"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array($packageID)); + $row = $statement->fetchArray(); + + // build redirect location + $location = $row['domainName'] . $row['domainPath'] . 'acp/index.php/PackageList/' . SID_ARG_1ST; + // show success $this->data = array( 'progress' => 100, + 'redirectLocation' => $location, 'step' => 'success' ); return; -- 2.20.1