ILIAS  release_8 Revision v8.24
class.ilUser8DBUpdateSteps.php
Go to the documentation of this file.
1<?php
2
19declare(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 $this->db->modifyTableColumn(
33 'usr_session',
34 'session_id',
35 [
36 'type' => ilDBConstants::T_TEXT,
37 'length' => '256'
38 ]
39 );
40 $this->db->modifyTableColumn(
41 'usr_session_stats_raw',
42 'session_id',
43 [
44 'type' => ilDBConstants::T_TEXT,
45 'length' => '256'
46 ]
47 );
48 try {
49 $this->db->modifyTableColumn(
50 'usr_sess_istorage',
51 'session_id',
52 [
53 'type' => ilDBConstants::T_TEXT,
54 'length' => '256'
55 ]
56 );
57 } catch (\Exception $e) {
58 $message = "DB Hotfix 102: \n\n"
59 . "We could not Update the length of the column `session_id` in the table\n"
60 . "`usr_session_istorage` as the table engine is MyIsam.\n"
61 . "This step will be finished after updating to ILIAS 8.\n"
62 . "You could also lengthen the field manually after you ran the migration\n"
63 . "to migrate to InnoDB, if you require longer session_ids.";
64 global $ilLog;
65 $ilLog->warning($message);
66 }
67 }
68 public function step_2(): void
69 {
70 $this->db->modifyTableColumn(
71 'usr_data',
72 'time_limit_from',
73 [
75 'length' => '8'
76 ]
77 );
78 $this->db->modifyTableColumn(
79 'usr_data',
80 'time_limit_until',
81 [
83 'length' => '8'
84 ]
85 );
86 }
87
88 public function step_3(): void
89 {
90 if (!$this->db->tableExists('usr_change_email_token')) {
91 $this->db->createTable(
92 'usr_change_email_token',
93 [
94 'token' => [
95 'type' => 'text',
96 'length' => 32
97 ],
98 'new_email' => [
99 'type' => 'text',
100 'length' => 256
101 ],
102 'valid_until' => [
103 'type' => 'integer',
104 'length' => 8
105 ]
106 ]
107 );
108 }
109 }
110
111 public function step_4(): void
112 {
113 if ($this->db->tableColumnExists('usr_data', 'street')) {
114 $this->db->modifyTableColumn('usr_data', 'street', [
115 'type' => \ilDBConstants::T_TEXT,
116 'length' => 512,
117 'notnull' => false
118 ]);
119 }
120 }
121
122 public function step_5(): void
123 {
124 if (!$this->db->indexExistsByFields('usr_change_email_token', ['token'])) {
125 $this->db->manipulate('DELETE token1 FROM usr_change_email_token token1 '
126 . 'INNER JOIN usr_change_email_token token2 '
127 . 'WHERE token1.token = token2.token AND token1.valid_until < token2.valid_until');
128 $this->db->addPrimaryKey('usr_change_email_token', ['token']);
129 }
130 }
131
132 public function step_6(): void
133 {
134 if ($this->db->tableColumnExists('personal_clipboard', 'title')) {
135 $this->db->modifyTableColumn('personal_clipboard', 'title', [
136 'type' => \ilDBConstants::T_TEXT,
137 'length' => 255,
138 'notnull' => false
139 ]);
140 }
141 }
142}
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$message
Definition: xapiexit.php:32