ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilCmiXapiDatabaseUpdateSteps.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 protected ilDBInterface $db;
24
25 public function prepare(ilDBInterface $db): void
26 {
27 $this->db = $db;
28 }
29
30 public function step_1(): void
31 {
32 if (!$this->db->tableColumnExists('cmix_users', 'registration')) {
33 $this->db->addTableColumn('cmix_users', 'registration', array(
34 'type' => 'text',
35 'length' => 255,
36 'notnull' => true,
37 'default' => ''
38 ));
39 }
40 }
41
42 public function step_2(): void
43 {
44 if (!$this->db->tableColumnExists('cmix_settings', 'publisher_id')) {
45 $this->db->addTableColumn('cmix_settings', 'publisher_id', array(
46 'type' => 'text',
47 'length' => 255,
48 'notnull' => true,
49 'default' => ''
50 ));
51 }
52 }
53
54 public function step_3(): void
55 {
56 if (!$this->db->tableColumnExists('cmix_settings', 'anonymous_homepage')) {
57 $this->db->addTableColumn('cmix_settings', 'anonymous_homepage', array(
58 'type' => 'integer',
59 'length' => 1,
60 'notnull' => true,
61 'default' => 1
62 ));
63 }
64 }
65
66 public function step_4(): void
67 {
68 if (!$this->db->tableColumnExists('cmix_settings', 'moveon')) {
69 $this->db->addTableColumn('cmix_settings', 'moveon', array(
70 'type' => 'text',
71 'length' => 32,
72 'notnull' => true,
73 'default' => ''
74 ));
75 }
76 }
77
78 public function step_5(): void
79 {
80 if (!$this->db->tableColumnExists('cmix_token', 'cmi5_session')) {
81 $this->db->addTableColumn("cmix_token", "cmi5_session", [
82 'type' => 'text',
83 'length' => 255,
84 'notnull' => true,
85 'default' => ''
86 ]);
87 }
88 }
89
90 public function step_6(): void
91 {
92 if (!$this->db->tableColumnExists('cmix_token', 'returned_for_cmi5_session')) {
93 $this->db->addTableColumn("cmix_token", "returned_for_cmi5_session", [
94 'type' => 'text',
95 'length' => 255,
96 'notnull' => true,
97 'default' => ''
98 ]);
99 }
100 }
101
102 public function step_7(): void
103 {
104 if (!$this->db->tableColumnExists('cmix_settings', 'launch_parameters')) {
105 $this->db->addTableColumn('cmix_settings', 'launch_parameters', array(
106 'type' => 'text',
107 'length' => 255,
108 'notnull' => true,
109 'default' => ''
110 ));
111 }
112 }
113
114 public function step_8(): void
115 {
116 if (!$this->db->tableColumnExists('cmix_settings', 'entitlement_key')) {
117 $this->db->addTableColumn('cmix_settings', 'entitlement_key', array(
118 'type' => 'text',
119 'length' => 255,
120 'notnull' => true,
121 'default' => ''
122 ));
123 }
124 }
125
126 public function step_9(): void
127 {
128 if (!$this->db->tableColumnExists('cmix_token', 'cmi5_session_data')) {
129 $this->db->addTableColumn("cmix_token", "cmi5_session_data", [
130 'type' => 'clob'
131 ]);
132 }
133 }
134
135 public function step_10(): void
136 {
137 if (!$this->db->tableColumnExists('cmix_users', 'satisfied')) {
138 $this->db->addTableColumn('cmix_users', 'satisfied', array(
139 'type' => 'integer',
140 'length' => 1,
141 'notnull' => true,
142 'default' => 0
143 ));
144 }
145 }
146
147 public function step_11(): void
148 {
149 if (!$this->db->tableColumnExists('cmix_settings', 'switch_to_review')) {
150 $this->db->addTableColumn('cmix_settings', 'switch_to_review', array(
151 'type' => 'integer',
152 'length' => 1,
153 'notnull' => true,
154 'default' => 1
155 ));
156 }
157 }
158
159 public function step_12(): void
160 {
161 $this->db->manipulateF('DELETE FROM cmix_users WHERE usr_id = %s', ['integer'], [13]);
162 }
163
164 public function step_13(): void
165 {
166 if (!$this->db->tableColumnExists('cmix_lrs_types', 'delete_data')) {
167 $this->db->addTableColumn('cmix_lrs_types', 'delete_data', array(
168 'type' => 'integer',
169 'length' => 1,
170 'notnull' => true,
171 'default' => 0
172 ));
173 }
174 }
175
176 public function step_14(): void
177 {
178 if (!$this->db->tableColumnExists('cmix_settings', 'delete_data')) {
179 $this->db->addTableColumn('cmix_settings', 'delete_data', array(
180 'type' => 'integer',
181 'length' => 1,
182 'notnull' => true,
183 'default' => 0
184 ));
185 }
186 }
187
188 public function step_15(): void
189 {
190 if (!$this->db->tableExists('cmix_del_user')) {
191 $fields_data = array(
192 'usr_id' => array(
193 'type' => 'integer',
194 'length' => 4,
195 'notnull' => true
196 ),
197 'added' => array(
198 'type' => 'timestamp',
199 'notnull' => true
200 ),
201 'updated' => array(
202 'type' => 'timestamp',
203 'notnull' => false,
204 'default' => null
205 ),
206 );
207 $this->db->createTable("cmix_del_user", $fields_data);
208 $this->db->addPrimaryKey("cmix_del_user", array("usr_id"));
209 }
210 }
211
212 public function step_16(): void
213 {
214 if (!$this->db->tableExists('cmix_del_object')) {
215 $fields_data = array(
216 'obj_id' => array(
217 'type' => 'integer',
218 'length' => 4,
219 'notnull' => true
220 ),
221 'type_id' => array(
222 'type' => 'integer',
223 'length' => 4,
224 'notnull' => true
225 ),
226 'activity_id' => array(
227 'type' => 'text',
228 'length' => 128,
229 'notnull' => true,
230 ),
231 'added' => array(
232 'type' => 'timestamp',
233 'notnull' => true
234 ),
235 'updated' => array(
236 'type' => 'timestamp',
237 'notnull' => false,
238 'default' => null
239 ),
240 );
241 $this->db->createTable("cmix_del_object", $fields_data);
242 $this->db->addPrimaryKey("cmix_del_object", array("obj_id", "type_id", "activity_id"));
243 }
244 }
245}
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...