blob: 132885eb399a841d1ce896a92b2e69b62b4387c9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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();
}
}
};
|