public function invoke() {
$dispatcher = new DevtoolsPackageInstallationDispatcher($this->project);
/** @var IIdempotentPackageInstallationPlugin $pip */
- $pip = new $this->packageInstallationPlugin->className($dispatcher, [
- 'value' => $this->devtoolsPip->getInstructionValue($this->project, $this->parameters['target'])
- ]);
+ $pip = new $this->packageInstallationPlugin->className(
+ $dispatcher,
+ $this->devtoolsPip->getInstructions($this->project, $this->parameters['target'])
+ );
$start = microtime(true);
}
/**
- * Computes and prepares the instruction value for the provided target file.
+ * Computes and prepares the instructions for the provided target file.
*
* @param DevtoolsProject $project
* @param string $target
- * @return string
+ * @return string[]
*/
- public function getInstructionValue(DevtoolsProject $project, $target) {
+ public function getInstructions(DevtoolsProject $project, $target) {
$defaultFilename = $this->getDefaultFilename();
$pluginName = $this->getDecoratedObject()->pluginName;
$tar = $project->getPackageArchive()->getTar();
$tar->reset();
+ $instructions = [];
+
if ($project->isCore()) {
switch ($pluginName) {
case 'acpTemplate':
}
}
- return $defaultFilename;
+ $instructions['value'] = $defaultFilename;
+
+ break;
case 'language':
$filename = "wcfsetup/install/lang/{$target}";
$tar->registerFile($filename, $project->path . $filename);
- return $filename;
+ $instructions['value'] = $filename;
+
+ break;
default:
$filename = "com.woltlab.wcf/{$target}";
$tar->registerFile($filename, $project->path . $filename);
- return $filename;
+ $instructions['value'] = $filename;
+
+ break;
}
}
else {
}
else {
$path = 'files/';
+ if (preg_match('~^files_(?<application>.*)\.tar$~', $target, $match)) {
+ $path = "files_{$match['application']}/";
+
+ $instructions['attributes'] = ['application' => $match['application']];
+ }
$directory = new \RecursiveDirectoryIterator($project->path . $path);
$filter = new \RecursiveCallbackFilterIterator($directory, function ($current) {
}
}
- return $defaultFilename;
+ $instructions['value'] = $defaultFilename;
+
+ break;
default:
if (strpos($defaultFilename, '*') !== false) {
$tar->registerFile($filename, $project->path . $filename);
}
- return $filename;
+ $instructions['value'] = $filename;
+
+ break;
}
}
+
+ return $instructions;
}
}