ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilDataCollectionDBUpdateSteps11.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 {
23  protected ilDBInterface $db;
24 
25  public function prepare(ilDBInterface $db): void
26  {
27  $this->db = $db;
28  }
29 
30  public function step_1(): void
31  {
32  if ($this->db->tableColumnExists('il_dcl_field', 'is_unique')) {
33  $st = $this->db->queryF(
34  'SELECT id FROM il_dcl_field WHERE is_unique = %s AND datatype_id IN (%s, %s, %s, %s)',
35  [
41  ],
42  [
43  1,
48  ]
49  );
50  while ($row = $this->db->fetchAssoc($st)) {
51  $this->db->insert(
52  'il_dcl_field_prop',
53  [
54  "id" => [ilDBConstants::T_INTEGER, $this->db->nextId('il_dcl_field_prop')],
55  "field_id" => [ilDBConstants::T_INTEGER, (int) $row['id']],
57  "value" => [ilDBConstants::T_TEXT, '1'],
58  ]
59  );
60  }
61  $this->db->dropTableColumn('il_dcl_field', 'is_unique');
62  }
63  }
64 
65  public function step_2(): void
66  {
67  if (!$this->db->tableColumnExists('il_dcl_tableview', 'role_limitation')) {
68  $this->db->addTableColumn('il_dcl_tableview', 'role_limitation', [
69  'type' => ilDBConstants::T_INTEGER,
70  'length' => 1,
71  'notnull' => true,
72  'default' => 0
73  ]);
74  $this->db->manipulateF('UPDATE il_dcl_tableview SET role_limitation = %s', [ilDBConstants::T_INTEGER], [1]);
75  }
76  }
77 
78  public function step_3(): void
79  {
80  $query = 'SELECT id FROM il_dcl_datatype WHERE id = %s';
81  if ($this->db->fetchAssoc($this->db->queryF($query, [ilDBConstants::T_INTEGER], [ilDclDatatype::INPUTFORMAT_DATETIME])) === null) {
82  $this->db->insert('il_dcl_datatype', [
84  'title' => [ilDBConstants::T_TEXT, 'datetime'],
85  'storage_location' => [ilDBConstants::T_INTEGER, 3],
86  'sort' => [ilDBConstants::T_INTEGER, 52],
87  ]);
88  }
89  if ($this->db->fetchAssoc($this->db->queryF($query, [ilDBConstants::T_INTEGER], [ilDclDatatype::INPUTFORMAT_DATETIME_SELECTION])) === null) {
90  $this->db->insert('il_dcl_datatype', [
92  'title' => [ilDBConstants::T_TEXT, 'datetime_selection'],
93  'storage_location' => [ilDBConstants::T_INTEGER, 1],
94  'sort' => [ilDBConstants::T_INTEGER, 54],
95  ]);
96  }
97  }
98 }
const INPUTFORMAT_TEXT_SELECTION
const INPUTFORMAT_DATE_SELECTION
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
const INPUTFORMAT_DATETIME_SELECTION