mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/12074] Managing extensions doesn't produce any log entry
PHPBB3-12074
This commit is contained in:
@@ -26,16 +26,18 @@ class acp_extensions
|
||||
private $config;
|
||||
private $template;
|
||||
private $user;
|
||||
private $log;
|
||||
|
||||
function main()
|
||||
{
|
||||
// Start the page
|
||||
global $config, $user, $template, $request, $phpbb_extension_manager, $db, $phpbb_root_path, $phpEx;
|
||||
global $config, $user, $template, $request, $phpbb_extension_manager, $db, $phpbb_root_path, $phpEx, $phpbb_log;
|
||||
|
||||
$this->db = $db;
|
||||
$this->config = $config;
|
||||
$this->template = $template;
|
||||
$this->user = $user;
|
||||
$this->log = $phpbb_log;
|
||||
|
||||
$user->add_lang(array('install', 'acp/extensions', 'migrator'));
|
||||
|
||||
@@ -90,16 +92,19 @@ class acp_extensions
|
||||
case 'enable_pre':
|
||||
if (!$md_manager->validate_dir())
|
||||
{
|
||||
$this->log->add('critical', $user->data['user_id'], $user->ip, 'LOG_EXT_ENABLE_DIR_INVALID_ERROR', time(), array($ext_name));
|
||||
trigger_error($user->lang['EXTENSION_DIR_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
if (!$md_manager->validate_enable())
|
||||
{
|
||||
$this->log->add('critical', $user->data['user_id'], $user->ip, 'LOG_EXT_ENABLE_NOT_AVAILABLE_ERROR', time(), array($ext_name));
|
||||
trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
if ($phpbb_extension_manager->enabled($ext_name))
|
||||
{
|
||||
$this->log->add('critical', $user->data['user_id'], $user->ip, 'LOG_EXT_ENABLE_ALREADY_ENABLED_ERROR', time(), array($ext_name));
|
||||
redirect($this->u_action);
|
||||
}
|
||||
|
||||
@@ -115,14 +120,22 @@ class acp_extensions
|
||||
case 'enable':
|
||||
if (!$md_manager->validate_dir())
|
||||
{
|
||||
$this->log->add('critical', $user->data['user_id'], $user->ip, 'LOG_EXT_ENABLE_DIR_INVALID_ERROR', time(), array($ext_name));
|
||||
trigger_error($user->lang['EXTENSION_DIR_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
if (!$md_manager->validate_enable())
|
||||
{
|
||||
$this->log->add('critical', $user->data['user_id'], $user->ip, 'LOG_EXT_ENABLE_NOT_AVAILABLE_ERROR', time(), array($ext_name));
|
||||
trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
if ($phpbb_extension_manager->enabled($ext_name))
|
||||
{
|
||||
$this->log->add('critical', $user->data['user_id'], $user->ip, 'LOG_EXT_ENABLE_ALREADY_ENABLED_ERROR', time(), array($ext_name));
|
||||
redirect($this->u_action);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
while ($phpbb_extension_manager->enable_step($ext_name))
|
||||
@@ -135,9 +148,11 @@ class acp_extensions
|
||||
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));
|
||||
}
|
||||
catch (\phpbb\db\migration\exception $e)
|
||||
{
|
||||
$this->log->add('critical', $user->data['user_id'], $user->ip, 'LOG_EXT_ENABLE_MIGRATION_ERROR', time(), array($ext_name));
|
||||
$template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($user));
|
||||
}
|
||||
|
||||
@@ -151,6 +166,7 @@ class acp_extensions
|
||||
case 'disable_pre':
|
||||
if (!$phpbb_extension_manager->enabled($ext_name))
|
||||
{
|
||||
$this->log->add('critical', $user->data['user_id'], $user->ip, 'LOG_EXT_DISABLE_NOT_ENABLED_ERROR', time(), array($ext_name));
|
||||
redirect($this->u_action);
|
||||
}
|
||||
|
||||
@@ -164,6 +180,12 @@ class acp_extensions
|
||||
break;
|
||||
|
||||
case 'disable':
|
||||
if (!$phpbb_extension_manager->enabled($ext_name))
|
||||
{
|
||||
$this->log->add('critical', $user->data['user_id'], $user->ip, 'LOG_EXT_DISABLE_NOT_ENABLED_ERROR', time(), array($ext_name));
|
||||
redirect($this->u_action);
|
||||
}
|
||||
|
||||
while ($phpbb_extension_manager->disable_step($ext_name))
|
||||
{
|
||||
// Are we approaching the time limit? If so we want to pause the update and continue after refreshing
|
||||
@@ -174,6 +196,7 @@ class acp_extensions
|
||||
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->tpl_name = 'acp_ext_disable';
|
||||
|
||||
@@ -185,6 +208,7 @@ class acp_extensions
|
||||
case 'delete_data_pre':
|
||||
if ($phpbb_extension_manager->enabled($ext_name))
|
||||
{
|
||||
$this->log->add('critical', $user->data['user_id'], $user->ip, 'LOG_EXT_PURGE_ENABLED_ERROR', time(), array($ext_name));
|
||||
redirect($this->u_action);
|
||||
}
|
||||
$this->tpl_name = 'acp_ext_delete_data';
|
||||
@@ -197,6 +221,12 @@ class acp_extensions
|
||||
break;
|
||||
|
||||
case 'delete_data':
|
||||
if ($phpbb_extension_manager->enabled($ext_name))
|
||||
{
|
||||
$this->log->add('critical', $user->data['user_id'], $user->ip, 'LOG_EXT_PURGE_ENABLED_ERROR', time(), array($ext_name));
|
||||
redirect($this->u_action);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
while ($phpbb_extension_manager->purge_step($ext_name))
|
||||
@@ -209,9 +239,11 @@ class acp_extensions
|
||||
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));
|
||||
}
|
||||
catch (\phpbb\db\migration\exception $e)
|
||||
{
|
||||
$this->log->add('critical', $user->data['user_id'], $user->ip, 'LOG_EXT_PURGE_MIGRATION_ERROR', time(), array($ext_name));
|
||||
$template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($user));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user