From: Matthias Schmidt Date: Sun, 14 Mar 2021 08:07:37 +0000 (+0100) Subject: Support database PIP in devtools sync function X-Git-Tag: 5.4.0_Alpha_1~162^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1c8ec432ca10a52a16aa491b4b8da1bcf3338380;p=GitHub%2FWoltLab%2FWCF.git Support database PIP in devtools sync function --- diff --git a/ts/WoltLabSuite/Core/Acp/Ui/Devtools/Project/Sync.ts b/ts/WoltLabSuite/Core/Acp/Ui/Devtools/Project/Sync.ts index 62fdbb7570..667d207b88 100644 --- a/ts/WoltLabSuite/Core/Acp/Ui/Devtools/Project/Sync.ts +++ b/ts/WoltLabSuite/Core/Acp/Ui/Devtools/Project/Sync.ts @@ -15,6 +15,7 @@ type PendingPip = [string, string]; interface AjaxResponse { returnValues: { + invokeAgain: boolean; pluginName: string; target: string; timeElapsed: string; @@ -203,7 +204,11 @@ class AcpUiDevtoolsProjectSync { this.buttons.get(identifier)!.disabled = false; this.buttonStatus.get(identifier)!.innerHTML = data.returnValues.timeElapsed; - this.syncNext(); + if (data.returnValues.invokeAgain) { + this.sync(data.returnValues.pluginName, data.returnValues.target); + } else { + this.syncNext(); + } } _ajaxFailure( diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Devtools/Project/Sync.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Devtools/Project/Sync.js index a08f8613a8..b550ad8cc2 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Devtools/Project/Sync.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Devtools/Project/Sync.js @@ -139,7 +139,12 @@ define(["require", "exports", "tslib", "../../../../Ajax", "../../../../Language const identifier = this.getButtonIdentifier(data.returnValues.pluginName, data.returnValues.target); this.buttons.get(identifier).disabled = false; this.buttonStatus.get(identifier).innerHTML = data.returnValues.timeElapsed; - this.syncNext(); + if (data.returnValues.invokeAgain) { + this.sync(data.returnValues.pluginName, data.returnValues.target); + } + else { + this.syncNext(); + } } _ajaxFailure(data, responseText, xhr, requestData) { const identifier = this.getButtonIdentifier(requestData.parameters.pluginName, requestData.parameters.target); diff --git a/wcfsetup/install/files/lib/data/package/installation/plugin/PackageInstallationPluginAction.class.php b/wcfsetup/install/files/lib/data/package/installation/plugin/PackageInstallationPluginAction.class.php index 61c32a53c8..e3d0286c5c 100644 --- a/wcfsetup/install/files/lib/data/package/installation/plugin/PackageInstallationPluginAction.class.php +++ b/wcfsetup/install/files/lib/data/package/installation/plugin/PackageInstallationPluginAction.class.php @@ -107,10 +107,15 @@ class PackageInstallationPluginAction extends AbstractDatabaseObjectAction $start = \microtime(true); + $invokeAgain = false; try { $pip->update(); } catch (SplitNodeException $e) { - throw new \RuntimeException("PIP '{$this->packageInstallationPlugin->pluginName}' is not allowed to throw a 'SplitNodeException'."); + if ($this->parameters['pluginName'] !== 'database') { + throw new \RuntimeException("PIP '{$this->packageInstallationPlugin->pluginName}' is not allowed to throw a 'SplitNodeException'."); + } + + $invokeAgain = true; } SearchIndexManager::getInstance()->createSearchIndices(); @@ -143,6 +148,7 @@ class PackageInstallationPluginAction extends AbstractDatabaseObjectAction } return [ + 'invokeAgain' => $invokeAgain, 'pluginName' => $this->packageInstallationPlugin->pluginName, 'target' => $this->parameters['target'], 'timeElapsed' => WCF::getLanguage()->getDynamicVariable( diff --git a/wcfsetup/install/files/lib/system/devtools/pip/DevtoolsPip.class.php b/wcfsetup/install/files/lib/system/devtools/pip/DevtoolsPip.class.php index fa3f70208b..b3d0fced91 100644 --- a/wcfsetup/install/files/lib/system/devtools/pip/DevtoolsPip.class.php +++ b/wcfsetup/install/files/lib/system/devtools/pip/DevtoolsPip.class.php @@ -6,6 +6,7 @@ use wcf\data\DatabaseObjectDecorator; use wcf\data\devtools\project\DevtoolsProject; use wcf\data\package\installation\plugin\PackageInstallationPlugin; use wcf\system\application\ApplicationHandler; +use wcf\system\package\plugin\DatabasePackageInstallationPlugin; use wcf\system\package\plugin\IPackageInstallationPlugin; use wcf\system\WCF; use wcf\util\FileUtil; @@ -200,6 +201,16 @@ class DevtoolsPip extends DatabaseObjectDecorator // these pips are satisfied by definition return [$defaultFilename]; + case 'database': + foreach (\glob("{$path}wcfsetup/install/files/{$defaultFilename}") as $file) { + $targets[] = \basename($file); + } + + // `glob()` returns files in an arbitrary order + \sort($targets, \SORT_NATURAL); + + return $targets; + case 'language': foreach (\glob($path . 'wcfsetup/install/lang/*.xml') as $file) { $targets[] = \basename($file); @@ -330,6 +341,13 @@ class DevtoolsPip extends DatabaseObjectDecorator break; + case 'database': + $instructions['value'] = DatabasePackageInstallationPlugin::SCRIPT_DIR . $target; + + $tar->registerFile($instructions['value'], $project->path . 'wcfsetup/install/files/' . $target); + + break; + case 'language': $tar->registerFile($target, $project->path . 'wcfsetup/install/lang/' . $target);