mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR batchactions JS fix
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@83594 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
efbfb4a5f2
commit
a39ec17057
@ -13,30 +13,37 @@
|
|||||||
* to no subdirectory.
|
* to no subdirectory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (file_exists('../subsites/host-map.php')) {
|
$cacheOn = true;
|
||||||
include_once '../subsites/host-map.php';
|
$hostmapLocation = '../subsites/host-map.php';
|
||||||
$subsiteHostmap['default'] = isset($subsiteHostmap['default']) ? $subsiteHostmap['default'] : '';
|
|
||||||
|
|
||||||
// Look for the host, and find the cache dir
|
|
||||||
$host = str_replace('www.', '', $_SERVER['HTTP_HOST']);
|
|
||||||
$cacheDir = (isset($subsiteHostmap[$host]) ? $subsiteHostmap[$host] : $subsiteHostmap['default']) . '/';
|
|
||||||
} else {
|
|
||||||
$cacheDir = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Look for the file in the cachedir
|
if ($cacheOn) {
|
||||||
$file = preg_replace('/[^a-zA-Z0-9]/si', '_', trim($_SERVER['REQUEST_URI'], '/'));
|
if (file_exists($hostmapLocation)) {
|
||||||
$file = $file ? $file : 'index';
|
include_once $hostmapLocation;
|
||||||
|
$subsiteHostmap['default'] = isset($subsiteHostmap['default']) ? $subsiteHostmap['default'] : '';
|
||||||
|
|
||||||
if (file_exists('../cache/'.$cacheDir.$file.'.html')) {
|
// Look for the host, and find the cache dir
|
||||||
header('X-cache: hit at '.date('r'));
|
$host = str_replace('www.', '', $_SERVER['HTTP_HOST']);
|
||||||
echo file_get_contents('../cache/'.$cacheDir.$file.'.html');
|
$cacheDir = (isset($subsiteHostmap[$host]) ? $subsiteHostmap[$host] : $subsiteHostmap['default']) . '/';
|
||||||
} elseif (file_exists('../cache/'.$cacheDir.$file.'.php')) {
|
} else {
|
||||||
header('X-cache: hit at '.date('r'));
|
$cacheDir = '';
|
||||||
include_once '../cache/'.$cacheDir.$file.'.php';
|
}
|
||||||
|
|
||||||
|
// Look for the file in the cachedir
|
||||||
|
$file = preg_replace('/[^a-zA-Z0-9]/si', '_', trim($_SERVER['REQUEST_URI'], '/'));
|
||||||
|
$file = $file ? $file : 'index';
|
||||||
|
|
||||||
|
if (file_exists('../cache/'.$cacheDir.$file.'.html')) {
|
||||||
|
header('X-cache: hit at '.date('r'));
|
||||||
|
echo file_get_contents('../cache/'.$cacheDir.$file.'.html');
|
||||||
|
} elseif (file_exists('../cache/'.$cacheDir.$file.'.php')) {
|
||||||
|
header('X-cache: hit at '.date('r'));
|
||||||
|
include_once '../cache/'.$cacheDir.$file.'.php';
|
||||||
|
} else {
|
||||||
|
header('X-cache: miss at '.date('r') . ' on ' . $cacheDir . $file);
|
||||||
|
// No cache hit... fallback!!!
|
||||||
|
include 'main.php';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
header('X-cache: miss at '.date('r'));
|
|
||||||
// No cache hit... fallback!!!
|
|
||||||
include 'main.php';
|
include 'main.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user