ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilDataCollectionDBUpdateSteps9 Class Reference
+ Inheritance diagram for ilDataCollectionDBUpdateSteps9:
+ Collaboration diagram for ilDataCollectionDBUpdateSteps9:

Public Member Functions

 prepare (ilDBInterface $db)
 
 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 ()
 
- Public Member Functions inherited from ilDatabaseUpdateSteps
 prepare (\ilDBInterface $db)
 Prepare the execution of the steps. More...
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

Definition at line 21 of file class.ilDataCollectionDBUpdateSteps9.php.

Member Function Documentation

◆ prepare()

ilDataCollectionDBUpdateSteps9::prepare ( ilDBInterface  $db)

Definition at line 25 of file class.ilDataCollectionDBUpdateSteps9.php.

25 : void
26 {
27 $this->db = $db;
28 }

References $db.

◆ step_1()

ilDataCollectionDBUpdateSteps9::step_1 ( )

Definition at line 30 of file class.ilDataCollectionDBUpdateSteps9.php.

30 : void
31 {
32 $this->db->manipulate(
33 "UPDATE il_dcl_tableview " .
34 "SET description=" . $this->db->quote("", "text") .
35 "WHERE description is null"
36 );
37 $this->db->modifyTableColumn("il_dcl_tableview", "description", [
38 'notnull' => true,
39 'default' => ''
40 ]);
41 }

◆ step_10()

ilDataCollectionDBUpdateSteps9::step_10 ( )

Definition at line 144 of file class.ilDataCollectionDBUpdateSteps9.php.

144 : void
145 {
146 if (!$this->db->indexExistsByFields('il_dcl_field_prop', array('field_id'))) {
147 $this->db->addIndex('il_dcl_field_prop', array('field_id'), 'i2');
148 }
149 if (!$this->db->indexExistsByFields('il_dcl_sel_opts', array('field_id'))) {
150 $this->db->addIndex('il_dcl_sel_opts', array('field_id'), 'i1');
151 }
152 if (!$this->db->indexExistsByFields('il_dcl_sel_opts', array('opt_id'))) {
153 $this->db->addIndex('il_dcl_sel_opts', array('opt_id'), 'i2');
154 }
155 if (!$this->db->indexExistsByFields('il_dcl_tview_set', array('field'))) {
156 $this->db->addIndex('il_dcl_tview_set', array('field'), 'i2');
157 }
158 if (!$this->db->indexExistsByFields('il_dcl_tview_set', array('in_filter'))) {
159 $this->db->addIndex('il_dcl_tview_set', array('in_filter'), 'i3');
160 }
161 if (!$this->db->indexExistsByFields('il_dcl_tfield_set', array('field'))) {
162 $this->db->addIndex('il_dcl_tfield_set', array('field'), 'i3');
163 }
164 if (!$this->db->indexExistsByFields('il_dcl_tfield_set', array('table_id'))) {
165 $this->db->addIndex('il_dcl_tfield_set', array('table_id'), 'i4');
166 }
167 }

◆ step_11()

ilDataCollectionDBUpdateSteps9::step_11 ( )

Definition at line 169 of file class.ilDataCollectionDBUpdateSteps9.php.

169 : void
170 {
171 $this->db->manipulateF(
172 'UPDATE il_dcl_field_prop prop INNER JOIN il_dcl_field field ON field.id = prop.field_id ' .
173 'SET name = "link_detail_page_mob" WHERE field.datatype_id = %s AND name = "link_detail_page"',
176 );
177 }

References ilDclDatatype\INPUTFORMAT_MOB, and ilDBConstants\T_INTEGER.

◆ step_12()

ilDataCollectionDBUpdateSteps9::step_12 ( )

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

179 : void
180 {
181 $this->db->manipulateF(
182 'UPDATE il_dcl_stloc1_value v ' .
183 'INNER JOIN il_dcl_record_field rf ON rf.id = v.record_field_id ' .
184 'INNER JOIN il_dcl_field f ON f.id = rf.field_id ' .
185 'SET v.value = REPLACE(v.value, "<br />", "\r\n") WHERE f.datatype_id = %s',
188 );
189 }

References ilDclDatatype\INPUTFORMAT_TEXT, and ilDBConstants\T_INTEGER.

◆ step_13()

ilDataCollectionDBUpdateSteps9::step_13 ( )

Definition at line 191 of file class.ilDataCollectionDBUpdateSteps9.php.

191 : void
192 {
193 if ($this->db->tableColumnExists('il_dcl_tableview', 'step_vs')) {
194 $this->db->dropTableColumn('il_dcl_tableview', 'step_vs');
195 }
196 if ($this->db->tableColumnExists('il_dcl_tableview', 'step_c')) {
197 $this->db->dropTableColumn('il_dcl_tableview', 'step_c');
198 }
199 if ($this->db->tableColumnExists('il_dcl_tableview', 'step_e')) {
200 $this->db->dropTableColumn('il_dcl_tableview', 'step_e');
201 }
202 if ($this->db->tableColumnExists('il_dcl_tableview', 'step_o')) {
203 $this->db->dropTableColumn('il_dcl_tableview', 'step_o');
204 }
205 if ($this->db->tableColumnExists('il_dcl_tableview', 'step_s')) {
206 $this->db->dropTableColumn('il_dcl_tableview', 'step_s');
207 }
208 }

◆ step_14()

ilDataCollectionDBUpdateSteps9::step_14 ( )

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

210 : void
211 {
212 $this->db->manipulate('UPDATE il_dcl_field_prop SET value = "" WHERE value IS NULL');
213 }

◆ step_15()

ilDataCollectionDBUpdateSteps9::step_15 ( )

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

215 : void
216 {
217 if ($this->db->tableExists('il_dcl_field_prop_b')) {
218 $this->db->dropTable('il_dcl_field_prop_b');
219 }
220
221 if ($this->db->tableExists('il_dcl_field_prop_s_b')) {
222 $this->db->dropTable('il_dcl_field_prop_s_b');
223 }
224 }

◆ step_16()

ilDataCollectionDBUpdateSteps9::step_16 ( )

Definition at line 226 of file class.ilDataCollectionDBUpdateSteps9.php.

226 : void
227 {
228 global $DIC;
229 $slot = $DIC['component.repository']->getPluginSlotById(ilDclFieldTypePlugin::SLOT_ID);
230 foreach ($slot->getPlugins() as $plugin) {
231 $plugin = $DIC['component.factory']->getPlugin($plugin->getId());
232 $field_type_name = ilDclFieldTypePlugin::getDataType($plugin->getId());
233
234 $field_ids = [];
235 $stmt = $this->db->queryF(
236 'SELECT field_id FROM il_dcl_field_prop WHERE name = "plugin_hook_name" AND value = %s',
238 [$plugin->getPluginName()]
239 );
240 while ($row = $this->db->fetchAssoc($stmt)) {
241 $field_ids[] = (int) $row['field_id'];
242 }
243
244 $id = 0;
245 $stmt = $this->db->queryF('SELECT id FROM il_dcl_datatype WHERE title LIKE %s', [ilDBConstants::T_TEXT], [$field_type_name]);
246 while ($row = $this->db->fetchAssoc($stmt)) {
247 $id = (int) $row['id'];
248 }
249 if ($id === 0) {
250 $type = $plugin->getStorageLocation();
251 $field_model_class = 'il' . $plugin->getPluginName() . 'FieldModel';
252 $type = (new $field_model_class())->getStorageLocationOverride() ?? $plugin->getStorageLocation();
253
254 $this->db->manipulateF(
255 'INSERT INTO il_dcl_datatype (id, title, ildb_type, storage_location, sort) SELECT GREATEST(MAX(id), 1000) + 1, %s, %s, %s, GREATEST(MAX(sort), 10000) + 10 FROM il_dcl_datatype;',
256 [
260 ],
261 [
262 $field_type_name,
264 $type
265 ]
266 );
267 $stmt = $this->db->queryF('SELECT id FROM il_dcl_datatype WHERE title LIKE %s', [ilDBConstants::T_TEXT], [$field_type_name]);
268 $id = (int) $this->db->fetchAssoc($stmt)['id'];
269 }
270
271 foreach ($field_ids as $field_id) {
272 $this->db->manipulateF(
273 'UPDATE il_dcl_field SET datatype_id = %s WHERE id = %s',
275 [$id, $field_id]
276 );
277 }
278
279 $this->db->manipulateF(
280 'DELETE FROM il_dcl_field_prop WHERE name = "plugin_hook_name" AND value = %s',
282 [$plugin->getPluginName()]
283 );
284 }
285 $this->db->manipulateF(
286 'DELETE FROM il_dcl_datatype WHERE id = %s',
288 [12]
289 );
290 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static getDataType(string $plugin_id)
global $DIC
Definition: shib_login.php:26

References $DIC, $id, XapiProxy\$plugin, ilDclFieldTypePlugin\DB_TYPES, ilDclFieldTypePlugin\getDataType(), ILIAS\Repository\int(), ilDclFieldTypePlugin\SLOT_ID, ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

+ Here is the call graph for this function:

◆ step_17()

ilDataCollectionDBUpdateSteps9::step_17 ( )

Definition at line 292 of file class.ilDataCollectionDBUpdateSteps9.php.

292 : void
293 {
294 $id = false;
295 $stmt = $this->db->queryF('SELECT id FROM il_dcl_datatype WHERE id LIKE %s', [ilDBConstants::T_INTEGER], [ilDclDatatype::INPUTFORMAT_COPY]);
296 if ($row = $this->db->fetchAssoc($stmt)) {
297 $id = true;
298 }
299
300 if (!$id) {
301 $this->db->insert(
302 'il_dcl_datatype',
303 [
305 'title' => [ilDBConstants::T_TEXT, 'copy'],
307 'storage_location' => [ilDBConstants::T_INTEGER, 1],
308 'sort' => [ilDBConstants::T_INTEGER, 85],
309 ]
310 );
311 }
312 }

References $id, ilDclDatatype\INPUTFORMAT_COPY, ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

◆ step_18()

ilDataCollectionDBUpdateSteps9::step_18 ( )

Definition at line 314 of file class.ilDataCollectionDBUpdateSteps9.php.

314 : void
315 {
316 $stmt = $this->db->queryF(
317 'SELECT * FROM page_object INNER JOIN il_dcl_tableview ON page_id = id WHERE rendered_content IS NOT NULL AND parent_type = %s',
320 );
321
322 while ($row = $this->db->fetchAssoc($stmt)) {
323 $tableview = new ilDclTableView((int) $row['page_id']);
324 $content = $row['content'];
325 $rendered_content = $row['rendered_content'];
326
327 foreach (['id', 'create_date', 'last_update', 'owner', 'last_edit_by'] as $field) {
328 $content = str_replace('[' . $field . ']', '[[' . $field . ']]', $content);
329 $content = str_replace('[[[' . $field . ']]]', '[[' . $field . ']]', $content);
330 $rendered_content = str_replace('[' . $field . ']', '[[' . $field . ']]', $rendered_content);
331 $rendered_content = str_replace('[[[' . $field . ']]]', '[[' . $field . ']]', $rendered_content);
332 }
333
334 $sub_stmt = $this->db->queryF(
335 'SELECT * FROM il_dcl_field WHERE table_id = %s',
337 [(int) $row['table_id']]
338 );
339 while ($field = $this->db->fetchAssoc($sub_stmt)) {
340 $old = ['[' . $field['title'] . ']','[dclrefln field="' . $field['title'] . '"][/dclrefln]' ];
341 $content = str_replace($old, '[[' . $field['id'] . ']]', $content);
342 $rendered_content = str_replace($old, '[[' . $field['id'] . ']]', $rendered_content);
343 }
344
345 $this->db->manipulateF(
346 'UPDATE page_object SET content = %s, rendered_content = %s WHERE page_id = %s',
348 [$content, $rendered_content, (int) $row['page_id']]
349 );
350 }
351 }

References ilDclDetailedViewDefinition\PARENT_TYPE, ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

◆ step_19()

ilDataCollectionDBUpdateSteps9::step_19 ( )

Definition at line 353 of file class.ilDataCollectionDBUpdateSteps9.php.

353 : void
354 {
355 if ($this->db->tableColumnExists('il_dcl_datatype', 'ildb_type')) {
356 $this->db->dropTableColumn('il_dcl_datatype', 'ildb_type');
357 }
358 }

◆ step_2()

ilDataCollectionDBUpdateSteps9::step_2 ( )

Definition at line 43 of file class.ilDataCollectionDBUpdateSteps9.php.

43 : void
44 {
45 $this->db->manipulate(
46 "UPDATE il_dcl_tview_set " .
47 "SET in_filter=0 " .
48 "WHERE in_filter is null"
49 );
50 $this->db->manipulate(
51 "UPDATE il_dcl_tview_set " .
52 "SET visible=0 " .
53 "WHERE visible is null"
54 );
55 $this->db->manipulate(
56 "UPDATE il_dcl_tview_set " .
57 "SET filter_changeable=0 " .
58 "WHERE filter_changeable is null"
59 );
60 $this->db->modifyTableColumn("il_dcl_tview_set", "in_filter", [
61 'notnull' => 1,
62 'default' => 0
63 ]);
64 $this->db->modifyTableColumn("il_dcl_tview_set", "visible", [
65 'notnull' => 1,
66 'default' => 0
67 ]);
68 $this->db->modifyTableColumn("il_dcl_tview_set", "filter_changeable", [
69 'notnull' => 1,
70 'default' => 0
71 ]);
72 }

◆ step_20()

ilDataCollectionDBUpdateSteps9::step_20 ( )

Definition at line 360 of file class.ilDataCollectionDBUpdateSteps9.php.

360 : void
361 {
362 $stmt = $this->db->queryF(
363 'SELECT id FROM il_dcl_datatype WHERE id = %s AND title = %s',
366 );
367 if ($this->db->fetchAssoc($stmt) === null) {
368 $this->db->manipulateF(
369 'UPDATE il_dcl_datatype SET title = %s WHERE id = %s',
372 );
373 }
374 }

References ilDclDatatype\INPUTFORMAT_DATE, ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

◆ step_3()

ilDataCollectionDBUpdateSteps9::step_3 ( )

Definition at line 74 of file class.ilDataCollectionDBUpdateSteps9.php.

74 : void
75 {
76 $this->db->manipulate(
77 "UPDATE il_dcl_tfield_set " .
78 "SET exportable=0 " .
79 "WHERE exportable is null"
80 );
81 $this->db->modifyTableColumn("il_dcl_tfield_set", "exportable", [
82 'notnull' => 1,
83 'default' => 0
84 ]);
85 }

◆ step_4()

ilDataCollectionDBUpdateSteps9::step_4 ( )

Definition at line 87 of file class.ilDataCollectionDBUpdateSteps9.php.

87 : void
88 {
89 $this->db->modifyTableColumn("il_dcl_stloc3_value", "value", ['notnull' => false]);
90 }

◆ step_5()

ilDataCollectionDBUpdateSteps9::step_5 ( )

Definition at line 92 of file class.ilDataCollectionDBUpdateSteps9.php.

92 : void
93 {
94 if (!$this->db->indexExistsByFields('il_dcl_field_prop', ['id', 'field_id'])) {
95 $this->db->addIndex('il_dcl_field_prop', ['id', 'field_id'], 'i1');
96 }
97 if (!$this->db->indexExistsByFields('il_dcl_tview_set', ['tableview_id'])) {
98 $this->db->addIndex('il_dcl_tview_set', ['tableview_id'], 'i1');
99 }
100 }

◆ step_6()

ilDataCollectionDBUpdateSteps9::step_6 ( )

Definition at line 102 of file class.ilDataCollectionDBUpdateSteps9.php.

102 : void
103 {
104 $this->db->insert("il_dcl_datatype", [
106 'title' => [ilDBConstants::T_TEXT, 'file'],
108 'storage_location' => [ilDBConstants::T_INTEGER, 1],
109 'sort' => [ilDBConstants::T_INTEGER, 75],
110 ]);
111 }

References ilDclDatatype\INPUTFORMAT_FILE, ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

◆ step_7()

ilDataCollectionDBUpdateSteps9::step_7 ( )

Definition at line 113 of file class.ilDataCollectionDBUpdateSteps9.php.

113 : void
114 {
115 $this->db->manipulateF(
116 "DELETE FROM il_dcl_datatype WHERE id = %s",
118 [defined(ilDclDatatype::class . '::INPUTFORMAT_FILEUPLOAD') ? ilDclDatatype::INPUTFORMAT_FILEUPLOAD : 6]
119 );
120 }

References ilDclDatatype\INPUTFORMAT_FILEUPLOAD, and ilDBConstants\T_INTEGER.

◆ step_8()

ilDataCollectionDBUpdateSteps9::step_8 ( )

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

122 : void
123 {
124 $this->db->modifyTableColumn(
125 'il_dcl_sel_opts',
126 'value',
127 [
128 "length" => 4000,
129 ]
130 );
131 }

◆ step_9()

ilDataCollectionDBUpdateSteps9::step_9 ( )

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

133 : void
134 {
135 $this->db->manipulate(
136 "UPDATE il_dcl_field_prop, il_dcl_field
137 SET name='link_detail_page_text'
138 WHERE name='link_detail_page'
139 AND il_dcl_field_prop.field_id=il_dcl_field.id
140 AND il_dcl_field.datatype_id=2"
141 );
142 }

Field Documentation

◆ $db

ilDBInterface ilDataCollectionDBUpdateSteps9::$db
protected

Definition at line 23 of file class.ilDataCollectionDBUpdateSteps9.php.

Referenced by prepare().


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