ILIAS  release_8 Revision v8.24
ilNotificationUpdateSteps.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24{
25 protected ilDBInterface $db;
26
27 public function prepare(ilDBInterface $db): void
28 {
29 $this->db = $db;
30 }
31
32 public function step_1(): void
33 {
34 // Creation of administration node forced by \ilTreeAdminNodeAddedObjective
35 }
36
37 public function step_2(): void
38 {
39 $this->db->manipulateF(
40 'DELETE FROM settings WHERE module = %s AND keyword = %s',
41 ['text', 'text'],
42 ['notifications', 'enable_mail']
43 );
44 $this->db->manipulateF(
45 'UPDATE settings SET keyword = %s WHERE module = %s AND keyword = %s',
46 ['text', 'text', 'text'],
47 ['osd_interval', 'notifications', 'osd_polling_intervall']
48 );
49 $this->db->manipulateF(
50 'UPDATE settings SET module = %s, keyword = %s WHERE module = %s AND keyword = %s',
51 ['text', 'text', 'text', 'text'],
52 ['notifications', 'play_sound', 'chatroom', 'play_invitation_sound']
53 );
54 $this->db->manipulateF(
55 'UPDATE usr_pref SET keyword = %s WHERE keyword = %s',
56 ['text', 'text'],
57 ['play_sound', 'chat_play_invitation_sound']
58 );
59 }
60
61 public function step_3(): void
62 {
63 $this->db->manipulateF('DELETE FROM notification_usercfg WHERE module = %s', ['text'], ['osd_main']);
64 ilNotificationSetupHelper::registerType(
65 $this->db,
66 'buddysystem_request',
67 'buddysystem_request',
68 'buddysystem_request_desc',
69 'contact',
70 'set_by_admin'
71 );
72 }
73
74 public function step_4(): void
75 {
76 ilNotificationSetupHelper::registerType(
77 $this->db,
78 'who_is_online',
79 'who_is_online',
80 'who_is_online_desc',
81 'user',
82 'set_by_admin'
83 );
84 $this->db->insert(
85 'notification_usercfg',
86 [
87 'usr_id' => ['integer', -1],
88 'module' => ['text', 'who_is_online'],
89 'channel' => ['text', 'osd']
90 ]
91 );
92 $this->db->manipulateF(
93 'UPDATE notification_osd SET type = %s WHERE type = %s AND serialized LIKE %s',
94 ['text', 'text', 'text'],
95 ['who_is_online', 'osd_main', '%icon_usr.svg%']
96 );
97 }
98
99 public function step_5(): void
100 {
101 ilNotificationSetupHelper::registerType(
102 $this->db,
103 'badge_received',
104 'badge_received',
105 'badge_received_desc',
106 'achievement',
107 'set_by_admin'
108 );
109 $this->db->insert(
110 'notification_usercfg',
111 [
112 'usr_id' => ['integer', -1],
113 'module' => ['text', 'badge_received'],
114 'channel' => ['text', 'osd']
115 ]
116 );
117 $this->db->manipulateF(
118 'UPDATE notification_osd SET type = %s WHERE type = %s AND serialized LIKE %s',
119 ['text', 'text', 'text'],
120 ['badge_received', 'osd_main', '%icon_bdga.svg%']
121 );
122 }
123
124 public function step_6(): void
125 {
126 $this->db->insert('settings', [
127 'module' => ['text', 'notifications'],
128 'keyword' => ['text', 'osd_vanish'],
129 'value' => ['integer', 5]
130 ]);
131 $this->db->insert('settings', [
132 'module' => ['text', 'notifications'],
133 'keyword' => ['text', 'osd_delay'],
134 'value' => ['integer', 500]
135 ]);
136 }
137
138 public function step_7(): void
139 {
140 $this->db->insert('settings', [
141 'module' => ['text', 'notifications'],
142 'keyword' => ['text', 'enable_mail'],
143 'value' => ['text', '1']
144 ]);
145 }
146
147 public function step_8(): void
148 {
149 $this->db->addIndex('notification_osd', ['usr_id', 'type', 'time_added'], 'i1');
150 }
151
152 public function step_9(): void
153 {
154 $this->db->manipulateF(
155 "UPDATE settings SET value = CONCAT(value , '000') WHERE keyword = %s",
156 ['text'],
157 ['osd_interval']
158 );
159 $this->db->manipulateF(
160 "UPDATE settings SET value = CONCAT(value , '000') WHERE keyword = %s",
161 ['text'],
162 ['osd_vanish']
163 );
164 $this->db->manipulateF(
165 'UPDATE usr_pref SET keyword = %s WHERE keyword = %s',
166 ['text', 'text'],
167 ['osd_play_sound', 'play_sound']
168 );
169
170 }
171
172 public function step_10(): void
173 {
174 if (!$this->db->tableColumnExists('notification_osd', 'identification')) {
175 $this->db->addTableColumn('notification_osd', 'identification', [
176 'type' => 'text',
177 'length' => 255,
178 'notnull' => true,
179 'default' => ''
180 ]);
181 }
182
183 $this->db->manipulate('TRUNCATE TABLE notification_osd');
184 }
185
186 public function step_11(): void
187 {
188 $this->db->manipulateF(
189 'DELETE FROM settings WHERE module = %s AND keyword = %s',
190 ['text', 'text'],
191 ['notifications', 'enable_mail']
192 );
193 $this->db->insert('settings', [
194 'module' => ['text', 'notifications'],
195 'keyword' => ['text', 'enable_mail'],
196 'value' => ['text', '1']
197 ]);
198 }
199}
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...