From 65539df39a2649427f4208b836a65f2d8ca7b4b3 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Wed, 1 Oct 2014 00:03:54 -0700 Subject: [PATCH 1/2] [ticket/13121] Remove cache mode from style management module https://tracker.phpbb.com/browse/PHPBB3-13121 PHPBB3-13121 --- phpBB/includes/acp/acp_styles.php | 22 -------- phpBB/includes/acp/info/acp_styles.php | 1 - .../data/v310/acp_style_cache_module.php | 51 +++++++++++++++++++ 3 files changed, 51 insertions(+), 23 deletions(-) create mode 100644 phpBB/phpbb/db/migration/data/v310/acp_style_cache_module.php diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 2a02e3e845..42c67a88b5 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -133,32 +133,10 @@ class acp_styles $this->welcome_message('INSTALL_STYLES', 'INSTALL_STYLES_EXPLAIN'); $this->show_available(); return; - case 'cache': - $this->action_cache(); - return; } trigger_error($this->user->lang['NO_MODE'] . adm_back_link($this->u_action), E_USER_WARNING); } - /** - * Purge cache - */ - protected function action_cache() - { - global $db, $cache, $auth; - - $this->config->increment('assets_version', 1); - $this->cache->purge(); - - // Clear permissions - $this->auth->acl_clear_prefetch(); - phpbb_cache_moderators($db, $cache, $auth); - - add_log('admin', 'LOG_PURGE_CACHE'); - - trigger_error($this->user->lang['PURGED_CACHE'] . adm_back_link($this->u_base_action), E_USER_NOTICE); - } - /** * Install style(s) */ diff --git a/phpBB/includes/acp/info/acp_styles.php b/phpBB/includes/acp/info/acp_styles.php index 1a9865aa1d..c0ab005502 100644 --- a/phpBB/includes/acp/info/acp_styles.php +++ b/phpBB/includes/acp/info/acp_styles.php @@ -22,7 +22,6 @@ class acp_styles_info 'modes' => array( 'style' => array('title' => 'ACP_STYLES', 'auth' => 'acl_a_styles', 'cat' => array('ACP_STYLE_MANAGEMENT')), 'install' => array('title' => 'ACP_STYLES_INSTALL', 'auth' => 'acl_a_styles', 'cat' => array('ACP_STYLE_MANAGEMENT')), - 'cache' => array('title' => 'ACP_STYLES_CACHE', 'auth' => 'acl_a_styles', 'cat' => array('ACP_STYLE_MANAGEMENT')), ), ); } diff --git a/phpBB/phpbb/db/migration/data/v310/acp_style_cache_module.php b/phpBB/phpbb/db/migration/data/v310/acp_style_cache_module.php new file mode 100644 index 0000000000..a922a7cb78 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/acp_style_cache_module.php @@ -0,0 +1,51 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class acp_style_cache_module extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + $sql = 'SELECT module_id + FROM ' . MODULES_TABLE . " + WHERE module_class = 'acp' + AND module_langname = 'ACP_STYLES_CACHE'"; + $result = $this->db->sql_query($sql); + $module_id = $this->db->sql_fetchfield('module_id'); + $this->db->sql_freeresult($result); + + return $module_id == false; + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\dev'); + } + + public function update_data() + { + return array( + array('module.remove', array( + 'acp', + 'ACP_STYLE_MANAGEMENT', + array( + 'module_basename' => 'acp_styles', + 'module_langname' => 'ACP_STYLES_CACHE', + 'module_mode' => 'cache', + 'module_auth' => 'acl_a_styles', + ), + )), + ); + } +} From 1ee48942719500f128fd40d6ae60561174204954 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Wed, 1 Oct 2014 00:29:45 -0700 Subject: [PATCH 2/2] [ticket/13121] Fix migration file PHPBB3-13121 --- ...p_style_cache_module.php => remove_acp_styles_cache.php} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename phpBB/phpbb/db/migration/data/v310/{acp_style_cache_module.php => remove_acp_styles_cache.php} (87%) diff --git a/phpBB/phpbb/db/migration/data/v310/acp_style_cache_module.php b/phpBB/phpbb/db/migration/data/v310/remove_acp_styles_cache.php similarity index 87% rename from phpBB/phpbb/db/migration/data/v310/acp_style_cache_module.php rename to phpBB/phpbb/db/migration/data/v310/remove_acp_styles_cache.php index a922a7cb78..7b84539814 100644 --- a/phpBB/phpbb/db/migration/data/v310/acp_style_cache_module.php +++ b/phpBB/phpbb/db/migration/data/v310/remove_acp_styles_cache.php @@ -13,7 +13,7 @@ namespace phpbb\db\migration\data\v310; -class acp_style_cache_module extends \phpbb\db\migration\migration +class remove_acp_styles_cache extends \phpbb\db\migration\migration { public function effectively_installed() { @@ -25,12 +25,12 @@ class acp_style_cache_module extends \phpbb\db\migration\migration $module_id = $this->db->sql_fetchfield('module_id'); $this->db->sql_freeresult($result); - return $module_id == false; + return !$module_id; } static public function depends_on() { - return array('\phpbb\db\migration\data\v310\dev'); + return array('\phpbb\db\migration\data\v310\rc4'); } public function update_data()