mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #2559 from willmorgan/cachetofile-arguments
Making cacheToFile key more resilient against mixed/nested types
This commit is contained in:
commit
337a29abce
@ -1066,7 +1066,7 @@ abstract class Object {
|
|||||||
if(!is_array($arguments)) $arguments = array($arguments);
|
if(!is_array($arguments)) $arguments = array($arguments);
|
||||||
|
|
||||||
if($ID) $cacheName .= '_' . $ID;
|
if($ID) $cacheName .= '_' . $ID;
|
||||||
if(count($arguments)) $cacheName .= '_' . implode('_', $arguments);
|
if(count($arguments)) $cacheName .= '_' . md5(serialize($arguments));
|
||||||
|
|
||||||
if($data = $this->loadCache($cacheName, $lifetime)) {
|
if($data = $this->loadCache($cacheName, $lifetime)) {
|
||||||
return $data;
|
return $data;
|
||||||
@ -1085,7 +1085,7 @@ abstract class Object {
|
|||||||
$cacheName = $this->class . '_' . $method;
|
$cacheName = $this->class . '_' . $method;
|
||||||
if(!is_array($arguments)) $arguments = array($arguments);
|
if(!is_array($arguments)) $arguments = array($arguments);
|
||||||
if($ID) $cacheName .= '_' . $ID;
|
if($ID) $cacheName .= '_' . $ID;
|
||||||
if(count($arguments)) $cacheName .= '_' . implode('_', $arguments);
|
if(count($arguments)) $cacheName .= '_' . md5(serialize($arguments));
|
||||||
|
|
||||||
$file = TEMP_FOLDER . '/' . $this->sanitiseCachename($cacheName);
|
$file = TEMP_FOLDER . '/' . $this->sanitiseCachename($cacheName);
|
||||||
if(file_exists($file)) unlink($file);
|
if(file_exists($file)) unlink($file);
|
||||||
|
Loading…
Reference in New Issue
Block a user