From 828eaecf6ab4f6c013a7955bf6af2a81c049e42f Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 30 Jul 2012 15:24:31 -0500 Subject: [ticket/10875] Changes to Cache Driver caused method_exists checks to fail SQL Cache and other functions using the check method_exists($cache, failed because of the changes to the cache system. method_exists($cache has been changed to method_exists($cache->get_driver() PHPBB3-10875 --- phpBB/includes/db/mysql.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/db/mysql.php') diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index 8d1f805870..31bb59711a 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -172,7 +172,7 @@ class dbal_mysql extends dbal $this->sql_report('start', $query); } - $this->query_result = ($cache_ttl && method_exists($cache, 'sql_load')) ? $cache->sql_load($query) : false; + $this->query_result = ($cache_ttl && method_exists($cache->get_driver(), 'sql_load')) ? $cache->sql_load($query) : false; $this->sql_add_num_queries($this->query_result); if ($this->query_result === false) @@ -187,7 +187,7 @@ class dbal_mysql extends dbal $this->sql_report('stop', $query); } - if ($cache_ttl && method_exists($cache, 'sql_save')) + if ($cache_ttl && method_exists($cache->get_driver(), 'sql_save')) { $this->open_queries[(int) $this->query_result] = $this->query_result; $cache->sql_save($query, $this->query_result, $cache_ttl); -- cgit v1.2.1 From edcac438df164764c84ca9fb7a7f751bf76d5c34 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 30 Jul 2012 15:57:51 -0500 Subject: [ticket/10875] method_exists check is not required, interface declares them The changes to the cache drivers added an interface, which requires many cache functions exist. For these, we can remove the method_exists() check PHPBB3-10875 --- phpBB/includes/db/mysql.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/db/mysql.php') diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index 31bb59711a..dbab1ec0b8 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -172,7 +172,7 @@ class dbal_mysql extends dbal $this->sql_report('start', $query); } - $this->query_result = ($cache_ttl && method_exists($cache->get_driver(), 'sql_load')) ? $cache->sql_load($query) : false; + $this->query_result = ($cache_ttl) ? $cache->sql_load($query) : false; $this->sql_add_num_queries($this->query_result); if ($this->query_result === false) @@ -187,7 +187,7 @@ class dbal_mysql extends dbal $this->sql_report('stop', $query); } - if ($cache_ttl && method_exists($cache->get_driver(), 'sql_save')) + if ($cache_ttl) { $this->open_queries[(int) $this->query_result] = $this->query_result; $cache->sql_save($query, $this->query_result, $cache_ttl); -- cgit v1.2.1