diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2024-06-21 09:29:24 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2024-06-21 09:29:24 +0000 |
| commit | b1f13ce8299d581ccb889e2d98e13574bffcc5ba (patch) | |
| tree | 644385d6fea33f831a714fc3783f8161a2cb1d86 /db | |
| parent | 7635e34c038e86e2b369b3f6edc457042ffa5b66 (diff) | |
add remaining class filename and add migration to fix the cronjobs, re #4282
Merge request studip/studip!3136
Diffstat (limited to 'db')
| -rw-r--r-- | db/migrations/1.128_step00240_coursesets.php | 2 | ||||
| -rw-r--r-- | db/migrations/1.12_step_120_userpic.php | 2 | ||||
| -rw-r--r-- | db/migrations/6.0.11_adjust_cronjobs.php | 43 |
3 files changed, 45 insertions, 2 deletions
diff --git a/db/migrations/1.128_step00240_coursesets.php b/db/migrations/1.128_step00240_coursesets.php index b767ae3..2f47805 100644 --- a/db/migrations/1.128_step00240_coursesets.php +++ b/db/migrations/1.128_step00240_coursesets.php @@ -1,6 +1,6 @@ <?php require_once 'vendor/phpass/PasswordHash.php'; -require_once 'lib/classes/admission/CourseSet.class.php'; +require_once 'lib/classes/admission/CourseSet.php'; class Step00240CourseSets extends Migration { diff --git a/db/migrations/1.12_step_120_userpic.php b/db/migrations/1.12_step_120_userpic.php index f907b9f..eeb787a 100644 --- a/db/migrations/1.12_step_120_userpic.php +++ b/db/migrations/1.12_step_120_userpic.php @@ -10,7 +10,7 @@ * the License, or (at your option) any later version. */ -require_once 'lib/classes/Avatar.class.php'; +require_once 'lib/classes/Avatar.php'; class Step120Userpic extends Migration { diff --git a/db/migrations/6.0.11_adjust_cronjobs.php b/db/migrations/6.0.11_adjust_cronjobs.php new file mode 100644 index 0000000..132885e --- /dev/null +++ b/db/migrations/6.0.11_adjust_cronjobs.php @@ -0,0 +1,43 @@ +<?php +return new class extends Migration +{ + private const ADJUSTMENTS = [ + 'lib/cronjobs/purge_cache', + 'lib/cronjobs/check_admission', + 'lib/cronjobs/session_gc', + 'lib/cronjobs/cleanup_log', + 'lib/cronjobs/garbage_collector', + 'lib/cronjobs/send_mail_queue', + 'lib/cronjobs/remind_oer_upload', + 'lib/cronjobs/send_mail_notifications', + ]; + + public function description() + { + return 'Adjusts the class names for core cronjobs by losing the .class suffix'; + } + + protected function up() + { + $this->changeCronjobFilenames('.class.php', '.php'); + } + + protected function down() + { + $this->changeCronjobFilenames('.php', '.class.php'); + } + + private function changeCronjobFilenames(string $fromExtension, string $toExtension): void + { + $query = "UPDATE `cronjobs_tasks` + SET `filename` = :new + WHERE `filename` = :old"; + $statement = DBManager::get()->prepare($query); + + foreach (self::ADJUSTMENTS as $filename) { + $statement->bindValue(':new', $filename . $toExtension); + $statement->bindValue(':old', $filename . $fromExtension); + $statement->execute(); + } + } +}; |
