Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
release_3_0_6_rc1.php
001 <?php
002 /**
003 *
004 * This file is part of the phpBB Forum Software package.
005 *
006 * @copyright (c) phpBB Limited <https://www.phpbb.com>
007 * @license GNU General Public License, version 2 (GPL-2.0)
008 *
009 * For full copyright and license information, please see
010 * the docs/CREDITS.txt file.
011 *
012 */
013
014 namespace phpbb\db\migration\data\v30x;
015
016 class release_3_0_6_rc1 extends \phpbb\db\migration\migration
017 {
018 public function effectively_installed()
019 {
020 return phpbb_version_compare($this->config['version'], '3.0.6-RC1', '>=');
021 }
022
023 static public function depends_on()
024 {
025 return array('\phpbb\db\migration\data\v30x\release_3_0_5');
026 }
027
028 public function update_schema()
029 {
030 return array(
031 'add_columns' => array(
032 $this->table_prefix . 'confirm' => array(
033 'attempts' => array('UINT', 0),
034 ),
035 $this->table_prefix . 'users' => array(
036 'user_new' => array('BOOL', 1),
037 'user_reminded' => array('TINT:4', 0),
038 'user_reminded_time' => array('TIMESTAMP', 0),
039 ),
040 $this->table_prefix . 'groups' => array(
041 'group_skip_auth' => array('BOOL', 0, 'after' => 'group_founder_manage'),
042 ),
043 $this->table_prefix . 'privmsgs' => array(
044 'message_reported' => array('BOOL', 0),
045 ),
046 $this->table_prefix . 'reports' => array(
047 'pm_id' => array('UINT', 0),
048 ),
049 $this->table_prefix . 'profile_fields' => array(
050 'field_show_on_vt' => array('BOOL', 0),
051 ),
052 $this->table_prefix . 'forums' => array(
053 'forum_options' => array('UINT:20', 0),
054 ),
055 ),
056 'change_columns' => array(
057 $this->table_prefix . 'users' => array(
058 'user_options' => array('UINT:11', 230271),
059 ),
060 ),
061 'add_index' => array(
062 $this->table_prefix . 'reports' => array(
063 'post_id' => array('post_id'),
064 'pm_id' => array('pm_id'),
065 ),
066 $this->table_prefix . 'posts' => array(
067 'post_username' => array('post_username:255'),
068 ),
069 ),
070 );
071 }
072
073 public function revert_schema()
074 {
075 return array(
076 'drop_columns' => array(
077 $this->table_prefix . 'confirm' => array(
078 'attempts',
079 ),
080 $this->table_prefix . 'users' => array(
081 'user_new',
082 'user_reminded',
083 'user_reminded_time',
084 ),
085 $this->table_prefix . 'groups' => array(
086 'group_skip_auth',
087 ),
088 $this->table_prefix . 'privmsgs' => array(
089 'message_reported',
090 ),
091 $this->table_prefix . 'reports' => array(
092 'pm_id',
093 ),
094 $this->table_prefix . 'profile_fields' => array(
095 'field_show_on_vt',
096 ),
097 $this->table_prefix . 'forums' => array(
098 'forum_options',
099 ),
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 }
365