diff options
Diffstat (limited to 'phpBB/includes/acp/acp_extensions.php')
-rw-r--r-- | phpBB/includes/acp/acp_extensions.php | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index 21a1909ac1..9033fbbe60 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,9 +19,6 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_extensions { var $u_action; @@ -26,16 +27,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 +126,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 +143,7 @@ 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) { @@ -164,6 +173,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 +188,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'; @@ -197,6 +212,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 +229,7 @@ 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) { |