ILIAS  release_8 Revision v8.24
class.ilSkillDBUpdateSteps.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
23{
24 protected \ilDBInterface $db;
25
26 public function prepare(\ilDBInterface $db): void
27 {
28 $this->db = $db;
29 }
30
31 public function step_1(): void
32 {
33 if ($this->db->sequenceExists('skl_self_eval')) {
34 $this->db->dropSequence('skl_self_eval');
35 }
36
37 if ($this->db->tableExists('skl_self_eval')) {
38 $this->db->dropTable('skl_self_eval');
39 }
40
41 if ($this->db->tableExists('skl_self_eval_level')) {
42 $this->db->dropTable('skl_self_eval_level');
43 }
44 }
45
46 public function step_2(): void
47 {
48 if (!$this->db->tableColumnExists('skl_user_skill_level', 'trigger_user_id')) {
49 $this->db->addTableColumn(
50 'skl_user_skill_level',
51 'trigger_user_id',
52 array(
53 'type' => 'text',
54 'notnull' => true,
55 'length' => 20,
56 'default' => "-"
57 )
58 );
59 }
60 }
61
62 public function step_3(): void
63 {
64 if (!$this->db->tableColumnExists('skl_user_has_level', 'trigger_user_id')) {
65 $this->db->addTableColumn(
66 'skl_user_has_level',
67 'trigger_user_id',
68 array(
69 'type' => 'text',
70 'notnull' => true,
71 'length' => 20,
72 'default' => "-"
73 )
74 );
75 }
76 }
77
78 public function step_4(): void
79 {
80 // moved to ilSkillSetupAgent using Objectives
81 }
82
83 public function step_5(): void
84 {
85 // moved to ilSkillSetupAgent using Objectives
86 }
87
88 public function step_6(): void
89 {
90 $this->db->update(
91 "object_data",
92 [
93 "title" => ["text", "Default"],
94 "description" => ["text", ""]
95 ],
96 [ // where
97 "type" => ["text", "skee"],
98 "title" => ["text", "Skill Tree"]
99 ]
100 );
101 }
102
103 public function step_7(): void
104 {
105 $set = $this->db->queryF(
106 "SELECT * FROM object_data " .
107 " WHERE type = %s AND title = %s",
108 ["string", "string"],
109 ["skee", "Default"]
110 );
111 $rec = $this->db->fetchAssoc($set);
112
113 $this->db->update(
114 "skl_tree",
115 [
116 "skl_tree_id" => ["integer", $rec["obj_id"]]
117 ],
118 [ // where
119 "skl_tree_id" => ["integer", 1]
120 ]
121 );
122 }
123
124 public function step_8(): void
125 {
126 if (!$this->db->tableColumnExists("skl_profile", "skill_tree_id")) {
127 $this->db->addTableColumn("skl_profile", "skill_tree_id", array(
128 "type" => "integer",
129 "notnull" => true,
130 "default" => 0,
131 "length" => 4
132 ));
133 }
134 }
135
136 public function step_9(): void
137 {
138 $set = $this->db->queryF(
139 "SELECT * FROM object_data " .
140 " WHERE type = %s AND title = %s",
141 ["string", "string"],
142 ["skee", "Default"]
143 );
144 $rec = $this->db->fetchAssoc($set);
145
146 $this->db->update(
147 "skl_profile",
148 [
149 "skill_tree_id" => ["integer", $rec["obj_id"]]
150 ],
151 [ // where
152 "skill_tree_id" => ["integer", 0]
153 ]
154 );
155 }
156
157 public function step_10(): void
158 {
159 if (!$this->db->tableColumnExists("skl_profile", "image_id")) {
160 $this->db->addTableColumn("skl_profile", "image_id", array(
161 "type" => "text",
162 "notnull" => true,
163 "length" => 4000
164 ));
165 }
166 }
167
168 public function step_11(): void
169 {
170 if (!$this->db->tableExists("skl_profile_completion")) {
171 $fields = [
172 "profile_id" => [
173 "type" => "integer",
174 "length" => 4,
175 "notnull" => true
176 ],
177 "user_id" => [
178 "type" => "integer",
179 "length" => 4,
180 "notnull" => true
181 ],
182 "date" => [
183 "type" => "timestamp",
184 "notnull" => true
185 ],
186 "fulfilled" => [
187 "type" => "integer",
188 "length" => 1,
189 "notnull" => true
190 ]
191 ];
192 $this->db->createTable("skl_profile_completion", $fields);
193 $this->db->addPrimaryKey("skl_profile_completion", ["profile_id", "user_id", "date"]);
194 }
195 }
196}
return true
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
prepare(\ilDBInterface $db)
Prepare the execution of the steps.
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...