ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
class.ilCalendarDBUpdateSteps9.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25{
26 protected \ilDBInterface $db;
27
28 public function prepare(\ilDBInterface $db): void
29 {
30 $this->db = $db;
31 }
32
33 public function step_1(): void
34 {
35 // Add indices
36 if (!$this->db->indexExistsByFields('cal_entries', ['starta'])) {
37 $this->db->addIndex('cal_entries', ['starta'], 'i3');
38 }
39 if (!$this->db->indexExistsByFields('cal_entries', ['enda'])) {
40 $this->db->addIndex('cal_entries', ['enda'], 'i4');
41 }
42 }
43
44 public function step_2(): void
45 {
46 // Removes is_milestones column from cal_entries
47 if ($this->db->tableExists('cal_entries')
48 && $this->db->tableColumnExists('cal_entries', 'is_milestone')) {
49 $this->db->dropTableColumn('cal_entries', 'is_milestone');
50 }
51 // Removes completion column from cal_entries
52 if ($this->db->tableExists('cal_entries')
53 && $this->db->tableColumnExists('cal_entries', 'completion')) {
54 $this->db->dropTableColumn('cal_entries', 'completion');
55 }
56 // Deletes table cal_entry_responsible
57 if ($this->db->tableExists('cal_entry_responsible')) {
58 $this->db->dropTable('cal_entry_responsible');
59 }
60
61 $query = 'delete from settings where ' .
62 'keyword = ' . $this->db->quote('enable_grp_milestones', ilDBConstants::T_TEXT) . ' ' .
63 'and module = ' . $this->db->quote('calendar', ilDBConstants::T_TEXT);
64 $this->db->manipulate($query);
65 }
66}
prepare(\ilDBInterface $db)
Prepare the execution of the steps.
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...