Make dispatcher::cached() use here()

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

Fixes #2381
This commit is contained in:
mark_story 2011-12-17 12:19:34 -05:00
parent a71b0f9867
commit e05d7d1791
2 changed files with 6 additions and 4 deletions

View file

@ -68,7 +68,7 @@ class Dispatcher {
* 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 @@ class Dispatcher {
/**
* 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) {

View file

@ -1360,6 +1360,7 @@ class DispatcherTest extends CakeTestCase {
* - 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 @@ class DispatcherTest extends CakeTestCase {
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 @@ class DispatcherTest extends CakeTestCase {
$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 @@ class DispatcherTest extends CakeTestCase {
$this->assertEquals($expected, $result);
$filename = $this->__cachePath($request->here);
$filename = $this->__cachePath($request->here());
unlink($filename);
}