[ticket/269] Move definition of portal tables to services file
B3P-269
This commit is contained in:
@@ -23,7 +23,7 @@ class portal_module
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $db, $user, $cache, $request, $template;
|
||||
global $db, $user, $cache, $request, $template, $table_prefix;
|
||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpbb_container, $phpEx;
|
||||
|
||||
$user->add_lang_ext('board3/portal', array('portal', 'portal_acp'));
|
||||
@@ -44,6 +44,8 @@ class portal_module
|
||||
$this->phpbb_container = $phpbb_container;
|
||||
$this->mod_version_check = $this->phpbb_container->get('board3.version.check');
|
||||
$this->register_modules($this->phpbb_container->get('board3.module_collection'));
|
||||
define('PORTAL_MODULES_TABLE', $this->phpbb_container->getParameter('board3.modules.table'));
|
||||
define('PORTAL_CONFIG_TABLE', $this->phpbb_container->getParameter('board3.config.table'));
|
||||
|
||||
if (!function_exists('column_string_const'))
|
||||
{
|
||||
|
||||
@@ -11,6 +11,8 @@ parameters:
|
||||
- board3.de
|
||||
- updatecheck
|
||||
- board3_portal.xml
|
||||
board3.config.table: %core.table_prefix%portal_config
|
||||
board3.modules.table: %core.table_prefix%portal_modules
|
||||
|
||||
services:
|
||||
board3.portal.main:
|
||||
@@ -24,6 +26,8 @@ services:
|
||||
- %core.root_path%
|
||||
- .%core.php_ext%
|
||||
- @board3.module_collection
|
||||
- %board3.config.table%
|
||||
- %board3.modules.table%
|
||||
|
||||
board3.version.check:
|
||||
class: board3\portal\includes\mod_version_check
|
||||
|
||||
@@ -84,8 +84,10 @@ class main
|
||||
* @param string $php_ext PHP file extension
|
||||
* @param \phpbb\di\service_collection $modules Board3 Modules service
|
||||
* collection
|
||||
* @param string $config_table Board3 config table
|
||||
* @param string $modules_table Board3 modules table
|
||||
*/
|
||||
public function __construct($auth, $config, $template, $user, $path_helper, $phpbb_root_path, $php_ext, $modules)
|
||||
public function __construct($auth, $config, $template, $user, $path_helper, $phpbb_root_path, $php_ext, $modules, $config_table, $modules_table)
|
||||
{
|
||||
global $portal_root_path;
|
||||
|
||||
@@ -101,6 +103,8 @@ class main
|
||||
$this->includes_path = $phpbb_root_path . 'ext/board3/portal/includes/';
|
||||
$this->root_path = $phpbb_root_path . 'ext/board3/portal/';
|
||||
$portal_root_path = $this->root_path;
|
||||
define('PORTAL_MODULES_TABLE', $modules_table);
|
||||
define('PORTAL_CONFIG_TABLE', $config_table);
|
||||
|
||||
if (!function_exists('obtain_portal_config'))
|
||||
{
|
||||
|
||||
@@ -7,18 +7,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
global $table_prefix;
|
||||
|
||||
// Config constants
|
||||
define('B3_MODULE_DISABLED', 0);
|
||||
define('B3_MODULE_ENABLED', 1);
|
||||
|
||||
// Tables and paths
|
||||
define('PORTAL_ROOT_PATH', 'portal/');
|
||||
define('PORTAL_MODULES_TABLE', $table_prefix . 'portal_modules');
|
||||
define('PORTAL_CONFIG_TABLE', $table_prefix . 'portal_config');
|
||||
|
||||
@@ -21,7 +21,7 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
global $db, $cache, $phpbb_root_path, $phpEx, $user, $phpbb_container, $request, $template;
|
||||
global $db, $cache, $phpbb_root_path, $phpEx, $user, $phpbb_container, $request, $template, $table_prefix;
|
||||
$user = new \board3\portal\tests\mock\user();
|
||||
$phpbb_container = new \phpbb_mock_container_builder();
|
||||
// Mock version check
|
||||
@@ -38,6 +38,8 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
|
||||
new \board3\portal\modules\welcome($config, new \phpbb_mock_request, $this->db, $user, $phpbb_root_path, $phpEx),
|
||||
new \board3\portal\modules\donation($config, $template, $user),
|
||||
));
|
||||
$phpbb_container->setParameter('board3.modules.table', $table_prefix . 'portal_modules');
|
||||
$phpbb_container->setParameter('board3.config.table', $table_prefix . 'portal_config');
|
||||
$cache = $this->getMock('\phpbb\cache\cache', array('destroy', 'sql_exists', 'get', 'put'));
|
||||
$cache->expects($this->any())
|
||||
->method('destroy')
|
||||
|
||||
Reference in New Issue
Block a user