ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps Class Reference
+ Inheritance diagram for ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps:
+ Collaboration diagram for ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps:

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 24 of file class.ilStyleDBUpdateSteps.php.

Member Function Documentation

◆ prepare()

ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::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 28 of file class.ilStyleDBUpdateSteps.php.

References ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps\$db.

28  : void
29  {
30  $this->db = $db;
31  }

◆ step_1()

ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::step_1 ( )

Definition at line 33 of file class.ilStyleDBUpdateSteps.php.

33  : void
34  {
35  if (!$this->db->tableExists('style_char_title')) {
36  $fields = [
37  'type' => [
38  'type' => 'text',
39  'length' => 30,
40  'notnull' => true
41  ],
42  'characteristic' => [
43  'type' => 'text',
44  'length' => 30,
45  'notnull' => true
46  ],
47  'lang' => [
48  'type' => 'text',
49  'length' => 2,
50  'notnull' => true
51  ],
52  'title' => [
53  'type' => 'text',
54  'length' => 200,
55  'notnull' => false
56  ]
57  ];
58 
59  $this->db->createTable('style_char_title', $fields);
60  $this->db->addPrimaryKey('style_char_title', ['type', 'characteristic', 'lang']);
61  }
62  }

◆ step_10()

ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::step_10 ( )

Definition at line 179 of file class.ilStyleDBUpdateSteps.php.

180  {
181  $set = $this->db->queryF(
182  "SELECT * FROM style_data WHERE standard = %s",
183  ["integer"],
184  [0]
185  );
186  while ($rec = $this->db->fetchAssoc($set)) {
187  $set2 = $this->db->queryF(
188  "SELECT * FROM style_usage " .
189  " WHERE style_id = %s ",
190  ["integer"],
191  [$rec["id"]]
192  );
193  while ($rec2 = $this->db->fetchAssoc($set2)) {
194  $this->db->update(
195  "style_data",
196  [
197  "owner_obj" => ["integer", $rec2["obj_id"]]
198  ],
199  [ // where
200  "id" => ["integer", $rec["id"]]
201  ]
202  );
203  }
204  }
205  }

◆ step_11()

ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::step_11 ( )

Definition at line 207 of file class.ilStyleDBUpdateSteps.php.

208  {
209  // Add new index
210  if (!$this->db->indexExistsByFields('style_template', ['style_id'])) {
211  $this->db->addIndex('style_template', ['style_id'], 'i1');
212  }
213  }

◆ step_12()

ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::step_12 ( )

Definition at line 215 of file class.ilStyleDBUpdateSteps.php.

216  {
217  // Add new index
218  if (!$this->db->indexExistsByFields('style_usage', array('style_id'))) {
219  $this->db->addIndex('style_usage', array('style_id'), 'i1');
220  }
221  }

◆ step_13()

ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::step_13 ( )

Definition at line 223 of file class.ilStyleDBUpdateSteps.php.

224  {
225  $this->db->update(
226  "style_parameter",
227  [
228  "tag" => ["text", "p"]
229  ],
230  [ // where
231  "type" => ["text", "text_block"],
232  "tag" => ["text", "div"]
233  ]
234  );
235  }

◆ step_14()

ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::step_14 ( )

Definition at line 237 of file class.ilStyleDBUpdateSteps.php.

238  {
239  $this->db->update(
240  "style_data",
241  [
242  "uptodate" => ["integer", 0]
243  ],
244  [ // where
245  "uptodate" => ["integer", 1]
246  ]
247  );
248  }

◆ step_15()

ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::step_15 ( )

Definition at line 250 of file class.ilStyleDBUpdateSteps.php.

251  {
252  $this->db->update(
253  "style_char",
254  [
255  "type" => ["text", "strong"]
256  ],
257  [ // where
258  "type" => ["text", "text_inline"],
259  "characteristic" => ["text", "Strong"]
260  ]
261  );
262  }

◆ step_16()

ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::step_16 ( )

Definition at line 264 of file class.ilStyleDBUpdateSteps.php.

265  {
266  $this->db->update(
267  "style_parameter",
268  [
269  "tag" => ["text", "strong"],
270  "type" => ["text", "strong"]
271  ],
272  [ // where
273  "type" => ["text", "text_inline"],
274  "tag" => ["text", "span"],
275  "class" => ["text", "Strong"]
276  ]
277  );
278  }

◆ step_17()

ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::step_17 ( )

Definition at line 280 of file class.ilStyleDBUpdateSteps.php.

281  {
282  $this->db->update(
283  "style_char",
284  [
285  "type" => ["text", "em"]
286  ],
287  [ // where
288  "type" => ["text", "text_inline"],
289  "characteristic" => ["text", "Emph"]
290  ]
291  );
292  }

◆ step_18()

ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::step_18 ( )

Definition at line 294 of file class.ilStyleDBUpdateSteps.php.

295  {
296  $this->db->update(
297  "style_parameter",
298  [
299  "tag" => ["text", "em"],
300  "type" => ["text", "em"]
301  ],
302  [ // where
303  "type" => ["text", "text_inline"],
304  "tag" => ["text", "span"],
305  "class" => ["text", "Emph"]
306  ]
307  );
308  }

◆ step_19()

ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::step_19 ( )

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

311  {
312  $this->db->update(
313  "style_data",
314  [
315  "uptodate" => ["integer", 0]
316  ],
317  [ // where
318  "uptodate" => ["integer", 1]
319  ]
320  );
321  }

◆ step_2()

ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::step_2 ( )

Definition at line 64 of file class.ilStyleDBUpdateSteps.php.

65  {
66  $this->db->dropPrimaryKey('style_char_title');
67  if (!$this->db->tableColumnExists('style_char_title', 'style_id')) {
68  $this->db->addTableColumn('style_char_title', 'style_id', array(
69  "type" => "integer",
70  "notnull" => true,
71  "length" => 4
72  ));
73  }
74  $this->db->addPrimaryKey('style_char_title', ['style_id', 'type', 'characteristic', 'lang']);
75  }

◆ step_20()

ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::step_20 ( )

Definition at line 323 of file class.ilStyleDBUpdateSteps.php.

324  {
325  $this->db->update(
326  "style_data",
327  [
328  "uptodate" => ["integer", 0]
329  ],
330  [ // where
331  "uptodate" => ["integer", 1]
332  ]
333  );
334  }

◆ step_21()

ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::step_21 ( )

Definition at line 336 of file class.ilStyleDBUpdateSteps.php.

337  {
338  if (!$this->db->tableColumnExists('style_data', 'rid')) {
339  $this->db->addTableColumn('style_data', 'rid', [
340  'type' => 'text',
341  'notnull' => false,
342  'length' => 64,
343  'default' => ''
344  ]);
345  }
346  }

◆ step_3()

ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::step_3 ( )

Definition at line 77 of file class.ilStyleDBUpdateSteps.php.

78  {
79  if (!$this->db->tableColumnExists('style_char', 'order_nr')) {
80  $this->db->addTableColumn('style_char', 'order_nr', array(
81  "type" => "integer",
82  "notnull" => true,
83  "length" => 4,
84  "default" => 0
85  ));
86  }
87  }

◆ step_4()

ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::step_4 ( )

Definition at line 89 of file class.ilStyleDBUpdateSteps.php.

90  {
91  if (!$this->db->tableColumnExists('style_char', 'deprecated')) {
92  $this->db->addTableColumn('style_char', 'deprecated', array(
93  "type" => "integer",
94  "notnull" => true,
95  "length" => 1,
96  "default" => 0
97  ));
98  }
99  }

◆ step_5()

ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::step_5 ( )

Definition at line 101 of file class.ilStyleDBUpdateSteps.php.

102  {
103  $this->db->renameTableColumn('style_char', "deprecated", 'outdated');
104  }

◆ step_6()

ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::step_6 ( )

Definition at line 106 of file class.ilStyleDBUpdateSteps.php.

107  {
108  if (!$this->db->tableExists('sty_rep_container')) {
109  $fields = [
110  'ref_id' => [
111  'type' => 'integer',
112  'length' => 4,
113  'notnull' => true,
114  'default' => 0
115  ],
116  'reuse' => [
117  'type' => 'integer',
118  'length' => 1,
119  'notnull' => true,
120  'default' => 0
121  ]
122  ];
123 
124  $this->db->createTable('sty_rep_container', $fields);
125  $this->db->addPrimaryKey('sty_rep_container', ['ref_id']);
126  }
127  }

◆ step_7()

ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::step_7 ( )

Definition at line 129 of file class.ilStyleDBUpdateSteps.php.

130  {
131  $set = $this->db->queryF(
132  "SELECT * FROM content_object ",
133  [],
134  []
135  );
136  while ($rec = $this->db->fetchAssoc($set)) {
137  $this->db->replace(
138  "style_usage",
139  array(
140  "obj_id" => array("integer", (int) $rec["id"])
141  ),
142  array(
143  "style_id" => array("integer", (int) $rec["stylesheet"])
144  )
145  );
146  }
147  }

◆ step_8()

ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::step_8 ( )

Definition at line 149 of file class.ilStyleDBUpdateSteps.php.

150  {
151  $set = $this->db->queryF(
152  "SELECT * FROM content_page_data ",
153  [],
154  []
155  );
156  while ($rec = $this->db->fetchAssoc($set)) {
157  $this->db->replace(
158  "style_usage",
159  array(
160  "obj_id" => array("integer", (int) $rec["content_page_id"])),
161  array(
162  "style_id" => array("integer", (int) $rec["stylesheet"]))
163  );
164  }
165  }

◆ step_9()

ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::step_9 ( )

Definition at line 167 of file class.ilStyleDBUpdateSteps.php.

168  {
169  if (!$this->db->tableColumnExists('style_data', 'owner_obj')) {
170  $this->db->addTableColumn('style_data', 'owner_obj', array(
171  'type' => 'integer',
172  'notnull' => false,
173  'length' => 4,
174  'default' => 0
175  ));
176  }
177  }

Field Documentation

◆ $db

ilDBInterface ILIAS\Style\Content\Setup\ilStyleDBUpdateSteps::$db
protected

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