ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilIntroduceComponentArtifactDBUpdateSteps.php
Go to the documentation of this file.
1 <?php
19 declare(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  $this->db->dropTable("il_component");
36  }
37 
38  public function step_2(): void
39  {
40  $this->db->dropTable("il_pluginslot");
41  }
42 
43  public function step_3(): void
44  {
45  $this->db->manipulate("DELETE FROM il_plugin WHERE plugin_id IS NULL");
46  }
47 
48  public function step_4(): void
49  {
50  try {
51  $this->db->addPrimaryKey("il_plugin", ["plugin_id"]);
52  } catch (\PDOException $e) {
53  $this->db->dropPrimaryKey("il_plugin");
54  $this->db->addPrimaryKey("il_plugin", ["plugin_id"]);
55  }
56  }
57 
58  public function step_5(): void
59  {
60  if (!$this->db->tableColumnExists("il_plugin", "component_type")) {
61  return;
62  }
63 
64  $this->db->dropTableColumn("il_plugin", "component_type");
65  }
66 
67  public function step_6(): void
68  {
69  if (!$this->db->tableColumnExists("il_plugin", "component_name")) {
70  return;
71  }
72 
73  $this->db->dropTableColumn("il_plugin", "component_name");
74  }
75 
76  public function step_7(): void
77  {
78  if (!$this->db->tableColumnExists("il_plugin", "slot_id")) {
79  return;
80  }
81 
82  $this->db->dropTableColumn("il_plugin", "slot_id");
83  }
84 
85  public function step_8(): void
86  {
87  if (!$this->db->tableColumnExists("il_plugin", "name")) {
88  return;
89  }
90 
91  $this->db->dropTableColumn("il_plugin", "name");
92  }
93 }
prepare(\ilDBInterface $db)
Prepare the execution of the steps.