mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Make dispatcher::cached() use here()
This allows separate cache files to be created for different query parameters. Fixes #2381
This commit is contained in:
parent
a71b0f9867
commit
e05d7d1791
2 changed files with 6 additions and 4 deletions
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue