[ Index ] |
PHP Cross Reference of phpBB-3.1.12-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 'modes' => array('post'), 40 ), 41 )), 42 array('config.add', array('load_unreads_search', 1)), 43 array('config.update_if_equals', array(600, 'queue_interval', 60)), 44 array('config.update_if_equals', array(50, 'email_package_size', 20)), 45 46 array('config.update', array('version', '3.0.8-RC1')), 47 ); 48 } 49 50 public function update_file_extension_group_names() 51 { 52 // Update file extension group names to use language strings. 53 $sql = 'SELECT lang_dir 54 FROM ' . LANG_TABLE; 55 $result = $this->db->sql_query($sql); 56 57 $extension_groups_updated = array(); 58 while ($lang_dir = $this->db->sql_fetchfield('lang_dir')) 59 { 60 $lang_dir = basename($lang_dir); 61 62 // The language strings we need are either in language/.../acp/attachments.php 63 // in the update package if we're updating to 3.0.8-RC1 or later, 64 // or they are in language/.../install.php when we're updating from 3.0.7-PL1 or earlier. 65 // On an already updated board, they can also already be in language/.../acp/attachments.php 66 // in the board root. 67 $lang_files = array( 68 "{$this->phpbb_root_path}install/update/new/language/$lang_dir/acp/attachments.{$this->php_ext}", 69 "{$this->phpbb_root_path}language/$lang_dir/install.{$this->php_ext}", 70 "{$this->phpbb_root_path}language/$lang_dir/acp/attachments.{$this->php_ext}", 71 ); 72 73 foreach ($lang_files as $lang_file) 74 { 75 if (!file_exists($lang_file)) 76 { 77 continue; 78 } 79 80 $lang = array(); 81 include($lang_file); 82 83 foreach($lang as $lang_key => $lang_val) 84 { 85 if (isset($extension_groups_updated[$lang_key]) || strpos($lang_key, 'EXT_GROUP_') !== 0) 86 { 87 continue; 88 } 89 90 $sql_ary = array( 91 'group_name' => substr($lang_key, 10), // Strip off 'EXT_GROUP_' 92 ); 93 94 $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . ' 95 SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . " 96 WHERE group_name = '" . $this->db->sql_escape($lang_val) . "'"; 97 $this->sql_query($sql); 98 99 $extension_groups_updated[$lang_key] = true; 100 } 101 } 102 } 103 $this->db->sql_freeresult($result); 104 } 105 106 public function update_module_auth() 107 { 108 $sql = 'UPDATE ' . MODULES_TABLE . ' 109 SET module_auth = \'cfg_allow_avatar && (cfg_allow_avatar_local || cfg_allow_avatar_remote || cfg_allow_avatar_upload || cfg_allow_avatar_remote_upload)\' 110 WHERE module_class = \'ucp\' 111 AND module_basename = \'profile\' 112 AND module_mode = \'avatar\''; 113 $this->sql_query($sql); 114 } 115 116 public function delete_orphan_shadow_topics() 117 { 118 // Delete shadow topics pointing to not existing topics 119 $batch_size = 500; 120 121 // Set of affected forums we have to resync 122 $sync_forum_ids = array(); 123 124 $sql_array = array( 125 'SELECT' => 't1.topic_id, t1.forum_id', 126 'FROM' => array( 127 TOPICS_TABLE => 't1', 128 ), 129 'LEFT_JOIN' => array( 130 array( 131 'FROM' => array(TOPICS_TABLE => 't2'), 132 'ON' => 't1.topic_moved_id = t2.topic_id', 133 ), 134 ), 135 'WHERE' => 't1.topic_moved_id <> 0 136 AND t2.topic_id IS NULL', 137 ); 138 $sql = $this->db->sql_build_query('SELECT', $sql_array); 139 $result = $this->db->sql_query_limit($sql, $batch_size); 140 141 $topic_ids = array(); 142 while ($row = $this->db->sql_fetchrow($result)) 143 { 144 $topic_ids[] = (int) $row['topic_id']; 145 146 $sync_forum_ids[(int) $row['forum_id']] = (int) $row['forum_id']; 147 } 148 $this->db->sql_freeresult($result); 149 150 if (!empty($topic_ids)) 151 { 152 $sql = 'DELETE FROM ' . TOPICS_TABLE . ' 153 WHERE ' . $this->db->sql_in_set('topic_id', $topic_ids); 154 $this->db->sql_query($sql); 155 156 // Sync the forums we have deleted shadow topics from. 157 sync('forum', 'forum_id', $sync_forum_ids, true, true); 158 159 return false; 160 } 161 } 162 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Jan 11 00:25:41 2018 | Cross-referenced by PHPXref 0.7.1 |