19 declare(strict_types=1);
32 $this->db->manipulate(
33 "UPDATE il_dcl_tableview " .
34 "SET description=" . $this->db->quote(
"",
"text") .
35 "WHERE description is null" 37 $this->db->modifyTableColumn(
"il_dcl_tableview",
"description", [
45 $this->db->manipulate(
46 "UPDATE il_dcl_tview_set " .
48 "WHERE in_filter is null" 50 $this->db->manipulate(
51 "UPDATE il_dcl_tview_set " .
53 "WHERE visible is null" 55 $this->db->manipulate(
56 "UPDATE il_dcl_tview_set " .
57 "SET filter_changeable=0 " .
58 "WHERE filter_changeable is null" 60 $this->db->modifyTableColumn(
"il_dcl_tview_set",
"in_filter", [
64 $this->db->modifyTableColumn(
"il_dcl_tview_set",
"visible", [
68 $this->db->modifyTableColumn(
"il_dcl_tview_set",
"filter_changeable", [
76 $this->db->manipulate(
77 "UPDATE il_dcl_tfield_set " .
79 "WHERE exportable is null" 81 $this->db->modifyTableColumn(
"il_dcl_tfield_set",
"exportable", [
89 $this->db->modifyTableColumn(
"il_dcl_stloc3_value",
"value", [
'notnull' =>
false]);
94 if (!$this->db->indexExistsByFields(
'il_dcl_field_prop', [
'id',
'field_id'])) {
95 $this->db->addIndex(
'il_dcl_field_prop', [
'id',
'field_id'],
'i1');
97 if (!$this->db->indexExistsByFields(
'il_dcl_tview_set', [
'tableview_id'])) {
98 $this->db->addIndex(
'il_dcl_tview_set', [
'tableview_id'],
'i1');
104 $this->db->insert(
"il_dcl_datatype", [
115 $this->db->manipulateF(
116 "DELETE FROM il_dcl_datatype WHERE id = %s",
124 $this->db->modifyTableColumn(
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" 146 if (!$this->db->indexExistsByFields(
'il_dcl_field_prop', array(
'field_id'))) {
147 $this->db->addIndex(
'il_dcl_field_prop', array(
'field_id'),
'i2');
149 if (!$this->db->indexExistsByFields(
'il_dcl_sel_opts', array(
'field_id'))) {
150 $this->db->addIndex(
'il_dcl_sel_opts', array(
'field_id'),
'i1');
152 if (!$this->db->indexExistsByFields(
'il_dcl_sel_opts', array(
'opt_id'))) {
153 $this->db->addIndex(
'il_dcl_sel_opts', array(
'opt_id'),
'i2');
155 if (!$this->db->indexExistsByFields(
'il_dcl_tview_set', array(
'field'))) {
156 $this->db->addIndex(
'il_dcl_tview_set', array(
'field'),
'i2');
158 if (!$this->db->indexExistsByFields(
'il_dcl_tview_set', array(
'in_filter'))) {
159 $this->db->addIndex(
'il_dcl_tview_set', array(
'in_filter'),
'i3');
161 if (!$this->db->indexExistsByFields(
'il_dcl_tfield_set', array(
'field'))) {
162 $this->db->addIndex(
'il_dcl_tfield_set', array(
'field'),
'i3');
164 if (!$this->db->indexExistsByFields(
'il_dcl_tfield_set', array(
'table_id'))) {
165 $this->db->addIndex(
'il_dcl_tfield_set', array(
'table_id'),
'i4');
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"',
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',
193 if ($this->db->tableColumnExists(
'il_dcl_tableview',
'step_vs')) {
194 $this->db->dropTableColumn(
'il_dcl_tableview',
'step_vs');
196 if ($this->db->tableColumnExists(
'il_dcl_tableview',
'step_c')) {
197 $this->db->dropTableColumn(
'il_dcl_tableview',
'step_c');
199 if ($this->db->tableColumnExists(
'il_dcl_tableview',
'step_e')) {
200 $this->db->dropTableColumn(
'il_dcl_tableview',
'step_e');
202 if ($this->db->tableColumnExists(
'il_dcl_tableview',
'step_o')) {
203 $this->db->dropTableColumn(
'il_dcl_tableview',
'step_o');
205 if ($this->db->tableColumnExists(
'il_dcl_tableview',
'step_s')) {
206 $this->db->dropTableColumn(
'il_dcl_tableview',
'step_s');
212 $this->db->manipulate(
'UPDATE il_dcl_field_prop SET value = "" WHERE value IS NULL');
217 if ($this->db->tableExists(
'il_dcl_field_prop_b')) {
218 $this->db->dropTable(
'il_dcl_field_prop_b');
221 if ($this->db->tableExists(
'il_dcl_field_prop_s_b')) {
222 $this->db->dropTable(
'il_dcl_field_prop_s_b');
230 foreach ($slot->getPlugins() as
$plugin) {
235 $stmt = $this->db->queryF(
236 'SELECT field_id FROM il_dcl_field_prop WHERE name = "plugin_hook_name" AND value = %s',
240 while ($row = $this->db->fetchAssoc($stmt)) {
241 $field_ids[] = (
int) $row[
'field_id'];
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)) {
250 $type =
$plugin->getStorageLocation();
251 $field_model_class =
'il' .
$plugin->getPluginName() .
'FieldModel';
252 $type = (
new $field_model_class())->getStorageLocationOverride() ??
$plugin->getStorageLocation();
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;',
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'];
271 foreach ($field_ids as $field_id) {
272 $this->db->manipulateF(
273 'UPDATE il_dcl_field SET datatype_id = %s WHERE id = %s',
279 $this->db->manipulateF(
280 'DELETE FROM il_dcl_field_prop WHERE name = "plugin_hook_name" AND value = %s',
285 $this->db->manipulateF(
286 'DELETE FROM il_dcl_datatype WHERE id = %s',
296 if ($row = $this->db->fetchAssoc($stmt)) {
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',
322 while ($row = $this->db->fetchAssoc($stmt)) {
324 $content = $row[
'content'];
325 $rendered_content = $row[
'rendered_content'];
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);
334 $sub_stmt = $this->db->queryF(
335 'SELECT * FROM il_dcl_field WHERE table_id = %s',
337 [(
int) $row[
'table_id']]
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);
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']]
355 if ($this->db->tableColumnExists(
'il_dcl_datatype',
'ildb_type')) {
356 $this->db->dropTableColumn(
'il_dcl_datatype',
'ildb_type');
362 $stmt = $this->db->queryF(
363 'SELECT id FROM il_dcl_datatype WHERE id = %s AND title = %s',
367 if ($this->db->fetchAssoc($stmt) ===
null) {
368 $this->db->manipulateF(
369 'UPDATE il_dcl_datatype SET title = %s WHERE id = %s',
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getDataType(string $plugin_id)
const INPUTFORMAT_FILEUPLOAD
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
prepare(ilDBInterface $db)