ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ILIAS\COPage\Setup\ilCOPageDBUpdateSteps Class Reference
+ Inheritance diagram for ILIAS\COPage\Setup\ilCOPageDBUpdateSteps:
+ Collaboration diagram for ILIAS\COPage\Setup\ilCOPageDBUpdateSteps:

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 ()
 

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.ilCOPageDBUpdateSteps.php.

Member Function Documentation

◆ prepare()

ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::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.ilCOPageDBUpdateSteps.php.

References ILIAS\COPage\Setup\ilCOPageDBUpdateSteps\$db.

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

◆ step_1()

ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::step_1 ( )

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

33  : void
34  {
35  $field = array(
36  'type' => 'integer',
37  'length' => 2,
38  'notnull' => true,
39  'default' => 0
40  );
41 
42  $this->db->modifyTableColumn("copg_pc_def", "order_nr", $field);
43  }

◆ step_10()

ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::step_10 ( )

Definition at line 210 of file class.ilCOPageDBUpdateSteps.php.

210  : void
211  {
212  $content = <<<EOT
213 <PageObject><PageContent PCID="906a03fd9999c5c83a7166e9f9744fec"><Grid><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="5" WIDTH_L="4" WIDTH_XL="4" PCID="a27f25a9b1d8746d1cf3820759f37096"><PageContent PCID="2e77eb1d8a478497d69b99d938fda8e"><PlaceHolder ContentClass="Media" Height="300px"/></PageContent></GridCell><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="7" WIDTH_L="8" WIDTH_XL="8" PCID="8e769877102068dca417222215defaa9"><PageContent PCID="1f77eb1d8a478497d69b99d938fda8f"><PlaceHolder ContentClass="Text" Height="300px"/></PageContent></GridCell></Grid></PageContent><PageContent PCID="3f77eb1d8a478493d69b99d438fda8f"><PlaceHolder ContentClass="Question" Height="200px"/></PageContent></PageObject>
214 EOT;
215  $this->db->update(
216  "page_object",
217  [
218  "content" => ["clob", $content]
219  ],
220  [ // where
221  "page_id" => ["integer", 4],
222  "parent_type" => ["text", "stys"],
223  "lang" => ["text", '-'],
224  ]
225  );
226  }

◆ step_11()

ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::step_11 ( )

Definition at line 228 of file class.ilCOPageDBUpdateSteps.php.

228  : void
229  {
230  $content = <<<EOT
231 <PageObject><PageContent PCID="0fb0511a01dcb9b83d9f21eb0d588a19"><Grid><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="4" WIDTH_L="4" WIDTH_XL="4" PCID="b241816c4270ec842782a664cbe72979"><PageContent PCID="428c956f8035dc8ac59a9412bc19f955"><PlaceHolder Height="250px" ContentClass="Media"/></PageContent><PageContent PCID="6d0291683f92aa84920755184b0da66c"><PlaceHolder Height="250px" ContentClass="Text"/></PageContent></GridCell><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="4" WIDTH_L="4" WIDTH_XL="4" PCID="375c6f40533390645bd1bb58259bec54"><PageContent PCID="41f4e5a703244309231c2d6be0c49231"><PlaceHolder Height="250px" ContentClass="Media"/></PageContent><PageContent PCID="325dac9e34424f129a4e4f9a0c4e37c4"><PlaceHolder Height="250px" ContentClass="Text"/></PageContent></GridCell><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="4" WIDTH_L="4" WIDTH_XL="4" PCID="d8379b454401c9b7071d32efb69cc028"><PageContent PCID="5e744ec7c8784471e4668bcbc5e4b405"><PlaceHolder Height="250px" ContentClass="Media"/></PageContent><PageContent PCID="0ba252ad3ab834e2c8fba58708dc1995"><PlaceHolder Height="250px" ContentClass="Text"/></PageContent></GridCell></Grid></PageContent></PageObject>
232 EOT;
233  $this->db->update(
234  "page_object",
235  [
236  "content" => ["clob", $content]
237  ],
238  [ // where
239  "page_id" => ["integer", 5],
240  "parent_type" => ["text", "stys"],
241  "lang" => ["text", '-'],
242  ]
243  );
244  }

◆ step_12()

ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::step_12 ( )

Definition at line 246 of file class.ilCOPageDBUpdateSteps.php.

246  : void
247  {
248  $layout_id = $this->db->nextId("page_layout");
249  $this->db->insert("page_layout", array(
250  "layout_id" => array("integer", $layout_id),
251  "active" => array("integer", 1),
252  "title" => array("text", "Leading image with text"),
253  "content" => array("clob", ""),
254  "description" => array("text", "")
255  ));
256 
257  $content = <<<EOT
258 <PageObject><PageContent PCID="6b1a4e68d752380bf108afff7fa66595"><PlaceHolder Height="300px" ContentClass="Media"/></PageContent><PageContent PCID="8535f59bec330f1cc30286898a36356f"><PlaceHolder Height="200px" ContentClass="Text"/></PageContent></PageObject>
259 EOT;
260  $this->db->insert("page_object", array(
261  "page_id" => array("integer", $layout_id),
262  "parent_type" => array("text", "stys"),
263  "content" => array("clob", $content),
264  "lang" => array("text", "-")
265  ));
266  }

◆ step_13()

ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::step_13 ( )

Definition at line 268 of file class.ilCOPageDBUpdateSteps.php.

268  : void
269  {
270  if ($this->db->tableExists("copg_pc_def")) {
271  $query = "UPDATE copg_pc_def SET " . PHP_EOL
272  . " component = REPLACE(component, 'Modules', 'components/ILIAS') " . PHP_EOL
273  . " WHERE component LIKE ('Modules/%')";
274 
275  $this->db->manipulate($query);
276  }
277  }

◆ step_14()

ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::step_14 ( )

Definition at line 279 of file class.ilCOPageDBUpdateSteps.php.

279  : void
280  {
281  if ($this->db->tableExists("copg_pc_def")) {
282  $query = "UPDATE copg_pc_def SET " . PHP_EOL
283  . " component = REPLACE(component, 'Services', 'components/ILIAS') " . PHP_EOL
284  . " WHERE component LIKE ('Services/%')";
285 
286  $this->db->manipulate($query);
287  }
288  }

◆ step_2()

ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::step_2 ( )

Definition at line 45 of file class.ilCOPageDBUpdateSteps.php.

45  : void
46  {
47  $field = array(
48  'type' => 'integer',
49  'length' => 4,
50  'notnull' => true,
51  'default' => 0
52  );
53 
54  $this->db->modifyTableColumn("copg_pc_def", "order_nr", $field);
55  }

◆ step_3()

ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::step_3 ( )

Definition at line 57 of file class.ilCOPageDBUpdateSteps.php.

57  : void
58  {
59  $this->db->update(
60  "page_layout",
61  [
62  "title" => ["text", "Text page with accompanying media"]
63  ],
64  [ // where
65  "title" => ["text", "1A Simple text page with accompanying media"]
66  ]
67  );
68  $this->db->update(
69  "page_layout",
70  [
71  "title" => ["text", "Text page with accompanying media and test"]
72  ],
73  [ // where
74  "title" => ["text", "1C Text page with accompanying media and test"]
75  ]
76  );
77  $this->db->update(
78  "page_layout",
79  [
80  "title" => ["text", "Text page with accompanying media followed by test and text"]
81  ],
82  [ // where
83  "title" => ["text", "1E Text page with accompanying media followed by test and text"]
84  ]
85  );
86  $this->db->update(
87  "page_layout",
88  [
89  "title" => ["text", "Media page with accompanying text and test"]
90  ],
91  [ // where
92  "title" => ["text", "2C Simple media page with accompanying text and test"]
93  ]
94  );
95  $this->db->update(
96  "page_layout",
97  [
98  "title" => ["text", "Vertical component navigation page with media and text "]
99  ],
100  [ // where
101  "title" => ["text", "7C Vertical component navigation page with media and text"]
102  ]
103  );
104  }

◆ step_4()

ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::step_4 ( )

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

106  : void
107  {
108  if (!$this->db->tableColumnExists('page_object', 'est_reading_time')) {
109  $this->db->addTableColumn('page_object', 'est_reading_time', array(
110  'type' => 'integer',
111  'notnull' => true,
112  'length' => 4,
113  'default' => 0
114  ));
115  }
116  }

◆ step_5()

ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::step_5 ( )

Definition at line 118 of file class.ilCOPageDBUpdateSteps.php.

References $r.

118  : void
119  {
120  $set = $this->db->queryF(
121  "SELECT content FROM page_object " .
122  " WHERE page_id = %s AND parent_type = %s AND lang = %s",
123  ["integer", "text", "text"],
124  [5, "stys", "-"]
125  );
126  while ($rec = $this->db->fetchAssoc($set)) {
127  $content = $rec["content"];
128 
129  $replacements = [
130  ["a4e417c08feebeafb1487e60a2e245a4", "a4e417c08feebeafb1487e60a2e245a5"],
131  ["a4e417c08feebeafb1487e60a2e245a4", "a4e417c08feebeafb1487e60a2e245a6"],
132  ["a4e417c08feebeafb1487e60a2e245a5", "a4e417c08feebeafb1487e60a2e245a7"],
133  ["a4e417c08feebeafb1487e60a2e245a5", "a4e417c08feebeafb1487e60a2e245a8"]
134  ];
135 
136  foreach ($replacements as $r) {
137  $content = preg_replace('/' . $r[0] . '/', $r[1], $content, 1);
138  }
139 
140  $this->db->update(
141  "page_object",
142  [
143  "content" => ["clob", $content]
144  ],
145  [ // where
146  "page_id" => ["integer", 5],
147  "parent_type" => ["text", "stys"],
148  "lang" => ["text", '-'],
149  ]
150  );
151  }
152  }
$r

◆ step_6()

ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::step_6 ( )

Definition at line 153 of file class.ilCOPageDBUpdateSteps.php.

153  : void
154  {
155  }

◆ step_7()

ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::step_7 ( )

Definition at line 156 of file class.ilCOPageDBUpdateSteps.php.

156  : void
157  {
158  $content = <<<EOT
159 <PageObject><PageContent PCID="0568f23f59f828dd532cd77c66dcea97"><Grid><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="7" WIDTH_L="8" WIDTH_XL="8" PCID="2fe139a171c9276193832c2d64f5822b"><PageContent PCID="1f77eb1d8a478497d69b99d938fda8f"><PlaceHolder ContentClass="Text" Height="500px"/></PageContent></GridCell><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="5" WIDTH_L="4" WIDTH_XL="4" PCID="010960eb5296c409d0b5070e186f033e"><PageContent PCID="2e77eb1d8a478497d69b99d938fda8e"><PlaceHolder ContentClass="Media" Height="500px"/></PageContent></GridCell></Grid></PageContent></PageObject>
160 EOT;
161  $this->db->update(
162  "page_object",
163  [
164  "content" => ["clob", $content]
165  ],
166  [ // where
167  "page_id" => ["integer", 1],
168  "parent_type" => ["text", "stys"],
169  "lang" => ["text", '-'],
170  ]
171  );
172  }

◆ step_8()

ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::step_8 ( )

Definition at line 174 of file class.ilCOPageDBUpdateSteps.php.

174  : void
175  {
176  $content = <<<EOT
177 <PageObject><PageContent PCID="336db62153bc33b955c8eab6b4ba1331"><Grid><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="7" WIDTH_L="8" WIDTH_XL="8" PCID="18772b9425070318d27bb2fdaf6b6bdf"><PageContent PCID="1f77eb1d8a478497d69b99d938fda8f"><PlaceHolder ContentClass="Text" Height="300px"/></PageContent></GridCell><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="5" WIDTH_L="4" WIDTH_XL="4" PCID="4309720c697857f55946691119fd7f10"><PageContent PCID="2e77eb1d8a478497d69b99d938fda8e"><PlaceHolder ContentClass="Media" Height="300px"/></PageContent></GridCell></Grid></PageContent><PageContent PCID="3f77eb1d8a478493d69b99d438fda8f"><PlaceHolder ContentClass="Question" Height="200px"/></PageContent></PageObject>
178 EOT;
179  $this->db->update(
180  "page_object",
181  [
182  "content" => ["clob", $content]
183  ],
184  [ // where
185  "page_id" => ["integer", 2],
186  "parent_type" => ["text", "stys"],
187  "lang" => ["text", '-'],
188  ]
189  );
190  }

◆ step_9()

ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::step_9 ( )

Definition at line 192 of file class.ilCOPageDBUpdateSteps.php.

192  : void
193  {
194  $content = <<<EOT
195 <PageObject><PageContent PCID="6239da5ab9497f14774a2cceb5525c3d"><Grid><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="5" WIDTH_L="4" WIDTH_XL="4" PCID="2f9835a738e7c83dbef27915816b0f5a"><PageContent PCID="2e77eb1d8a478497d69b99d938fda8e"><PlaceHolder ContentClass="Media" Height="500px"/></PageContent></GridCell><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="7" WIDTH_L="8" WIDTH_XL="8" PCID="1d74da9bf94b63e8c85a451399b624d9"><PageContent PCID="1f77eb1d8a478497d69b99d938fda8f"><PlaceHolder ContentClass="Text" Height="500px"/></PageContent></GridCell></Grid></PageContent></PageObject>
196 EOT;
197  $this->db->update(
198  "page_object",
199  [
200  "content" => ["clob", $content]
201  ],
202  [ // where
203  "page_id" => ["integer", 3],
204  "parent_type" => ["text", "stys"],
205  "lang" => ["text", '-'],
206  ]
207  );
208  }

Field Documentation

◆ $db

ilDBInterface ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::$db
protected

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