ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
DB100.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
27{
28 private ?\ilDBInterface $db = null;
29
30 public function prepare(\ilDBInterface $db): void
31 {
32 $this->db = $db;
33 }
34
35 public function step_1(): void
36 {
37 if ($this->db->tableExists('gs_footer_items')) {
38 $this->db->dropTable('gs_footer_items'); //
39 }
40 }
41
42 public function step_2(): void
43 {
44 if ($this->db->tableExists('gs_footer_items')) {
45 return;
46 }
47 $this->db->createTable(
48 'gs_footer_items',
49 [
50 'id' => ['type' => 'text', 'length' => 255, 'notnull' => true],
51 'type' => ['type' => 'integer', 'length' => 1, 'notnull' => true],
52 'title' => ['type' => 'text', 'length' => 4000, 'notnull' => true],
53 'position' => ['type' => 'integer', 'length' => 4, 'notnull' => true],
54 'is_active' => ['type' => 'integer', 'length' => 1, 'notnull' => true],
55 'parent' => ['type' => 'text', 'length' => 255, 'notnull' => false],
56 'action' => ['type' => 'text', 'length' => 4000, 'notnull' => false],
57 'external' => ['type' => 'integer', 'length' => 1, 'notnull' => false],
58 'core' => ['type' => 'integer', 'length' => 1, 'notnull' => true],
59 ]
60 );
61 }
62
63 public function step_3(): void
64 {
65 if ($this->db->tableExists('gs_item_translation')) {
66 return;
67 }
68 $this->db->createTable(
69 'gs_item_translation',
70 [
71 'id' => ['type' => 'text', 'length' => 255, 'notnull' => true],
72 'language_code' => ['type' => 'text', 'length' => 4, 'notnull' => true],
73 'translation' => ['type' => 'text', 'length' => 4000, 'notnull' => true],
74 'status' => ['type' => 'integer', 'length' => 1, 'notnull' => true, 'default' => 0],
75 ]
76 );
77 $this->db->addPrimaryKey('gs_item_translation', ['id', 'language_code']);
78 }
79
80 public function step_4(): void
81 {
82 if (!$this->db->primaryExistsByFields('gs_footer_items', ['id'])) {
83 $this->db->addPrimaryKey('gs_footer_items', ['id']);
84 }
85 }
86
87 public function step_5(): void
88 {
89 $initial_setup = "INSERT INTO gs_footer_items
90 (id, type, title, position, is_active, parent, action, external, core)
91VALUES
92 ('ilAccessibilitySupportFooterProvider|accessibility', 1, 'Accessibility', 10, 1, NULL, NULL, NULL, 1),
93 ('ilAccessibilitySupportFooterProvider|accessibility_control', 2, 'Accessibility', 0, 1, 'ilAccessibilitySupportFooterProvider|accessibility', 'ilias.php?baseClass=ilaccessibilitycontrolconceptgui', 0, 1),
94 ('ilFooterStandardGroupsProvider|imprint', 2, 'Legal Notice', 0, 1, 'ilFooterStandardGroupsProvider|legal_information', 'http://10.ilias.localhost/go/impr/0', 0, 1),
95 ('ilFooterStandardGroupsProvider|legal_information', 1, 'Legal Information', 20, 1, NULL, NULL, NULL, 1),
96 ('ilFooterStandardGroupsProvider|services', 1, 'Services', 40, 1, NULL, NULL, NULL, 1),
97 ('ilFooterStandardGroupsProvider|support', 1, 'Support', 30, 1, NULL, NULL, NULL, 1)
98ON DUPLICATE KEY UPDATE
99 type = VALUES(type),
100 title = VALUES(title),
101 position = VALUES(position),
102 is_active = VALUES(is_active),
103 parent = VALUES(parent),
104 action = VALUES(action),
105 external = VALUES(external),
106 core = VALUES(core);";
107
108 $this->db->manipulate($initial_setup);
109 }
110}
prepare(\ilDBInterface $db)
Prepare the execution of the steps.
Definition: DB100.php:30
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...