aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-05-26 18:55:19 +0200
committerJoas Schilling <nickvergessen@gmx.de>2014-05-26 18:55:19 +0200
commita6782801e768e9aac937c6670cd22f84dfdfb726 (patch)
treec223d72ddaefe1f8eeb7ff1a7bfbeb590fea0dd9 /phpBB
parent26674bff3999cf70840b6c15007f9c66ef4bb218 (diff)
parent93d3c517e3aac385e5ce8adb7e20592abf8b4b14 (diff)
downloadforums-a6782801e768e9aac937c6670cd22f84dfdfb726.tar
forums-a6782801e768e9aac937c6670cd22f84dfdfb726.tar.gz
forums-a6782801e768e9aac937c6670cd22f84dfdfb726.tar.bz2
forums-a6782801e768e9aac937c6670cd22f84dfdfb726.tar.xz
forums-a6782801e768e9aac937c6670cd22f84dfdfb726.zip
Merge pull request #2429 from Nicofuma/ticket/12074
[ticket/12074] Managing extensions doesn't produce any log entry * Nicofuma/ticket/12074: [ticket/12074] Update the visibility of the constructor [ticket/12074] Don't log errors [ticket/12074] Managing extensions doesn't produce any log entry
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/config/console.yml3
-rw-r--r--phpBB/includes/acp/acp_extensions.php22
-rw-r--r--phpBB/language/en/acp/common.php4
-rw-r--r--phpBB/phpbb/console/command/extension/command.php6
-rw-r--r--phpBB/phpbb/console/command/extension/disable.php1
-rw-r--r--phpBB/phpbb/console/command/extension/enable.php1
-rw-r--r--phpBB/phpbb/console/command/extension/purge.php1
7 files changed, 36 insertions, 2 deletions
diff --git a/phpBB/config/console.yml b/phpBB/config/console.yml
index d32befa15e..1305a12101 100644
--- a/phpBB/config/console.yml
+++ b/phpBB/config/console.yml
@@ -62,6 +62,7 @@ services:
class: phpbb\console\command\extension\disable
arguments:
- @ext.manager
+ - @log
tags:
- { name: console.command }
@@ -69,6 +70,7 @@ services:
class: phpbb\console\command\extension\enable
arguments:
- @ext.manager
+ - @log
tags:
- { name: console.command }
@@ -76,6 +78,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..1fb2d2df26 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'));
@@ -123,6 +125,11 @@ class acp_extensions
trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
}
+ if ($phpbb_extension_manager->enabled($ext_name))
+ {
+ redirect($this->u_action);
+ }
+
try
{
while ($phpbb_extension_manager->enable_step($ext_name))
@@ -135,6 +142,7 @@ class acp_extensions
meta_refresh(0, $this->u_action . '&amp;action=enable&amp;ext_name=' . urlencode($ext_name) . '&amp;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)
{
@@ -164,6 +172,11 @@ class acp_extensions
break;
case 'disable':
+ if (!$phpbb_extension_manager->enabled($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 +187,7 @@ class acp_extensions
meta_refresh(0, $this->u_action . '&amp;action=disable&amp;ext_name=' . urlencode($ext_name) . '&amp;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';
@@ -197,6 +211,11 @@ class acp_extensions
break;
case 'delete_data':
+ if ($phpbb_extension_manager->enabled($ext_name))
+ {
+ redirect($this->u_action);
+ }
+
try
{
while ($phpbb_extension_manager->purge_step($ext_name))
@@ -209,6 +228,7 @@ class acp_extensions
meta_refresh(0, $this->u_action . '&amp;action=delete_data&amp;ext_name=' . urlencode($ext_name) . '&amp;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)
{
diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php
index 6f6a5f901f..8014ee64f1 100644
--- a/phpBB/language/en/acp/common.php
+++ b/phpBB/language/en/acp/common.php
@@ -777,4 +777,8 @@ $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',
));
diff --git a/phpBB/phpbb/console/command/extension/command.php b/phpBB/phpbb/console/command/extension/command.php
index edde7ce2e2..72325ce768 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;
+
+ public 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..ceaf168108 100644
--- a/phpBB/phpbb/console/command/extension/disable.php
+++ b/phpBB/phpbb/console/command/extension/disable.php
@@ -40,6 +40,7 @@ class disable extends command
}
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..757f19005e 100644
--- a/phpBB/phpbb/console/command/extension/enable.php
+++ b/phpBB/phpbb/console/command/extension/enable.php
@@ -35,6 +35,7 @@ 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;
}
diff --git a/phpBB/phpbb/console/command/extension/purge.php b/phpBB/phpbb/console/command/extension/purge.php
index c2e1d2928c..0342d116f5 100644
--- a/phpBB/phpbb/console/command/extension/purge.php
+++ b/phpBB/phpbb/console/command/extension/purge.php
@@ -40,6 +40,7 @@ class purge extends command
}
else
{
+ $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_PURGE', time(), array($name));
$output->writeln("<info>Successfully purge extension $name</info>");
return 0;
}