From 6368d8be7bc6a13bd79ad937a056c2cd6549ba3d Mon Sep 17 00:00:00 2001 From: Fabian Helfer Date: Thu, 22 Jan 2026 11:39:36 +0100 Subject: [PATCH] [Improvement] Block: Add user_id Index to il_block_setting --- components/ILIAS/Block/Block.php | 3 ++ .../Setup/class.ilBlockDBUpdateSteps.php | 36 ++++++++++++++++ .../classes/Setup/class.ilBlockSetupAgent.php | 42 +++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 components/ILIAS/Block/classes/Setup/class.ilBlockDBUpdateSteps.php create mode 100644 components/ILIAS/Block/classes/Setup/class.ilBlockSetupAgent.php diff --git a/components/ILIAS/Block/Block.php b/components/ILIAS/Block/Block.php index 19ea49e12a65..eb7c57ca819e 100644 --- a/components/ILIAS/Block/Block.php +++ b/components/ILIAS/Block/Block.php @@ -32,6 +32,9 @@ public function init( array | \ArrayAccess &$pull, array | \ArrayAccess &$internal, ): void { + $contribute[\ILIAS\Setup\Agent::class] = static fn() => new \ilBlockSetupAgent( + $pull[\ILIAS\Refinery\Factory::class] + ); $contribute[Component\Resource\PublicAsset::class] = fn() => new Component\Resource\ComponentJS($this, "ilblockcallback.js"); } diff --git a/components/ILIAS/Block/classes/Setup/class.ilBlockDBUpdateSteps.php b/components/ILIAS/Block/classes/Setup/class.ilBlockDBUpdateSteps.php new file mode 100644 index 000000000000..058b91abcf04 --- /dev/null +++ b/components/ILIAS/Block/classes/Setup/class.ilBlockDBUpdateSteps.php @@ -0,0 +1,36 @@ +db = $db; + } + + public function step_1(): void + { + if (!$this->db->indexExistsByFields('il_block_setting', ['user_id'])) { + $this->db->addIndex('il_block_setting', ['user_id'], 'i1'); + } + } +} diff --git a/components/ILIAS/Block/classes/Setup/class.ilBlockSetupAgent.php b/components/ILIAS/Block/classes/Setup/class.ilBlockSetupAgent.php new file mode 100644 index 000000000000..cfb3c807b180 --- /dev/null +++ b/components/ILIAS/Block/classes/Setup/class.ilBlockSetupAgent.php @@ -0,0 +1,42 @@ +