ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps Class Reference
+ Inheritance diagram for ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps:
+ Collaboration diagram for ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps:

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 ()
 
 step_13 ()
 
 step_14 ()
 
 step_15 ()
 
 step_16 ()
 
 step_17 ()
 
 step_18 ()
 
 step_19 ()
 
 step_20 ()
 
 step_21 ()
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 26 of file class.ilExerciseDBUpdateSteps.php.

Member Function Documentation

◆ prepare()

ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::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 30 of file class.ilExerciseDBUpdateSteps.php.

References ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps\$db.

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

◆ step_1()

ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::step_1 ( )

Definition at line 35 of file class.ilExerciseDBUpdateSteps.php.

35  : void
36  {
37  if (!$this->db->indexExistsByFields('exc_assignment', ['exc_id'])) {
38  $this->db->addIndex('exc_assignment', ['exc_id'], 'i1');
39  }
40  }

◆ step_10()

ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::step_10 ( )

Definition at line 128 of file class.ilExerciseDBUpdateSteps.php.

128  : void
129  {
130  $this->db->addUniqueConstraint("exc_assignment_peer", array('ass_id', 'giver_id', 'peer_id'), 'c1');
131  }

◆ step_11()

ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::step_11 ( )

Definition at line 133 of file class.ilExerciseDBUpdateSteps.php.

133  : void
134  {
135  $this->db->addIndex("exc_assignment_peer", ["ass_id"], "i1");
136  }

◆ step_12()

ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::step_12 ( )

Definition at line 138 of file class.ilExerciseDBUpdateSteps.php.

138  : void
139  {
140  if (!$this->db->tableColumnExists('exc_idl', 'requested')) {
141  $this->db->addTableColumn('exc_idl', 'requested', array(
142  'type' => 'integer',
143  'notnull' => true,
144  'length' => 1,
145  'default' => 0
146  ));
147  }
148  }

◆ step_13()

ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::step_13 ( )

Definition at line 150 of file class.ilExerciseDBUpdateSteps.php.

150  : void
151  {
152  if (!$this->db->tableColumnExists('exc_assignment', 'solution_rid')) {
153  $this->db->addTableColumn(
154  'exc_assignment',
155  'solution_rid',
156  [
157  'type' => 'text',
158  'notnull' => false,
159  'length' => 64,
160  'default' => ''
161  ]
162  );
163  }
164  }

◆ step_14()

ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::step_14 ( )

Definition at line 166 of file class.ilExerciseDBUpdateSteps.php.

166  : void
167  {
168  if (!$this->db->tableColumnExists('exc_mem_ass_status', 'feedback_rcid')) {
169  $this->db->addTableColumn(
170  'exc_mem_ass_status',
171  'feedback_rcid',
172  [
173  'type' => 'text',
174  'notnull' => false,
175  'length' => 64,
176  'default' => ''
177  ]
178  );
179  }
180  }

◆ step_15()

ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::step_15 ( )

Definition at line 182 of file class.ilExerciseDBUpdateSteps.php.

182  : void
183  {
184  if (!$this->db->tableExists('exc_team_data')) {
185  $this->db->createTable(
186  'exc_team_data',
187  [
188  "id" => [
189  'type' => 'integer',
190  'notnull' => true,
191  'length' => 4
192  ],
193  "feedback_rcid" => [
194  'type' => 'text',
195  'notnull' => false,
196  'length' => 64,
197  'default' => ''
198  ]
199  ]
200  );
201  }
202  $this->db->addPrimaryKey('exc_team_data', ["id"]);
203  }

◆ step_16()

ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::step_16 ( )

Definition at line 205 of file class.ilExerciseDBUpdateSteps.php.

205  : void
206  {
207  $set = $this->db->queryF(
208  "SELECT DISTINCT il_exc_team.id FROM il_exc_team LEFT JOIN exc_team_data ON il_exc_team.id = exc_team_data.id WHERE exc_team_data.id IS NULL",
209  [],
210  []
211  );
212  while ($rec = $this->db->fetchAssoc($set)) {
213  $this->db->insert("exc_team_data", [
214  "id" => ["integer", (int) $rec["id"]],
215  ]);
216  }
217  }

◆ step_17()

ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::step_17 ( )

Definition at line 219 of file class.ilExerciseDBUpdateSteps.php.

219  : void
220  {
221  if (!$this->db->tableExists('exc_multi_feedback')) {
222  $this->db->createTable(
223  'exc_multi_feedback',
224  [
225  "tutor_id" => [
226  'type' => 'integer',
227  'notnull' => true,
228  'length' => 4
229  ],
230  "ass_id" => [
231  'type' => 'integer',
232  'notnull' => true,
233  'length' => 4
234  ],
235  "zip_rid" => [
236  'type' => 'text',
237  'notnull' => false,
238  'length' => 64,
239  'default' => ''
240  ]
241  ]
242  );
243  }
244  $this->db->addPrimaryKey('exc_multi_feedback', ["tutor_id", "ass_id"]);
245  }

◆ step_18()

ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::step_18 ( )

Definition at line 247 of file class.ilExerciseDBUpdateSteps.php.

247  : void
248  {
249  if (!$this->db->tableColumnExists('exc_returned', 'rid')) {
250  $this->db->addTableColumn(
251  'exc_returned',
252  'rid',
253  [
254  'type' => 'text',
255  'notnull' => false,
256  'length' => 64,
257  'default' => ''
258  ]
259  );
260  }
261  }

◆ step_19()

ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::step_19 ( )

Definition at line 263 of file class.ilExerciseDBUpdateSteps.php.

263  : void
264  {
265  if (!$this->db->tableExists('exc_crit_file')) {
266  $this->db->createTable(
267  'exc_crit_file',
268  [
269  "ass_id" => [
270  'type' => 'integer',
271  'notnull' => true,
272  'length' => 4,
273  'default' => 0
274  ],
275  "giver_id" => [
276  'type' => 'integer',
277  'notnull' => true,
278  'length' => 4,
279  'default' => 0
280  ],
281  "peer_id" => [
282  'type' => 'integer',
283  'notnull' => true,
284  'length' => 4,
285  'default' => 0
286  ],
287  "criteria_id" => [
288  'type' => 'integer',
289  'notnull' => true,
290  'length' => 4,
291  'default' => 0
292  ],
293  "rid" => [
294  'type' => 'text',
295  'notnull' => true,
296  'length' => 64,
297  'default' => ""
298  ],
299  ]
300  );
301  $this->db->addPrimaryKey('exc_crit_file', ['ass_id', 'giver_id','peer_id','criteria_id']);
302  }
303  }

◆ step_2()

ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::step_2 ( )

Definition at line 42 of file class.ilExerciseDBUpdateSteps.php.

42  : void
43  {
44  if (!$this->db->indexExistsByFields('exc_members', ['usr_id'])) {
45  $this->db->addIndex('exc_members', ['usr_id'], 'i1');
46  }
47  }

◆ step_20()

ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::step_20 ( )

Definition at line 305 of file class.ilExerciseDBUpdateSteps.php.

305  : void
306  {
307  $this->db->manipulate("UPDATE exc_returned SET rid = NULL WHERE rid = " . $this->db->quote("", "text"));
308  }

◆ step_21()

ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::step_21 ( )

Definition at line 310 of file class.ilExerciseDBUpdateSteps.php.

310  : void
311  {
312  if (!$this->db->tableColumnExists('exc_assignment_peer', 'migrated')) {
313  $this->db->addTableColumn(
314  'exc_assignment_peer',
315  'migrated',
316  [
317  'type' => 'integer',
318  'notnull' => true,
319  'length' => 1,
320  'default' => 0
321  ]
322  );
323  }
324  }

◆ step_3()

ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::step_3 ( )

Definition at line 49 of file class.ilExerciseDBUpdateSteps.php.

49  : void
50  {
51  if (!$this->db->indexExistsByFields('exc_assignment', ['deadline_mode', 'exc_id'])) {
52  $this->db->addIndex('exc_assignment', ['deadline_mode', 'exc_id'], 'i2');
53  }
54  }

◆ step_4()

ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::step_4 ( )

Definition at line 56 of file class.ilExerciseDBUpdateSteps.php.

56  : void
57  {
58  if (!$this->db->indexExistsByFields('exc_ass_file_order', ['assignment_id'])) {
59  $this->db->addIndex('exc_ass_file_order', ['assignment_id'], 'i1');
60  }
61  }

◆ step_5()

ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::step_5 ( )

Definition at line 63 of file class.ilExerciseDBUpdateSteps.php.

63  : void
64  {
65  if (!$this->db->indexExistsByFields('il_exc_team', ['id'])) {
66  $this->db->addIndex('il_exc_team', ['id'], 'i1');
67  }
68  }

◆ step_6()

ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::step_6 ( )

Definition at line 70 of file class.ilExerciseDBUpdateSteps.php.

70  : void
71  {
72  if (!$this->db->tableColumnExists('exc_assignment', 'if_rcid')) {
73  $this->db->addTableColumn(
74  'exc_assignment',
75  'if_rcid',
76  [
77  'type' => 'text',
78  'notnull' => false,
79  'length' => 64,
80  'default' => ''
81  ]
82  );
83  }
84  }

◆ step_7()

ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::step_7 ( )

Definition at line 86 of file class.ilExerciseDBUpdateSteps.php.

86  : void
87  {
88  if (!$this->db->tableColumnExists('exc_assignment_peer', 'id')) {
89  $this->db->addTableColumn('exc_assignment_peer', 'id', array(
90  'type' => 'integer',
91  'notnull' => true,
92  'length' => 4,
93  'default' => 0
94  ));
95  $this->db->createSequence('exc_assignment_peer');
96  }
97  }

◆ step_8()

ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::step_8 ( )

Definition at line 99 of file class.ilExerciseDBUpdateSteps.php.

99  : void
100  {
101  $set = $this->db->queryF(
102  "SELECT * FROM exc_assignment_peer ",
103  [],
104  []
105  );
106  while ($rec = $this->db->fetchAssoc($set)) {
107  $next_id = $this->db->nextId("exc_assignment_peer");
108  $this->db->update(
109  "exc_assignment_peer",
110  [
111  "id" => ["integer", $next_id]
112  ],
113  [ // where
114  "ass_id" => ["integer", $rec["ass_id"]],
115  "giver_id" => ["integer", $rec["giver_id"]],
116  "peer_id" => ["integer", $rec["peer_id"]]
117  ]
118  );
119  }
120  }

◆ step_9()

ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::step_9 ( )

Definition at line 122 of file class.ilExerciseDBUpdateSteps.php.

122  : void
123  {
124  $this->db->dropPrimaryKey("exc_assignment_peer");
125  $this->db->addPrimaryKey("exc_assignment_peer", ["id"]);
126  }

Field Documentation

◆ $db

ilDBInterface ILIAS\Exercise\Setup\ilExerciseDBUpdateSteps::$db
protected

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