ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilCalendarDBUpdateSteps9.php
Go to the documentation of this file.
1 <?php
18 declare(strict_types=1);
19 
24 {
25  protected \ilDBInterface $db;
26 
27  public function prepare(\ilDBInterface $db): void
28  {
29  $this->db = $db;
30  }
31 
32  public function step_1(): void
33  {
34  // Add indices
35  if (!$this->db->indexExistsByFields('cal_entries', ['starta'])) {
36  $this->db->addIndex('cal_entries', ['starta'], 'i3');
37  }
38  if (!$this->db->indexExistsByFields('cal_entries', ['enda'])) {
39  $this->db->addIndex('cal_entries', ['enda'], 'i4');
40  }
41  }
42 
43  public function step_2(): void
44  {
45  // Removes is_milestones column from cal_entries
46  if($this->db->tableExists('cal_entries')
47  && $this->db->tableColumnExists('cal_entries', 'is_milestone')) {
48  $this->db->dropTableColumn('cal_entries', 'is_milestone');
49  }
50  // Removes completion column from cal_entries
51  if($this->db->tableExists('cal_entries')
52  && $this->db->tableColumnExists('cal_entries', 'completion')) {
53  $this->db->dropTableColumn('cal_entries', 'completion');
54  }
55  // Deletes table cal_entry_responsible
56  if($this->db->tableExists('cal_entry_responsible')) {
57  $this->db->dropTable('cal_entry_responsible');
58  }
59 
60  $query = 'delete from settings where ' .
61  'keyword = ' . $this->db->quote('enable_grp_milestones', ilDBConstants::T_TEXT) . ' ' .
62  'and module = ' . $this->db->quote('calendar', ilDBConstants::T_TEXT);
63  $this->db->manipulate($query);
64  }
65 }
prepare(\ilDBInterface $db)
Prepare the execution of the steps.