Merge branch '3.7' into 3

This commit is contained in:
Daniel Hensby 2018-06-13 14:23:57 +01:00
commit 587737ffaf
No known key found for this signature in database
GPG Key ID: B00D1E9767F0B06E
3 changed files with 11 additions and 7 deletions

View File

@ -103,7 +103,7 @@ class Page_Controller extends ContentController
{
public function init()
{
HTTPCacheControl::inst()
HTTPCacheControl::singleton()
->enableCache()
->setMaxAge(60); // 1 minute
@ -130,7 +130,7 @@ class MyPage_Controller extends Page_Controller
public function myprivateaction($request)
{
$response = $this->myPrivateResponse();
HTTPCacheControl::inst()
HTTPCacheControl::singleton()
->disableCache();
return $response;
@ -160,7 +160,7 @@ class Page_Controller extends ContentController
{
public function init()
{
HTTPCacheControl::inst()
HTTPCacheControl::singleton()
->enableCache($force=true) // DANGER ZONE
->setMaxAge(60); // 1 minute

View File

@ -113,7 +113,7 @@ class Page_Controller extends ContentController
public function init()
{
- HTTP::set_cache_age(60);
+ HTTPCacheControl::inst()
+ HTTPCacheControl::singleton()
+ ->enableCache()
+ ->setMaxAge(60); // 1 minute
@ -141,7 +141,7 @@ class MyPage_Controller extends Page_Controller
{
$response = $this->myPrivateResponse();
- HTTP::set_cache_age(0);
+ HTTPCacheControl::inst()
+ HTTPCacheControl::singleton()
+ ->disableCache();
@ -173,7 +173,7 @@ class Page_Controller extends ContentController
public function init()
{
- HTTP::set_cache_age(60);
+ HTTPCacheControl::inst()
+ HTTPCacheControl::singleton()
+ ->enableCache($force=true) // DANGER ZONE
+ ->setMaxAge(60); // 1 minute

View File

@ -1215,9 +1215,13 @@ class Versioned extends DataExtension implements TemplateGlobalProvider {
* @param SS_HTTPRequest|null $request
*/
public static function choose_site_stage(SS_HTTPRequest $request = null) {
if (!$request && Controller::has_curr()) {
$request = Controller::curr()->getRequest();
}
if (!$request) {
throw new InvalidArgumentException("Request not found");
}
$mode = static::get_default_reading_mode();
// Check any pre-existing session mode
@ -1481,7 +1485,7 @@ class Versioned extends DataExtension implements TemplateGlobalProvider {
*/
public static function get_by_stage($class, $stage, $filter = '', $sort = '', $join = '', $limit = '',
$containerClass = 'DataList') {
VersionedReadingMode::validateStage($stage);
$result = DataObject::get($class, $filter, $sort, $join, $limit, $containerClass);
return $result->setDataQueryParam(array(
'Versioned.mode' => 'stage',