aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/config/console.yml3
-rw-r--r--phpBB/includes/acp/acp_extensions.php34
-rw-r--r--phpBB/language/en/acp/common.php18
-rw-r--r--phpBB/phpbb/console/command/extension/command.php6
-rw-r--r--phpBB/phpbb/console/command/extension/disable.php2
-rw-r--r--phpBB/phpbb/console/command/extension/enable.php2
-rw-r--r--phpBB/phpbb/console/command/extension/purge.php2
7 files changed, 65 insertions, 2 deletions
diff --git a/phpBB/config/console.yml b/phpBB/config/console.yml
index 1340d9c0d7..ac6f4ecef1 100644
--- a/phpBB/config/console.yml
+++ b/phpBB/config/console.yml
@@ -61,6 +61,7 @@ services:
class: phpbb\console\command\extension\disable
arguments:
- @ext.manager
+ - @log
tags:
- { name: console.command }
@@ -68,6 +69,7 @@ services:
class: phpbb\console\command\extension\enable
arguments:
- @ext.manager
+ - @log
tags:
- { name: console.command }
@@ -75,6 +77,7 @@ services:
class: phpbb\console\command\extension\purge
arguments:
- @ext.manager
+ - @log
tags:
- { name: console.command }
diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php
index 21a1909ac1..f0133bc648 100644
--- a/phpBB/includes/acp/acp_extensions.php
+++ b/phpBB/includes/acp/acp_extensions.php
@@ -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));
}
diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php
index 6f6a5f901f..2896ab4e36 100644
--- a/phpBB/language/en/acp/common.php
+++ b/phpBB/language/en/acp/common.php
@@ -777,4 +777,22 @@ $lang = array_merge($lang, array(
'LOG_WORD_ADD' => '<strong>Added word censor</strong><br />» %s',
'LOG_WORD_DELETE' => '<strong>Deleted word censor</strong><br />» %s',
'LOG_WORD_EDIT' => '<strong>Edited word censor</strong><br />» %s',
+
+ 'LOG_EXT_ENABLE' => '<strong>Extension enabled</strong><br />» %s',
+ 'LOG_EXT_DISABLE' => '<strong>Extension disabled</strong><br />» %s',
+ 'LOG_EXT_PURGE' => '<strong>Extension’s data deleted</strong><br />» %s',
+
+ 'LOG_EXT_ENABLE_ERROR' => '<strong>Error while enabling an extension</strong><br />» %s',
+ 'LOG_EXT_DISABLE_ERROR' => '<strong>Error while disabling an extension</strong><br />» %s',
+ 'LOG_EXT_PURGE_ERROR' => '<strong>Error while deleted the data of an extension</strong><br />» %s',
+
+ 'LOG_EXT_ENABLE_DIR_INVALID_ERROR' => '<strong>Error while enabling the extension "%s"</strong><br />» Invalid directory structure.',
+ 'LOG_EXT_ENABLE_NOT_AVAILABLE_ERROR' => '<strong>Error while enabling the extension "%s"</strong><br />» Extension unavailable for this board.',
+ 'LOG_EXT_ENABLE_ALREADY_ENABLED_ERROR' => '<strong>Error while enabling the extension "%s"</strong><br />» Extension already enabled.',
+ 'LOG_EXT_ENABLE_MIGRATION_ERROR' => '<strong>Error while enabling the extension "%s"</strong><br />» Migration error.',
+
+ 'LOG_EXT_DISABLE_NOT_ENABLED_ERROR' => '<strong>Error while disabling the extension "%s"</strong><br />» Extension not enabled.',
+
+ 'LOG_EXT_PURGE_ENABLED_ERROR' => '<strong>Error while deleting the data of the extension "%s"</strong><br />» Extension enabled.',
+ 'LOG_EXT_PURGE_MIGRATION_ERROR' => '<strong>Error while deleting the data of the extension "%s"</strong><br />» Migration error.',
));
diff --git a/phpBB/phpbb/console/command/extension/command.php b/phpBB/phpbb/console/command/extension/command.php
index edde7ce2e2..d133c2224f 100644
--- a/phpBB/phpbb/console/command/extension/command.php
+++ b/phpBB/phpbb/console/command/extension/command.php
@@ -13,9 +13,13 @@ abstract class command extends \phpbb\console\command\command
/** @var \phpbb\extension\manager */
protected $manager;
- function __construct(\phpbb\extension\manager $manager)
+ /** @var \phpbb\log\log */
+ protected $log;
+
+ function __construct(\phpbb\extension\manager $manager, \phpbb\log\log $log)
{
$this->manager = $manager;
+ $this->log = $log;
parent::__construct();
}
diff --git a/phpBB/phpbb/console/command/extension/disable.php b/phpBB/phpbb/console/command/extension/disable.php
index e4de70ca34..fb0c23762f 100644
--- a/phpBB/phpbb/console/command/extension/disable.php
+++ b/phpBB/phpbb/console/command/extension/disable.php
@@ -35,11 +35,13 @@ class disable extends command
if ($this->manager->enabled($name))
{
+ $this->log->add('critical', ANONYMOUS, '', 'LOG_EXT_DISABLE_ERROR', time(), array($name));
$output->writeln("<error>Could not disable extension $name</error>");
return 1;
}
else
{
+ $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_DISABLE', time(), array($name));
$output->writeln("<info>Successfully disabled extension $name</info>");
return 0;
}
diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php
index ee7dae76aa..e20a5ba81d 100644
--- a/phpBB/phpbb/console/command/extension/enable.php
+++ b/phpBB/phpbb/console/command/extension/enable.php
@@ -35,11 +35,13 @@ class enable extends command
if ($this->manager->enabled($name))
{
+ $this->log->add('admin', ANONYMOUS, '', 'LOG_EXTENSION_ENABLE', time(), array($name));
$output->writeln("<info>Successfully enabled extension $name</info>");
return 0;
}
else
{
+ $this->log->add('critical', ANONYMOUS, '', 'LOG_EXT_ENABLE_ERROR', time(), array($name));
$output->writeln("<error>Could not enable extension $name</error>");
return 1;
}
diff --git a/phpBB/phpbb/console/command/extension/purge.php b/phpBB/phpbb/console/command/extension/purge.php
index c2e1d2928c..234d32f302 100644
--- a/phpBB/phpbb/console/command/extension/purge.php
+++ b/phpBB/phpbb/console/command/extension/purge.php
@@ -35,11 +35,13 @@ class purge extends command
if ($this->manager->enabled($name))
{
+ $this->log->add('critical', ANONYMOUS, '', 'LOG_EXT_PURGE_ERROR', time(), array($name));
$output->writeln("<error>Could not purge extension $name</error>");
return 1;
}
else
{
+ $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_PURGE', time(), array($name));
$output->writeln("<info>Successfully purge extension $name</info>");
return 0;
}