Fixed path calculation upon WCFSetup
authorAlexander Ebert <ebert@woltlab.com>
Tue, 2 Jul 2013 11:51:58 +0000 (13:51 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 2 Jul 2013 11:51:58 +0000 (13:51 +0200)
wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php

index 2062908f6d64b5e8a3ce649c0894f8bd5c539747..8c36137c7171c03ca69e40c397980ed0b41c6345 100644 (file)
@@ -650,7 +650,21 @@ class PackageInstallationDispatcher {
                                
                                // determine domain path, in some environments (e.g. ISPConfig) the $_SERVER paths are
                                // faked and differ from the real filesystem path
-                               $documentRoot = str_replace(ApplicationHandler::getInstance()->getWCF()->domainPath, '', FileUtil::unifyDirSeperator(WCF_DIR));
+                               if (PACKAGE_ID) {
+                                       $wcfDomainPath = ApplicationHandler::getInstance()->getWCF()->domainPath;
+                               }
+                               else {
+                                       $sql = "SELECT  domainPath
+                                               FROM    wcf".WCF_N."_application
+                                               WHERE   packageID = ?";
+                                       $statement = WCF::getDB()->prepareStatement($sql);
+                                       $statement->execute(array(1));
+                                       $row = $statement->fetchArray();
+                                       
+                                       $wcfDomainPath = $row['domainPath'];
+                               }
+                               
+                               $documentRoot = str_replace($wcfDomainPath, '', FileUtil::unifyDirSeperator(WCF_DIR));
                                $domainPath = str_replace($documentRoot, '', $packageDir);
                                
                                // update application path