Skip to content

Commit

Permalink
Make dispatcher::cached() use here()
Browse files Browse the repository at this point in the history
This allows separate cache files to be created
for different query parameters.

Fixes #2381
  • Loading branch information
markstory committed Dec 17, 2011
1 parent a71b0f9 commit e05d7d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/Cake/Routing/Dispatcher.php
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 4 additions & 2 deletions lib/Cake/Test/Case/Routing/DispatcherTest.php
Expand Up @@ -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
Expand All @@ -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'),
);
}
Expand Down Expand Up @@ -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);
Expand All @@ -1414,7 +1416,7 @@ public function testFullPageCachingDispatch($url) {

$this->assertEquals($expected, $result);

$filename = $this->__cachePath($request->here);
$filename = $this->__cachePath($request->here());
unlink($filename);
}

Expand Down

0 comments on commit e05d7d1

Please sign in to comment.