Fix syncing Core file-based PIPs
authorMatthias Schmidt <gravatronics@live.com>
Sat, 24 Nov 2018 08:28:56 +0000 (09:28 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Sat, 24 Nov 2018 08:28:56 +0000 (09:28 +0100)
Core does not explicitly use the PIP to install files and acp templates thus there is no install instructions for those PIPs. Additionally, the (implicit) archive names of the file-based PIPs does not easily translate to the directory location.

See #2616

wcfsetup/install/files/lib/system/devtools/package/DevtoolsInstaller.class.php

index 534740d42eae87fa3c493f4c9f4dd15c04da0001..09274ca09f75807a10cb47601e03e6bc6a594887 100644 (file)
@@ -38,7 +38,24 @@ class DevtoolsInstaller extends Installer {
        public function getTar($source) {
                $directory = null;
                
-               foreach ($this->project->getPackageArchive()->getInstallInstructions() as $instruction) {
+               $instructions = $this->project->getPackageArchive()->getInstallInstructions();
+               
+               // WoltLab Suite Core does not install its acp templates and files via PIP
+               if ($this->project->isCore()) {
+                       $instructions[] = [
+                               'attributes' => ['type' => 'acpTemplate'],
+                               'pip' => 'acpTemplate',
+                               'value' => ''
+                       ];
+                       
+                       $instructions[] = [
+                               'attributes' => ['type' => 'file'],
+                               'pip' => 'file',
+                               'value' => ''
+                       ];
+               }
+               
+               foreach ($instructions as $instruction) {
                        $archive = null;
                        switch ($instruction['pip']) {
                                case 'acpTemplate':
@@ -55,7 +72,25 @@ class DevtoolsInstaller extends Installer {
                        }
                        
                        if ($archive !== null) {
-                               $directory = FileUtil::addTrailingSlash($this->project->path . pathinfo($archive, PATHINFO_FILENAME));
+                               if ($this->project->isCore()) {
+                                       switch ($instruction['pip']) {
+                                               case 'acpTemplate':
+                                                       $directory = $this->project->path . 'wcfsetup/install/files/acp/templates/';
+                                                       break;
+                                               
+                                               case 'file':
+                                                       $directory = $this->project->path . 'wcfsetup/install/files/';
+                                                       break;
+                                               
+                                               case 'template':
+                                                       $directory = $this->project->path . 'com.woltlab.wcf/templates/';
+                                                       break;
+                                       }
+                               }
+                               else {
+                                       $directory = FileUtil::addTrailingSlash($this->project->path . pathinfo($archive, PATHINFO_FILENAME));
+                               }
+                               
                                if ($source == $archive && is_dir($directory)) {
                                        $files = $this->project->getPackageArchive()->getTar()->getFiles();