Added automatic import of projects
authorAlexander Ebert <ebert@woltlab.com>
Sat, 25 Nov 2017 10:24:05 +0000 (11:24 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 25 Nov 2017 10:24:05 +0000 (11:24 +0100)
See #2477

extra/examples/wsc-dev-config-31.json
wcfsetup/install/files/lib/system/devtools/DevtoolsSetup.class.php
wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php

index 2ae9526e689c52517e42532b5004d7b3a22ef149..da5cdd9881a8966f9c55968f8a704fff3c186286 100644 (file)
@@ -13,6 +13,9 @@
         "option": {
             "captcha_type": "",
             "module_cookie_policy_page": "0"
+        },
+        "devtools": {
+            "importFromPath": "C:/inetpub/wwwroot/wcf/"
         }
     },
     "user": [
index 755dcf7dd24540fc566e076010677b659a589798..c3ea5d31fe9b12908288c3ac3303e613379b075a 100644 (file)
@@ -109,6 +109,15 @@ class DevtoolsSetup extends SingletonFactory {
                }
        }
        
+       /**
+        * Returns the base path for projects that should be automatically imported.
+        * 
+        * @return      string
+        */
+       public function getDevtoolsImportPath() {
+               return (isset($this->configuration['configuration']['devtools']) && !empty($this->configuration['configuration']['devtools']['importFromPath'])) ? $this->configuration['configuration']['devtools']['importFromPath'] : '';
+       }
+       
        /**
         * Returns the raw configuration data.
         * 
index dac3166e83c26272da3630570e28c8a48156be93..534562c81dc3cc80cf091a8bcafdd7c47a7f4791 100644 (file)
@@ -2,6 +2,7 @@
 namespace wcf\system\package;
 use wcf\data\application\Application;
 use wcf\data\application\ApplicationEditor;
+use wcf\data\devtools\project\DevtoolsProjectAction;
 use wcf\data\language\category\LanguageCategory;
 use wcf\data\language\LanguageEditor;
 use wcf\data\language\LanguageList;
@@ -270,6 +271,12 @@ class PackageInstallationDispatcher {
                                                                ]
                                                        ]))->executeAction();
                                                }
+                                               
+                                               if (($importPath = DevtoolsSetup::getInstance()->getDevtoolsImportPath()) !== '') {
+                                                       (new DevtoolsProjectAction([], 'quickSetup', [
+                                                               'path' => $importPath
+                                                       ]))->executeAction();
+                                               }
                                        }
                                        
                                        // update options.inc.php