From ac41ca63f7e7f9ce24a2c2f023e8e648c8a56634 Mon Sep 17 00:00:00 2001 From: Stefano Mazzega Date: Wed, 3 Dec 2014 11:55:47 +0100 Subject: add querystring to page caching. #2349 --- system/core/Output.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/system/core/Output.php b/system/core/Output.php index 8b7d6efbd..4743690c9 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -564,6 +564,9 @@ class CI_Output { .$CI->config->item('index_page') .$CI->uri->uri_string(); + // append querystring + $uri .= (empty($_SERVER['QUERY_STRING'])) ? '' : '?' . $_SERVER['QUERY_STRING']; + $cache_path .= md5($uri); if ( ! $fp = @fopen($cache_path, 'w+b')) @@ -648,6 +651,9 @@ class CI_Output { // Build the file path. The file name is an MD5 hash of the full URI $uri = $CFG->item('base_url').$CFG->item('index_page').$URI->uri_string; + // append querystring + $uri .= (empty($_SERVER['QUERY_STRING'])) ? '' : '?' . $_SERVER['QUERY_STRING']; + $filepath = $cache_path.md5($uri); if ( ! file_exists($filepath) OR ! $fp = @fopen($filepath, 'rb')) @@ -727,6 +733,9 @@ class CI_Output { $uri = $CI->uri->uri_string(); } + // append querystring + $uri .= (empty($_SERVER['QUERY_STRING'])) ? '' : '?' . $_SERVER['QUERY_STRING']; + $cache_path .= md5($CI->config->item('base_url').$CI->config->item('index_page').$uri); if ( ! @unlink($cache_path)) -- cgit v1.2.3-24-g4f1b From 6d61a058611b87043b25849fc144c256dbd79323 Mon Sep 17 00:00:00 2001 From: Stefano Mazzega Date: Wed, 3 Dec 2014 12:10:13 +0100 Subject: add querystring to page caching. #2349 --- system/core/Output.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/core/Output.php b/system/core/Output.php index 4743690c9..58a9d896b 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -565,7 +565,7 @@ class CI_Output { .$CI->uri->uri_string(); // append querystring - $uri .= (empty($_SERVER['QUERY_STRING'])) ? '' : '?' . $_SERVER['QUERY_STRING']; + $uri .= (empty($_SERVER['QUERY_STRING'])) ? '' : '?' . $_SERVER['QUERY_STRING']; $cache_path .= md5($uri); @@ -652,7 +652,7 @@ class CI_Output { // Build the file path. The file name is an MD5 hash of the full URI $uri = $CFG->item('base_url').$CFG->item('index_page').$URI->uri_string; // append querystring - $uri .= (empty($_SERVER['QUERY_STRING'])) ? '' : '?' . $_SERVER['QUERY_STRING']; + $uri .= (empty($_SERVER['QUERY_STRING'])) ? '' : '?' . $_SERVER['QUERY_STRING']; $filepath = $cache_path.md5($uri); @@ -734,7 +734,7 @@ class CI_Output { } // append querystring - $uri .= (empty($_SERVER['QUERY_STRING'])) ? '' : '?' . $_SERVER['QUERY_STRING']; + $uri .= (empty($_SERVER['QUERY_STRING'])) ? '' : '?' . $_SERVER['QUERY_STRING']; $cache_path .= md5($CI->config->item('base_url').$CI->config->item('index_page').$uri); -- cgit v1.2.3-24-g4f1b From af14e26e72ed484b2388b88bf8df245c2490a387 Mon Sep 17 00:00:00 2001 From: Stefano Mazzega Date: Wed, 3 Dec 2014 13:43:07 +0100 Subject: Fixed code style. Update changelog. #2349 --- system/core/Output.php | 6 +++--- user_guide_src/source/changelog.rst | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/system/core/Output.php b/system/core/Output.php index 58a9d896b..081423c99 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -565,7 +565,7 @@ class CI_Output { .$CI->uri->uri_string(); // append querystring - $uri .= (empty($_SERVER['QUERY_STRING'])) ? '' : '?' . $_SERVER['QUERY_STRING']; + empty($_SERVER['QUERY_STRING']) OR $uri .= '?'.$_SERVER['QUERY_STRING']; $cache_path .= md5($uri); @@ -652,7 +652,7 @@ class CI_Output { // Build the file path. The file name is an MD5 hash of the full URI $uri = $CFG->item('base_url').$CFG->item('index_page').$URI->uri_string; // append querystring - $uri .= (empty($_SERVER['QUERY_STRING'])) ? '' : '?' . $_SERVER['QUERY_STRING']; + empty($_SERVER['QUERY_STRING']) OR $uri .= '?'.$_SERVER['QUERY_STRING']; $filepath = $cache_path.md5($uri); @@ -734,7 +734,7 @@ class CI_Output { } // append querystring - $uri .= (empty($_SERVER['QUERY_STRING'])) ? '' : '?' . $_SERVER['QUERY_STRING']; + empty($_SERVER['QUERY_STRING']) OR $uri .= '?'.$_SERVER['QUERY_STRING']; $cache_path .= md5($CI->config->item('base_url').$CI->config->item('index_page').$uri); diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index f01ff8a5d..f336b3ae4 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -500,6 +500,7 @@ Release Date: Not Released - Added methods ``get_content_type()`` and ``get_header()``. - Added method ``delete_cache()``. - Changed caching behavior to compress the output before storing it, if ``$config['compress_output']`` is enabled. + - Added querystring to page caching. - :doc:`Config Library ` changes include: -- cgit v1.2.3-24-g4f1b