Application path is now properly resolved
authorAlexander Ebert <ebert@woltlab.com>
Thu, 3 Nov 2011 16:17:40 +0000 (17:17 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 3 Nov 2011 16:17:40 +0000 (17:17 +0100)
wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php
wcfsetup/install/files/lib/util/FileUtil.class.php

index 264c0c475de73b48d3a26773e4cdb563eed39ca5..701a88d8f70a8b6c5052a1966b6eb5e0747e8340 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 namespace wcf\system\package;
 use wcf\system\menu\acp\ACPMenu;
+use wcf\data\application\Application;
 use wcf\data\application\ApplicationEditor;
 use wcf\data\language\LanguageEditor;
 use wcf\data\option\OptionEditor;
@@ -454,6 +455,17 @@ class PackageInstallationDispatcher {
                                        'packageDir' => FileUtil::getRelativePath(WCF_DIR, $packageDir)
                                ));
                                
+                               // parse domain path
+                               $domainPath = FileUtil::getRelativePath(FileUtil::unifyDirSeperator($_SERVER['DOCUMENT_ROOT']), FileUtil::unifyDirSeperator($packageDir));
+                               $domainPath = FileUtil::addLeadingSlash(FileUtil::addTrailingSlash($domainPath));
+                               
+                               // update application path
+                               $application = new Application($this->getPackage()->packageID);
+                               $applicationEditor = new ApplicationEditor($application);
+                               $applicationEditor->update(array(
+                                       'domainPath' => $domainPath
+                               ));
+                               
                                // create directory and set permissions
                                @mkdir($packageDir, 0777, true);
                                @chmod($packageDir, 0777);
index 5ff89223f0dfbceca18bebeb8b3d2d5664afefb5..8139aa3c285089ab715466c4cebd524fee9dff13 100644 (file)
@@ -74,9 +74,22 @@ class FileUtil {
                if (substr($path, -1) != '/') {
                        return $path.'/';
                }
-               else {
-                       return $path;
-               }       
+               
+               return $path;
+       }
+       
+       /**
+        * Adds a leading slash.
+        * 
+        * @param       string          $path
+        * @return      string          $path
+        */
+       public static function addLeadingSlash($path) {
+               if (substr($path, 0, 1) != '/') {
+                       return '/'.$path;
+               }
+               
+               return $path;
        }
 
        /**