From: Alexander Ebert Date: Thu, 6 Oct 2016 11:21:40 +0000 (+0200) Subject: Fixed core installation in a path other than current X-Git-Tag: 3.0.0_Beta_3~50^2~76 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3cdb99872374251ce318de781483302c40fb5431;p=GitHub%2FWoltLab%2FWCF.git Fixed core installation in a path other than current --- diff --git a/wcfsetup/install/files/lib/system/application/ApplicationHandler.class.php b/wcfsetup/install/files/lib/system/application/ApplicationHandler.class.php index 70630e0a2a..c172cf67c2 100644 --- a/wcfsetup/install/files/lib/system/application/ApplicationHandler.class.php +++ b/wcfsetup/install/files/lib/system/application/ApplicationHandler.class.php @@ -4,9 +4,12 @@ use wcf\data\application\Application; use wcf\data\application\ApplicationAction; use wcf\data\application\ApplicationList; use wcf\system\cache\builder\ApplicationCacheBuilder; +use wcf\system\exception\SystemException; +use wcf\system\io\File; use wcf\system\request\RouteHandler; use wcf\system\Regex; use wcf\system\SingletonFactory; +use wcf\util\FileUtil; /** * Handles multi-application environments. @@ -92,12 +95,21 @@ class ApplicationHandler extends SingletonFactory { // work-around during WCFSetup if (!PACKAGE_ID) { $host = str_replace(RouteHandler::getProtocol(), '', RouteHandler::getHost()); + $documentRoot = FileUtil::addTrailingSlash(FileUtil::unifyDirSeparator(realpath($_SERVER['DOCUMENT_ROOT']))); + + // always use the core directory + if (empty($_POST['directories']) || empty($_POST['directories']['wcf'])) { + // within ACP + $_POST['directories'] = ['wcf' => $documentRoot . FileUtil::removeLeadingSlash(RouteHandler::getPath(['acp']))]; + } + + $path = FileUtil::addLeadingSlash(FileUtil::addTrailingSlash(FileUtil::unifyDirSeparator(FileUtil::getRelativePath($documentRoot, $_POST['directories']['wcf'])))); return new Application(null, [ 'domainName' => $host, - 'domainPath' => RouteHandler::getPath(['acp']), + 'domainPath' => $path, 'cookieDomain' => $host, - 'cookiePath' => RouteHandler::getPath(['acp']) + 'cookiePath' => $path ]); } else if (isset($this->cache['application'][PACKAGE_ID])) {