[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
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_6_rc1 extends \phpbb\db\migration\migration 17 { 18 public function effectively_installed() 19 { 20 return phpbb_version_compare($this->config['version'], '3.0.6-RC1', '>='); 21 } 22 23 static public function depends_on() 24 { 25 return array('\phpbb\db\migration\data\v30x\release_3_0_5'); 26 } 27 28 public function update_schema() 29 { 30 return array( 31 'add_columns' => array( 32 $this->table_prefix . 'confirm' => array( 33 'attempts' => array('UINT', 0), 34 ), 35 $this->table_prefix . 'users' => array( 36 'user_new' => array('BOOL', 1), 37 'user_reminded' => array('TINT:4', 0), 38 'user_reminded_time' => array('TIMESTAMP', 0), 39 ), 40 $this->table_prefix . 'groups' => array( 41 'group_skip_auth' => array('BOOL', 0, 'after' => 'group_founder_manage'), 42 ), 43 $this->table_prefix . 'privmsgs' => array( 44 'message_reported' => array('BOOL', 0), 45 ), 46 $this->table_prefix . 'reports' => array( 47 'pm_id' => array('UINT', 0), 48 ), 49 $this->table_prefix . 'profile_fields' => array( 50 'field_show_on_vt' => array('BOOL', 0), 51 ), 52 $this->table_prefix . 'forums' => array( 53 'forum_options' => array('UINT:20', 0), 54 ), 55 ), 56 'change_columns' => array( 57 $this->table_prefix . 'users' => array( 58 'user_options' => array('UINT:11', 230271), 59 ), 60 ), 61 'add_index' => array( 62 $this->table_prefix . 'reports' => array( 63 'post_id' => array('post_id'), 64 'pm_id' => array('pm_id'), 65 ), 66 $this->table_prefix . 'posts' => array( 67 'post_username' => array('post_username:255'), 68 ), 69 ), 70 ); 71 } 72 73 public function revert_schema() 74 { 75 return array( 76 'drop_columns' => array( 77 $this->table_prefix . 'confirm' => array( 78 'attempts', 79 ), 80 $this->table_prefix . 'users' => array( 81 'user_new', 82 'user_reminded', 83 'user_reminded_time', 84 ), 85 $this->table_prefix . 'groups' => array( 86 'group_skip_auth', 87 ), 88 $this->table_prefix . 'privmsgs' => array( 89 'message_reported', 90 ), 91 $this->table_prefix . 'reports' => array( 92 'pm_id', 93 ), 94 $this->table_prefix . 'profile_fields' => array( 95 'field_show_on_vt', 96 ), 97 $this->table_prefix . 'forums' => array( 98 'forum_options', 99 ), 100 ), 101 'drop_keys' => array( 102 $this->table_prefix . 'reports' => array( 103 'post_id', 104 'pm_id', 105 ), 106 $this->table_prefix . 'posts' => array( 107 'post_username', 108 ), 109 ), 110 ); 111 } 112 113 public function update_data() 114 { 115 return array( 116 array('config.add', array('captcha_plugin', 'phpbb_captcha_nogd')), 117 array('if', array( 118 ($this->config['captcha_gd']), 119 array('config.update', array('captcha_plugin', 'phpbb_captcha_gd')), 120 )), 121 122 array('config.add', array('feed_enable', 0)), 123 array('config.add', array('feed_limit', 10)), 124 array('config.add', array('feed_overall_forums', 1)), 125 array('config.add', array('feed_overall_forums_limit', 15)), 126 array('config.add', array('feed_overall_topics', 0)), 127 array('config.add', array('feed_overall_topics_limit', 15)), 128 array('config.add', array('feed_forum', 1)), 129 array('config.add', array('feed_topic', 1)), 130 array('config.add', array('feed_item_statistics', 1)), 131 132 array('config.add', array('smilies_per_page', 50)), 133 array('config.add', array('allow_pm_report', 1)), 134 array('config.add', array('min_post_chars', 1)), 135 array('config.add', array('allow_quick_reply', 1)), 136 array('config.add', array('new_member_post_limit', 0)), 137 array('config.add', array('new_member_group_default', 0)), 138 array('config.add', array('delete_time', $this->config['edit_time'])), 139 140 array('config.add', array('allow_avatar', 0)), 141 array('if', array( 142 ($this->config['allow_avatar_upload'] || $this->config['allow_avatar_local'] || $this->config['allow_avatar_remote']), 143 array('config.update', array('allow_avatar', 1)), 144 )), 145 array('config.add', array('allow_avatar_remote_upload', 0)), 146 array('if', array( 147 ($this->config['allow_avatar_remote'] && $this->config['allow_avatar_upload']), 148 array('config.update', array('allow_avatar_remote_upload', 1)), 149 )), 150 151 array('module.add', array( 152 'acp', 153 'ACP_BOARD_CONFIGURATION', 154 array( 155 'module_basename' => 'acp_board', 156 'module_langname' => 'ACP_FEED_SETTINGS', 157 'module_mode' => 'feed', 158 'module_auth' => 'acl_a_board', 159 'after' => array('signature', 'ACP_SIGNATURE_SETTINGS'), 160 ), 161 )), 162 array('module.add', array( 163 'acp', 164 'ACP_CAT_USERS', 165 array( 166 'module_basename' => 'acp_users', 167 'module_langname' => 'ACP_USER_WARNINGS', 168 'module_mode' => 'warnings', 169 'module_auth' => 'acl_a_user', 170 'module_display' => false, 171 'after' => array('feedback', 'ACP_USER_FEEDBACK'), 172 ), 173 )), 174 array('module.add', array( 175 'acp', 176 'ACP_SERVER_CONFIGURATION', 177 array( 178 'module_basename' => 'acp_send_statistics', 179 'module_langname' => 'ACP_SEND_STATISTICS', 180 'module_mode' => 'send_statistics', 181 'module_auth' => 'acl_a_server', 182 ), 183 )), 184 array('module.add', array( 185 'acp', 186 'ACP_FORUM_BASED_PERMISSIONS', 187 array( 188 'module_basename' => 'acp_permissions', 189 'module_langname' => 'ACP_FORUM_PERMISSIONS_COPY', 190 'module_mode' => 'setting_forum_copy', 191 'module_auth' => 'acl_a_fauth && acl_a_authusers && acl_a_authgroups && acl_a_mauth', 192 'after' => array('setting_forum_local', 'ACP_FORUM_PERMISSIONS'), 193 ), 194 )), 195 array('module.add', array( 196 'mcp', 197 'MCP_REPORTS', 198 array( 199 'module_basename' => 'mcp_pm_reports', 200 'module_langname' => 'MCP_PM_REPORTS_OPEN', 201 'module_mode' => 'pm_reports', 202 'module_auth' => 'acl_m_pm_report', 203 ), 204 )), 205 array('module.add', array( 206 'mcp', 207 'MCP_REPORTS', 208 array( 209 'module_basename' => 'mcp_pm_reports', 210 'module_langname' => 'MCP_PM_REPORTS_CLOSED', 211 'module_mode' => 'pm_reports_closed', 212 'module_auth' => 'acl_m_pm_report', 213 ), 214 )), 215 array('module.add', array( 216 'mcp', 217 'MCP_REPORTS', 218 array( 219 'module_basename' => 'mcp_pm_reports', 220 'module_langname' => 'MCP_PM_REPORT_DETAILS', 221 'module_mode' => 'pm_report_details', 222 'module_auth' => 'acl_m_pm_report', 223 ), 224 )), 225 array('custom', array(array(&$this, 'add_newly_registered_group'))), 226 array('custom', array(array(&$this, 'set_user_options_default'))), 227 228 array('config.update', array('version', '3.0.6-RC1')), 229 ); 230 } 231 232 public function set_user_options_default() 233 { 234 // 229376 is the added value to enable all three signature options 235 $sql = 'UPDATE ' . USERS_TABLE . ' SET user_options = user_options + 229376'; 236 $this->sql_query($sql); 237 } 238 239 public function add_newly_registered_group() 240 { 241 // Add newly_registered group... but check if it already exists (we always supported running the updater on any schema) 242 $sql = 'SELECT group_id 243 FROM ' . GROUPS_TABLE . " 244 WHERE group_name = 'NEWLY_REGISTERED'"; 245 $result = $this->db->sql_query($sql); 246 $group_id = (int) $this->db->sql_fetchfield('group_id'); 247 $this->db->sql_freeresult($result); 248 249 if (!$group_id) 250 { 251 $sql = 'INSERT INTO ' . GROUPS_TABLE . " (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('NEWLY_REGISTERED', 3, 0, '', 0, '', '', '', 5)"; 252 $this->sql_query($sql); 253 254 $group_id = $this->db->sql_nextid(); 255 } 256 257 // Insert new user role... at the end of the chain 258 $sql = 'SELECT role_id 259 FROM ' . ACL_ROLES_TABLE . " 260 WHERE role_name = 'ROLE_USER_NEW_MEMBER' 261 AND role_type = 'u_'"; 262 $result = $this->db->sql_query($sql); 263 $u_role = (int) $this->db->sql_fetchfield('role_id'); 264 $this->db->sql_freeresult($result); 265 266 if (!$u_role) 267 { 268 $sql = 'SELECT MAX(role_order) as max_order_id 269 FROM ' . ACL_ROLES_TABLE . " 270 WHERE role_type = 'u_'"; 271 $result = $this->db->sql_query($sql); 272 $next_order_id = (int) $this->db->sql_fetchfield('max_order_id'); 273 $this->db->sql_freeresult($result); 274 275 $next_order_id++; 276 277 $sql = 'INSERT INTO ' . ACL_ROLES_TABLE . " (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_NEW_MEMBER', 'ROLE_DESCRIPTION_USER_NEW_MEMBER', 'u_', $next_order_id)"; 278 $this->sql_query($sql); 279 $u_role = $this->db->sql_nextid(); 280 281 // Now add the correct data to the roles... 282 // The standard role says that new users are not able to send a PM, Mass PM, are not able to PM groups 283 $sql = 'INSERT INTO ' . ACL_ROLES_DATA_TABLE . " (role_id, auth_option_id, auth_setting) SELECT $u_role, auth_option_id, 0 FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_sendpm', 'u_masspm', 'u_masspm_group')"; 284 $this->sql_query($sql); 285 286 // Add user role to group 287 $sql = 'INSERT INTO ' . ACL_GROUPS_TABLE . " (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES ($group_id, 0, 0, $u_role, 0)"; 288 $this->sql_query($sql); 289 } 290 291 // Insert new forum role 292 $sql = 'SELECT role_id 293 FROM ' . ACL_ROLES_TABLE . " 294 WHERE role_name = 'ROLE_FORUM_NEW_MEMBER' 295 AND role_type = 'f_'"; 296 $result = $this->db->sql_query($sql); 297 $f_role = (int) $this->db->sql_fetchfield('role_id'); 298 $this->db->sql_freeresult($result); 299 300 if (!$f_role) 301 { 302 $sql = 'SELECT MAX(role_order) as max_order_id 303 FROM ' . ACL_ROLES_TABLE . " 304 WHERE role_type = 'f_'"; 305 $result = $this->db->sql_query($sql); 306 $next_order_id = (int) $this->db->sql_fetchfield('max_order_id'); 307 $this->db->sql_freeresult($result); 308 309 $next_order_id++; 310 311 $sql = 'INSERT INTO ' . ACL_ROLES_TABLE . " (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_NEW_MEMBER', 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER', 'f_', $next_order_id)"; 312 $this->sql_query($sql); 313 $f_role = $this->db->sql_nextid(); 314 315 $sql = 'INSERT INTO ' . ACL_ROLES_DATA_TABLE . " (role_id, auth_option_id, auth_setting) SELECT $f_role, auth_option_id, 0 FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove')"; 316 $this->sql_query($sql); 317 } 318 319 // Set every members user_new column to 0 (old users) only if there is no one yet (this makes sure we do not execute this more than once) 320 $sql = 'SELECT 1 321 FROM ' . USERS_TABLE . ' 322 WHERE user_new = 0'; 323 $result = $this->db->sql_query_limit($sql, 1); 324 $row = $this->db->sql_fetchrow($result); 325 $this->db->sql_freeresult($result); 326 327 if (!$row) 328 { 329 $sql = 'UPDATE ' . USERS_TABLE . ' SET user_new = 0'; 330 $this->sql_query($sql); 331 } 332 333 // To mimick the old "feature" we will assign the forum role to every forum, regardless of the setting (this makes sure there are no "this does not work!!!! YUO!!!" posts... 334 // Check if the role is already assigned... 335 $sql = 'SELECT forum_id 336 FROM ' . ACL_GROUPS_TABLE . ' 337 WHERE group_id = ' . $group_id . ' 338 AND auth_role_id = ' . $f_role; 339 $result = $this->db->sql_query($sql); 340 $is_options = (int) $this->db->sql_fetchfield('forum_id'); 341 $this->db->sql_freeresult($result); 342 343 // Not assigned at all... :/ 344 if (!$is_options) 345 { 346 // Get postable forums 347 $sql = 'SELECT forum_id 348 FROM ' . FORUMS_TABLE . ' 349 WHERE forum_type != ' . FORUM_LINK; 350 $result = $this->db->sql_query($sql); 351 352 while ($row = $this->db->sql_fetchrow($result)) 353 { 354 $this->sql_query('INSERT INTO ' . ACL_GROUPS_TABLE . ' (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (' . $group_id . ', ' . (int) $row['forum_id'] . ', 0, ' . $f_role . ', 0)'); 355 } 356 $this->db->sql_freeresult($result); 357 } 358 359 // Clear permissions... 360 include_once($this->phpbb_root_path . 'includes/acp/auth.' . $this->php_ext); 361 $auth_admin = new \auth_admin(); 362 $auth_admin->acl_clear_prefetch(); 363 } 364 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |