Static caching merges from dnc branch

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@68900 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-12-15 01:30:41 +00:00
parent 0a017da580
commit a8dca3908e
4 changed files with 27 additions and 2 deletions

View File

@ -342,7 +342,7 @@ class HTTP {
// Now that we've generated them, either output them or attach them to the HTTPResponse as appropriate
foreach($responseHeaders as $k => $v) {
if($body) $body->addHeader($k, $v);
else header("$k: $v");
else if(!headers_sent()) header("$k: $v");
}
}
@ -355,6 +355,13 @@ class HTTP {
static function gmt_date($timestamp) {
return gmdate('D, d M Y H:i:s', $timestamp) . ' GMT';
}
/*
* Return static variable cache_age in second
*/
static function get_cache_age() {
return self::$cache_age;
}
}

View File

@ -479,12 +479,14 @@ class Requirements_Backend {
$this->disabled['css'] = $this->css;
$this->disabled['customScript'] = $this->customScript;
$this->disabled['customCSS'] = $this->customCSS;
Requirements::$disabled['customHeadTags'] = Requirements::$customHeadTags;
$this->javascript = array();
$this->css = array();
$this->customScript = array();
$this->customCSS = array();
$this->customHeadTags = array();
Requirements::$customHeadTags = "";
}
}
@ -511,6 +513,7 @@ class Requirements_Backend {
$this->css = $this->disabled['css'];
$this->customScript = $this->disabled['customScript'];
$this->customCSS = $this->disabled['customCSS'];
Requirements::$customHeadTags = Requirements::$disabled['customHeadTags'];
}
/**

View File

@ -2332,6 +2332,15 @@ class DataObject extends ViewableData implements DataObjectInterface,i18nEntityP
$this->componentCache = array();
}
static function flush_and_destroy_cache() {
if(self::$cache_get_one) foreach(self::$cache_get_one as $class => $items) {
if(is_array($items)) foreach($items as $item) {
if($item) $item->destroy();
}
}
self::$cache_get_one = array();
}
/**
* Does the hard work for get_one()
*

View File

@ -140,6 +140,12 @@ class RedirectorPage extends Page {
return $fields;
}
function subPagesToCache() {
$urls = parent::subPagesToCache();
$urls[] = $this->URLSegment . '/';
return $urls;
}
}
/**
@ -167,4 +173,4 @@ class RedirectorPage_Controller extends Page_Controller {
);
}
}
?>
?>