From c244fcc65a439a09e4be3b5331489008375511f6 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 3 Nov 2011 17:17:40 +0100 Subject: [PATCH] Application path is now properly resolved --- .../PackageInstallationDispatcher.class.php | 12 ++++++++++++ .../install/files/lib/util/FileUtil.class.php | 19 ++++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) 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; } /** -- 2.20.1