Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 19 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
hidpi_icons | |
0.00% |
0 / 19 |
|
0.00% |
0 / 5 |
56 | |
0.00% |
0 / 1 |
depends_on | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
update_data | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
revert_data | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
gif_to_svg_icons | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
6 | |||
svg_to_gif_icons | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | /** |
3 | * |
4 | * This file is part of the phpBB Forum Software package. |
5 | * |
6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
7 | * @license GNU General Public License, version 2 (GPL-2.0) |
8 | * |
9 | * For full copyright and license information, please see |
10 | * the docs/CREDITS.txt file. |
11 | * |
12 | */ |
13 | |
14 | namespace phpbb\db\migration\data\v400; |
15 | |
16 | use phpbb\db\migration\migration; |
17 | |
18 | class hidpi_icons extends migration |
19 | { |
20 | private array $default_icons = [ |
21 | 'misc/fire', |
22 | 'misc/heart', |
23 | 'misc/radioactive', |
24 | 'misc/star', |
25 | 'misc/thinking', |
26 | 'smile/alert', |
27 | 'smile/info', |
28 | 'smile/mrgreen', |
29 | 'smile/question', |
30 | 'smile/redface', |
31 | ]; |
32 | |
33 | public static function depends_on(): array |
34 | { |
35 | return [ |
36 | '\phpbb\db\migration\data\v400\dev' |
37 | ]; |
38 | } |
39 | |
40 | public function update_data(): array |
41 | { |
42 | return [ |
43 | ['custom', [[$this, 'gif_to_svg_icons']]], |
44 | ]; |
45 | } |
46 | |
47 | public function revert_data(): array |
48 | { |
49 | return [ |
50 | ['custom', [[$this, 'svg_to_gif_icons']]], |
51 | ]; |
52 | } |
53 | |
54 | public function gif_to_svg_icons(): void |
55 | { |
56 | foreach ($this->default_icons as $smiley) |
57 | { |
58 | $sql = 'UPDATE ' . $this->tables['icons'] . " |
59 | SET icons_url = '" . $this->db->sql_escape($smiley) . ".svg' |
60 | WHERE icons_url = '" . $this->db->sql_escape($smiley) . ".gif'"; |
61 | $this->db->sql_query($sql); |
62 | } |
63 | } |
64 | |
65 | public function svg_to_gif_icons(): void |
66 | { |
67 | foreach ($this->default_icons as $smiley) |
68 | { |
69 | $sql = 'UPDATE ' . $this->tables['icons'] . " |
70 | SET icons_url = '" . $this->db->sql_escape($smiley) . ".gif' |
71 | WHERE icons_url = '" . $this->db->sql_escape($smiley) . ".svg'"; |
72 | $this->db->sql_query($sql); |
73 | } |
74 | } |
75 | } |