Improve WCFSETUP_USEDEFAULTWCFDIR
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 2 Aug 2016 16:58:32 +0000 (18:58 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 2 Aug 2016 16:58:32 +0000 (18:58 +0200)
wcfsetup/install/files/lib/system/WCFSetup.class.php

index 9787bdc0529327ebb80a80aec8cdcbb4d58f3821..32e17b42bd2889b99fa801aef39ede911aa1d1bc 100644 (file)
@@ -134,11 +134,6 @@ class WCFSetup extends WCF {
         * @since       3.0
         */
        protected static function getInstallationDirectories() {
-               if (self::$developerMode && isset($_ENV['WCFSETUP_USEDEFAULTWCFDIR'])) {
-                       if (!isset($_REQUEST['directories']) || !is_array($_REQUEST['directories'])) $_REQUEST['directories'] = [];
-                       $_REQUEST['directories']['wcf'] = FileUtil::unifyDirSeparator(INSTALL_SCRIPT_DIR).'wcf/';
-               }
-               
                if (!empty($_REQUEST['directories']) && is_array($_REQUEST['directories'])) {
                        foreach ($_REQUEST['directories'] as $application => $directory) {
                                self::$directories[$application] = $directory;
@@ -251,13 +246,10 @@ class WCFSetup extends WCF {
                                        break;
                                }
                        
-                       /** @noinspection PhpMissingBreakStatementInspection */
                        case 'configureDirectories':
-                               if (!self::$developerMode || !isset($_ENV['WCFSETUP_USEDEFAULTWCFDIR'])) {
-                                       $this->calcProgress(3);
-                                       $this->configureDirectories();
-                                       break;
-                               }
+                               $this->calcProgress(3);
+                               $this->configureDirectories();
+                       break;
                        
                        case 'unzipFiles':
                                $this->calcProgress(4);
@@ -461,6 +453,14 @@ class WCFSetup extends WCF {
                        if ($application !== 'wcf') $showOrder[] = $application;
                }
                
+               if (self::$developerMode && isset($_ENV['WCFSETUP_USEDEFAULTWCFDIR'])) {
+                       // resolve path relative to document root
+                       $relativePath = FileUtil::getRelativePath($_SERVER['DOCUMENT_ROOT'], 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)) {