summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/config/config.php11
-rw-r--r--system/core/Output.php17
-rw-r--r--user_guide_src/source/changelog.rst2
3 files changed, 26 insertions, 4 deletions
diff --git a/application/config/config.php b/application/config/config.php
index fc4547b9b..4ee33358a 100644
--- a/application/config/config.php
+++ b/application/config/config.php
@@ -322,6 +322,17 @@ $config['cache_path'] = '';
/*
|--------------------------------------------------------------------------
+| Cache Include Query String
+|--------------------------------------------------------------------------
+|
+| Set this to TRUE if you want to use different cache files depending on the
+| URL query string. Please be aware this might result in numerous cache files.
+|
+*/
+$config['cache_query_string'] = FALSE;
+
+/*
+|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
diff --git a/system/core/Output.php b/system/core/Output.php
index f5521882c..e8f0b1590 100644
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -564,7 +564,10 @@ class CI_Output {
.$CI->config->item('index_page')
.$CI->uri->uri_string();
- empty($_SERVER['QUERY_STRING']) OR $uri .= '?'.$_SERVER['QUERY_STRING'];
+ if ($CI->config->item('cache_query_string') && ! empty($_SERVER['QUERY_STRING']))
+ {
+ $uri .= '?'.$_SERVER['QUERY_STRING'];
+ }
$cache_path .= md5($uri);
@@ -650,7 +653,11 @@ 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;
- empty($_SERVER['QUERY_STRING']) OR $uri .= '?'.$_SERVER['QUERY_STRING'];
+
+ if ($CFG->item('cache_query_string') && ! empty($_SERVER['QUERY_STRING']))
+ {
+ $uri .= '?'.$_SERVER['QUERY_STRING'];
+ }
$filepath = $cache_path.md5($uri);
@@ -729,7 +736,11 @@ class CI_Output {
if (empty($uri))
{
$uri = $CI->uri->uri_string();
- empty($_SERVER['QUERY_STRING']) OR $uri .= '?'.$_SERVER['QUERY_STRING'];
+
+ if ($CI->config->item('cache_query_string') && ! empty($_SERVER['QUERY_STRING']))
+ {
+ $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 fb97f94b5..38fd75971 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -505,8 +505,8 @@ Release Date: Not Released
- Added a second argument to method ``set_content_type()`` that allows setting the document charset as well.
- Added methods ``get_content_type()`` and ``get_header()``.
- Added method ``delete_cache()``.
+ - Added configuration option ``$config['cache_query_string']`` to enable taking the query string into account when caching.
- Changed caching behavior to compress the output before storing it, if ``$config['compress_output']`` is enabled.
- - Changed caching to take the query string into account.
- :doc:`Config Library <libraries/config>` changes include: