ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLTIConsumerDatabaseUpdateSteps.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('lti_ext_provider', 'instructor_send_name')) {
33 $this->db->addTableColumn('lti_ext_provider', 'instructor_send_name', [
34 'type' => 'integer',
35 'length' => 1,
36 'notnull' => true,
37 'default' => '0'
38 ]);
39 }
40 }
41
42 public function step_2(): void
43 {
44 if (!$this->db->tableColumnExists('lti_ext_provider', 'instructor_send_email')) {
45 $this->db->addTableColumn('lti_ext_provider', 'instructor_send_email', [
46 'type' => 'integer',
47 'length' => 1,
48 'notnull' => true,
49 'default' => '0'
50 ]);
51 }
52 }
53
54 public function step_3(): void
55 {
56 if (!$this->db->tableColumnExists('lti_ext_provider', 'client_id')) {
57 $this->db->addTableColumn('lti_ext_provider', 'client_id', [
58 'type' => 'text',
59 'length' => 255,
60 'notnull' => false
61 ]);
62 }
63 }
64
65 public function step_4(): void
66 {
67 if (!$this->db->tableColumnExists('lti_ext_provider', 'enabled_capability')) {
68 $this->db->addTableColumn('lti_ext_provider', 'enabled_capability', [
69 'type' => 'clob'
70 ]);
71 }
72 }
73
74 public function step_5(): void
75 {
76 if (!$this->db->tableColumnExists('lti_ext_provider', 'key_type')) {
77 $this->db->addTableColumn('lti_ext_provider', 'key_type', [
78 'type' => 'text',
79 'length' => 16,
80 'notnull' => false
81 ]);
82 }
83 }
84
85 public function step_6(): void
86 {
87 if (!$this->db->tableColumnExists('lti_ext_provider', 'public_key')) {
88 $this->db->addTableColumn('lti_ext_provider', 'public_key', [
89 'type' => 'clob'
90 ]);
91 }
92 }
93
94 public function step_7(): void
95 {
96 if (!$this->db->tableColumnExists('lti_ext_provider', 'public_keyset')) {
97 $this->db->addTableColumn('lti_ext_provider', 'public_keyset', [
98 'type' => 'text',
99 'length' => 255,
100 'notnull' => false
101 ]);
102 }
103 }
104
105 public function step_8(): void
106 {
107 if (!$this->db->tableColumnExists('lti_ext_provider', 'initiate_login')) {
108 $this->db->addTableColumn('lti_ext_provider', 'initiate_login', [
109 'type' => 'text',
110 'length' => 255,
111 'notnull' => false
112 ]);
113 }
114 }
115
116 public function step_9(): void
117 {
118 if (!$this->db->tableColumnExists('lti_ext_provider', 'redirection_uris')) {
119 $this->db->addTableColumn('lti_ext_provider', 'redirection_uris', [
120 'type' => 'text',
121 'length' => 510,
122 'notnull' => false
123 ]);
124 }
125 }
126
127 public function step_10(): void
128 {
129 if (!$this->db->tableColumnExists('lti_ext_provider', 'content_item')) {
130 $this->db->addTableColumn('lti_ext_provider', 'content_item', [
131 'type' => 'integer',
132 'length' => 1,
133 'notnull' => true,
134 'default' => '0'
135 ]);
136 }
137 }
138
139 public function step_11(): void
140 {
141 if (!$this->db->tableColumnExists('lti_ext_provider', 'content_item_url')) {
142 $this->db->addTableColumn('lti_ext_provider', 'content_item_url', [
143 'type' => 'text',
144 'length' => 510,
145 'notnull' => false
146 ]);
147 }
148 }
149
150 public function step_12(): void
151 {
152 if (!$this->db->tableColumnExists('lti_ext_provider', 'grade_synchronization')) {
153 $this->db->addTableColumn('lti_ext_provider', 'grade_synchronization', [
154 'type' => 'integer',
155 'length' => 1,
156 'notnull' => true,
157 'default' => '0'
158 ]);
159 }
160 }
161
162 public function step_13(): void
163 {
164 if (!$this->db->tableColumnExists('lti_ext_provider', 'lti_version')) {
165 $this->db->addTableColumn('lti_ext_provider', 'lti_version', [
166 'type' => 'text',
167 'length' => 10,
168 'notnull' => true,
169 'default' => 'LTI-1p0'
170 ]);
171 }
172 }
173
174 public function step_14(): void
175 {
176 if (!$this->db->tableColumnExists('lti_consumer_settings', 'custom_params')) {
177 $this->db->addTableColumn('lti_consumer_settings', 'custom_params', [
178 'type' => 'text',
179 'length' => 255,
180 'notnull' => true,
181 'default' => ''
182 ]);
183 }
184 }
185
186 public function step_15(): void
187 {
188 if (!$this->db->tableExists('lti_consumer_grades')) {
189 $values = array(
190 'id' => array(
191 'type' => 'integer',
192 'length' => 4,
193 'notnull' => true
194 ),
195 'obj_id' => array(
196 'type' => 'integer',
197 'length' => 4,
198 'notnull' => true
199 ),
200 'usr_id' => array(
201 'type' => 'integer',
202 'length' => 4,
203 'notnull' => true
204 ),
205 'score_given' => array(
206 'type' => 'float',
207 'notnull' => false
208 ),
209 'score_maximum' => array(
210 'type' => 'float',
211 'notnull' => false
212 ),
213 'activity_progress' => array(
214 'type' => 'text',
215 'length' => 20,
216 'notnull' => true
217 ),
218 'grading_progress' => array(
219 'type' => 'text',
220 'length' => 20,
221 'notnull' => true
222 ),
223 'lti_timestamp' => array(
224 'type' => 'timestamp',
225 'notnull' => false,
226 'default' => null
227 ),
228 'stored' => array(
229 'type' => 'timestamp',
230 'notnull' => true
231 )
232 );
233 $this->db->createTable("lti_consumer_grades", $values);
234 $this->db->addPrimaryKey("lti_consumer_grades", array("id"));
235 $this->db->createSequence("lti_consumer_grades");
236 $this->db->addIndex("lti_consumer_grades", array("obj_id","usr_id"), 'i1');
237 }
238 }
239}
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...