From: Alexander Ebert Date: Thu, 3 Nov 2011 16:17:40 +0000 (+0100) Subject: Application path is now properly resolved X-Git-Tag: 2.0.0_Beta_1~1628^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c244fcc65a439a09e4be3b5331489008375511f6;p=GitHub%2FWoltLab%2FWCF.git Application path is now properly resolved --- diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php index 264c0c475d..701a88d8f7 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php @@ -1,6 +1,7 @@ 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); diff --git a/wcfsetup/install/files/lib/util/FileUtil.class.php b/wcfsetup/install/files/lib/util/FileUtil.class.php index 5ff89223f0..8139aa3c28 100644 --- a/wcfsetup/install/files/lib/util/FileUtil.class.php +++ b/wcfsetup/install/files/lib/util/FileUtil.class.php @@ -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; } /**