mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
[ticket/15087] Optimize creation of metadata objects by caching
Code for [ticket/14919] Do not directly use globals in acp_extensions for phpbb 3.2. PHPBB3-15087
This commit is contained in:
parent
4fd6b0fd88
commit
17f8c53ef3
1 changed files with 71 additions and 73 deletions
|
@ -25,35 +25,36 @@ if (!defined('IN_PHPBB'))
|
||||||
class acp_extensions
|
class acp_extensions
|
||||||
{
|
{
|
||||||
var $u_action;
|
var $u_action;
|
||||||
|
var $tpl_name;
|
||||||
|
var $page_title;
|
||||||
|
|
||||||
private $db;
|
|
||||||
private $config;
|
private $config;
|
||||||
private $template;
|
private $template;
|
||||||
private $user;
|
private $user;
|
||||||
private $cache;
|
|
||||||
private $log;
|
private $log;
|
||||||
private $request;
|
private $request;
|
||||||
|
private $phpbb_dispatcher;
|
||||||
|
private $ext_manager;
|
||||||
|
|
||||||
function main()
|
function main()
|
||||||
{
|
{
|
||||||
// Start the page
|
// Start the page
|
||||||
global $config, $user, $template, $request, $phpbb_extension_manager, $db, $phpbb_root_path, $phpbb_log, $cache, $phpbb_dispatcher;
|
global $config, $user, $template, $request, $phpbb_extension_manager, $phpbb_root_path, $phpbb_log, $phpbb_dispatcher;
|
||||||
|
|
||||||
$this->db = $db;
|
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
$this->cache = $cache;
|
|
||||||
$this->request = $request;
|
$this->request = $request;
|
||||||
$this->log = $phpbb_log;
|
$this->log = $phpbb_log;
|
||||||
$this->phpbb_dispatcher = $phpbb_dispatcher;
|
$this->phpbb_dispatcher = $phpbb_dispatcher;
|
||||||
|
$this->ext_manager = $phpbb_extension_manager;
|
||||||
|
|
||||||
$user->add_lang(array('install', 'acp/extensions', 'migrator'));
|
$this->user->add_lang(array('install', 'acp/extensions', 'migrator'));
|
||||||
|
|
||||||
$this->page_title = 'ACP_EXTENSIONS';
|
$this->page_title = 'ACP_EXTENSIONS';
|
||||||
|
|
||||||
$action = $request->variable('action', 'list');
|
$action = $this->request->variable('action', 'list');
|
||||||
$ext_name = $request->variable('ext_name', '');
|
$ext_name = $this->request->variable('ext_name', '');
|
||||||
|
|
||||||
// What is a safe limit of execution time? Half the max execution time should be safe.
|
// What is a safe limit of execution time? Half the max execution time should be safe.
|
||||||
$safe_time_limit = (ini_get('max_execution_time') / 2);
|
$safe_time_limit = (ini_get('max_execution_time') / 2);
|
||||||
|
@ -75,13 +76,13 @@ class acp_extensions
|
||||||
extract($this->phpbb_dispatcher->trigger_event('core.acp_extensions_run_action', compact($vars)));
|
extract($this->phpbb_dispatcher->trigger_event('core.acp_extensions_run_action', compact($vars)));
|
||||||
|
|
||||||
// Cancel action
|
// Cancel action
|
||||||
if ($request->is_set_post('cancel'))
|
if ($this->request->is_set_post('cancel'))
|
||||||
{
|
{
|
||||||
$action = 'list';
|
$action = 'list';
|
||||||
$ext_name = '';
|
$ext_name = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($action, array('enable', 'disable', 'delete_data')) && !check_link_hash($request->variable('hash', ''), $action . '.' . $ext_name))
|
if (in_array($action, array('enable', 'disable', 'delete_data')) && !check_link_hash($this->request->variable('hash', ''), $action . '.' . $ext_name))
|
||||||
{
|
{
|
||||||
trigger_error('FORM_INVALID', E_USER_WARNING);
|
trigger_error('FORM_INVALID', E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
@ -89,7 +90,7 @@ class acp_extensions
|
||||||
// If they've specified an extension, let's load the metadata manager and validate it.
|
// If they've specified an extension, let's load the metadata manager and validate it.
|
||||||
if ($ext_name)
|
if ($ext_name)
|
||||||
{
|
{
|
||||||
$md_manager = new \phpbb\extension\metadata_manager($ext_name, $config, $phpbb_extension_manager, $phpbb_root_path);
|
$md_manager = $this->ext_manager->create_extension_metadata_manager($ext_name);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -114,12 +115,12 @@ class acp_extensions
|
||||||
'force_unstable' => $force_unstable,
|
'force_unstable' => $force_unstable,
|
||||||
));
|
));
|
||||||
|
|
||||||
confirm_box(false, $user->lang('EXTENSION_FORCE_UNSTABLE_CONFIRM'), $s_hidden_fields);
|
confirm_box(false, $this->user->lang('EXTENSION_FORCE_UNSTABLE_CONFIRM'), $s_hidden_fields);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$config->set('extension_force_unstable', false);
|
$this->config->set('extension_force_unstable', false);
|
||||||
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
|
trigger_error($this->user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -127,17 +128,17 @@ class acp_extensions
|
||||||
default:
|
default:
|
||||||
if (confirm_box(true))
|
if (confirm_box(true))
|
||||||
{
|
{
|
||||||
$config->set('extension_force_unstable', true);
|
$this->config->set('extension_force_unstable', true);
|
||||||
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
|
trigger_error($this->user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->list_enabled_exts($phpbb_extension_manager);
|
$this->list_enabled_exts();
|
||||||
$this->list_disabled_exts($phpbb_extension_manager);
|
$this->list_disabled_exts();
|
||||||
$this->list_available_exts($phpbb_extension_manager);
|
$this->list_available_exts();
|
||||||
|
|
||||||
$this->template->assign_vars(array(
|
$this->template->assign_vars(array(
|
||||||
'U_VERSIONCHECK_FORCE' => $this->u_action . '&action=list&versioncheck_force=1',
|
'U_VERSIONCHECK_FORCE' => $this->u_action . '&action=list&versioncheck_force=1',
|
||||||
'FORCE_UNSTABLE' => $config['extension_force_unstable'],
|
'FORCE_UNSTABLE' => $this->config['extension_force_unstable'],
|
||||||
'U_ACTION' => $this->u_action,
|
'U_ACTION' => $this->u_action,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -147,28 +148,28 @@ class acp_extensions
|
||||||
case 'enable_pre':
|
case 'enable_pre':
|
||||||
if (!$md_manager->validate_dir())
|
if (!$md_manager->validate_dir())
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['EXTENSION_DIR_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
|
trigger_error($this->user->lang['EXTENSION_DIR_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$md_manager->validate_enable())
|
if (!$md_manager->validate_enable())
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
|
trigger_error($this->user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
$extension = $phpbb_extension_manager->get_extension($ext_name);
|
$extension = $this->ext_manager->get_extension($ext_name);
|
||||||
if (!$extension->is_enableable())
|
if (!$extension->is_enableable())
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['EXTENSION_NOT_ENABLEABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
|
trigger_error($this->user->lang['EXTENSION_NOT_ENABLEABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($phpbb_extension_manager->is_enabled($ext_name))
|
if ($this->ext_manager->is_enabled($ext_name))
|
||||||
{
|
{
|
||||||
redirect($this->u_action);
|
redirect($this->u_action);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->tpl_name = 'acp_ext_enable';
|
$this->tpl_name = 'acp_ext_enable';
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$this->template->assign_vars(array(
|
||||||
'PRE' => true,
|
'PRE' => true,
|
||||||
'L_CONFIRM_MESSAGE' => $this->user->lang('EXTENSION_ENABLE_CONFIRM', $md_manager->get_metadata('display-name')),
|
'L_CONFIRM_MESSAGE' => $this->user->lang('EXTENSION_ENABLE_CONFIRM', $md_manager->get_metadata('display-name')),
|
||||||
'U_ENABLE' => $this->u_action . '&action=enable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('enable.' . $ext_name),
|
'U_ENABLE' => $this->u_action . '&action=enable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('enable.' . $ext_name),
|
||||||
|
@ -178,55 +179,55 @@ class acp_extensions
|
||||||
case 'enable':
|
case 'enable':
|
||||||
if (!$md_manager->validate_dir())
|
if (!$md_manager->validate_dir())
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['EXTENSION_DIR_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
|
trigger_error($this->user->lang['EXTENSION_DIR_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$md_manager->validate_enable())
|
if (!$md_manager->validate_enable())
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
|
trigger_error($this->user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
$extension = $phpbb_extension_manager->get_extension($ext_name);
|
$extension = $this->ext_manager->get_extension($ext_name);
|
||||||
if (!$extension->is_enableable())
|
if (!$extension->is_enableable())
|
||||||
{
|
{
|
||||||
trigger_error($user->lang['EXTENSION_NOT_ENABLEABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
|
trigger_error($this->user->lang['EXTENSION_NOT_ENABLEABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
while ($phpbb_extension_manager->enable_step($ext_name))
|
while ($this->ext_manager->enable_step($ext_name))
|
||||||
{
|
{
|
||||||
// Are we approaching the time limit? If so we want to pause the update and continue after refreshing
|
// Are we approaching the time limit? If so we want to pause the update and continue after refreshing
|
||||||
if ((time() - $start_time) >= $safe_time_limit)
|
if ((time() - $start_time) >= $safe_time_limit)
|
||||||
{
|
{
|
||||||
$template->assign_var('S_NEXT_STEP', true);
|
$this->template->assign_var('S_NEXT_STEP', true);
|
||||||
|
|
||||||
meta_refresh(0, $this->u_action . '&action=enable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('enable.' . $ext_name));
|
meta_refresh(0, $this->u_action . '&action=enable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('enable.' . $ext_name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->log->add('admin', $user->data['user_id'], $user->ip, 'LOG_EXT_ENABLE', time(), array($ext_name));
|
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_EXT_ENABLE', time(), array($ext_name));
|
||||||
}
|
}
|
||||||
catch (\phpbb\db\migration\exception $e)
|
catch (\phpbb\db\migration\exception $e)
|
||||||
{
|
{
|
||||||
$template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($user));
|
$this->template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($this->user));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->tpl_name = 'acp_ext_enable';
|
$this->tpl_name = 'acp_ext_enable';
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$this->template->assign_vars(array(
|
||||||
'U_RETURN' => $this->u_action . '&action=list',
|
'U_RETURN' => $this->u_action . '&action=list',
|
||||||
));
|
));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'disable_pre':
|
case 'disable_pre':
|
||||||
if (!$phpbb_extension_manager->is_enabled($ext_name))
|
if (!$this->ext_manager->is_enabled($ext_name))
|
||||||
{
|
{
|
||||||
redirect($this->u_action);
|
redirect($this->u_action);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->tpl_name = 'acp_ext_disable';
|
$this->tpl_name = 'acp_ext_disable';
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$this->template->assign_vars(array(
|
||||||
'PRE' => true,
|
'PRE' => true,
|
||||||
'L_CONFIRM_MESSAGE' => $this->user->lang('EXTENSION_DISABLE_CONFIRM', $md_manager->get_metadata('display-name')),
|
'L_CONFIRM_MESSAGE' => $this->user->lang('EXTENSION_DISABLE_CONFIRM', $md_manager->get_metadata('display-name')),
|
||||||
'U_DISABLE' => $this->u_action . '&action=disable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('disable.' . $ext_name),
|
'U_DISABLE' => $this->u_action . '&action=disable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('disable.' . $ext_name),
|
||||||
|
@ -234,38 +235,38 @@ class acp_extensions
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'disable':
|
case 'disable':
|
||||||
if (!$phpbb_extension_manager->is_enabled($ext_name))
|
if (!$this->ext_manager->is_enabled($ext_name))
|
||||||
{
|
{
|
||||||
redirect($this->u_action);
|
redirect($this->u_action);
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($phpbb_extension_manager->disable_step($ext_name))
|
while ($this->ext_manager->disable_step($ext_name))
|
||||||
{
|
{
|
||||||
// Are we approaching the time limit? If so we want to pause the update and continue after refreshing
|
// Are we approaching the time limit? If so we want to pause the update and continue after refreshing
|
||||||
if ((time() - $start_time) >= $safe_time_limit)
|
if ((time() - $start_time) >= $safe_time_limit)
|
||||||
{
|
{
|
||||||
$template->assign_var('S_NEXT_STEP', true);
|
$this->template->assign_var('S_NEXT_STEP', true);
|
||||||
|
|
||||||
meta_refresh(0, $this->u_action . '&action=disable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('disable.' . $ext_name));
|
meta_refresh(0, $this->u_action . '&action=disable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('disable.' . $ext_name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->log->add('admin', $user->data['user_id'], $user->ip, 'LOG_EXT_DISABLE', time(), array($ext_name));
|
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_EXT_DISABLE', time(), array($ext_name));
|
||||||
|
|
||||||
$this->tpl_name = 'acp_ext_disable';
|
$this->tpl_name = 'acp_ext_disable';
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$this->template->assign_vars(array(
|
||||||
'U_RETURN' => $this->u_action . '&action=list',
|
'U_RETURN' => $this->u_action . '&action=list',
|
||||||
));
|
));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'delete_data_pre':
|
case 'delete_data_pre':
|
||||||
if ($phpbb_extension_manager->is_enabled($ext_name))
|
if ($this->ext_manager->is_enabled($ext_name))
|
||||||
{
|
{
|
||||||
redirect($this->u_action);
|
redirect($this->u_action);
|
||||||
}
|
}
|
||||||
$this->tpl_name = 'acp_ext_delete_data';
|
$this->tpl_name = 'acp_ext_delete_data';
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$this->template->assign_vars(array(
|
||||||
'PRE' => true,
|
'PRE' => true,
|
||||||
'L_CONFIRM_MESSAGE' => $this->user->lang('EXTENSION_DELETE_DATA_CONFIRM', $md_manager->get_metadata('display-name')),
|
'L_CONFIRM_MESSAGE' => $this->user->lang('EXTENSION_DELETE_DATA_CONFIRM', $md_manager->get_metadata('display-name')),
|
||||||
'U_PURGE' => $this->u_action . '&action=delete_data&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('delete_data.' . $ext_name),
|
'U_PURGE' => $this->u_action . '&action=delete_data&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('delete_data.' . $ext_name),
|
||||||
|
@ -273,75 +274,75 @@ class acp_extensions
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'delete_data':
|
case 'delete_data':
|
||||||
if ($phpbb_extension_manager->is_enabled($ext_name))
|
if ($this->ext_manager->is_enabled($ext_name))
|
||||||
{
|
{
|
||||||
redirect($this->u_action);
|
redirect($this->u_action);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
while ($phpbb_extension_manager->purge_step($ext_name))
|
while ($this->ext_manager->purge_step($ext_name))
|
||||||
{
|
{
|
||||||
// Are we approaching the time limit? If so we want to pause the update and continue after refreshing
|
// Are we approaching the time limit? If so we want to pause the update and continue after refreshing
|
||||||
if ((time() - $start_time) >= $safe_time_limit)
|
if ((time() - $start_time) >= $safe_time_limit)
|
||||||
{
|
{
|
||||||
$template->assign_var('S_NEXT_STEP', true);
|
$this->template->assign_var('S_NEXT_STEP', true);
|
||||||
|
|
||||||
meta_refresh(0, $this->u_action . '&action=delete_data&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('delete_data.' . $ext_name));
|
meta_refresh(0, $this->u_action . '&action=delete_data&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('delete_data.' . $ext_name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->log->add('admin', $user->data['user_id'], $user->ip, 'LOG_EXT_PURGE', time(), array($ext_name));
|
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_EXT_PURGE', time(), array($ext_name));
|
||||||
}
|
}
|
||||||
catch (\phpbb\db\migration\exception $e)
|
catch (\phpbb\db\migration\exception $e)
|
||||||
{
|
{
|
||||||
$template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($user));
|
$this->template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($this->user));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->tpl_name = 'acp_ext_delete_data';
|
$this->tpl_name = 'acp_ext_delete_data';
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$this->template->assign_vars(array(
|
||||||
'U_RETURN' => $this->u_action . '&action=list',
|
'U_RETURN' => $this->u_action . '&action=list',
|
||||||
));
|
));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'details':
|
case 'details':
|
||||||
// Output it to the template
|
// Output it to the template
|
||||||
$md_manager->output_template_data($template);
|
$md_manager->output_template_data($this->template);
|
||||||
|
|
||||||
$meta = $md_manager->get_metadata('all');
|
$meta = $md_manager->get_metadata('all');
|
||||||
if (isset($meta['extra']['version-check']))
|
if (isset($meta['extra']['version-check']))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$updates_available = $phpbb_extension_manager->version_check($md_manager, $request->variable('versioncheck_force', false), $this->config['extension_force_unstable'] ? 'unstable' : null);
|
$updates_available = $this->ext_manager->version_check($md_manager, $this->request->variable('versioncheck_force', false), $this->config['extension_force_unstable'] ? 'unstable' : null);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$this->template->assign_vars(array(
|
||||||
'S_UP_TO_DATE' => empty($updates_available),
|
'S_UP_TO_DATE' => empty($updates_available),
|
||||||
'UP_TO_DATE_MSG' => $this->user->lang(empty($updates_available) ? 'UP_TO_DATE' : 'NOT_UP_TO_DATE', $md_manager->get_metadata('display-name')),
|
'UP_TO_DATE_MSG' => $this->user->lang(empty($updates_available) ? 'UP_TO_DATE' : 'NOT_UP_TO_DATE', $md_manager->get_metadata('display-name')),
|
||||||
));
|
));
|
||||||
|
|
||||||
foreach ($updates_available as $branch => $version_data)
|
foreach ($updates_available as $branch => $version_data)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('updates_available', $version_data);
|
$this->template->assign_block_vars('updates_available', $version_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (exception_interface $e)
|
catch (exception_interface $e)
|
||||||
{
|
{
|
||||||
$message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));
|
$message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$this->template->assign_vars(array(
|
||||||
'S_VERSIONCHECK_FAIL' => true,
|
'S_VERSIONCHECK_FAIL' => true,
|
||||||
'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== 'VERSIONCHECK_FAIL') ? $message : '',
|
'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== 'VERSIONCHECK_FAIL') ? $message : '',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
$template->assign_var('S_VERSIONCHECK', true);
|
$this->template->assign_var('S_VERSIONCHECK', true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$template->assign_var('S_VERSIONCHECK', false);
|
$this->template->assign_var('S_VERSIONCHECK', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$this->template->assign_vars(array(
|
||||||
'U_BACK' => $this->u_action . '&action=list',
|
'U_BACK' => $this->u_action . '&action=list',
|
||||||
'U_VERSIONCHECK_FORCE' => $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')),
|
'U_VERSIONCHECK_FORCE' => $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')),
|
||||||
));
|
));
|
||||||
|
@ -354,16 +355,15 @@ class acp_extensions
|
||||||
/**
|
/**
|
||||||
* Lists all the enabled extensions and dumps to the template
|
* Lists all the enabled extensions and dumps to the template
|
||||||
*
|
*
|
||||||
* @param $phpbb_extension_manager An instance of the extension manager
|
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
public function list_enabled_exts(\phpbb\extension\manager $phpbb_extension_manager)
|
public function list_enabled_exts()
|
||||||
{
|
{
|
||||||
$enabled_extension_meta_data = array();
|
$enabled_extension_meta_data = array();
|
||||||
|
|
||||||
foreach ($phpbb_extension_manager->all_enabled() as $name => $location)
|
foreach ($this->ext_manager->all_enabled() as $name => $location)
|
||||||
{
|
{
|
||||||
$md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name);
|
$md_manager = $this->ext_manager->create_extension_metadata_manager($name);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -378,7 +378,7 @@ class acp_extensions
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$force_update = $this->request->variable('versioncheck_force', false);
|
$force_update = $this->request->variable('versioncheck_force', false);
|
||||||
$updates = $phpbb_extension_manager->version_check($md_manager, $force_update, !$force_update);
|
$updates = $this->ext_manager->version_check($md_manager, $force_update, !$force_update);
|
||||||
|
|
||||||
$enabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates);
|
$enabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates);
|
||||||
$enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true;
|
$enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true;
|
||||||
|
@ -426,16 +426,15 @@ class acp_extensions
|
||||||
/**
|
/**
|
||||||
* Lists all the disabled extensions and dumps to the template
|
* Lists all the disabled extensions and dumps to the template
|
||||||
*
|
*
|
||||||
* @param $phpbb_extension_manager An instance of the extension manager
|
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
public function list_disabled_exts(\phpbb\extension\manager $phpbb_extension_manager)
|
public function list_disabled_exts()
|
||||||
{
|
{
|
||||||
$disabled_extension_meta_data = array();
|
$disabled_extension_meta_data = array();
|
||||||
|
|
||||||
foreach ($phpbb_extension_manager->all_disabled() as $name => $location)
|
foreach ($this->ext_manager->all_disabled() as $name => $location)
|
||||||
{
|
{
|
||||||
$md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name);
|
$md_manager = $this->ext_manager->create_extension_metadata_manager($name);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -448,7 +447,7 @@ class acp_extensions
|
||||||
if (isset($meta['extra']['version-check']))
|
if (isset($meta['extra']['version-check']))
|
||||||
{
|
{
|
||||||
$force_update = $this->request->variable('versioncheck_force', false);
|
$force_update = $this->request->variable('versioncheck_force', false);
|
||||||
$updates = $phpbb_extension_manager->version_check($md_manager, $force_update, !$force_update);
|
$updates = $this->ext_manager->version_check($md_manager, $force_update, !$force_update);
|
||||||
|
|
||||||
$disabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates);
|
$disabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates);
|
||||||
$disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true;
|
$disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true;
|
||||||
|
@ -496,18 +495,17 @@ class acp_extensions
|
||||||
/**
|
/**
|
||||||
* Lists all the available extensions and dumps to the template
|
* Lists all the available extensions and dumps to the template
|
||||||
*
|
*
|
||||||
* @param $phpbb_extension_manager An instance of the extension manager
|
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
public function list_available_exts(\phpbb\extension\manager $phpbb_extension_manager)
|
public function list_available_exts()
|
||||||
{
|
{
|
||||||
$uninstalled = array_diff_key($phpbb_extension_manager->all_available(), $phpbb_extension_manager->all_configured());
|
$uninstalled = array_diff_key($this->ext_manager->all_available(), $this->ext_manager->all_configured());
|
||||||
|
|
||||||
$available_extension_meta_data = array();
|
$available_extension_meta_data = array();
|
||||||
|
|
||||||
foreach ($uninstalled as $name => $location)
|
foreach ($uninstalled as $name => $location)
|
||||||
{
|
{
|
||||||
$md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name);
|
$md_manager = $this->ext_manager->create_extension_metadata_manager($name);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -520,7 +518,7 @@ class acp_extensions
|
||||||
if (isset($meta['extra']['version-check']))
|
if (isset($meta['extra']['version-check']))
|
||||||
{
|
{
|
||||||
$force_update = $this->request->variable('versioncheck_force', false);
|
$force_update = $this->request->variable('versioncheck_force', false);
|
||||||
$updates = $phpbb_extension_manager->version_check($md_manager, $force_update, !$force_update);
|
$updates = $this->ext_manager->version_check($md_manager, $force_update, !$force_update);
|
||||||
|
|
||||||
$available_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates);
|
$available_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates);
|
||||||
$available_extension_meta_data[$name]['S_VERSIONCHECK'] = true;
|
$available_extension_meta_data[$name]['S_VERSIONCHECK'] = true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue