From c8bbb35aacee7af8527820f3d3d5fd47d1dbf340 Mon Sep 17 00:00:00 2001 From: onli Date: Wed, 19 Apr 2017 01:11:34 +0200 Subject: [PATCH] Fix cache by getting & setting global state variables See https://board.s9y.org/viewtopic.php?p=10447129#p10447129. Missed in #345 --- include/functions_entries.inc.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/include/functions_entries.inc.php b/include/functions_entries.inc.php index 117c3512..7cd2f907 100644 --- a/include/functions_entries.inc.php +++ b/include/functions_entries.inc.php @@ -207,14 +207,15 @@ function &serendipity_fetchEntryCategories($entryid) { function &serendipity_fetchEntries($range = null, $full = true, $limit = '', $fetchDrafts = false, $modified_since = false, $orderby = 'timestamp DESC', $filter_sql = '', $noCache = false, $noSticky = false, $select_key = null, $group_by = null, $returncode = 'array', $joinauthors = true, $joincategories = true, $joinown = null) { global $serendipity; + $initial_args = array_values(func_get_args()); + if ($serendipity['useInternalCache']) { $cache = serendipity_setupCache(); - - $args = func_get_args(); - $args = array_values($args); - $key = md5(serialize($args)); - - if (($entries = $cache->get($key, "fetchEntries")) !== false) { + $key = md5(serialize($initial_args) . $serendipity['GET']['page']); + + $entries = $cache->get($key, "fetchEntries"); + if ($entries !== false) { + $serendipity['fullCountQuery'] = $cache->get($key . '_fullCountQuery', "fetchEntries"); return unserialize($entries); } } @@ -461,10 +462,9 @@ function &serendipity_fetchEntries($range = null, $full = true, $limit = '', $fe } if ($serendipity['useInternalCache']) { - $args = func_get_args(); - $args = array_values($args); - $key = md5(serialize($args)); + $key = md5(serialize($initial_args) . $serendipity['GET']['page']); $cache->save(serialize($ret), $key, "fetchEntries"); + $cache->save($serendipity['fullCountQuery'], $key . '_fullCountQuery', "fetchEntries"); } return $ret;