[ticket/494] Remove SQL queries to portal_modules when changing settings

B3P-494
This commit is contained in:
Marc Alexander
2015-03-04 17:32:53 +01:00
parent 9fe7e17124
commit 1a74082154
5 changed files with 7 additions and 5 deletions

View File

@@ -296,7 +296,7 @@ class portal_module
WHERE module_id = ' . (int) $module_id; WHERE module_id = ' . (int) $module_id;
$this->db->sql_query($sql); $this->db->sql_query($sql);
$this->cache->destroy('portal_modules'); $this->cache->destroy('sql', PORTAL_MODULES_TABLE);
$this->cache->destroy('sql', CONFIG_TABLE); $this->cache->destroy('sql', CONFIG_TABLE);
if(isset($module_name)) if(isset($module_name))

View File

@@ -71,6 +71,8 @@ function set_portal_config($config_name, $config_value)
/** /**
* Get portal modules * Get portal modules
*
* @return array Portal modules array
*/ */
function obtain_portal_modules() function obtain_portal_modules()
{ {

View File

@@ -215,7 +215,7 @@ class manager
trigger_error($this->user->lang['UNABLE_TO_MOVE' . (($is_row) ? '_ROW' : '')] . adm_back_link($this->u_action)); trigger_error($this->user->lang['UNABLE_TO_MOVE' . (($is_row) ? '_ROW' : '')] . adm_back_link($this->u_action));
} }
$this->cache->destroy('portal_modules'); $this->cache->destroy('sql', PORTAL_MODULES_TABLE);
// Handle ajax requests // Handle ajax requests
$this->handle_ajax_request(array('success' => true)); $this->handle_ajax_request(array('success' => true));
@@ -375,7 +375,7 @@ class manager
} }
} }
$this->cache->destroy('portal_modules'); $this->cache->destroy('sql', PORTAL_MODULES_TABLE);
} }
/** /**

View File

@@ -64,7 +64,7 @@ class phpbb_acp_move_module_test extends \board3\portal\tests\testframework\data
$cache = $this->getMock('\phpbb\cache\cache', array('destroy', 'sql_exists', 'get', 'put', 'sql_load', 'sql_save')); $cache = $this->getMock('\phpbb\cache\cache', array('destroy', 'sql_exists', 'get', 'put', 'sql_load', 'sql_save'));
$cache->expects($this->any()) $cache->expects($this->any())
->method('destroy') ->method('destroy')
->with($this->equalTo('portal_modules')); ->with($this->equalTo('sql'));
$cache->expects($this->any()) $cache->expects($this->any())
->method('get') ->method('get')
->with($this->anything()) ->with($this->anything())

View File

@@ -112,7 +112,7 @@ class modules_manager_confirm_box_test extends \board3\portal\tests\testframewor
$this->cache = $this->getMock('\phpbb\cache\cache', array('destroy', 'sql_exists', 'get', 'put', 'purge')); $this->cache = $this->getMock('\phpbb\cache\cache', array('destroy', 'sql_exists', 'get', 'put', 'purge'));
$this->cache->expects($this->any()) $this->cache->expects($this->any())
->method('destroy') ->method('destroy')
->with($this->equalTo('portal_modules')); ->with($this->equalTo('sql'));
$this->cache->expects($this->any()) $this->cache->expects($this->any())
->method('get') ->method('get')
->with($this->anything()) ->with($this->anything())