diff options
Diffstat (limited to 'phpBB/includes/db/migration/tools')
-rw-r--r-- | phpBB/includes/db/migration/tools/base.php | 47 | ||||
-rw-r--r-- | phpBB/includes/db/migration/tools/config.php | 26 | ||||
-rw-r--r-- | phpBB/includes/db/migration/tools/module.php | 38 | ||||
-rw-r--r-- | phpBB/includes/db/migration/tools/permission.php | 26 |
4 files changed, 68 insertions, 69 deletions
diff --git a/phpBB/includes/db/migration/tools/base.php b/phpBB/includes/db/migration/tools/base.php deleted file mode 100644 index 61116d8b55..0000000000 --- a/phpBB/includes/db/migration/tools/base.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php -/** -* -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 -* -*/ - -class phpbb_db_migration_tools_base -{ - /** @var phpbb_auth */ - protected $auth = null; - - /** @var phpbb_cache_service */ - protected $cache = null; - - /** @var phpbb_config */ - protected $config = null; - - /** @var dbal */ - protected $db = null; - - /** @var phpbb_template */ - protected $template = null; - - /** @var phpbb_user */ - protected $user = null; - - /** @var string */ - protected $phpbb_root_path = null; - - /** @var string */ - protected $php_ext = null; - - public function __construct(dbal $db, phpbb_cache_driver_interface $cache, phpbb_template $template, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) - { - $this->db = $db; - $this->cache = $cache; - $this->template = $template; - $this->user = $user; - $this->auth = $auth; - $this->config = $config; - $this->phpbb_root_path = $phpbb_root_path; - $this->php_ext = $php_ext; - } -}
\ No newline at end of file diff --git a/phpBB/includes/db/migration/tools/config.php b/phpBB/includes/db/migration/tools/config.php index 965ba1d136..2d58c8093c 100644 --- a/phpBB/includes/db/migration/tools/config.php +++ b/phpBB/includes/db/migration/tools/config.php @@ -7,20 +7,14 @@ * */ -class phpbb_db_migration_tools_config extends phpbb_db_migration_tools_base +class phpbb_db_migration_tools_config { - /** - * Config Exists - * - * This function is to check to see if a config variable exists or if it does not. - * - * @param string $config_name The name of the config setting you wish to check for. - * - * @return bool true/false if config exists - */ - public function exists($config_name) + /** @var phpbb_config */ + protected $config = null; + + public function __construct(phpbb_config $config) { - return (bool) $this->config->offsetExists($config_name); + $this->config = $config; } /** @@ -34,7 +28,7 @@ class phpbb_db_migration_tools_config extends phpbb_db_migration_tools_base */ public function add($config_name, $config_value = '', $is_dynamic = false) { - if ($this->config_exists($config_name)) + if (isset($this->config[$config_name])) { throw new phpbb_db_migration_exception('CONFIG_ALREADY_EXISTS', $config_name); } @@ -54,7 +48,7 @@ class phpbb_db_migration_tools_config extends phpbb_db_migration_tools_base */ public function update($config_name, $config_value = '') { - if (!$this->config_exists($config_name)) + if (!isset($this->config[$config_name])) { throw new phpbb_db_migration_exception('CONFIG_NOT_EXIST', $config_name); } @@ -75,7 +69,7 @@ class phpbb_db_migration_tools_config extends phpbb_db_migration_tools_base */ public function update_if_equals($compare, $config_name, $config_value = '') { - if (!$this->config_exists($config_name)) + if (!isset($this->config[$config_name])) { throw new phpbb_db_migration_exception('CONFIG_NOT_EXIST', $config_name); } @@ -94,7 +88,7 @@ class phpbb_db_migration_tools_config extends phpbb_db_migration_tools_base */ public function remove($config_name) { - if (!$this->config_exists($config_name)) + if (!isset($this->config[$config_name])) { throw new phpbb_db_migration_exception('CONFIG_NOT_EXIST', $config_name); } diff --git a/phpBB/includes/db/migration/tools/module.php b/phpBB/includes/db/migration/tools/module.php index df1912a022..e17197d73e 100644 --- a/phpBB/includes/db/migration/tools/module.php +++ b/phpBB/includes/db/migration/tools/module.php @@ -7,8 +7,32 @@ * */ -class phpbb_db_migration_tools_module extends phpbb_db_migration_tools_base +class phpbb_db_migration_tools_module { + /** @var phpbb_cache_service */ + protected $cache = null; + + /** @var dbal */ + protected $db = null; + + /** @var phpbb_user */ + protected $user = null; + + /** @var string */ + protected $phpbb_root_path = null; + + /** @var string */ + protected $php_ext = null; + + public function __construct(dbal $db, phpbb_cache_driver_interface $cache, $user, $phpbb_root_path, $php_ext) + { + $this->db = $db; + $this->cache = $cache; + $this->user = $user; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } + /** * Module Exists * @@ -117,11 +141,15 @@ class phpbb_db_migration_tools_module extends phpbb_db_migration_tools_base if (!isset($data['module_langname'])) { + /** + * @TODO does not work with 3.1 modules yet, but must continue for old 3.0 versions for + * upgrades from a 3.0.x version to 3.1 + */ // The "automatic" way $basename = (isset($data['module_basename'])) ? $data['module_basename'] : ''; $basename = str_replace(array('/', '\\'), '', $basename); $class = str_replace(array('/', '\\'), '', $class); - $info_file = "$class/info/{$class}_$basename.$this->phpEx"; + $info_file = "$class/info/{$class}_$basename.{$this->php_ext}"; // The manual and automatic ways both failed... if (!file_exists((($include_path === false) ? $this->phpbb_root_path . 'includes/' : $include_path) . $info_file)) @@ -196,7 +224,7 @@ class phpbb_db_migration_tools_module extends phpbb_db_migration_tools_base if (!class_exists('acp_modules')) { - include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->phpEx); + include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext); $this->user->add_lang('acp/modules'); } $acp_modules = new acp_modules(); @@ -302,7 +330,7 @@ class phpbb_db_migration_tools_module extends phpbb_db_migration_tools_base // Automatic method $basename = str_replace(array('/', '\\'), '', $module['module_basename']); $class = str_replace(array('/', '\\'), '', $class); - $info_file = "$class/info/{$class}_$basename.$this->phpEx"; + $info_file = "$class/info/{$class}_$basename.{$this->php_ext}"; if (!file_exists((($include_path === false) ? $this->phpbb_root_path . 'includes/' : $include_path) . $info_file)) { @@ -396,7 +424,7 @@ class phpbb_db_migration_tools_module extends phpbb_db_migration_tools_base if (!class_exists('acp_modules')) { - include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->phpEx); + include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext); $this->user->add_lang('acp/modules'); } $acp_modules = new acp_modules(); diff --git a/phpBB/includes/db/migration/tools/permission.php b/phpBB/includes/db/migration/tools/permission.php index 3fbe7c649c..7694bae0cb 100644 --- a/phpBB/includes/db/migration/tools/permission.php +++ b/phpBB/includes/db/migration/tools/permission.php @@ -9,6 +9,30 @@ class phpbb_db_migration_tools_permission extends phpbb_db_migration_tools_base { + /** @var phpbb_auth */ + protected $auth = null; + + /** @var phpbb_cache_service */ + protected $cache = null; + + /** @var dbal */ + protected $db = null; + + /** @var string */ + protected $phpbb_root_path = null; + + /** @var string */ + protected $php_ext = null; + + public function __construct(dbal $db, phpbb_cache_driver_interface $cache, phpbb_auth $auth, $phpbb_root_path, $php_ext) + { + $this->db = $db; + $this->cache = $cache; + $this->auth = $auth; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } + /** * Permission Exists * @@ -69,7 +93,7 @@ class phpbb_db_migration_tools_permission extends phpbb_db_migration_tools_base if (!class_exists('auth_admin')) { - include($this->phpbb_root_path . 'includes/acp/auth.' . $this->phpEx); + include($this->phpbb_root_path . 'includes/acp/auth.' . $this->php_ext); } $auth_admin = new auth_admin(); |