summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2015-07-15 16:15:00 +0200
committerAndrey Andreev <narf@devilix.net>2015-07-15 16:15:00 +0200
commit148c02ee988a9082aab053b992bd73bbcf6e30ca (patch)
tree5cbe1bc632493d12cd7ad99383a45a689560c8b6 /system
parent63c34f2774440c5de77429cb613a4dda268f4dd9 (diff)
parentdc29c6dc9069650d69496635643f00ab5e52067e (diff)
Merge branch 'patch-1' of github.com:w0den/CodeIgniter into feature/output_cache
Diffstat (limited to 'system')
-rw-r--r--system/core/Output.php35
1 files changed, 28 insertions, 7 deletions
diff --git a/system/core/Output.php b/system/core/Output.php
index e7d559a1d..4aed62a86 100644
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -556,9 +556,16 @@ class CI_Output {
.$CI->config->item('index_page')
.$CI->uri->uri_string();
- if ($CI->config->item('cache_query_string') && ! empty($_SERVER['QUERY_STRING']))
+ if (($cache_query_string = $CI->config->item('cache_query_string')) && !empty($_SERVER['QUERY_STRING']))
{
- $uri .= '?'.$_SERVER['QUERY_STRING'];
+ if (is_array($cache_query_string))
+ {
+ $uri .= '?'.http_build_query(array_intersect_key($_GET, array_flip($cache_query_string)));
+ }
+ else
+ {
+ $uri .= '?'.$_SERVER['QUERY_STRING'];
+ }
}
$cache_path .= md5($uri);
@@ -646,9 +653,16 @@ 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;
- if ($CFG->item('cache_query_string') && ! empty($_SERVER['QUERY_STRING']))
+ if (($cache_query_string = $CFG->item('cache_query_string')) && !empty($_SERVER['QUERY_STRING']))
{
- $uri .= '?'.$_SERVER['QUERY_STRING'];
+ if (is_array($cache_query_string))
+ {
+ $uri .= '?'.http_build_query(array_intersect_key($_GET, array_flip($cache_query_string)));
+ }
+ else
+ {
+ $uri .= '?'.$_SERVER['QUERY_STRING'];
+ }
}
$filepath = $cache_path.md5($uri);
@@ -729,13 +743,20 @@ class CI_Output {
{
$uri = $CI->uri->uri_string();
- if ($CI->config->item('cache_query_string') && ! empty($_SERVER['QUERY_STRING']))
+ if (($cache_query_string = $CI->config->item('cache_query_string')) && !empty($_SERVER['QUERY_STRING']))
{
- $uri .= '?'.$_SERVER['QUERY_STRING'];
+ if (is_array($cache_query_string))
+ {
+ $uri .= '?'.http_build_query(array_intersect_key($_GET, array_flip($cache_query_string)));
+ }
+ else
+ {
+ $uri .= '?'.$_SERVER['QUERY_STRING'];
+ }
}
}
- $cache_path .= md5($CI->config->item('base_url').$CI->config->item('index_page').$uri);
+ $cache_path .= md5($CI->config->item('base_url').$CI->config->item('index_page').ltrim($uri, '/'));
if ( ! @unlink($cache_path))
{