ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilIntroduceComponentArtifactDBUpdateSteps.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 if ($this->db->tableExists("il_compoment")) {
36 $this->db->dropTable("il_component");
37 }
38 }
39
40 public function step_2(): void
41 {
42 $this->db->dropTable("il_pluginslot");
43 }
44
45 public function step_3(): void
46 {
47 $this->db->manipulate("DELETE FROM il_plugin WHERE plugin_id IS NULL");
48 }
49
50 public function step_4(): void
51 {
52 try {
53 $this->db->addPrimaryKey("il_plugin", ["plugin_id"]);
54 } catch (\PDOException $e) {
55 $this->db->dropPrimaryKey("il_plugin");
56 $this->db->addPrimaryKey("il_plugin", ["plugin_id"]);
57 }
58 }
59
60 public function step_5(): void
61 {
62 if (!$this->db->tableColumnExists("il_plugin", "component_type")) {
63 return;
64 }
65
66 $this->db->dropTableColumn("il_plugin", "component_type");
67 }
68
69 public function step_6(): void
70 {
71 if (!$this->db->tableColumnExists("il_plugin", "component_name")) {
72 return;
73 }
74
75 $this->db->dropTableColumn("il_plugin", "component_name");
76 }
77
78 public function step_7(): void
79 {
80 if (!$this->db->tableColumnExists("il_plugin", "slot_id")) {
81 return;
82 }
83
84 $this->db->dropTableColumn("il_plugin", "slot_id");
85 }
86
87 public function step_8(): void
88 {
89 if (!$this->db->tableColumnExists("il_plugin", "name")) {
90 return;
91 }
92
93 $this->db->dropTableColumn("il_plugin", "name");
94 }
95}
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...