From 2c68414b2fa78890b4de048183a8fec360654631 Mon Sep 17 00:00:00 2001 From: jochen-ac Date: Wed, 7 Oct 2026 15:43:44 +0200 Subject: [PATCH 1/3] Update class.ilExerciseSubmissionMigrationFix48178.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added a filter for ‘title’ --- .../Setup/class.ilExerciseSubmissionMigrationFix48178.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/ILIAS/Exercise/classes/Setup/class.ilExerciseSubmissionMigrationFix48178.php b/components/ILIAS/Exercise/classes/Setup/class.ilExerciseSubmissionMigrationFix48178.php index 5c439c8c6f01..c1009dc5cb31 100644 --- a/components/ILIAS/Exercise/classes/Setup/class.ilExerciseSubmissionMigrationFix48178.php +++ b/components/ILIAS/Exercise/classes/Setup/class.ilExerciseSubmissionMigrationFix48178.php @@ -51,6 +51,7 @@ public function prepare(Environment $environment): void public function getSql(bool $count = false): string { $sub_filename = "SUBSTRING_INDEX(er.filename, '/', -1)"; + $sub_title = "REGEXP_REPLACE(SUBSTRING_INDEX(rev.title, '/', -1), '&', '&')"; if (!$count) { $fields = " DISTINCT er.user_id, er.ass_id, er.team_id "; } else { @@ -61,7 +62,7 @@ public function getSql(bool $count = false): string JOIN il_resource_revision rev ON rev.rid = er.rid JOIN il_resource_info i ON i.rid = rev.rid AND i.version_number = rev.version_number WHERE er.rid IS NOT NULL AND er.rid <> '' - AND rev.title <> $sub_filename + AND $sub_title <> $sub_filename AND er.filename IS NOT NULL AND er.filename <> '' ORDER BY `er`.`returned_id` DESC"; return $sql; @@ -94,7 +95,7 @@ protected function fixCase(int $user_id, int $ass_id, int $team_id): void LEFT JOIN il_resource_revision rev ON rev.rid = er.rid LEFT JOIN il_resource_info i ON i.rid = rev.rid AND i.version_number = rev.version_number WHERE er.user_id = %s AND er.ass_id = %s AND er.team_id = %s - AND (rev.title <> SUBSTRING_INDEX(er.filename, '/', -1) OR rev.title IS NULL) + AND (REGEXP_REPLACE(SUBSTRING_INDEX(rev.title, '/', -1), '&', '&') <> SUBSTRING_INDEX(er.filename, '/', -1)) OR rev.title IS NULL) AND er.filename IS NOT NULL AND er.filename <> ''"; $set = $db->queryF( $sql, From af3bb559ac5d554f7f0262a749ae62246ff498d7 Mon Sep 17 00:00:00 2001 From: jochen-ac Date: Thu, 8 Oct 2026 10:35:12 +0200 Subject: [PATCH 2/3] Update class.ilExerciseSubmissionMigrationFix48178.php Added additional replaces to solve false positives due to .sec-extension. --- .../Setup/class.ilExerciseSubmissionMigrationFix48178.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/components/ILIAS/Exercise/classes/Setup/class.ilExerciseSubmissionMigrationFix48178.php b/components/ILIAS/Exercise/classes/Setup/class.ilExerciseSubmissionMigrationFix48178.php index c1009dc5cb31..e69df1de8dfc 100644 --- a/components/ILIAS/Exercise/classes/Setup/class.ilExerciseSubmissionMigrationFix48178.php +++ b/components/ILIAS/Exercise/classes/Setup/class.ilExerciseSubmissionMigrationFix48178.php @@ -50,8 +50,8 @@ public function prepare(Environment $environment): void public function getSql(bool $count = false): string { - $sub_filename = "SUBSTRING_INDEX(er.filename, '/', -1)"; - $sub_title = "REGEXP_REPLACE(SUBSTRING_INDEX(rev.title, '/', -1), '&', '&')"; + $sub_filename = "REGEXP_REPLACE(REGEXP_REPLACE(SUBSTRING_INDEX(er.filename, '/', -1),'\\.sec',''),'\\.','')"; + $sub_title = "REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(SUBSTRING_INDEX(rev.title, '/', -1), '&', '&')"; if (!$count) { $fields = " DISTINCT er.user_id, er.ass_id, er.team_id "; } else { @@ -90,12 +90,14 @@ public function getRemainingAmountOfSteps(): int protected function fixCase(int $user_id, int $ass_id, int $team_id): void { $db = $this->helper->getDatabase(); + $sub_filename = "REGEXP_REPLACE(REGEXP_REPLACE(SUBSTRING_INDEX(er.filename, '/', -1),'\\.sec',''),'\\.','')"; + $sub_title = "REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(SUBSTRING_INDEX(rev.title, '/', -1), '&', '&')"; $sql = "SELECT er.returned_id, rev.title, SUBSTRING_INDEX(er.filename, '/', -1) subname, rev.rid FROM exc_returned er LEFT JOIN il_resource_revision rev ON rev.rid = er.rid LEFT JOIN il_resource_info i ON i.rid = rev.rid AND i.version_number = rev.version_number WHERE er.user_id = %s AND er.ass_id = %s AND er.team_id = %s - AND (REGEXP_REPLACE(SUBSTRING_INDEX(rev.title, '/', -1), '&', '&') <> SUBSTRING_INDEX(er.filename, '/', -1)) OR rev.title IS NULL) + AND ($sub_title <> $sub_filename) OR rev.title IS NULL) AND er.filename IS NOT NULL AND er.filename <> ''"; $set = $db->queryF( $sql, From 71ac0ca08f90f67e55e28c633fa6b5e75e72fad6 Mon Sep 17 00:00:00 2001 From: jochen-ac Date: Sun, 11 Oct 2026 19:02:10 +0200 Subject: [PATCH 3/3] Update class.ilExerciseSubmissionMigrationFix48178.php Added replacement of ' --- .../Setup/class.ilExerciseSubmissionMigrationFix48178.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/ILIAS/Exercise/classes/Setup/class.ilExerciseSubmissionMigrationFix48178.php b/components/ILIAS/Exercise/classes/Setup/class.ilExerciseSubmissionMigrationFix48178.php index e69df1de8dfc..65c6066c0451 100644 --- a/components/ILIAS/Exercise/classes/Setup/class.ilExerciseSubmissionMigrationFix48178.php +++ b/components/ILIAS/Exercise/classes/Setup/class.ilExerciseSubmissionMigrationFix48178.php @@ -50,8 +50,8 @@ public function prepare(Environment $environment): void public function getSql(bool $count = false): string { - $sub_filename = "REGEXP_REPLACE(REGEXP_REPLACE(SUBSTRING_INDEX(er.filename, '/', -1),'\\.sec',''),'\\.','')"; - $sub_title = "REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(SUBSTRING_INDEX(rev.title, '/', -1), '&', '&')"; + $sub_filename = "REGEXP_REPLACE(REPLACE(REPLACE(REPLACE(SUBSTRING_INDEX(rev.title, '/', -1), '&', '&'), '<', '<'), ''', '\''),'\\.sec|\\.', '')"; + $sub_title = "REGEXP_REPLACE(SUBSTRING_INDEX(er.filename, '/', -1), '\\.sec|\\.', '')"; if (!$count) { $fields = " DISTINCT er.user_id, er.ass_id, er.team_id "; } else { @@ -90,8 +90,8 @@ public function getRemainingAmountOfSteps(): int protected function fixCase(int $user_id, int $ass_id, int $team_id): void { $db = $this->helper->getDatabase(); - $sub_filename = "REGEXP_REPLACE(REGEXP_REPLACE(SUBSTRING_INDEX(er.filename, '/', -1),'\\.sec',''),'\\.','')"; - $sub_title = "REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(SUBSTRING_INDEX(rev.title, '/', -1), '&', '&')"; + $sub_filename = "REGEXP_REPLACE(REPLACE(REPLACE(REPLACE(SUBSTRING_INDEX(rev.title, '/', -1), '&', '&'), '<', '<'), ''', '\''),'\\.sec|\\.', '')"; + $sub_title = "REGEXP_REPLACE(SUBSTRING_INDEX(er.filename, '/', -1), '\\.sec|\\.', '')"; $sql = "SELECT er.returned_id, rev.title, SUBSTRING_INDEX(er.filename, '/', -1) subname, rev.rid FROM exc_returned er LEFT JOIN il_resource_revision rev ON rev.rid = er.rid