Missing recognition of application (acp)templates
authorAlexander Ebert <ebert@woltlab.com>
Fri, 26 Jan 2018 12:12:32 +0000 (13:12 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 26 Jan 2018 12:12:32 +0000 (13:12 +0100)
This change adds support for `acptemplates_<application>.tar` and
`templates_<application>.tar` imports.

wcfsetup/install/files/lib/system/devtools/pip/DevtoolsPip.class.php

index a3108ae80d530fffed15d0e9ae6276125690dcee..1f7a52c744686c23ebb68721701433b58f6c0881 100644 (file)
@@ -271,7 +271,17 @@ class DevtoolsPip extends DatabaseObjectDecorator {
                                case 'file':
                                case 'template':
                                        if ($pluginName === 'acpTemplate' || $pluginName === 'template') {
-                                               $path = ($pluginName === 'acpTemplate') ? 'acptemplates/' : 'templates/';
+                                               $pathPrefix = ($pluginName === 'acpTemplate') ? 'acptemplates' : 'templates';
+                                               
+                                               if (preg_match('~^'.$pathPrefix.'_(?<application>.*)\.tar$~', $target, $match)) {
+                                                       $path = "{$pathPrefix}_{$match['application']}/";
+                                                       
+                                                       $instructions['attributes'] = ['application' => $match['application']];
+                                               }
+                                               else {
+                                                       $path = "{$pathPrefix}/";
+                                               }
+                                               
                                                foreach (glob($project->path . $path . '*.tpl') as $template) {
                                                        $tar->registerFile(basename($template), FileUtil::unifyDirSeparator($template));
                                                }