Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 12 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
remove_remote_avatar | |
0.00% |
0 / 12 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
depends_on | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
update_data | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
remove_remote_avatars | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 |
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\container_aware_migration; |
17 | |
18 | class remove_remote_avatar extends container_aware_migration |
19 | { |
20 | public static function depends_on() |
21 | { |
22 | return ['\phpbb\db\migration\data\v400\dev']; |
23 | } |
24 | |
25 | public function update_data() |
26 | { |
27 | return [ |
28 | ['config.remove', ['allow_avatar_remote']], |
29 | ['config.remove', ['allow_avatar_remote_upload']], |
30 | ['custom', [[$this, 'remove_remote_avatars']]], |
31 | ]; |
32 | } |
33 | |
34 | public function remove_remote_avatars(): void |
35 | { |
36 | // Remove remote avatar from users and groups |
37 | $sql = 'UPDATE ' . $this->table_prefix . "users |
38 | SET user_avatar = '', |
39 | user_avatar_type = '' |
40 | WHERE user_avatar_type = 'avatar.driver.remote'"; |
41 | |
42 | $this->db->sql_query($sql); |
43 | |
44 | $sql = 'UPDATE ' . $this->table_prefix . "groups |
45 | SET group_avatar = '', |
46 | group_avatar_type = '' |
47 | WHERE group_avatar_type = 'avatar.driver.remote'"; |
48 | $this->db->sql_query($sql); |
49 | } |
50 | } |