From eb3e5c60bdc889f4717228d8f3036ecd28be0dfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Jou=C3=9Fen?= Date: Tue, 27 Oct 2026 11:46:02 +0100 Subject: [PATCH 1/2] BackgroundTasks: Move setup and SOAP classes into the component Move the setup agent, its config and objectives, and the SOAP administration class into components/ILIAS/BackgroundTasks/src under the ILIAS\BackgroundTasks namespace. Delete the old files from BackgroundTasks_ and the empty class.ilBackgroundTasksDB80.php. ilBackgroundTasksDBHotfixes10 keeps its global class name, because the database step log stores executed steps by that class name. --- .../ILIAS/BackgroundTasks/BackgroundTasks.php | 4 ++-- .../src/SOAP/Administration.php} | 8 ++++---- .../Setup/Agent.php} | 19 +++++++++++-------- .../src}/Setup/BackgoundWorkerObjective.php | 3 +-- .../src/Setup/ConfigStoredObjective.php} | 9 ++++++--- .../src/Setup/MetricsCollectedObjective.php} | 5 ++++- .../src/Setup/SetupConfig.php} | 4 +++- .../Setup/class.ilBackgroundTasksDB80.php | 0 .../ILIAS/soap/include/inc.soap_functions.php | 2 +- 9 files changed, 32 insertions(+), 22 deletions(-) rename components/ILIAS/{BackgroundTasks_/classes/class.ilSoapBackgroundTasksAdministration.php => BackgroundTasks/src/SOAP/Administration.php} (85%) rename components/ILIAS/BackgroundTasks/{classes/Setup/class.ilBackgroundTasksSetupAgent.php => src/Setup/Agent.php} (84%) rename components/ILIAS/{BackgroundTasks_/classes => BackgroundTasks/src}/Setup/BackgoundWorkerObjective.php (98%) rename components/ILIAS/{BackgroundTasks_/classes/Setup/class.ilBackgroundTasksConfigStoredObjective.php => BackgroundTasks/src/Setup/ConfigStoredObjective.php} (90%) rename components/ILIAS/{BackgroundTasks_/classes/Setup/class.ilBackgroundTasksMetricsCollectedObjective.php => BackgroundTasks/src/Setup/MetricsCollectedObjective.php} (92%) rename components/ILIAS/{BackgroundTasks_/classes/Setup/class.ilBackgroundTasksSetupConfig.php => BackgroundTasks/src/Setup/SetupConfig.php} (95%) delete mode 100755 components/ILIAS/BackgroundTasks_/classes/Setup/class.ilBackgroundTasksDB80.php diff --git a/components/ILIAS/BackgroundTasks/BackgroundTasks.php b/components/ILIAS/BackgroundTasks/BackgroundTasks.php index 7785d9d378dd..d4bd88a66d2a 100644 --- a/components/ILIAS/BackgroundTasks/BackgroundTasks.php +++ b/components/ILIAS/BackgroundTasks/BackgroundTasks.php @@ -36,8 +36,8 @@ public function init( array | \ArrayAccess &$pull, array | \ArrayAccess &$internal, ): void { - $contribute[Agent::class] = static fn(): \ilBackgroundTasksSetupAgent => - new \ilBackgroundTasksSetupAgent( + $contribute[Agent::class] = static fn(): Agent => + new \ILIAS\BackgroundTasks\Setup\Agent( $pull[Factory::class] ); } diff --git a/components/ILIAS/BackgroundTasks_/classes/class.ilSoapBackgroundTasksAdministration.php b/components/ILIAS/BackgroundTasks/src/SOAP/Administration.php similarity index 85% rename from components/ILIAS/BackgroundTasks_/classes/class.ilSoapBackgroundTasksAdministration.php rename to components/ILIAS/BackgroundTasks/src/SOAP/Administration.php index 93202a85b98d..b5add484c37a 100755 --- a/components/ILIAS/BackgroundTasks_/classes/class.ilSoapBackgroundTasksAdministration.php +++ b/components/ILIAS/BackgroundTasks/src/SOAP/Administration.php @@ -16,12 +16,12 @@ * *********************************************************************/ -/** @noRector */ -require_once __DIR__ . "/../../../../vendor/composer/vendor/autoload.php"; +namespace ILIAS\BackgroundTasks\SOAP; use ILIAS\BackgroundTasks\Implementation\TaskManager\AsyncTaskManager; +use ilSoapAdministration; -class ilSoapBackgroundTasksAdministration extends ilSoapAdministration +class Administration extends ilSoapAdministration { public function __construct(bool $use_nusoap = true) { @@ -29,7 +29,7 @@ public function __construct(bool $use_nusoap = true) } /** - * @return bool|soap_fault|SoapFault|null + * @return bool|\soap_fault|\SoapFault|null */ public function runAsync(string $sid) { diff --git a/components/ILIAS/BackgroundTasks/classes/Setup/class.ilBackgroundTasksSetupAgent.php b/components/ILIAS/BackgroundTasks/src/Setup/Agent.php similarity index 84% rename from components/ILIAS/BackgroundTasks/classes/Setup/class.ilBackgroundTasksSetupAgent.php rename to components/ILIAS/BackgroundTasks/src/Setup/Agent.php index bade8b809230..f7fd7af9b9fd 100755 --- a/components/ILIAS/BackgroundTasks/classes/Setup/class.ilBackgroundTasksSetupAgent.php +++ b/components/ILIAS/BackgroundTasks/src/Setup/Agent.php @@ -16,7 +16,8 @@ * *********************************************************************/ -use ILIAS\Setup\Agent; +namespace ILIAS\BackgroundTasks\Setup; + use ILIAS\Setup\Agent\HasNoNamedObjective; use ILIAS\Refinery\Factory; use ILIAS\Refinery\Transformation; @@ -25,10 +26,12 @@ use ILIAS\Setup\Objective\NullObjective; use ILIAS\Setup\Metrics\Storage; use ILIAS\Setup\ObjectiveCollection; -use ILIAS\BackgroundTasks\Setup\BackgoundWorkerObjective; use ILIAS\Setup\ObjectiveConstructor; +use ilBackgroundTasksDBHotfixes10; +use ilDatabaseUpdateStepsExecutedObjective; +use ilDatabaseUpdateStepsMetricsCollectedObjective; -class ilBackgroundTasksSetupAgent implements Agent +class Agent implements \ILIAS\Setup\Agent { use HasNoNamedObjective; @@ -49,8 +52,8 @@ public function hasConfig(): bool */ public function getArrayToConfigTransformation(): Transformation { - return $this->refinery->custom()->transformation(fn($data): \ilBackgroundTasksSetupConfig => new \ilBackgroundTasksSetupConfig( - $data["type"] ?? \ilBackgroundTasksSetupConfig::TYPE_SYNCHRONOUS, + return $this->refinery->custom()->transformation(fn($data): SetupConfig => new SetupConfig( + $data["type"] ?? SetupConfig::TYPE_SYNCHRONOUS, $data["max_number_of_concurrent_tasks"] ?? 1 )); } @@ -68,14 +71,14 @@ public function getInstallObjective(?Config $config = null): Objective */ public function getUpdateObjective(?Config $config = null): Objective { - if (!$config instanceof ilBackgroundTasksSetupConfig) { + if (!$config instanceof SetupConfig) { return new NullObjective(); } return new ObjectiveCollection( 'BackgroundTasks', true, - new ilBackgroundTasksConfigStoredObjective($config), + new ConfigStoredObjective($config), new ilDatabaseUpdateStepsExecutedObjective(new ilBackgroundTasksDBHotfixes10()) ); } @@ -96,7 +99,7 @@ public function getStatusObjective(Storage $storage): Objective return new ObjectiveCollection( 'Component BackgroundTasks', true, - new ilBackgroundTasksMetricsCollectedObjective($storage), + new MetricsCollectedObjective($storage), new ilDatabaseUpdateStepsMetricsCollectedObjective($storage, new ilBackgroundTasksDBHotfixes10()) ); } diff --git a/components/ILIAS/BackgroundTasks_/classes/Setup/BackgoundWorkerObjective.php b/components/ILIAS/BackgroundTasks/src/Setup/BackgoundWorkerObjective.php similarity index 98% rename from components/ILIAS/BackgroundTasks_/classes/Setup/BackgoundWorkerObjective.php rename to components/ILIAS/BackgroundTasks/src/Setup/BackgoundWorkerObjective.php index 7fb67bc56d18..f4b26b4164e6 100644 --- a/components/ILIAS/BackgroundTasks_/classes/Setup/BackgoundWorkerObjective.php +++ b/components/ILIAS/BackgroundTasks/src/Setup/BackgoundWorkerObjective.php @@ -37,7 +37,6 @@ use ilSettingsFactoryExistsObjective; use ILIAS\Setup\Objective\ClientIdReadObjective; use ILIAS\Setup\Objective\AdminConfirmedObjective; -use ilBackgroundTasksSetupConfig; class BackgoundWorkerObjective extends AdminConfirmedObjective { @@ -92,7 +91,7 @@ public function isApplicable(Environment $environment): bool return false; } - return $ini->readVariable('background_tasks', 'concurrency') === ilBackgroundTasksSetupConfig::TYPE_ASYNCHRONOUS; + return $ini->readVariable('background_tasks', 'concurrency') === SetupConfig::TYPE_ASYNCHRONOUS; } public function achieve(Environment $environment): Environment diff --git a/components/ILIAS/BackgroundTasks_/classes/Setup/class.ilBackgroundTasksConfigStoredObjective.php b/components/ILIAS/BackgroundTasks/src/Setup/ConfigStoredObjective.php similarity index 90% rename from components/ILIAS/BackgroundTasks_/classes/Setup/class.ilBackgroundTasksConfigStoredObjective.php rename to components/ILIAS/BackgroundTasks/src/Setup/ConfigStoredObjective.php index 7bb8908b32a1..fca94fc024b8 100755 --- a/components/ILIAS/BackgroundTasks_/classes/Setup/class.ilBackgroundTasksConfigStoredObjective.php +++ b/components/ILIAS/BackgroundTasks/src/Setup/ConfigStoredObjective.php @@ -16,13 +16,16 @@ * *********************************************************************/ +namespace ILIAS\BackgroundTasks\Setup; + use ILIAS\Setup\Objective; use ILIAS\Setup\Environment; use ILIAS\Setup\UnachievableException; +use ilIniFilesLoadedObjective; -class ilBackgroundTasksConfigStoredObjective implements Objective +class ConfigStoredObjective implements Objective { - public function __construct(protected ilBackgroundTasksSetupConfig $config) + public function __construct(protected SetupConfig $config) { } @@ -59,7 +62,7 @@ public function achieve(Environment $environment): Environment $ini->addGroup("background_tasks"); } - if ($this->config->getType() === \ilBackgroundTasksSetupConfig::TYPE_ASYNCHRONOUS) { + if ($this->config->getType() === SetupConfig::TYPE_ASYNCHRONOUS) { $io = $environment->getResource(Environment::RESOURCE_ADMIN_INTERACTION); /** @var Setup\CLI\IOWrapper $io */ $io->inform('Asynchronous background tasks need SOAP administration to be enabled. Make sure to enable it in your configuarion.'); diff --git a/components/ILIAS/BackgroundTasks_/classes/Setup/class.ilBackgroundTasksMetricsCollectedObjective.php b/components/ILIAS/BackgroundTasks/src/Setup/MetricsCollectedObjective.php similarity index 92% rename from components/ILIAS/BackgroundTasks_/classes/Setup/class.ilBackgroundTasksMetricsCollectedObjective.php rename to components/ILIAS/BackgroundTasks/src/Setup/MetricsCollectedObjective.php index 0236691d7251..08b7490069c3 100755 --- a/components/ILIAS/BackgroundTasks_/classes/Setup/class.ilBackgroundTasksMetricsCollectedObjective.php +++ b/components/ILIAS/BackgroundTasks/src/Setup/MetricsCollectedObjective.php @@ -16,11 +16,14 @@ * *********************************************************************/ +namespace ILIAS\BackgroundTasks\Setup; + use ILIAS\Setup\Metrics\CollectedObjective; use ILIAS\Setup\Environment; use ILIAS\Setup\Metrics\Storage; +use ilIniFilesLoadedObjective; -class ilBackgroundTasksMetricsCollectedObjective extends CollectedObjective +class MetricsCollectedObjective extends CollectedObjective { /** * @return \ilIniFilesLoadedObjective[] diff --git a/components/ILIAS/BackgroundTasks_/classes/Setup/class.ilBackgroundTasksSetupConfig.php b/components/ILIAS/BackgroundTasks/src/Setup/SetupConfig.php similarity index 95% rename from components/ILIAS/BackgroundTasks_/classes/Setup/class.ilBackgroundTasksSetupConfig.php rename to components/ILIAS/BackgroundTasks/src/Setup/SetupConfig.php index 4f2c7003399c..068042a8a526 100755 --- a/components/ILIAS/BackgroundTasks_/classes/Setup/class.ilBackgroundTasksSetupConfig.php +++ b/components/ILIAS/BackgroundTasks/src/Setup/SetupConfig.php @@ -16,9 +16,11 @@ * *********************************************************************/ +namespace ILIAS\BackgroundTasks\Setup; + use ILIAS\Setup\Config; -class ilBackgroundTasksSetupConfig implements Config +class SetupConfig implements Config { public const TYPE_SYNCHRONOUS = "sync"; public const TYPE_ASYNCHRONOUS = "async"; diff --git a/components/ILIAS/BackgroundTasks_/classes/Setup/class.ilBackgroundTasksDB80.php b/components/ILIAS/BackgroundTasks_/classes/Setup/class.ilBackgroundTasksDB80.php deleted file mode 100755 index e69de29bb2d1..000000000000 diff --git a/components/ILIAS/soap/include/inc.soap_functions.php b/components/ILIAS/soap/include/inc.soap_functions.php index 1eb6de6cba15..c1995cfe6aef 100755 --- a/components/ILIAS/soap/include/inc.soap_functions.php +++ b/components/ILIAS/soap/include/inc.soap_functions.php @@ -676,7 +676,7 @@ public static function copyObject(string $sid, string $copy_settings_xml) */ public static function startBackgroundTaskWorker(string $sid) { - $soa = new ilSoapBackgroundTasksAdministration(); + $soa = new \ILIAS\BackgroundTasks\SOAP\Administration(); return $soa->runAsync($sid); } From c74f8868e516d03e393397927b4a2b439854ec51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Jou=C3=9Fen?= Date: Tue, 27 Oct 2026 11:52:18 +0100 Subject: [PATCH 2/2] BackgroundTasks: Remove redundant docblocks from moved setup classes Delete @inheritdoc blocks and @return or @throws tags that restate the interface or the method body. Delete the @var tag for $io in ConfigStoredObjective, which named a class that does not exist. Drop the two imports that only these docblocks used. --- .../ILIAS/BackgroundTasks/src/Setup/Agent.php | 21 ------------------- .../src/Setup/BackgoundWorkerObjective.php | 11 ---------- .../src/Setup/ConfigStoredObjective.php | 7 ------- .../src/Setup/MetricsCollectedObjective.php | 3 --- 4 files changed, 42 deletions(-) diff --git a/components/ILIAS/BackgroundTasks/src/Setup/Agent.php b/components/ILIAS/BackgroundTasks/src/Setup/Agent.php index f7fd7af9b9fd..15d7571626ea 100755 --- a/components/ILIAS/BackgroundTasks/src/Setup/Agent.php +++ b/components/ILIAS/BackgroundTasks/src/Setup/Agent.php @@ -39,17 +39,11 @@ public function __construct(protected Factory $refinery) { } - /** - * @inheritdoc - */ public function hasConfig(): bool { return true; } - /** - * @inheritdoc - */ public function getArrayToConfigTransformation(): Transformation { return $this->refinery->custom()->transformation(fn($data): SetupConfig => new SetupConfig( @@ -58,17 +52,11 @@ public function getArrayToConfigTransformation(): Transformation )); } - /** - * @inheritdoc - */ public function getInstallObjective(?Config $config = null): Objective { return $this->getUpdateObjective($config); } - /** - * @inheritdoc - */ public function getUpdateObjective(?Config $config = null): Objective { if (!$config instanceof SetupConfig) { @@ -83,17 +71,11 @@ public function getUpdateObjective(?Config $config = null): Objective ); } - /** - * @inheritdoc - */ public function getBuildObjective(): Objective { return new NullObjective(); } - /** - * @inheritdoc - */ public function getStatusObjective(Storage $storage): Objective { return new ObjectiveCollection( @@ -114,9 +96,6 @@ public function getNamedObjectives(?Config $config = null): array ]; } - /** - * @inheritDoc - */ public function getMigrations(): array { return []; diff --git a/components/ILIAS/BackgroundTasks/src/Setup/BackgoundWorkerObjective.php b/components/ILIAS/BackgroundTasks/src/Setup/BackgoundWorkerObjective.php index f4b26b4164e6..dfeaa47fbc68 100644 --- a/components/ILIAS/BackgroundTasks/src/Setup/BackgoundWorkerObjective.php +++ b/components/ILIAS/BackgroundTasks/src/Setup/BackgoundWorkerObjective.php @@ -28,9 +28,7 @@ use ilCurlConnection; use RuntimeException; use ILIAS\DI\Container; -use ILIAS\Setup\Objective; use ILIAS\Setup\Environment; -use ilCurlConnectionException; use ILIAS\Setup\CLI\IOWrapper; use ilIniFilesPopulatedObjective; use ilDatabaseInitializedObjective; @@ -67,9 +65,6 @@ public function isNotable(): bool return true; } - /** - * @return Objective[] - */ public function getPreconditions(Environment $environment): array { return [ @@ -80,9 +75,6 @@ public function getPreconditions(Environment $environment): array ]; } - /** - * @inheritDoc - */ public function isApplicable(Environment $environment): bool { $ini = $environment->getResource(Environment::RESOURCE_ILIAS_INI); @@ -193,9 +185,6 @@ private function error(string $text): void $this->io->error($text); } - /** - * @throws ilCurlConnectionException - */ private function getCurlConnection(ilSetting $settings, string $url): ilCurlConnection { $curl = new ilCurlConnection( diff --git a/components/ILIAS/BackgroundTasks/src/Setup/ConfigStoredObjective.php b/components/ILIAS/BackgroundTasks/src/Setup/ConfigStoredObjective.php index fca94fc024b8..2011b7a29590 100755 --- a/components/ILIAS/BackgroundTasks/src/Setup/ConfigStoredObjective.php +++ b/components/ILIAS/BackgroundTasks/src/Setup/ConfigStoredObjective.php @@ -44,9 +44,6 @@ public function isNotable(): bool return false; } - /** - * @return \ilIniFilesLoadedObjective[] - */ public function getPreconditions(Environment $environment): array { return [ @@ -64,7 +61,6 @@ public function achieve(Environment $environment): Environment if ($this->config->getType() === SetupConfig::TYPE_ASYNCHRONOUS) { $io = $environment->getResource(Environment::RESOURCE_ADMIN_INTERACTION); - /** @var Setup\CLI\IOWrapper $io */ $io->inform('Asynchronous background tasks need SOAP administration to be enabled. Make sure to enable it in your configuarion.'); } @@ -78,9 +74,6 @@ public function achieve(Environment $environment): Environment return $environment; } - /** - * @inheritDoc - */ public function isApplicable(Environment $environment): bool { $ini = $environment->getResource(Environment::RESOURCE_ILIAS_INI); diff --git a/components/ILIAS/BackgroundTasks/src/Setup/MetricsCollectedObjective.php b/components/ILIAS/BackgroundTasks/src/Setup/MetricsCollectedObjective.php index 08b7490069c3..c03c5a82fd97 100755 --- a/components/ILIAS/BackgroundTasks/src/Setup/MetricsCollectedObjective.php +++ b/components/ILIAS/BackgroundTasks/src/Setup/MetricsCollectedObjective.php @@ -25,9 +25,6 @@ class MetricsCollectedObjective extends CollectedObjective { - /** - * @return \ilIniFilesLoadedObjective[] - */ public function getTentativePreconditions(Environment $environment): array { return [