ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Chatroom\Setup\UpdateSteps Class Reference
+ Inheritance diagram for ILIAS\Chatroom\Setup\UpdateSteps:
+ Collaboration diagram for ILIAS\Chatroom\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\Chatroom\Setup\UpdateSteps::dropColumnWhenExists ( string  $table,
string  $column 
)
private

Definition at line 99 of file UpdateSteps.php.

99 : void
100 {
101 if ($this->db->tableColumnExists($table, $column)) {
102 $this->db->dropTableColumn($table, $column);
103 }
104 }

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

+ Here is the caller graph for this function:

◆ dropTableWhenExists()

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

Definition at line 106 of file UpdateSteps.php.

106 : void
107 {
108 if ($this->db->tableExists($table)) {
109 $this->db->dropTable($table);
110 }
111 }

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

+ Here is the caller graph for this function:

◆ prepare()

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

Definition at line 31 of file UpdateSteps.php.

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

References ILIAS\Chatroom\Setup\UpdateSteps\$db.

◆ step_1()

ILIAS\Chatroom\Setup\UpdateSteps::step_1 ( )

Definition at line 36 of file UpdateSteps.php.

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

References ILIAS\Chatroom\Setup\UpdateSteps\dropColumnWhenExists().

+ Here is the call graph for this function:

◆ step_2()

ILIAS\Chatroom\Setup\UpdateSteps::step_2 ( )

Definition at line 47 of file UpdateSteps.php.

47 : void
48 {
49 $this->dropTableWhenExists('chatroom_smilies');
50 }

References ILIAS\Chatroom\Setup\UpdateSteps\dropTableWhenExists().

+ Here is the call graph for this function:

◆ step_3()

ILIAS\Chatroom\Setup\UpdateSteps::step_3 ( )

Definition at line 52 of file UpdateSteps.php.

52 : void
53 {
54 $this->dropColumnWhenExists('chatroom_settings', 'restrict_history');
55 }

References ILIAS\Chatroom\Setup\UpdateSteps\dropColumnWhenExists().

+ Here is the call graph for this function:

◆ step_4()

ILIAS\Chatroom\Setup\UpdateSteps::step_4 ( )

Definition at line 57 of file UpdateSteps.php.

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 }

References ilDBConstants\T_TEXT.

◆ step_5()

ILIAS\Chatroom\Setup\UpdateSteps::step_5 ( )

Definition at line 73 of file UpdateSteps.php.

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 }

References ILIAS\Chatroom\Setup\UpdateSteps\dropTableWhenExists().

+ Here is the call graph for this function:

◆ step_6()

ILIAS\Chatroom\Setup\UpdateSteps::step_6 ( )

Definition at line 79 of file UpdateSteps.php.

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 }

References ilDBConstants\T_TEXT.

Field Documentation

◆ $db

ilDBInterface ILIAS\Chatroom\Setup\UpdateSteps::$db
protected

Definition at line 29 of file UpdateSteps.php.

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


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