Fix installation if document root is symlink
authorMatthias Schmidt <gravatronics@live.com>
Thu, 4 Aug 2016 15:51:47 +0000 (17:51 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 4 Aug 2016 16:13:12 +0000 (18:13 +0200)
wcfsetup/install/files/lib/system/WCFSetup.class.php

index ad8371482296ae5f272d7c99748efc97ff9fc415..81699a8db90a5eb1ba4eb9cd365a89de7c2e1624 100644 (file)
@@ -456,15 +456,15 @@ class WCFSetup extends WCF {
                        if ($application !== 'wcf') $showOrder[] = $application;
                }
                
+               $documentRoot = FileUtil::unifyDirSeparator(realpath($_SERVER['DOCUMENT_ROOT']));
                if (self::$developerMode && isset($_ENV['WCFSETUP_USEDEFAULTWCFDIR'])) {
                        // resolve path relative to document root
-                       $relativePath = FileUtil::getRelativePath($_SERVER['DOCUMENT_ROOT'], INSTALL_SCRIPT_DIR);
+                       $relativePath = FileUtil::getRelativePath($documentRoot, INSTALL_SCRIPT_DIR);
                        foreach ($packages as $application => $packageData) {
                                self::$directories[$application] = $relativePath . ($application === 'wcf' ? '' : $packageData['directory'] . '/');
                        }
                }
                
-               $documentRoot = FileUtil::unifyDirSeparator($_SERVER['DOCUMENT_ROOT']);
                $errors = [];
                if (!empty(self::$directories)) {
                        $applicationPaths = $knownPaths = [];
@@ -515,7 +515,7 @@ class WCFSetup extends WCF {
                }
                else {
                        // resolve path relative to document root
-                       $relativePath = FileUtil::getRelativePath($_SERVER['DOCUMENT_ROOT'], INSTALL_SCRIPT_DIR);
+                       $relativePath = FileUtil::getRelativePath($documentRoot, INSTALL_SCRIPT_DIR);
                        foreach ($packages as $application => $packageData) {
                                self::$directories[$application] = $relativePath . ($application === 'wcf' ? '' : $packageData['directory'] . '/');
                        }