mirror of
https://github.com/phpbb/phpbb.git
synced 2025-01-18 06:38:43 +01:00
[ticket/13777] Reorder get_module_infos() method's arguments
PHPBB3-13777
This commit is contained in:
parent
fcff3ee4ad
commit
4044b5df89
@ -209,7 +209,7 @@ class acp_modules
|
||||
list($module_basename, $module_mode) = explode('::', $quick_install);
|
||||
|
||||
// Check if module name and mode exist...
|
||||
$fileinfo = $module_manager->get_module_infos($module_basename, $this->module_class);
|
||||
$fileinfo = $module_manager->get_module_infos($this->module_class, $module_basename);
|
||||
$fileinfo = $fileinfo[$module_basename];
|
||||
|
||||
if (isset($fileinfo['modes'][$module_mode]))
|
||||
@ -326,7 +326,7 @@ class acp_modules
|
||||
// Adjust auth row
|
||||
if ($module_data['module_basename'] && $module_data['module_mode'])
|
||||
{
|
||||
$fileinfo = $module_manager->get_module_infos($module_data['module_basename'], $this->module_class);
|
||||
$fileinfo = $module_manager->get_module_infos($this->module_class, $module_data['module_basename']);
|
||||
$module_data['module_auth'] = $fileinfo[$module_data['module_basename']]['modes'][$module_data['module_mode']]['auth'];
|
||||
}
|
||||
|
||||
@ -358,7 +358,7 @@ class acp_modules
|
||||
$is_cat = (!$module_data['module_basename']) ? true : false;
|
||||
|
||||
// Get module information
|
||||
$module_infos = $module_manager->get_module_infos('', $this->module_class);
|
||||
$module_infos = $module_manager->get_module_infos($this->module_class);
|
||||
|
||||
// Build name options
|
||||
$s_name_options = $s_mode_options = '';
|
||||
@ -545,7 +545,7 @@ class acp_modules
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Quick adding module
|
||||
$module_infos = $module_manager->get_module_infos('', $this->module_class);
|
||||
$module_infos = $module_manager->get_module_infos($this->module_class);
|
||||
|
||||
// Build quick options
|
||||
$s_install_options = '';
|
||||
|
@ -1640,7 +1640,7 @@ class install_install extends module
|
||||
}
|
||||
|
||||
// Get the modules we want to add... returned sorted by name
|
||||
$module_info = $_module->get_module_infos('', $module_class);
|
||||
$module_info = $_module->get_module_infos($module_class);
|
||||
|
||||
foreach ($module_info as $module_basename => $fileinfo)
|
||||
{
|
||||
|
@ -461,7 +461,7 @@ class module implements \phpbb\db\migration\tool\tool_interface
|
||||
*/
|
||||
protected function get_module_info($class, $basename)
|
||||
{
|
||||
$module = $this->module_manager->get_module_infos($basename, $class, true);
|
||||
$module = $this->module_manager->get_module_infos($class, $basename, true);
|
||||
|
||||
if (empty($module))
|
||||
{
|
||||
|
@ -102,20 +102,15 @@ class module_manager
|
||||
/**
|
||||
* Get available module information from module files
|
||||
*
|
||||
* @param string $module ID of module
|
||||
* @param string $module_class Class of the module (acp, ucp, mcp etc...)
|
||||
* @param string $module ID of module
|
||||
* @param bool $use_all_available Use all available instead of just all
|
||||
* enabled extensions
|
||||
*
|
||||
* @return array Array with module information gathered from module info files.
|
||||
*/
|
||||
public function get_module_infos($module = '', $module_class = null, $use_all_available = false)
|
||||
public function get_module_infos($module_class, $module = '', $use_all_available = false)
|
||||
{
|
||||
if ($module_class === null)
|
||||
{
|
||||
throw new module_class_not_defined_exception();
|
||||
}
|
||||
|
||||
$directory = $this->phpbb_root_path . 'includes/' . $module_class . '/info/';
|
||||
$fileinfo = array();
|
||||
|
||||
|
@ -64,7 +64,7 @@ class phpbb_extension_modules_test extends phpbb_test_case
|
||||
$phpbb_root_path = dirname(__FILE__) . '/';
|
||||
|
||||
// Find acp module info files
|
||||
$acp_modules = $this->module_manager->get_module_infos('', 'acp');
|
||||
$acp_modules = $this->module_manager->get_module_infos('acp');
|
||||
$this->assertEquals(array(
|
||||
'vendor2\\foo\\acp\\a_module' => array(
|
||||
'filename' => 'vendor2\\foo\\acp\\a_module',
|
||||
@ -83,7 +83,7 @@ class phpbb_extension_modules_test extends phpbb_test_case
|
||||
), $acp_modules);
|
||||
|
||||
// Find mcp module info files
|
||||
$acp_modules = $this->module_manager->get_module_infos('', 'mcp');
|
||||
$acp_modules = $this->module_manager->get_module_infos('mcp');
|
||||
$this->assertEquals(array(
|
||||
'vendor2\\foo\\mcp\\a_module' => array(
|
||||
'filename' => 'vendor2\\foo\\mcp\\a_module',
|
||||
@ -95,7 +95,7 @@ class phpbb_extension_modules_test extends phpbb_test_case
|
||||
), $acp_modules);
|
||||
|
||||
// Find a specific module info file (mcp_a_module)
|
||||
$acp_modules = $this->module_manager->get_module_infos('mcp_a_module', 'mcp');
|
||||
$acp_modules = $this->module_manager->get_module_infos('mcp', 'mcp_a_module');
|
||||
$this->assertEquals(array(
|
||||
'vendor2\\foo\\mcp\\a_module' => array(
|
||||
'filename' => 'vendor2\\foo\\mcp\\a_module',
|
||||
@ -107,15 +107,15 @@ class phpbb_extension_modules_test extends phpbb_test_case
|
||||
), $acp_modules);
|
||||
|
||||
// The mcp module info file we're looking for shouldn't exist
|
||||
$acp_modules = $this->module_manager->get_module_infos('mcp_a_fail', 'mcp');
|
||||
$acp_modules = $this->module_manager->get_module_infos('mcp', 'mcp_a_fail');
|
||||
$this->assertEquals(array(), $acp_modules);
|
||||
|
||||
// As there are no ucp modules we shouldn't find any
|
||||
$acp_modules = $this->module_manager->get_module_infos('', 'ucp');
|
||||
$acp_modules = $this->module_manager->get_module_infos('ucp');
|
||||
$this->assertEquals(array(), $acp_modules);
|
||||
|
||||
// Get module info of specified extension module
|
||||
$acp_modules = $this->module_manager->get_module_infos('foo_acp_a_module', 'acp');
|
||||
$acp_modules = $this->module_manager->get_module_infos('acp', 'foo_acp_a_module');
|
||||
$this->assertEquals(array(
|
||||
'vendor2\\foo\\acp\\a_module' => array (
|
||||
'filename' => 'vendor2\\foo\\acp\\a_module',
|
||||
@ -127,16 +127,16 @@ class phpbb_extension_modules_test extends phpbb_test_case
|
||||
), $acp_modules);
|
||||
|
||||
// No specific module and module class set to an incorrect name
|
||||
$acp_modules = $this->module_manager->get_module_infos('', 'wcp', true);
|
||||
$acp_modules = $this->module_manager->get_module_infos('wcp', '', true);
|
||||
$this->assertEquals(array(), $acp_modules);
|
||||
|
||||
// No specific module, no module_class set in the function parameter, and an incorrect module class
|
||||
$acp_modules = $this->module_manager->get_module_infos('', 'wcp');
|
||||
$acp_modules = $this->module_manager->get_module_infos('wcp');
|
||||
$this->assertEquals(array(), $acp_modules);
|
||||
|
||||
// No specific module, module class set to false (will default to the above acp)
|
||||
// Setting $use_all_available will cause get_module_infos() to also load not enabled extensions (vendor2/bar)
|
||||
$acp_modules = $this->module_manager->get_module_infos('', 'acp', true);
|
||||
$acp_modules = $this->module_manager->get_module_infos('acp', '', true);
|
||||
$this->assertEquals(array(
|
||||
'vendor2\\foo\\acp\\a_module' => array(
|
||||
'filename' => 'vendor2\\foo\\acp\\a_module',
|
||||
@ -162,7 +162,7 @@ class phpbb_extension_modules_test extends phpbb_test_case
|
||||
), $acp_modules);
|
||||
|
||||
// Specific module set to disabled extension
|
||||
$acp_modules = $this->module_manager->get_module_infos('vendor2_bar_acp_a_module', 'acp', true);
|
||||
$acp_modules = $this->module_manager->get_module_infos('acp', 'vendor2_bar_acp_a_module', true);
|
||||
$this->assertEquals(array(
|
||||
'vendor2\\bar\\acp\\a_module' => array(
|
||||
'filename' => 'vendor2\\bar\\acp\\a_module',
|
||||
|
Loading…
x
Reference in New Issue
Block a user