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_8_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_8_rc1 extends \phpbb\db\migration\migration
017 {
018 public function effectively_installed()
019 {
020 return phpbb_version_compare($this->config['version'], '3.0.8-RC1', '>=');
021 }
022
023 static public function depends_on()
024 {
025 return array('\phpbb\db\migration\data\v30x\release_3_0_7_pl1');
026 }
027
028 public function update_data()
029 {
030 return array(
031 array('custom', array(array(&$this, 'update_file_extension_group_names'))),
032 array('custom', array(array(&$this, 'update_module_auth'))),
033 array('custom', array(array(&$this, 'delete_orphan_shadow_topics'))),
034 array('module.add', array(
035 'acp',
036 'ACP_MESSAGES',
037 array(
038 'module_basename' => 'acp_board',
039 'module_langname' => 'ACP_POST_SETTINGS',
040 'module_mode' => 'post',
041 'module_auth' => 'acl_a_board',
042 'after' => array('message', 'ACP_MESSAGE_SETTINGS'),
043 ),
044 )),
045 array('config.add', array('load_unreads_search', 1)),
046 array('config.update_if_equals', array(600, 'queue_interval', 60)),
047 array('config.update_if_equals', array(50, 'email_package_size', 20)),
048
049 array('config.update', array('version', '3.0.8-RC1')),
050 );
051 }
052
053 public function update_file_extension_group_names()
054 {
055 // Update file extension group names to use language strings.
056 $sql = 'SELECT lang_dir
057 FROM ' . LANG_TABLE;
058 $result = $this->db->sql_query($sql);
059
060 $extension_groups_updated = array();
061 while ($row = $this->db->sql_fetchrow($result))
062 {
063 if (empty($row['lang_dir']))
064 {
065 continue;
066 }
067
068 $lang_dir = basename($row['lang_dir']);
069
070 // The language strings we need are either in language/.../acp/attachments.php
071 // in the update package if we're updating to 3.0.8-RC1 or later,
072 // or they are in language/.../install.php when we're updating from 3.0.7-PL1 or earlier.
073 // On an already updated board, they can also already be in language/.../acp/attachments.php
074 // in the board root.
075 $lang_files = array(
076 "{$this->phpbb_root_path}install/update/new/language/$lang_dir/acp/attachments.{$this->php_ext}",
077 "{$this->phpbb_root_path}language/$lang_dir/install.{$this->php_ext}",
078 "{$this->phpbb_root_path}language/$lang_dir/acp/attachments.{$this->php_ext}",
079 );
080
081 foreach ($lang_files as $lang_file)
082 {
083 if (!file_exists($lang_file))
084 {
085 continue;
086 }
087
088 $lang = array();
089 include($lang_file);
090
091 foreach($lang as $lang_key => $lang_val)
092 {
093 if (isset($extension_groups_updated[$lang_key]) || strpos($lang_key, 'EXT_GROUP_') !== 0)
094 {
095 continue;
096 }
097
098 $sql_ary = array(
099 'group_name' => substr($lang_key, 10), // Strip off 'EXT_GROUP_'
100 );
101
102 $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . '
103 SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . "
104 WHERE group_name = '" . $this->db->sql_escape($lang_val) . "'";
105 $this->sql_query($sql);
106
107 $extension_groups_updated[$lang_key] = true;
108 }
109 }
110 }
111 $this->db->sql_freeresult($result);
112 }
113
114 public function update_module_auth()
115 {
116 $sql = 'UPDATE ' . MODULES_TABLE . '
117 SET module_auth = \'cfg_allow_avatar && (cfg_allow_avatar_local || cfg_allow_avatar_remote || cfg_allow_avatar_upload || cfg_allow_avatar_remote_upload)\'
118 WHERE module_class = \'ucp\'
119 AND module_basename = \'profile\'
120 AND module_mode = \'avatar\'';
121 $this->sql_query($sql);
122 }
123
124 public function delete_orphan_shadow_topics()
125 {
126 // Delete shadow topics pointing to not existing topics
127 $batch_size = 500;
128
129 // Set of affected forums we have to resync
130 $sync_forum_ids = array();
131
132 $sql_array = array(
133 'SELECT' => 't1.topic_id, t1.forum_id',
134 'FROM' => array(
135 TOPICS_TABLE => 't1',
136 ),
137 'LEFT_JOIN' => array(
138 array(
139 'FROM' => array(TOPICS_TABLE => 't2'),
140 'ON' => 't1.topic_moved_id = t2.topic_id',
141 ),
142 ),
143 'WHERE' => 't1.topic_moved_id <> 0
144 AND t2.topic_id IS NULL',
145 );
146 $sql = $this->db->sql_build_query('SELECT', $sql_array);
147 $result = $this->db->sql_query_limit($sql, $batch_size);
148
149 $topic_ids = array();
150 while ($row = $this->db->sql_fetchrow($result))
151 {
152 $topic_ids[] = (int) $row['topic_id'];
153
154 $sync_forum_ids[(int) $row['forum_id']] = (int) $row['forum_id'];
155 }
156 $this->db->sql_freeresult($result);
157
158 if (!empty($topic_ids))
159 {
160 $sql = 'DELETE FROM ' . TOPICS_TABLE . '
161 WHERE ' . $this->db->sql_in_set('topic_id', $topic_ids);
162 $this->db->sql_query($sql);
163
164 // Sync the forums we have deleted shadow topics from.
165 sync('forum', 'forum_id', $sync_forum_ids, true, true);
166
167 return false;
168 }
169 }
170 }
171