1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-21 16:10:38 +01:00

[ticket/14849] Add core.acp_extensions_run_action

Moved the event to a slightly modified position to perform common
checks before calling the event, added an extra variable to allow
execution control, honor the extension modified value of u_action
(if any)

PHPBB-14849
This commit is contained in:
javiexin 2016-12-11 21:15:30 +01:00
parent 3322117c38
commit aae6341989

View File

@ -56,21 +56,6 @@ class acp_extensions
$safe_time_limit = (ini_get('max_execution_time') / 2);
$start_time = time();
/**
* Event to run a specific action on extension
*
* @event core.acp_extensions_run_action
* @var string action Action to run
* @var string u_action Url we are at
* @var string ext_name Extension name from request
* @var int safe_time_limit Safe limit of execution time
* @var int start_time Start time
* @since 3.1.11-RC1
*/
$u_action = $this->u_action;
$vars = array('action', 'u_action', 'ext_name', 'safe_time_limit', 'start_time');
extract($this->phpbb_dispatcher->trigger_event('core.acp_extensions_run_action', compact($vars)));
// Cancel action
if ($request->is_set_post('cancel'))
{
@ -83,6 +68,33 @@ class acp_extensions
trigger_error('FORM_INVALID', E_USER_WARNING);
}
/**
* Event to run a specific action on extension
*
* @event core.acp_extensions_run_action
* @var string action Action to run
* @var string u_action Url we are at
* @var string ext_name Extension name from request
* @var int safe_time_limit Safe limit of execution time
* @var int start_time Start time
* @var string tpl_name Template file to load; leave empty to continue execution, filled in if ready to finish
* @since 3.1.11-RC1
*/
$u_action = $this->u_action;
$tpl_name = '';
$vars = array('action', 'u_action', 'ext_name', 'safe_time_limit', 'start_time', 'tpl_name');
extract($this->phpbb_dispatcher->trigger_event('core.acp_extensions_run_action', compact($vars)));
// In case they have been updated by the event
$this->u_action = $u_action;
$this->tpl_name = $tpl_name;
// If tpl_name was set by the prior event, we are done
if ($tpl_name)
{
return;
}
// If they've specified an extension, let's load the metadata manager and validate it.
if ($ext_name)
{