Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
37.50% |
24 / 64 |
|
28.57% |
2 / 7 |
CRAP | |
0.00% |
0 / 1 |
release_3_0_1_rc1 | |
37.50% |
24 / 64 |
|
28.57% |
2 / 7 |
28.78 | |
0.00% |
0 / 1 |
effectively_installed | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
depends_on | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
update_schema | |
100.00% |
23 / 23 |
|
100.00% |
1 / 1 |
1 | |||
revert_schema | |
0.00% |
0 / 23 |
|
0.00% |
0 / 1 |
2 | |||
update_data | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
fix_unset_last_view_time | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
reset_smiley_size | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
12 |
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\v30x; |
15 | |
16 | class release_3_0_1_rc1 extends \phpbb\db\migration\migration |
17 | { |
18 | public function effectively_installed() |
19 | { |
20 | return phpbb_version_compare($this->config['version'], '3.0.1-RC1', '>='); |
21 | } |
22 | |
23 | public static function depends_on() |
24 | { |
25 | return array('\phpbb\db\migration\data\v30x\release_3_0_0'); |
26 | } |
27 | |
28 | public function update_schema() |
29 | { |
30 | return array( |
31 | 'add_columns' => array( |
32 | $this->table_prefix . 'forums' => array( |
33 | 'display_subforum_list' => array('BOOL', 1), |
34 | ), |
35 | $this->table_prefix . 'sessions' => array( |
36 | 'session_forum_id' => array('UINT', 0), |
37 | ), |
38 | ), |
39 | 'drop_keys' => array( |
40 | $this->table_prefix . 'groups' => array( |
41 | 'group_legend', |
42 | ), |
43 | ), |
44 | 'add_index' => array( |
45 | $this->table_prefix . 'sessions' => array( |
46 | 'session_forum_id' => array('session_forum_id'), |
47 | ), |
48 | $this->table_prefix . 'groups' => array( |
49 | 'group_legend_name' => array('group_legend', 'group_name'), |
50 | ), |
51 | ), |
52 | ); |
53 | } |
54 | |
55 | public function revert_schema() |
56 | { |
57 | return array( |
58 | 'drop_columns' => array( |
59 | $this->table_prefix . 'forums' => array( |
60 | 'display_subforum_list', |
61 | ), |
62 | $this->table_prefix . 'sessions' => array( |
63 | 'session_forum_id', |
64 | ), |
65 | ), |
66 | 'add_index' => array( |
67 | $this->table_prefix . 'groups' => array( |
68 | 'group_legend' => array('group_legend'), |
69 | ), |
70 | ), |
71 | 'drop_keys' => array( |
72 | $this->table_prefix . 'sessions' => array( |
73 | 'session_forum_id', |
74 | ), |
75 | $this->table_prefix . 'groups' => array( |
76 | 'group_legend_name', |
77 | ), |
78 | ), |
79 | ); |
80 | } |
81 | |
82 | public function update_data() |
83 | { |
84 | return array( |
85 | array('custom', array(array(&$this, 'fix_unset_last_view_time'))), |
86 | array('custom', array(array(&$this, 'reset_smiley_size'))), |
87 | |
88 | array('config.update', array('version', '3.0.1-RC1')), |
89 | ); |
90 | } |
91 | |
92 | public function fix_unset_last_view_time() |
93 | { |
94 | $sql = 'UPDATE ' . $this->table_prefix . "topics |
95 | SET topic_last_view_time = topic_last_post_time |
96 | WHERE topic_last_view_time = 0"; |
97 | $this->sql_query($sql); |
98 | } |
99 | |
100 | public function reset_smiley_size() |
101 | { |
102 | // Update smiley sizes |
103 | $smileys = array('icon_e_surprised.gif', 'icon_eek.gif', 'icon_cool.gif', 'icon_lol.gif', 'icon_mad.gif', 'icon_razz.gif', 'icon_redface.gif', 'icon_cry.gif', 'icon_evil.gif', 'icon_twisted.gif', 'icon_rolleyes.gif', 'icon_exclaim.gif', 'icon_question.gif', 'icon_idea.gif', 'icon_arrow.gif', 'icon_neutral.gif', 'icon_mrgreen.gif', 'icon_e_ugeek.gif'); |
104 | |
105 | foreach ($smileys as $smiley) |
106 | { |
107 | if (file_exists($this->phpbb_root_path . 'images/smilies/' . $smiley)) |
108 | { |
109 | list($width, $height) = getimagesize($this->phpbb_root_path . 'images/smilies/' . $smiley); |
110 | |
111 | $sql = 'UPDATE ' . SMILIES_TABLE . ' |
112 | SET smiley_width = ' . $width . ', smiley_height = ' . $height . " |
113 | WHERE smiley_url = '" . $this->db->sql_escape($smiley) . "'"; |
114 | |
115 | $this->sql_query($sql); |
116 | } |
117 | } |
118 | } |
119 | } |