Permalink
Browse files

Make dispatcher::cached() use here()

This allows separate cache files to be created
for different query parameters.

Fixes #2381
  • Loading branch information...
1 parent a71b0f9 commit e05d7d1791e275ac93cd5a4924c9c70372271add @markstory markstory committed Dec 17, 2011
Showing with 6 additions and 4 deletions.
  1. +2 −2 lib/Cake/Routing/Dispatcher.php
  2. +4 −2 lib/Cake/Test/Case/Routing/DispatcherTest.php
@@ -68,7 +68,7 @@ public function __construct($base = false) {
* are encountered.
*/
public function dispatch(CakeRequest $request, CakeResponse $response, $additionalParams = array()) {
- if ($this->asset($request->url, $response) || $this->cached($request->here)) {
+ if ($this->asset($request->url, $response) || $this->cached($request->here())) {
return;
}
@@ -203,7 +203,7 @@ protected function _loadRoutes() {
/**
* Outputs cached dispatch view cache
*
- * @param string $path Requested URL path
+ * @param string $path Requested URL path with any query string parameters
* @return string|boolean False if is not cached or output
*/
public function cached($path) {
@@ -1360,6 +1360,7 @@ public function testAssetFilterForThemeAndPlugins() {
* - Test simple views
* - Test views with nocache tags
* - Test requests with named + passed params.
+ * - Test requests with query string params
* - Test themed views.
*
* @return array
@@ -1373,6 +1374,7 @@ public static function cacheActionProvider() {
array('TestCachedPages/test_nocache_tags'),
array('test_cached_pages/view/param/param'),
array('test_cached_pages/view/foo:bar/value:goo'),
+ array('test_cached_pages/view?q=cakephp'),
array('test_cached_pages/themed'),
);
}
@@ -1405,7 +1407,7 @@ public function testFullPageCachingDispatch($url) {
$out = ob_get_clean();
ob_start();
- $dispatcher->cached($request->here);
+ $dispatcher->cached($request->here());
$cached = ob_get_clean();
$result = str_replace(array("\t", "\r\n", "\n"), "", $out);
@@ -1414,7 +1416,7 @@ public function testFullPageCachingDispatch($url) {
$this->assertEquals($expected, $result);
- $filename = $this->__cachePath($request->here);
+ $filename = $this->__cachePath($request->here());
unlink($filename);
}

0 comments on commit e05d7d1

Please sign in to comment.