Fixed broken redirect after uninstallation
authorAlexander Ebert <ebert@woltlab.com>
Thu, 9 Feb 2012 13:11:12 +0000 (14:11 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 9 Feb 2012 13:11:12 +0000 (14:11 +0100)
wcfsetup/install/files/lib/acp/action/UninstallPackageAction.class.php

index 205c9efd2bd3ea6d0850248c50016063fc4bd135..654dd4604a3d0743fac94b4234f6be8a4b7ee3e1 100644 (file)
@@ -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;