From 306bd37469ab77081802fa89f75eab754371f1c6 Mon Sep 17 00:00:00 2001 From: Matheus Zych Date: Fri, 20 Feb 2026 07:14:35 +0100 Subject: [PATCH] BackgroundTasks: Extend background task DB indexes See: https://mantis.ilias.de/view.php?id=42356 The ILIAS 8.0 background-task migration only indexed `il_bt_bucket` by `user_id`. Typical lookups filter by bucket state and join tasks or stored values via `bucket_id`, which stayed unindexed. `step_1` now replaces that index with `(user_id, state)` on `il_bt_bucket` and adds `bucket_id` indexes on `il_bt_task` and `il_bt_value_to_task`. --- ... => class.ilBackgroundTasksDBHotfixes10.php} | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) rename components/ILIAS/BackgroundTasks_/classes/Setup/{class.ilBackgroundTasksDB80.php => class.ilBackgroundTasksDBHotfixes10.php} (60%) diff --git a/components/ILIAS/BackgroundTasks_/classes/Setup/class.ilBackgroundTasksDB80.php b/components/ILIAS/BackgroundTasks_/classes/Setup/class.ilBackgroundTasksDBHotfixes10.php similarity index 60% rename from components/ILIAS/BackgroundTasks_/classes/Setup/class.ilBackgroundTasksDB80.php rename to components/ILIAS/BackgroundTasks_/classes/Setup/class.ilBackgroundTasksDBHotfixes10.php index cf586b968fe2..74db2c229b11 100755 --- a/components/ILIAS/BackgroundTasks_/classes/Setup/class.ilBackgroundTasksDB80.php +++ b/components/ILIAS/BackgroundTasks_/classes/Setup/class.ilBackgroundTasksDBHotfixes10.php @@ -16,10 +16,9 @@ * *********************************************************************/ -use ILIAS\Setup; -use ILIAS\Data\Password; +declare(strict_types=1); -class ilBackgroundTasksDB80 implements ilDatabaseUpdateSteps +class ilBackgroundTasksDBHotfixes10 implements ilDatabaseUpdateSteps { protected ilDBInterface $db; @@ -30,8 +29,16 @@ public function prepare(ilDBInterface $db): void public function step_1(): void { - if (!$this->db->indexExistsByFields('il_bt_bucket', ['user_id'])) { - $this->db->addIndex('il_bt_bucket', ['user_id'], 'i1'); + if (!$this->db->indexExistsByFields('il_bt_bucket', ['user_id', 'state'])) { + $this->db->addIndex('il_bt_bucket', ['user_id', 'state'], 'i1'); + } + + if (!$this->db->indexExistsByFields('il_bt_task', ['bucket_id'])) { + $this->db->addIndex('il_bt_task', ['bucket_id'], 'i1'); + } + + if (!$this->db->indexExistsByFields('il_bt_value_to_task', ['bucket_id'])) { + $this->db->addIndex('il_bt_value_to_task', ['bucket_id'], 'i1'); } } }