diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-08-07 12:09:01 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-08-07 12:09:01 +0200 |
commit | 58d1dcc7f2872b2c9116254d0eae3a5ee1bea48e (patch) | |
tree | ac804c383316e276dedb3c8058a4dd8676928376 /phpBB/phpbb/cache | |
parent | 89a6fed91d9344152f0b2a0779d3d458f3311ecf (diff) | |
parent | cc32ee8a2848b902f7dc9d809499855a78cb41f4 (diff) | |
download | forums-58d1dcc7f2872b2c9116254d0eae3a5ee1bea48e.tar forums-58d1dcc7f2872b2c9116254d0eae3a5ee1bea48e.tar.gz forums-58d1dcc7f2872b2c9116254d0eae3a5ee1bea48e.tar.bz2 forums-58d1dcc7f2872b2c9116254d0eae3a5ee1bea48e.tar.xz forums-58d1dcc7f2872b2c9116254d0eae3a5ee1bea48e.zip |
Merge pull request #2637 from Nicofuma/ticket/12387
[ticket/12387] Cleanup *_free_result call and remove @ on that call
* Nicofuma/ticket/12387:
[ticket/12387] Fix a call to sql_freeresult in full_text_native
[ticket/12387] Fix \phpbb\db\driver\mysqli::sql_freeresult
[ticket/12387] Use the hash as query_id for caching
[ticket/12387] Remove unnecessary checks
[ticket/12387] mssql_query return true if a select query returns 0 row
[ticket/12387] Cleanup *_free_result call and remove @ on that call
Diffstat (limited to 'phpBB/phpbb/cache')
-rw-r--r-- | phpBB/phpbb/cache/driver/file.php | 8 | ||||
-rw-r--r-- | phpBB/phpbb/cache/driver/memory.php | 11 |
2 files changed, 9 insertions, 10 deletions
diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index b32af32d25..fbd3b571f7 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -396,13 +396,13 @@ class file extends \phpbb\cache\driver\base { // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); + $query_id = md5($query); - if (($rowset = $this->_read('sql_' . md5($query))) === false) + if (($rowset = $this->_read('sql_' . $query_id)) === false) { return false; } - $query_id = sizeof($this->sql_rowset); $this->sql_rowset[$query_id] = $rowset; $this->sql_row_pointer[$query_id] = 0; @@ -417,7 +417,7 @@ class file extends \phpbb\cache\driver\base // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); - $query_id = sizeof($this->sql_rowset); + $query_id = md5($query); $this->sql_rowset[$query_id] = array(); $this->sql_row_pointer[$query_id] = 0; @@ -427,7 +427,7 @@ class file extends \phpbb\cache\driver\base } $db->sql_freeresult($query_result); - if ($this->_write('sql_' . md5($query), $this->sql_rowset[$query_id], $ttl + time(), $query)) + if ($this->_write('sql_' . $query_id, $this->sql_rowset[$query_id], $ttl + time(), $query)) { return $query_id; } diff --git a/phpBB/phpbb/cache/driver/memory.php b/phpBB/phpbb/cache/driver/memory.php index 5dee375192..cb2b6a10a7 100644 --- a/phpBB/phpbb/cache/driver/memory.php +++ b/phpBB/phpbb/cache/driver/memory.php @@ -266,9 +266,9 @@ abstract class memory extends \phpbb\cache\driver\base { // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); - $query_id = sizeof($this->sql_rowset); + $query_id = md5($query); - if (($result = $this->_read('sql_' . md5($query))) === false) + if (($result = $this->_read('sql_' . $query_id)) === false) { return false; } @@ -286,7 +286,7 @@ abstract class memory extends \phpbb\cache\driver\base { // Remove extra spaces and tabs $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); - $hash = md5($query); + $query_id = md5($query); // determine which tables this query belongs to // Some queries use backticks, namely the get_database_size() query @@ -315,14 +315,13 @@ abstract class memory extends \phpbb\cache\driver\base $temp = array(); } - $temp[$hash] = true; + $temp[$query_id] = true; // This must never expire $this->_write('sql_' . $table_name, $temp, 0); } // store them in the right place - $query_id = sizeof($this->sql_rowset); $this->sql_rowset[$query_id] = array(); $this->sql_row_pointer[$query_id] = 0; @@ -332,7 +331,7 @@ abstract class memory extends \phpbb\cache\driver\base } $db->sql_freeresult($query_result); - $this->_write('sql_' . $hash, $this->sql_rowset[$query_id], $ttl); + $this->_write('sql_' . $query_id, $this->sql_rowset[$query_id], $ttl); return $query_id; } |