Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

release_3_0_6_rc1.php

Zuletzt modifiziert: 09.10.2024, 12:57 - Dateigröße: 10.56 KiB


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                      'modes'                => array('feed'),
157                  ),
158              )),
159              array('module.add', array(
160                  'acp',
161                  'ACP_CAT_USERS',
162                  array(
163                      'module_basename'    => 'acp_users',
164                      'modes'                => array('warnings'),
165                  ),
166              )),
167              array('module.add', array(
168                  'acp',
169                  'ACP_SERVER_CONFIGURATION',
170                  array(
171                      'module_basename'    => 'acp_send_statistics',
172                      'modes'                => array('send_statistics'),
173                  ),
174              )),
175              array('module.add', array(
176                  'acp',
177                  'ACP_FORUM_BASED_PERMISSIONS',
178                  array(
179                      'module_basename'    => 'acp_permissions',
180                      'modes'                => array('setting_forum_copy'),
181                  ),
182              )),
183              array('module.add', array(
184                  'mcp',
185                  'MCP_REPORTS',
186                  array(
187                      'module_basename'    => 'mcp_pm_reports',
188                      'modes'                => array('pm_reports','pm_reports_closed','pm_report_details'),
189                  ),
190              )),
191              array('custom', array(array(&$this, 'add_newly_registered_group'))),
192              array('custom', array(array(&$this, 'set_user_options_default'))),
193   
194              array('config.update', array('version', '3.0.6-RC1')),
195          );
196      }
197   
198      public function set_user_options_default()
199      {
200          // 229376 is the added value to enable all three signature options
201          $sql = 'UPDATE ' . USERS_TABLE . ' SET user_options = user_options + 229376';
202          $this->sql_query($sql);
203      }
204   
205      public function add_newly_registered_group()
206      {
207          // Add newly_registered group... but check if it already exists (we always supported running the updater on any schema)
208          $sql = 'SELECT group_id
209              FROM ' . GROUPS_TABLE . "
210              WHERE group_name = 'NEWLY_REGISTERED'";
211          $result = $this->db->sql_query($sql);
212          $group_id = (int) $this->db->sql_fetchfield('group_id');
213          $this->db->sql_freeresult($result);
214   
215          if (!$group_id)
216          {
217              $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)";
218              $this->sql_query($sql);
219   
220              $group_id = $this->db->sql_nextid();
221          }
222   
223          // Insert new user role... at the end of the chain
224          $sql = 'SELECT role_id
225              FROM ' . ACL_ROLES_TABLE . "
226              WHERE role_name = 'ROLE_USER_NEW_MEMBER'
227                  AND role_type = 'u_'";
228          $result = $this->db->sql_query($sql);
229          $u_role = (int) $this->db->sql_fetchfield('role_id');
230          $this->db->sql_freeresult($result);
231   
232          if (!$u_role)
233          {
234              $sql = 'SELECT MAX(role_order) as max_order_id
235                  FROM ' . ACL_ROLES_TABLE . "
236                  WHERE role_type = 'u_'";
237              $result = $this->db->sql_query($sql);
238              $next_order_id = (int) $this->db->sql_fetchfield('max_order_id');
239              $this->db->sql_freeresult($result);
240   
241              $next_order_id++;
242   
243              $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)";
244              $this->sql_query($sql);
245              $u_role = $this->db->sql_nextid();
246   
247              // Now add the correct data to the roles...
248              // The standard role says that new users are not able to send a PM, Mass PM, are not able to PM groups
249              $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')";
250              $this->sql_query($sql);
251   
252              // Add user role to group
253              $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)";
254              $this->sql_query($sql);
255          }
256   
257          // Insert new forum role
258          $sql = 'SELECT role_id
259              FROM ' . ACL_ROLES_TABLE . "
260              WHERE role_name = 'ROLE_FORUM_NEW_MEMBER'
261                  AND role_type = 'f_'";
262          $result = $this->db->sql_query($sql);
263          $f_role = (int) $this->db->sql_fetchfield('role_id');
264          $this->db->sql_freeresult($result);
265   
266          if (!$f_role)
267          {
268              $sql = 'SELECT MAX(role_order) as max_order_id
269                  FROM ' . ACL_ROLES_TABLE . "
270                  WHERE role_type = 'f_'";
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_FORUM_NEW_MEMBER', 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER', 'f_', $next_order_id)";
278              $this->sql_query($sql);
279              $f_role = $this->db->sql_nextid();
280   
281              $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')";
282              $this->sql_query($sql);
283          }
284   
285          // 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)
286          $sql = 'SELECT 1
287              FROM ' . USERS_TABLE . '
288              WHERE user_new = 0';
289          $result = $this->db->sql_query_limit($sql, 1);
290          $row = $this->db->sql_fetchrow($result);
291          $this->db->sql_freeresult($result);
292   
293          if (!$row)
294          {
295              $sql = 'UPDATE ' . USERS_TABLE . ' SET user_new = 0';
296              $this->sql_query($sql);
297          }
298   
299          // 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...
300          // Check if the role is already assigned...
301          $sql = 'SELECT forum_id
302              FROM ' . ACL_GROUPS_TABLE . '
303              WHERE group_id = ' . $group_id . '
304                  AND auth_role_id = ' . $f_role;
305          $result = $this->db->sql_query($sql);
306          $is_options = (int) $this->db->sql_fetchfield('forum_id');
307          $this->db->sql_freeresult($result);
308   
309          // Not assigned at all... :/
310          if (!$is_options)
311          {
312              // Get postable forums
313              $sql = 'SELECT forum_id
314                  FROM ' . FORUMS_TABLE . '
315                  WHERE forum_type != ' . FORUM_LINK;
316              $result = $this->db->sql_query($sql);
317   
318              while ($row = $this->db->sql_fetchrow($result))
319              {
320                  $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)');
321              }
322              $this->db->sql_freeresult($result);
323          }
324   
325          // Clear permissions...
326          include_once($this->phpbb_root_path . 'includes/acp/auth.' . $this->php_ext);
327          $auth_admin = new \auth_admin();
328          $auth_admin->acl_clear_prefetch();
329      }
330  }
331