ILIAS  release_8 Revision v8.24
class.ilTestQuestionPool80DBUpdateSteps.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 $this->db->manipulateF("DELETE FROM qpl_qst_type WHERE type_tag = %s", ['text'], ['assJavaApplet']);
33 $this->db->manipulateF("DELETE FROM qpl_qst_type WHERE type_tag = %s", ['text'], ['assFlashQuestion']);
34 }
35
36 public function step_2(): void
37 {
38 if (!$this->db->tableColumnExists('tst_rnd_quest_set_qpls', 'pool_ref_id')) {
39 $this->db->addTableColumn(
40 'tst_rnd_quest_set_qpls',
41 'pool_ref_id',
42 [
44 'length' => 8,
45 'notnull' => false,
46 'default' => null
47 ]
48 );
49 }
50 }
51
52 public function step_3(): void
53 {
54 $fields = ['gap_id'];
55 if (!$this->db->indexExistsByFields('qpl_a_cloze', $fields)) {
56 $this->db->addIndex(
57 'qpl_a_cloze',
58 $fields,
59 'i2'
60 );
61 }
62 }
63
64 public function step_4(): void
65 {
66 $fields = ['gap_fi', 'question_fi'];
67 if (!$this->db->indexExistsByFields('qpl_a_cloze_combi_res', $fields)) {
68 $this->db->addIndex(
69 'qpl_a_cloze_combi_res',
70 $fields,
71 'i1'
72 );
73 }
74 }
75
76 public function step_5(): void
77 {
78 $fields = ['owner'];
79 if (!$this->db->indexExistsByFields('qpl_questions', $fields)) {
80 $this->db->addIndex(
81 'qpl_questions',
82 $fields,
83 'i5'
84 );
85 }
86 $fields = ['question_fi'];
87 if (!$this->db->indexExistsByFields('qpl_num_range', $fields)) {
88 $this->db->addIndex(
89 'qpl_num_range',
90 $fields,
91 'i6'
92 );
93 }
94 }
95
96 public function step_6(): void
97 {
98 if (!$this->db->tableColumnExists('qpl_a_errortext', 'position')) {
99 $this->db->addTableColumn(
100 'qpl_a_errortext',
101 'position',
102 [
103 'type' => ilDBConstants::T_INTEGER,
104 'length' => 2,
105 'notnull' => false,
106 'default' => null
107 ]
108 );
109 }
110 }
111
112 public function step_7(): void
113 {
114 if (!$this->db->tableColumnExists('qpl_qst_errortext', 'parsed_errortext')) {
115 $this->db->addTableColumn(
116 'qpl_qst_errortext',
117 'parsed_errortext',
118 [
119 'type' => ilDBConstants::T_CLOB,
120 'notnull' => false,
121 'default' => null
122 ]
123 );
124 }
125 }
126
127 public function step_8(): void
128 {
129 $this->db->modifyTableColumn(
130 'qpl_questions',
131 'author',
132 ['type' => 'text', 'length' => 512]
133 );
134 }
135
136 public function step_9(): void
137 {
138 $this->db->modifyTableColumn(
139 'qpl_questions',
140 'title',
141 ['type' => 'text', 'length' => 124]
142 );
143 }
144}
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...