ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\User\Setup\DBUpdateSteps10 Class Reference
+ Inheritance diagram for ILIAS\User\Setup\DBUpdateSteps10:
+ Collaboration diagram for ILIAS\User\Setup\DBUpdateSteps10:

Public Member Functions

 prepare (\ilDBInterface $db)
 Prepare the execution of the steps. More...
 
 step_1 ()
 
 step_2 ()
 
 step_3 ()
 
 step_4 ()
 
 step_5 ()
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

Definition at line 25 of file DBUpdateSteps10.php.

Member Function Documentation

◆ prepare()

ILIAS\User\Setup\DBUpdateSteps10::prepare ( \ilDBInterface  $db)

Prepare the execution of the steps.

Do not use anything from the globals or the DIC inside your steps, only use the instance of the database provided here.

Implements ilDatabaseUpdateSteps.

Definition at line 29 of file DBUpdateSteps10.php.

References ILIAS\User\Setup\DBUpdateSteps10\$db.

29  : void
30  {
31  $this->db = $db;
32  }

◆ step_1()

ILIAS\User\Setup\DBUpdateSteps10::step_1 ( )

Definition at line 34 of file DBUpdateSteps10.php.

References ilDBConstants\T_TEXT.

34  : void
35  {
36  $this->db->manipulate(
37  'DELETE FROM usr_pref WHERE keyword = ' . $this->db->quote('hits_per_page', \ilDBConstants::T_TEXT)
38  );
39  $this->db->manipulate(
40  'DELETE FROM settings WHERE ' . $this->db->like('keyword', \ilDBConstants::T_TEXT, '%hits_per_page%')
41  );
42  }

◆ step_2()

ILIAS\User\Setup\DBUpdateSteps10::step_2 ( )

Definition at line 44 of file DBUpdateSteps10.php.

References ilDBConstants\T_INTEGER.

44  : void
45  {
46  if (!$this->db->tableColumnExists(ChangeMailTokenDBRepository::TABLE_NAME, 'usr_id')) {
47  $this->db->addTableColumn(
48  ChangeMailTokenDBRepository::TABLE_NAME,
49  'usr_id',
50  [
51  'type' => \ilDBConstants::T_INTEGER,
52  'notnull' => true,
53  'length' => 8
54  ]
55  );
56  }
57  if (!$this->db->tableColumnExists(ChangeMailTokenDBRepository::TABLE_NAME, 'status')) {
58  $this->db->addTableColumn(
59  ChangeMailTokenDBRepository::TABLE_NAME,
60  'status',
61  [
62  'type' => \ilDBConstants::T_INTEGER,
63  'notnull' => false,
64  'length' => 1
65  ]
66  );
67  }
68  if ($this->db->tableColumnExists(ChangeMailTokenDBRepository::TABLE_NAME, 'valid_until')) {
69  $this->db->renameTableColumn(
70  ChangeMailTokenDBRepository::TABLE_NAME,
71  'valid_until',
72  'created_ts'
73  );
74  }
75  if (!$this->db->primaryExistsByFields(ChangeMailTokenDBRepository::TABLE_NAME, ['token'])) {
76  $this->db->manipulate('DELETE token1 FROM ' . ChangeMailTokenDBRepository::TABLE_NAME . ' token1 '
77  . 'INNER JOIN ' . ChangeMailTokenDBRepository::TABLE_NAME . ' token2 '
78  . 'WHERE token1.token = token2.token AND token1.created_ts < token2.created_ts');
79  $this->db->addPrimaryKey(ChangeMailTokenDBRepository::TABLE_NAME, ['token']);
80  }
81  }

◆ step_3()

ILIAS\User\Setup\DBUpdateSteps10::step_3 ( )

Definition at line 83 of file DBUpdateSteps10.php.

References ILIAS\Repository\int(), null, ilSessionReminder\SUGGESTED_LEAD_TIME, ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

83  : void
84  {
85  $query = 'SELECT * FROM settings WHERE module = %s AND keyword = %s';
86  $result = $this->db->queryF(
87  $query,
89  ['common', 'session_reminder_enabled']
90  );
91  $session_reminder = $result->numRows() ? (bool) $this->db->fetchAssoc($result)['value'] : false;
92  $query = 'SELECT * FROM settings WHERE module = %s AND keyword = %s';
93  $result = $this->db->queryF(
94  $query,
96  ['common', 'session_reminder_lead_time']
97  );
98  $session_reminder_lead_time = $result->numRows() ? (int) $this->db->fetchAssoc($result)['value'] : null;
99  if ($session_reminder && !isset($session_reminder_lead_time)) {
100  $query = 'INSERT INTO settings (module, keyword, value) VALUES (%s, %s, %s)';
101  $this->db->manipulateF(
102  $query,
104  ['common', 'session_reminder_lead_time', \ilSessionReminder::SUGGESTED_LEAD_TIME]
105  );
106  }
107  $query = 'DELETE FROM settings WHERE module = %s AND keyword = %s';
108  $this->db->manipulateF(
109  $query,
111  ['common', 'session_reminder_enabled']
112  );
113  $query = 'DELETE FROM usr_pref WHERE keyword = %s';
114  $this->db->manipulateF(
115  $query,
117  ['session_reminder_enabled']
118  );
119  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ step_4()

ILIAS\User\Setup\DBUpdateSteps10::step_4 ( )

Definition at line 121 of file DBUpdateSteps10.php.

References $res, ilSecuritySettings\MAX_LOGIN_ATTEMPTS, ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

121  : void
122  {
123  $query = 'SELECT value FROM settings WHERE module = %s AND keyword = %s';
124  $res = $this->db->queryF(
125  $query,
127  ['common', 'ps_login_max_attempts']
128  );
129 
130  // We should adjust the usr_data values, even if the "Max. Login Attempts" are currently not set
131  $max_login_attempts = min(
132  (int) ($this->db->fetchAssoc($res)['value'] ?? \ilSecuritySettings::MAX_LOGIN_ATTEMPTS),
134  );
135 
136  $max_login_attempts_exceeded = $max_login_attempts + 1;
137 
138  $this->db->manipulateF(
139  'UPDATE usr_data SET login_attempts = %s WHERE login_attempts > %s',
141  [$max_login_attempts_exceeded, $max_login_attempts_exceeded]
142  );
143  }
$res
Definition: ltiservices.php:66

◆ step_5()

ILIAS\User\Setup\DBUpdateSteps10::step_5 ( )

Definition at line 145 of file DBUpdateSteps10.php.

References ilDBConstants\T_TEXT.

145  : void
146  {
147  if ($this->db->tableColumnExists('personal_clipboard', 'title')) {
148  $this->db->modifyTableColumn('personal_clipboard', 'title', [
149  'type' => \ilDBConstants::T_TEXT,
150  'length' => 255,
151  'notnull' => false
152  ]);
153  }
154  }

Field Documentation

◆ $db

ilDBInterface ILIAS\User\Setup\DBUpdateSteps10::$db
protected

Definition at line 27 of file DBUpdateSteps10.php.

Referenced by ILIAS\User\Setup\DBUpdateSteps10\prepare().


The documentation for this class was generated from the following file: