[ Index ] |
PHP Cross Reference of phpBB-3.3.14-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_8_rc1 extends \phpbb\db\migration\migration 17 { 18 public function effectively_installed() 19 { 20 return phpbb_version_compare($this->config['version'], '3.0.8-RC1', '>='); 21 } 22 23 static public function depends_on() 24 { 25 return array('\phpbb\db\migration\data\v30x\release_3_0_7_pl1'); 26 } 27 28 public function update_data() 29 { 30 return array( 31 array('custom', array(array(&$this, 'update_file_extension_group_names'))), 32 array('custom', array(array(&$this, 'update_module_auth'))), 33 array('custom', array(array(&$this, 'delete_orphan_shadow_topics'))), 34 array('module.add', array( 35 'acp', 36 'ACP_MESSAGES', 37 array( 38 'module_basename' => 'acp_board', 39 'module_langname' => 'ACP_POST_SETTINGS', 40 'module_mode' => 'post', 41 'module_auth' => 'acl_a_board', 42 'after' => array('message', 'ACP_MESSAGE_SETTINGS'), 43 ), 44 )), 45 array('config.add', array('load_unreads_search', 1)), 46 array('config.update_if_equals', array(600, 'queue_interval', 60)), 47 array('config.update_if_equals', array(50, 'email_package_size', 20)), 48 49 array('config.update', array('version', '3.0.8-RC1')), 50 ); 51 } 52 53 public function update_file_extension_group_names() 54 { 55 // Update file extension group names to use language strings. 56 $sql = 'SELECT lang_dir 57 FROM ' . LANG_TABLE; 58 $result = $this->db->sql_query($sql); 59 60 $extension_groups_updated = array(); 61 while ($row = $this->db->sql_fetchrow($result)) 62 { 63 if (empty($row['lang_dir'])) 64 { 65 continue; 66 } 67 68 $lang_dir = basename($row['lang_dir']); 69 70 // The language strings we need are either in language/.../acp/attachments.php 71 // in the update package if we're updating to 3.0.8-RC1 or later, 72 // or they are in language/.../install.php when we're updating from 3.0.7-PL1 or earlier. 73 // On an already updated board, they can also already be in language/.../acp/attachments.php 74 // in the board root. 75 $lang_files = array( 76 "{$this->phpbb_root_path}install/update/new/language/$lang_dir/acp/attachments.{$this->php_ext}", 77 "{$this->phpbb_root_path}language/$lang_dir/install.{$this->php_ext}", 78 "{$this->phpbb_root_path}language/$lang_dir/acp/attachments.{$this->php_ext}", 79 ); 80 81 foreach ($lang_files as $lang_file) 82 { 83 if (!file_exists($lang_file)) 84 { 85 continue; 86 } 87 88 $lang = array(); 89 include($lang_file); 90 91 foreach($lang as $lang_key => $lang_val) 92 { 93 if (isset($extension_groups_updated[$lang_key]) || strpos($lang_key, 'EXT_GROUP_') !== 0) 94 { 95 continue; 96 } 97 98 $sql_ary = array( 99 '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 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Nov 25 19:05:08 2024 | Cross-referenced by PHPXref 0.7.1 |