mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Replace hard-coded directory separators constant
This removes warnings when building the manifest cache in Windows environments.
This commit is contained in:
parent
fcd3d2478c
commit
a4167e29fe
@ -21,22 +21,22 @@ interface ManifestCache {
|
|||||||
*/
|
*/
|
||||||
class ManifestCache_File implements ManifestCache {
|
class ManifestCache_File implements ManifestCache {
|
||||||
function __construct($name) {
|
function __construct($name) {
|
||||||
$this->folder = TEMP_FOLDER.'/'.$name;
|
$this->folder = TEMP_FOLDER.DIRECTORY_SEPARATOR.$name;
|
||||||
if (!is_dir($this->folder)) mkdir($this->folder);
|
if (!is_dir($this->folder)) mkdir($this->folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
function load($key) {
|
function load($key) {
|
||||||
$file = $this->folder.'/cache_'.$key;
|
$file = $this->folder.DIRECTORY_SEPARATOR.'cache_'.$key;
|
||||||
return file_exists($file) ? unserialize(file_get_contents($file)) : null;
|
return file_exists($file) ? unserialize(file_get_contents($file)) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function save($data, $key) {
|
function save($data, $key) {
|
||||||
$file = $this->folder.'/cache_'.$key;
|
$file = $this->folder.DIRECTORY_SEPARATOR.'cache_'.$key;
|
||||||
file_put_contents($file, serialize($data));
|
file_put_contents($file, serialize($data));
|
||||||
}
|
}
|
||||||
|
|
||||||
function clear() {
|
function clear() {
|
||||||
array_map('unlink', glob($this->folder.'/cache_*'));
|
array_map('unlink', glob($this->folder.DIRECTORY_SEPARATOR.'cache_*'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,14 +52,14 @@ class ManifestCache_File_PHP extends ManifestCache_File {
|
|||||||
global $loaded_manifest;
|
global $loaded_manifest;
|
||||||
$loaded_manifest = null;
|
$loaded_manifest = null;
|
||||||
|
|
||||||
$file = $this->folder.'/cache_'.$key;
|
$file = $this->folder.DIRECTORY_SEPARATOR.'cache_'.$key;
|
||||||
if (file_exists($file)) include $file;
|
if (file_exists($file)) include $file;
|
||||||
|
|
||||||
return $loaded_manifest;
|
return $loaded_manifest;
|
||||||
}
|
}
|
||||||
|
|
||||||
function save($data, $key) {
|
function save($data, $key) {
|
||||||
$file = $this->folder.'/cache_'.$key;
|
$file = $this->folder.DIRECTORY_SEPARATOR.'cache_'.$key;
|
||||||
file_put_contents($file, '<?php $loaded_manifest = '.var_export($data, true).';');
|
file_put_contents($file, '<?php $loaded_manifest = '.var_export($data, true).';');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user