ILIAS  release_8 Revision v8.24
ilDataCollectionDBUpdateSteps Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilDataCollectionDBUpdateSteps:
+ Collaboration diagram for ilDataCollectionDBUpdateSteps:

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

Protected Attributes

ilDBInterface $db
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Definition at line 19 of file class.ilDataCollectionDBUpdateSteps80.php.

Member Function Documentation

◆ prepare()

ilDataCollectionDBUpdateSteps::prepare ( ilDBInterface  $db)

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

23 : void
24 {
25 $this->db = $db;
26 }

References $db.

◆ step_1()

ilDataCollectionDBUpdateSteps::step_1 ( )

Definition at line 28 of file class.ilDataCollectionDBUpdateSteps80.php.

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

◆ step_10()

ilDataCollectionDBUpdateSteps::step_10 ( )

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

144 : void
145 {
146 $this->db->manipulate('UPDATE il_dcl_field_prop SET value = "" WHERE value IS NULL');
147 }

◆ step_11()

ilDataCollectionDBUpdateSteps::step_11 ( )

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

149 : void
150 {
151 if ($this->db->tableExists('il_dcl_field_prop_b')) {
152 $this->db->dropTable('il_dcl_field_prop_b');
153 }
154
155 if ($this->db->tableExists('il_dcl_field_prop_s_b')) {
156 $this->db->dropTable('il_dcl_field_prop_s_b');
157 }
158 }

◆ step_12()

ilDataCollectionDBUpdateSteps::step_12 ( )

Definition at line 160 of file class.ilDataCollectionDBUpdateSteps80.php.

160 : void
161 {
162 global $DIC;
163 $slot = $DIC['component.repository']->getPluginSlotById(ilDclFieldTypePlugin::SLOT_ID);
164 foreach ($slot->getPlugins() as $plugin) {
165 $plugin = $DIC['component.factory']->getPlugin($plugin->getId());
166 $field_type_name = ilDclFieldTypePlugin::getDataType($plugin->getId());
167
168 $field_ids = [];
169 $stmt = $this->db->queryF(
170 'SELECT field_id FROM il_dcl_field_prop WHERE name = "plugin_hook_name" AND value = %s',
172 [$plugin->getPluginName()]
173 );
174 while ($row = $this->db->fetchAssoc($stmt)) {
175 $field_ids[] = (int) $row['field_id'];
176 }
177
178 $id = 0;
179 $stmt = $this->db->queryF('SELECT id FROM il_dcl_datatype WHERE title LIKE %s', [ilDBConstants::T_TEXT], [$field_type_name]);
180 while ($row = $this->db->fetchAssoc($stmt)) {
181 $id = (int) $row['id'];
182 }
183 if ($id === 0) {
184 $type = $plugin->getStorageLocation();
185 $field_model_class = 'il' . $plugin->getPluginName() . 'FieldModel';
186 $type = (new $field_model_class())->getStorageLocationOverride() ?? $plugin->getStorageLocation();
187
188 $this->db->manipulateF(
189 '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;',
190 [
194 ],
195 [
196 $field_type_name,
198 $type
199 ]
200 );
201 $stmt = $this->db->queryF('SELECT id FROM il_dcl_datatype WHERE title LIKE %s', [ilDBConstants::T_TEXT], [$field_type_name]);
202 $id = (int) $this->db->fetchAssoc($stmt)['id'];
203 }
204
205 foreach ($field_ids as $field_id) {
206 $this->db->manipulateF(
207 'UPDATE il_dcl_field SET datatype_id = %s WHERE id = %s',
209 [$id, $field_id]
210 );
211 }
212
213 $this->db->manipulateF(
214 'DELETE FROM il_dcl_field_prop WHERE name = "plugin_hook_name" AND value = %s',
216 [$plugin->getPluginName()]
217 );
218 }
219 $this->db->manipulateF(
220 'DELETE FROM il_dcl_datatype WHERE id = %s',
223 );
224 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static getDataType(string $plugin_id)
global $DIC
Definition: feed.php:28
$type

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

+ Here is the call graph for this function:

◆ step_13()

ilDataCollectionDBUpdateSteps::step_13 ( )

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

226 : void
227 {
228 $id = false;
229 $stmt = $this->db->queryF('SELECT id FROM il_dcl_datatype WHERE id LIKE %s', [ilDBConstants::T_INTEGER], [17]);
230 if ($row = $this->db->fetchAssoc($stmt)) {
231 $id = true;
232 }
233
234 if (!$id) {
235 $this->db->insert(
236 'il_dcl_datatype',
237 [
238 'id' => [ilDBConstants::T_INTEGER, 17],
239 'title' => [ilDBConstants::T_TEXT, 'copy'],
241 'storage_location' => [ilDBConstants::T_INTEGER, 1],
242 'sort' => [ilDBConstants::T_INTEGER, 85],
243 ]
244 );
245 }
246 }

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

◆ step_2()

ilDataCollectionDBUpdateSteps::step_2 ( )

Definition at line 37 of file class.ilDataCollectionDBUpdateSteps80.php.

37 : void
38 {
39 $this->db->manipulate("UPDATE il_dcl_tview_set " .
40 "SET in_filter=0 " .
41 "WHERE in_filter is null");
42 $this->db->manipulate("UPDATE il_dcl_tview_set " .
43 "SET visible=0 " .
44 "WHERE visible is null");
45 $this->db->manipulate("UPDATE il_dcl_tview_set " .
46 "SET filter_changeable=0 " .
47 "WHERE filter_changeable is null");
48 $this->db->modifyTableColumn("il_dcl_tview_set", "in_filter", [ 'notnull' => true,
49 'default' => 0]);
50 $this->db->modifyTableColumn("il_dcl_tview_set", "visible", [ 'notnull' => true,
51 'default' => 0]);
52 $this->db->modifyTableColumn("il_dcl_tview_set", "filter_changeable", [ 'notnull' => true,
53 'default' => 0]);
54 }

◆ step_3()

ilDataCollectionDBUpdateSteps::step_3 ( )

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

56 : void
57 {
58 $this->db->manipulate("UPDATE il_dcl_tfield_set " .
59 "SET exportable=0 " .
60 "WHERE exportable is null");
61 $this->db->modifyTableColumn("il_dcl_tfield_set", "exportable", [ 'notnull' => true,
62 'default' => 0]);
63 }

◆ step_4()

ilDataCollectionDBUpdateSteps::step_4 ( )

Definition at line 65 of file class.ilDataCollectionDBUpdateSteps80.php.

65 : void
66 {
67 $this->db->modifyTableColumn("il_dcl_stloc3_value", "value", [ 'notnull' => false]);
68 }

◆ step_5()

ilDataCollectionDBUpdateSteps::step_5 ( )

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

70 : void
71 {
72 if (!$this->db->indexExistsByFields('il_dcl_field_prop', array('id', 'field_id'))) {
73 $this->db->addIndex('il_dcl_field_prop', array('id', 'field_id'), 'i1');
74 }
75 if (!$this->db->indexExistsByFields('il_dcl_tview_set', array('tableview_id'))) {
76 $this->db->addIndex('il_dcl_tview_set', array('tableview_id'), 'i1');
77 }
78 }

◆ step_6()

ilDataCollectionDBUpdateSteps::step_6 ( )

Definition at line 80 of file class.ilDataCollectionDBUpdateSteps80.php.

80 : void
81 {
82 $this->db->modifyTableColumn(
83 'il_dcl_sel_opts',
84 'value',
85 [
86 "length" => 4000,
87 ]
88 );
89 }

◆ step_7()

ilDataCollectionDBUpdateSteps::step_7 ( )

Definition at line 91 of file class.ilDataCollectionDBUpdateSteps80.php.

91 : void
92 {
93 if (!$this->db->indexExistsByFields('il_dcl_field_prop', array('field_id'))) {
94 $this->db->addIndex('il_dcl_field_prop', array('field_id'), 'i2');
95 }
96 if (!$this->db->indexExistsByFields('il_dcl_sel_opts', array('field_id'))) {
97 $this->db->addIndex('il_dcl_sel_opts', array('field_id'), 'i1');
98 }
99 if (!$this->db->indexExistsByFields('il_dcl_sel_opts', array('opt_id'))) {
100 $this->db->addIndex('il_dcl_sel_opts', array('opt_id'), 'i2');
101 }
102 if (!$this->db->indexExistsByFields('il_dcl_tview_set', array('field'))) {
103 $this->db->addIndex('il_dcl_tview_set', array('field'), 'i2');
104 }
105 if (!$this->db->indexExistsByFields('il_dcl_tview_set', array('in_filter'))) {
106 $this->db->addIndex('il_dcl_tview_set', array('in_filter'), 'i3');
107 }
108 if (!$this->db->indexExistsByFields('il_dcl_tfield_set', array('field'))) {
109 $this->db->addIndex('il_dcl_tfield_set', array('field'), 'i3');
110 }
111 if (!$this->db->indexExistsByFields('il_dcl_tfield_set', array('table_id'))) {
112 $this->db->addIndex('il_dcl_tfield_set', array('table_id'), 'i4');
113 }
114 }

◆ step_8()

ilDataCollectionDBUpdateSteps::step_8 ( )

Definition at line 116 of file class.ilDataCollectionDBUpdateSteps80.php.

116 : void
117 {
118 $this->db->manipulateF(
119 'UPDATE il_dcl_field_prop prop INNER JOIN il_dcl_field field ON field.id = prop.field_id ' .
120 'SET name = "link_detail_page_text" WHERE field.datatype_id = %s AND name = "link_detail_page"',
123 );
124 $this->db->manipulateF(
125 'UPDATE il_dcl_field_prop prop INNER JOIN il_dcl_field field ON field.id = prop.field_id ' .
126 'SET name = "link_detail_page_mob" WHERE field.datatype_id = %s AND name = "link_detail_page"',
129 );
130 }

References ilDclDatatype\INPUTFORMAT_MOB, ilDclDatatype\INPUTFORMAT_TEXT, and ilDBConstants\T_INTEGER.

◆ step_9()

ilDataCollectionDBUpdateSteps::step_9 ( )

Definition at line 132 of file class.ilDataCollectionDBUpdateSteps80.php.

132 : void
133 {
134 $this->db->manipulateF(
135 'UPDATE il_dcl_stloc1_value v ' .
136 'INNER JOIN il_dcl_record_field rf ON rf.id = v.record_field_id ' .
137 'INNER JOIN il_dcl_field f ON f.id = rf.field_id ' .
138 'SET v.value = REPLACE(v.value, "<br />", "\r\n") WHERE f.datatype_id = %s',
141 );
142 }

References ilDclDatatype\INPUTFORMAT_TEXT, and ilDBConstants\T_INTEGER.

Field Documentation

◆ $db

ilDBInterface ilDataCollectionDBUpdateSteps::$db
protected

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

Referenced by prepare().


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