19declare(strict_types=1);
28 private \ilDBInterface
$db;
34 $this->uuid_factory =
new UUIDFactory();
41 if ($this->db->fetchObject(
43 "SELECT COUNT(*) cnt FROM settings WHERE module = 'common' AND keyword='{$keyword}'"
71 if (!$this->db->tableColumnExists(
'mail_template',
'att_rid')) {
72 $this->db->addTableColumn(
85 if ($this->db->tableExists(
'usr_data_multi')
86 && !$this->db->tableExists(
'usr_profile_data')) {
87 $this->db->renameTable(
92 if ($this->db->tableExists(
'usr_profile_data')) {
95 if ($this->db->sequenceExists(
'usr_profile_data')) {
96 $this->db->dropSequence(
'usr_profile_data');
98 if ($this->db->tableExists(
'usr_profile_data')
99 && $this->db->tableColumnExists(
'usr_profile_data',
'id')) {
100 $this->db->dropTableColumn(
'usr_profile_data',
'id');
102 if ($this->db->tableExists(
'usr_profile_data')
103 && !$this->db->indexExistsByFields(
'usr_profile_data', [
'usr_id',
'field_id'])) {
104 $this->db->addIndex(
'usr_profile_data', [
'usr_id',
'field_id'],
'uf');
110 if ($this->db->tableExists(
'udf_data')) {
111 $this->db->dropTable(
'udf_data');
114 if ($this->db->sequenceExists(
'udf_definition')) {
119 $this->db->modifyTableColumn(
'ldap_attribute_mapping',
'keyword', [
'length' => 68]);
120 $this->db->modifyTableColumn(
'settings',
'keyword', [
'length' => 74]);
122 $this->db->renameTableColumn(
'udf_definition',
'field_id',
'old_field_id');
123 $this->db->manipulate(
'ALTER TABLE udf_definition ADD COLUMN field_id VARCHAR(64) NOT NULL FIRST');
124 $this->db->modifyTableColumn(
'udf_clob',
'field_id', [
'type' =>
'text',
'length' => 64]);
125 $this->db->modifyTableColumn(
'udf_text',
'field_id', [
'type' =>
'text',
'length' => 64]);
126 $fields_query = $this->db->query(
'SELECT old_field_id FROM udf_definition');
127 while (($row = $this->db->fetchObject($fields_query))) {
128 $uuid = $this->uuid_factory->uuid4AsString();
129 $this->db->manipulate(
130 "UPDATE udf_definition SET field_id = '{$uuid}' WHERE old_field_id = '{$row->old_field_id}'"
132 $this->db->manipulate(
133 "UPDATE udf_clob SET field_id = '{$uuid}' WHERE field_id = '{$row->old_field_id}'"
135 $this->db->manipulate(
136 "UPDATE udf_text SET field_id = '{$uuid}' WHERE field_id = '{$row->old_field_id}'"
138 $this->db->manipulate(
139 "UPDATE ldap_attribute_mapping SET keyword = 'udf_{$uuid}' WHERE keyword = 'udf_{$row->old_field_id}'"
141 $this->db->manipulate(
142 "UPDATE settings SET keyword = 'pmap_udf_{$uuid}' WHERE keyword = 'pmap_udf_{$row->old_field_id}'"
144 $this->db->manipulate(
145 "UPDATE settings SET keyword = 'pumap_udf_{$uuid}' WHERE keyword = 'pumap_udf_{$row->old_field_id}'"
148 $this->db->dropTableColumn(
'udf_definition',
'old_field_id');
149 $this->db->addPrimaryKey(
'udf_definition', [
'field_id']);
150 $this->db->dropSequence(
'udf_definition');
156 if ($this->db->tableExists(
'udf_text')) {
157 $this->db->manipulate(
'INSERT INTO usr_profile_data SELECT * FROM udf_text');
158 $this->db->dropTable(
'udf_text');
161 if ($this->db->tableExists(
'udf_clob')) {
162 $this->db->manipulate(
'INSERT INTO usr_profile_data SELECT * FROM udf_clob');
163 $this->db->dropTable(
'udf_clob');
169 if (!$this->db->tableExists(
'usr_field_config')) {
170 $this->db->createTable(
178 'visible_in_registration' => [
183 'visible_to_user' => [
188 'visible_in_lua' => [
193 'visible_in_crss' => [
198 'visible_in_grps' => [
203 'visible_in_prgs' => [
208 'changeable_by_user' => [
213 'changeable_in_lua' => [
233 'available_in_certs' => [
240 $this->db->addPrimaryKey(
'usr_field_config', [
'field_id']);
264 $this->db->modifyTableColumn(
321 if (!$this->db->tableColumnExists(
'udf_definition',
'section')) {
322 $this->db->addTableColumn(
337 if ($this->db->fetchObject(
339 'SELECT COUNT(*) cnt FROM settings WHERE module = "common"' . PHP_EOL
340 .
'AND keyword="usr_settings_changeable_by_user_new_mail_notification"'
344 $this->db->manipulate(
345 'INSERT INTO settings (module, keyword, value) VALUES '
346 .
'("common", "usr_settings_changeable_by_user_new_mail_notification", "1"), '
347 .
'("common", "usr_settings_changeable_lua_new_mail_notification", "1"), '
348 .
'("common", "usr_settings_export_new_mail_notification", "1")'
353 'hide_own_online_status' =>
'awrn_user_show',
354 'bs_allow_to_contact_me' =>
'allow_contact_request',
355 'mail_incoming_mail' =>
'incoming_mail',
356 'skin_style' =>
'style',
357 'upload' =>
'avatar',
358 'sel_country' =>
'selcountry',
359 'country' =>
'old_country',
360 'selcountry' =>
'country'
363 foreach ($renamed_fields as $old_id => $new_id) {
364 $settings_query = $this->db->query(
365 "SELECT keyword FROM settings WHERE {$this->db->like('keyword', \ilDBConstants::T_TEXT, "%_{$old_id}
")}"
367 while (($row = $this->db->fetchObject($settings_query)) !==
null) {
368 if ($row->keyword ===
'admin_country') {
376 str_replace(
"_{$old_id}",
"_{$new_id}", $row->keyword)
392 $user_query = $this->db->query(
393 "SELECT DISTINCT keyword FROM usr_pref WHERE {$this->db->like('keyword', \ilDBConstants::T_TEXT, "%_{$old_id}
")}"
395 while (($row = $this->db->fetchObject($user_query)) !==
null) {
401 str_replace(
"_{$old_id}",
"_{$new_id}", $row->keyword)
417 $query = $this->db->query(
418 "SELECT usr_id, keyword FROM usr_pref WHERE {$this->db->like('keyword', \ilDBConstants::T_TEXT, 'public_udf_&')}"
420 while (($row = $this->db->fetchObject($query)) !==
null) {
426 str_replace(
'public_udf_',
'public_', $row[
'keyword'])
445 if ($this->db->tableColumnExists(
'usr_data',
'time_limit_message')) {
446 $this->db->dropTableColumn(
'usr_data',
'time_limit_message');
449 if ($this->db->tableColumnExists(
'usr_data',
'sel_country')) {
450 $this->db->renameTableColumn(
'usr_data',
'country',
'old_country');
451 $this->db->renameTableColumn(
'usr_data',
'sel_country',
'country');
457 $this->db->modifyTableColumn(
'usr_pref',
'keyword', [
'length' => 74]);
462 if ($this->db->fetchObject(
464 'SELECT COUNT(*) cnt FROM settings WHERE module = "common"' . PHP_EOL
465 .
'AND keyword="usr_settings_changeable_by_user_starting_point"'
474 'usr_settings_changeable_by_user_starting_point'
484 'usr_starting_point_personal'
489 $this->db->manipulate(
490 'DELETE FROM settings WHERE module = "common" AND keyword= "usr_starting_point_personal"'
494 $this->insertSetting(
'usr_settings_changeable_lua_starting_point',
'1');
495 $this->insertSetting(
'usr_settings_export_starting_point',
'1');
503 $this->insertSetting(
"usr_settings_changeable_by_user_{$setting}",
'1');
504 $this->insertSetting(
"usr_settings_changeable_lua_{$setting}",
'1');
505 $this->insertSetting(
"usr_settings_export_{$setting}",
'1');
UUIDFactory $uuid_factory
prepare(\ilDBInterface $db)
Prepare the execution of the steps.
insertSetting(string $keyword, string $value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
if(!file_exists('../ilias.ini.php'))