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

Public Member Functions

 prepare (ilDBInterface $db)
 
 step_1 ()
 
 step_2 ()
 
 step_3 ()
 
 step_4 ()
 
 step_5 ()
 
 step_6 ()
 
- Public Member Functions inherited from ilDatabaseUpdateSteps
 prepare (\ilDBInterface $db)
 Prepare the execution of the steps. More...
 

Protected Attributes

ilDBInterface $db
 

Private Member Functions

 dropColumnWhenExists (string $table, string $column)
 
 dropTableWhenExists (string $table)
 

Detailed Description

Definition at line 27 of file UpdateSteps.php.

Member Function Documentation

◆ dropColumnWhenExists()

ILIAS\Setup\UpdateSteps::dropColumnWhenExists ( string  $table,
string  $column 
)
private

Definition at line 99 of file UpdateSteps.php.

Referenced by ILIAS\Setup\UpdateSteps\step_1(), and ILIAS\Setup\UpdateSteps\step_3().

99  : void
100  {
101  if ($this->db->tableColumnExists($table, $column)) {
102  $this->db->dropTableColumn($table, $column);
103  }
104  }
+ Here is the caller graph for this function:

◆ dropTableWhenExists()

ILIAS\Setup\UpdateSteps::dropTableWhenExists ( string  $table)
private

Definition at line 106 of file UpdateSteps.php.

Referenced by ILIAS\Setup\UpdateSteps\step_2(), and ILIAS\Setup\UpdateSteps\step_5().

106  : void
107  {
108  if ($this->db->tableExists($table)) {
109  $this->db->dropTable($table);
110  }
111  }
+ Here is the caller graph for this function:

◆ prepare()

ILIAS\Setup\UpdateSteps::prepare ( ilDBInterface  $db)

Definition at line 31 of file UpdateSteps.php.

References ILIAS\Setup\UpdateSteps\$db.

31  : void
32  {
33  $this->db = $db;
34  }

◆ step_1()

ILIAS\Setup\UpdateSteps::step_1 ( )

Definition at line 36 of file UpdateSteps.php.

References ILIAS\Setup\UpdateSteps\dropColumnWhenExists().

36  : void
37  {
38  $this->db->dropTable('chatroom_prooms', false);
39  $this->db->dropTable('chatroom_proomaccess', false);
40  $this->db->dropTable('chatroom_psessions', false);
41 
42  $this->dropColumnWhenExists('chatroom_history', 'sub_room');
43  $this->dropColumnWhenExists('chatroom_settings', 'allow_private_rooms');
44  $this->dropColumnWhenExists('chatroom_settings', 'private_rooms_enabled');
45  }
dropColumnWhenExists(string $table, string $column)
Definition: UpdateSteps.php:99
+ Here is the call graph for this function:

◆ step_2()

ILIAS\Setup\UpdateSteps::step_2 ( )

Definition at line 47 of file UpdateSteps.php.

References ILIAS\Setup\UpdateSteps\dropTableWhenExists().

47  : void
48  {
49  $this->dropTableWhenExists('chatroom_smilies');
50  }
dropTableWhenExists(string $table)
+ Here is the call graph for this function:

◆ step_3()

ILIAS\Setup\UpdateSteps::step_3 ( )

Definition at line 52 of file UpdateSteps.php.

References ILIAS\Setup\UpdateSteps\dropColumnWhenExists().

52  : void
53  {
54  $this->dropColumnWhenExists('chatroom_settings', 'restrict_history');
55  }
dropColumnWhenExists(string $table, string $column)
Definition: UpdateSteps.php:99
+ Here is the call graph for this function:

◆ step_4()

ILIAS\Setup\UpdateSteps::step_4 ( )

Definition at line 57 of file UpdateSteps.php.

References ilDBConstants\T_TEXT.

57  : void
58  {
59  $query = '
60  UPDATE object_data
61  INNER JOIN chatroom_settings ON object_data.obj_id = chatroom_settings.object_id
62  SET object_data.offline = IF(chatroom_settings.online_status = 1, 0, 1)
63  WHERE object_data.type = %s
64  ';
65 
66  $this->db->manipulateF(
67  $query,
69  ['chtr']
70  );
71  }

◆ step_5()

ILIAS\Setup\UpdateSteps::step_5 ( )

Definition at line 73 of file UpdateSteps.php.

References ILIAS\Setup\UpdateSteps\dropTableWhenExists().

73  : void
74  {
75  $this->dropTableWhenExists('chatroom_uploads');
76  $this->db->manipulate('DELETE FROM chatroom_bans WHERE user_id NOT IN (SELECT usr_id FROM usr_data)');
77  }
dropTableWhenExists(string $table)
+ Here is the call graph for this function:

◆ step_6()

ILIAS\Setup\UpdateSteps::step_6 ( )

Definition at line 79 of file UpdateSteps.php.

References ilDBConstants\T_TEXT.

79  : void
80  {
81  $replace = [
82  '&lt;' => '<',
83  '&gt;' => '>',
84  '&amp;' => '&',
85  '&quot;' => '"',
86  ];
87 
88  $s = 'JSON_VALUE(message, "$.content")';
89  foreach ($replace as $from => $to) {
90  $s = sprintf('REPLACE(%s, %s, %s)', $s, $this->db->quote($from, ilDBConstants::T_TEXT), $this->db->quote($to, ilDBConstants::T_TEXT));
91  }
92 
93  $this->db->manipulate(
94  'UPDATE chatroom_history SET message = JSON_SET(message, "$.content", ' . $s . ') ' .
95  'WHERE JSON_VALID(message) = 1 AND JSON_VALUE(message, "$.type") = ' . $this->db->quote('message', ilDBConstants::T_TEXT)
96  );
97  }

Field Documentation

◆ $db

ilDBInterface ILIAS\Setup\UpdateSteps::$db
protected

Definition at line 29 of file UpdateSteps.php.

Referenced by ILIAS\Setup\UpdateSteps\prepare().


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