[ 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\v310; 15 16 class acp_prune_users_module extends \phpbb\db\migration\migration 17 { 18 public function effectively_installed() 19 { 20 $sql = 'SELECT module_id 21 FROM ' . MODULES_TABLE . " 22 WHERE module_class = 'acp' 23 AND module_langname = 'ACP_CAT_USERS'"; 24 $result = $this->db->sql_query($sql); 25 $acp_cat_users_id = (int) $this->db->sql_fetchfield('module_id'); 26 $this->db->sql_freeresult($result); 27 28 $sql = 'SELECT parent_id 29 FROM ' . MODULES_TABLE . " 30 WHERE module_class = 'acp' 31 AND module_basename = 'acp_prune' 32 AND module_mode = 'users'"; 33 $result = $this->db->sql_query($sql); 34 $acp_prune_users_parent = (int) $this->db->sql_fetchfield('parent_id'); 35 $this->db->sql_freeresult($result); 36 37 // Skip migration if "Users" category has been deleted 38 // or the module has already been moved to that category 39 return !$acp_cat_users_id || $acp_cat_users_id === $acp_prune_users_parent; 40 } 41 42 static public function depends_on() 43 { 44 return array('\phpbb\db\migration\data\v310\beta1'); 45 } 46 47 public function update_data() 48 { 49 return array( 50 array('custom', array(array($this, 'move_prune_users_module'))), 51 ); 52 } 53 54 public function move_prune_users_module() 55 { 56 $sql = 'SELECT module_id 57 FROM ' . MODULES_TABLE . " 58 WHERE module_class = 'acp' 59 AND module_basename = 'acp_prune' 60 AND module_mode = 'users'"; 61 $result = $this->db->sql_query($sql); 62 $acp_prune_users_id = (int) $this->db->sql_fetchfield('module_id'); 63 $this->db->sql_freeresult($result); 64 65 $sql = 'SELECT module_id 66 FROM ' . MODULES_TABLE . " 67 WHERE module_class = 'acp' 68 AND module_langname = 'ACP_CAT_USERS'"; 69 $result = $this->db->sql_query($sql); 70 $acp_cat_users_id = (int) $this->db->sql_fetchfield('module_id'); 71 $this->db->sql_freeresult($result); 72 73 if (!class_exists('\acp_modules')) 74 { 75 include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext); 76 } 77 $module_manager = new \acp_modules(); 78 $module_manager->module_class = 'acp'; 79 $module_manager->move_module($acp_prune_users_id, $acp_cat_users_id); 80 } 81 }
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 |