ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Test\Setup\Test10DBUpdateSteps Class Reference
+ Inheritance diagram for ILIAS\Test\Setup\Test10DBUpdateSteps:
+ Collaboration diagram for ILIAS\Test\Setup\Test10DBUpdateSteps:

Public Member Functions

 prepare (\ilDBInterface $db)
 Prepare the execution of the steps. More...
 
 step_1 ()
 
 step_2 ()
 
 step_3 ()
 
 step_4 ()
 
 step_5 ()
 
 step_6 ()
 
 step_7 ()
 
 step_8 ()
 
 step_9 ()
 
 step_10 ()
 
 step_11 ()
 
 step_12 ()
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

Definition at line 27 of file Test10DBUpdateSteps.php.

Member Function Documentation

◆ prepare()

ILIAS\Test\Setup\Test10DBUpdateSteps::prepare ( \ilDBInterface  $db)

Prepare the execution of the steps.

Do not use anything from the globals or the DIC inside your steps, only use the instance of the database provided here.

Implements ilDatabaseUpdateSteps.

Definition at line 31 of file Test10DBUpdateSteps.php.

References ILIAS\Test\Setup\Test10DBUpdateSteps\$db.

31  : void
32  {
33  $this->db = $db;
34  }

◆ step_1()

ILIAS\Test\Setup\Test10DBUpdateSteps::step_1 ( )

Definition at line 36 of file Test10DBUpdateSteps.php.

36  : void
37  {
38  if (!$this->db->tableColumnExists('tst_tests', 'ip_range_from')) {
39  $this->db->addTableColumn(
40  'tst_tests',
41  'ip_range_from',
42  [
43  'type' => 'text',
44  'length' => 39
45  ]
46  );
47  }
48  if (!$this->db->tableColumnExists('tst_tests', 'ip_range_to')) {
49  $this->db->addTableColumn(
50  'tst_tests',
51  'ip_range_to',
52  [
53  'type' => 'text',
54  'length' => 39
55  ]
56  );
57  }
58  }

◆ step_10()

ILIAS\Test\Setup\Test10DBUpdateSteps::step_10 ( )

Definition at line 402 of file Test10DBUpdateSteps.php.

402  : void
403  {
404  if ($this->db->tableColumnExists('tst_tests', 'author')) {
405  $this->db->dropTableColumn('tst_tests', 'author');
406  }
407  }

◆ step_11()

ILIAS\Test\Setup\Test10DBUpdateSteps::step_11 ( )

Definition at line 409 of file Test10DBUpdateSteps.php.

References ilDBConstants\T_INTEGER.

409  : void
410  {
411  if ($this->db->tableColumnExists('tst_tests', 'enable_processing_time')) {
412  $this->db->manipulateF(
413  'UPDATE tst_tests SET enable_processing_time = %s WHERE enable_processing_time IS NULL',
415  [0]
416  );
417  $this->db->modifyTableColumn(
418  'tst_tests',
419  'enable_processing_time',
420  [
421  'type' => \ilDBConstants::T_INTEGER,
422  'length' => 1,
423  'notnull' => true,
424  'default' => 0
425  ]
426  );
427  }
428  }

◆ step_12()

ILIAS\Test\Setup\Test10DBUpdateSteps::step_12 ( )

Definition at line 430 of file Test10DBUpdateSteps.php.

References ilDBConstants\T_INTEGER, ilDBConstants\T_TEXT, and ILIAS\Test\ExportImport\DBRepository\TST_EXPORT_TABLE.

430  : void
431  {
432  if (!$this->db->tableExists(DBRepository::TST_EXPORT_TABLE)) {
433  $this->db->createTable(DBRepository::TST_EXPORT_TABLE, [
434  'object_id' => [
435  'type' => \ilDBConstants::T_INTEGER,
436  'length' => 8,
437  'notnull' => true
438  ],
439  'type' => [
440  'type' => \ilDBConstants::T_TEXT,
441  'length' => 32,
442  'notnull' => true
443  ],
444  'rid' => [
445  'type' => \ilDBConstants::T_TEXT,
446  'length' => 64
447  ]
448  ]);
449  $this->db->addPrimaryKey(DBRepository::TST_EXPORT_TABLE, ['rid']);
450  $this->db->addIndex(DBRepository::TST_EXPORT_TABLE, ['object_id'], 'oid');
451  }
452  }

◆ step_2()

ILIAS\Test\Setup\Test10DBUpdateSteps::step_2 ( )

Definition at line 60 of file Test10DBUpdateSteps.php.

References ilDBConstants\T_TEXT.

60  : void
61  {
62  $this->db->update(
63  'il_cert_cron_queue',
64  ['adapter_class' => [\ilDBConstants::T_TEXT, TestPlaceholderValues::class]],
65  ['adapter_class' => [\ilDBConstants::T_TEXT, 'ilTestPlaceholderValues']]
66  );
67  }

◆ step_3()

ILIAS\Test\Setup\Test10DBUpdateSteps::step_3 ( )

Definition at line 69 of file Test10DBUpdateSteps.php.

References ILIAS\Test\Logging\TestLoggingDatabaseRepository\ERROR_LOG_TABLE, ILIAS\Test\Logging\TestLoggingDatabaseRepository\PARTICIPANT_LOG_TABLE, ILIAS\Test\Logging\TestLoggingDatabaseRepository\QUESTION_ADMINISTRATION_LOG_TABLE, ILIAS\Test\Logging\TestLoggingDatabaseRepository\SCORING_LOG_TABLE, ilDBConstants\T_CLOB, ilDBConstants\T_INTEGER, ilDBConstants\T_TEXT, and ILIAS\Test\Logging\TestLoggingDatabaseRepository\TEST_ADMINISTRATION_LOG_TABLE.

69  : void
70  {
73  'id' => [
74  'type' => \ilDBConstants::T_INTEGER,
75  'length' => 8,
76  'notnull' => true
77  ],
78  'ref_id' => [
79  'type' => \ilDBConstants::T_INTEGER,
80  'length' => 8,
81  'notnull' => true
82  ],
83  'admin_id' => [
84  'type' => \ilDBConstants::T_INTEGER,
85  'length' => 8,
86  'notnull' => true
87  ],
88  'interaction_type' => [
89  'type' => \ilDBConstants::T_TEXT,
90  'length' => 256,
91  'notnull' => true
92  ],
93  'modification_ts' => [
94  'type' => \ilDBConstants::T_INTEGER,
95  'length' => 8,
96  'notnull' => true
97  ],
98  'additional_data' => [
99  'type' => \ilDBConstants::T_CLOB
100  ]
101  ]);
103  $this->db->addPrimaryKey(TestLoggingDatabaseRepository::TEST_ADMINISTRATION_LOG_TABLE, ['id']);
104  $this->db->addIndex(TestLoggingDatabaseRepository::TEST_ADMINISTRATION_LOG_TABLE, ['ref_id'], 'rid');
105  }
106 
109  'id' => [
110  'type' => \ilDBConstants::T_INTEGER,
111  'length' => 8,
112  'notnull' => true
113  ],
114  'ref_id' => [
115  'type' => \ilDBConstants::T_INTEGER,
116  'length' => 8,
117  'notnull' => true
118  ],
119  'qst_id' => [
120  'type' => \ilDBConstants::T_INTEGER,
121  'length' => 8
122  ],
123  'admin_id' => [
124  'type' => \ilDBConstants::T_INTEGER,
125  'length' => 8,
126  'notnull' => true
127  ],
128  'interaction_type' => [
129  'type' => \ilDBConstants::T_TEXT,
130  'length' => 256,
131  'notnull' => true
132  ],
133  'modification_ts' => [
134  'type' => \ilDBConstants::T_INTEGER,
135  'length' => 8,
136  'notnull' => true
137  ],
138  'additional_data' => [
139  'type' => \ilDBConstants::T_CLOB
140  ]
141  ]);
144  $this->db->addIndex(TestLoggingDatabaseRepository::QUESTION_ADMINISTRATION_LOG_TABLE, ['ref_id'], 'rid');
145  }
146 
147  if (!$this->db->tableExists(TestLoggingDatabaseRepository::PARTICIPANT_LOG_TABLE)) {
149  'id' => [
150  'type' => \ilDBConstants::T_INTEGER,
151  'length' => 8,
152  'notnull' => true
153  ],
154  'ref_id' => [
155  'type' => \ilDBConstants::T_INTEGER,
156  'length' => 8,
157  'notnull' => true
158  ],
159  'qst_id' => [
160  'type' => \ilDBConstants::T_INTEGER,
161  'length' => 8,
162  'notnull' => false
163  ],
164  'pax_id' => [
165  'type' => \ilDBConstants::T_INTEGER,
166  'length' => 8,
167  'notnull' => true
168  ],
169  'source_ip' => [
170  'type' => \ilDBConstants::T_TEXT,
171  'length' => 42,
172  'notnull' => true
173  ],
174  'interaction_type' => [
175  'type' => \ilDBConstants::T_TEXT,
176  'length' => 256,
177  'notnull' => true
178  ],
179  'modification_ts' => [
180  'type' => \ilDBConstants::T_INTEGER,
181  'length' => 8,
182  'notnull' => true
183  ],
184  'additional_data' => [
185  'type' => \ilDBConstants::T_CLOB
186  ]
187  ]);
188  $this->db->createSequence(TestLoggingDatabaseRepository::PARTICIPANT_LOG_TABLE);
189  $this->db->addPrimaryKey(TestLoggingDatabaseRepository::PARTICIPANT_LOG_TABLE, ['id']);
190  $this->db->addIndex(TestLoggingDatabaseRepository::PARTICIPANT_LOG_TABLE, ['ref_id'], 'rid');
191  }
192 
193  if (!$this->db->tableExists(TestLoggingDatabaseRepository::SCORING_LOG_TABLE)) {
194  $this->db->createTable(TestLoggingDatabaseRepository::SCORING_LOG_TABLE, [
195  'id' => [
196  'type' => \ilDBConstants::T_INTEGER,
197  'length' => 8,
198  'notnull' => true
199  ],
200  'ref_id' => [
201  'type' => \ilDBConstants::T_INTEGER,
202  'length' => 8,
203  'notnull' => true
204  ],
205  'qst_id' => [
206  'type' => \ilDBConstants::T_INTEGER,
207  'length' => 8,
208  'notnull' => true
209  ],
210  'admin_id' => [
211  'type' => \ilDBConstants::T_INTEGER,
212  'length' => 8,
213  'notnull' => true
214  ],
215  'pax_id' => [
216  'type' => \ilDBConstants::T_INTEGER,
217  'length' => 8,
218  'notnull' => true
219  ],
220  'interaction_type' => [
221  'type' => \ilDBConstants::T_TEXT,
222  'length' => 256,
223  'notnull' => true
224  ],
225  'modification_ts' => [
226  'type' => \ilDBConstants::T_INTEGER,
227  'length' => 8,
228  'notnull' => true
229  ],
230  'additional_data' => [
231  'type' => \ilDBConstants::T_CLOB
232  ]
233  ]);
234  $this->db->createSequence(TestLoggingDatabaseRepository::SCORING_LOG_TABLE);
235  $this->db->addPrimaryKey(TestLoggingDatabaseRepository::SCORING_LOG_TABLE, ['id']);
236  $this->db->addIndex(TestLoggingDatabaseRepository::SCORING_LOG_TABLE, ['ref_id'], 'rid');
237  }
238 
239  if (!$this->db->tableExists(TestLoggingDatabaseRepository::ERROR_LOG_TABLE)) {
240  $this->db->createTable(TestLoggingDatabaseRepository::ERROR_LOG_TABLE, [
241  'id' => [
242  'type' => \ilDBConstants::T_INTEGER,
243  'length' => 8,
244  'notnull' => true
245  ],
246  'ref_id' => [
247  'type' => \ilDBConstants::T_INTEGER,
248  'length' => 8,
249  'notnull' => true
250  ],
251  'qst_id' => [
252  'type' => \ilDBConstants::T_INTEGER,
253  'length' => 8
254  ],
255  'admin_id' => [
256  'type' => \ilDBConstants::T_INTEGER,
257  'length' => 8
258  ],
259  'pax_id' => [
260  'type' => \ilDBConstants::T_INTEGER,
261  'length' => 8
262  ],
263  'interaction_type' => [
264  'type' => \ilDBConstants::T_TEXT,
265  'length' => 256,
266  'notnull' => true
267  ],
268  'modification_ts' => [
269  'type' => \ilDBConstants::T_INTEGER,
270  'length' => 8,
271  'notnull' => true
272  ],
273  'error_message' => [
274  'type' => \ilDBConstants::T_TEXT,
275  'length' => 4000,
276  'notnull' => true,
277  'default' => ''
278  ]
279  ]);
280  $this->db->createSequence(TestLoggingDatabaseRepository::ERROR_LOG_TABLE);
281  $this->db->addPrimaryKey(TestLoggingDatabaseRepository::ERROR_LOG_TABLE, ['id']);
282  $this->db->addIndex(TestLoggingDatabaseRepository::ERROR_LOG_TABLE, ['ref_id'], 'rid');
283  }
284  }

◆ step_4()

ILIAS\Test\Setup\Test10DBUpdateSteps::step_4 ( )

Definition at line 286 of file Test10DBUpdateSteps.php.

286  : void
287  {
288  if (!$this->db->tableColumnExists('tst_invited_user', 'ip_range_from')) {
289  $this->db->addTableColumn(
290  'tst_invited_user',
291  'ip_range_from',
292  [
293  'type' => 'text',
294  'length' => 39
295  ]
296  );
297  }
298  if (!$this->db->tableColumnExists('tst_invited_user', 'ip_range_to')) {
299  $this->db->addTableColumn(
300  'tst_invited_user',
301  'ip_range_to',
302  [
303  'type' => 'text',
304  'length' => 39
305  ]
306  );
307  }
308 
309 
310  if ($this->db->tableColumnExists('tst_invited_user', 'clientip')) {
311  $this->db->manipulate('UPDATE tst_invited_user SET ip_range_from = clientip, ip_range_to = clientip WHERE ip_range_from IS NULL AND ip_range_to IS NULL');
312  $this->db->dropTableColumn('tst_invited_user', 'clientip');
313  }
314  }

◆ step_5()

ILIAS\Test\Setup\Test10DBUpdateSteps::step_5 ( )

Definition at line 316 of file Test10DBUpdateSteps.php.

References ilDBConstants\T_INTEGER.

316  : void
317  {
318  if (!$this->db->tableColumnExists('tst_addtime', 'user_fi')) {
319  $this->db->addTableColumn(
320  'tst_addtime',
321  'user_fi',
322  [
323  'type' => \ilDBConstants::T_INTEGER,
324  'length' => 8,
325  'notnull' => true
326  ]
327  );
328  }
329  if (!$this->db->tableColumnExists('tst_addtime', 'test_fi')) {
330  $this->db->addTableColumn(
331  'tst_addtime',
332  'test_fi',
333  [
334  'type' => \ilDBConstants::T_INTEGER,
335  'length' => 8,
336  'notnull' => true
337  ]
338  );
339  }
340 
341  if ($this->db->tableColumnExists('tst_addtime', 'active_fi')) {
342  $this->db->manipulate(
343  '
344  UPDATE tst_addtime INNER JOIN tst_active ON tst_active.active_id = tst_addtime.active_fi
345  SET tst_addtime.test_fi = tst_active.test_fi, tst_addtime.user_fi = tst_active.user_fi'
346  );
347 
348  $this->db->dropTableColumn('tst_addtime', 'active_fi');
349  }
350 
351  if (!$this->db->primaryExistsByFields('tst_addtime', ['user_fi', 'test_fi'])) {
352  $this->db->addPrimaryKey('tst_addtime', ['user_fi', 'test_fi']);
353  }
354  }

◆ step_6()

ILIAS\Test\Setup\Test10DBUpdateSteps::step_6 ( )

Definition at line 356 of file Test10DBUpdateSteps.php.

356  : void
357  {
358  if ($this->db->tableColumnExists('tst_tests', 'broken')) {
359  $this->db->dropTableColumn('tst_tests', 'broken');
360  }
361  }

◆ step_7()

ILIAS\Test\Setup\Test10DBUpdateSteps::step_7 ( )

Definition at line 363 of file Test10DBUpdateSteps.php.

363  : void
364  {
365  if ($this->db->tableColumnExists('tst_tests', 'obligations_enabled')) {
366  $this->db->dropTableColumn('tst_tests', 'obligations_enabled');
367  }
368 
369  if ($this->db->tableColumnExists('tst_pass_result', 'obligations_answered')) {
370  $this->db->dropTableColumn('tst_pass_result', 'obligations_answered');
371  }
372 
373  if ($this->db->tableColumnExists('tst_test_question', 'obligatory')) {
374  $this->db->dropTableColumn('tst_test_question', 'obligatory');
375  }
376 
377  if ($this->db->tableColumnExists('tst_result_cache', 'obligations_answered')) {
378  $this->db->dropTableColumn('tst_result_cache', 'obligations_answered');
379  }
380  }

◆ step_8()

ILIAS\Test\Setup\Test10DBUpdateSteps::step_8 ( )

Definition at line 382 of file Test10DBUpdateSteps.php.

References ilDBConstants\T_TEXT.

382  : void
383  {
384  if (!$this->db->tableColumnExists('tst_pass_result', 'finalized_by')) {
385  $this->db->addTableColumn(
386  'tst_pass_result',
387  'finalized_by',
388  [
389  'type' => \ilDBConstants::T_TEXT,
390  'length' => 256,
391  'notnull' => false
392  ]
393  );
394  }
395  }

◆ step_9()

ILIAS\Test\Setup\Test10DBUpdateSteps::step_9 ( )

Definition at line 397 of file Test10DBUpdateSteps.php.

397  : void
398  {
399  $this->db->manipulate('DELETE FROM rbac_operations WHERE operation = "tst_statistics"');
400  }

Field Documentation

◆ $db

ilDBInterface ILIAS\Test\Setup\Test10DBUpdateSteps::$db
protected

The documentation for this class was generated from the following file: