mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merge branch '3.7' into 3
This commit is contained in:
commit
587737ffaf
@ -103,7 +103,7 @@ class Page_Controller extends ContentController
|
|||||||
{
|
{
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
HTTPCacheControl::inst()
|
HTTPCacheControl::singleton()
|
||||||
->enableCache()
|
->enableCache()
|
||||||
->setMaxAge(60); // 1 minute
|
->setMaxAge(60); // 1 minute
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ class MyPage_Controller extends Page_Controller
|
|||||||
public function myprivateaction($request)
|
public function myprivateaction($request)
|
||||||
{
|
{
|
||||||
$response = $this->myPrivateResponse();
|
$response = $this->myPrivateResponse();
|
||||||
HTTPCacheControl::inst()
|
HTTPCacheControl::singleton()
|
||||||
->disableCache();
|
->disableCache();
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
@ -160,7 +160,7 @@ class Page_Controller extends ContentController
|
|||||||
{
|
{
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
HTTPCacheControl::inst()
|
HTTPCacheControl::singleton()
|
||||||
->enableCache($force=true) // DANGER ZONE
|
->enableCache($force=true) // DANGER ZONE
|
||||||
->setMaxAge(60); // 1 minute
|
->setMaxAge(60); // 1 minute
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ class Page_Controller extends ContentController
|
|||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
- HTTP::set_cache_age(60);
|
- HTTP::set_cache_age(60);
|
||||||
+ HTTPCacheControl::inst()
|
+ HTTPCacheControl::singleton()
|
||||||
+ ->enableCache()
|
+ ->enableCache()
|
||||||
+ ->setMaxAge(60); // 1 minute
|
+ ->setMaxAge(60); // 1 minute
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ class MyPage_Controller extends Page_Controller
|
|||||||
{
|
{
|
||||||
$response = $this->myPrivateResponse();
|
$response = $this->myPrivateResponse();
|
||||||
- HTTP::set_cache_age(0);
|
- HTTP::set_cache_age(0);
|
||||||
+ HTTPCacheControl::inst()
|
+ HTTPCacheControl::singleton()
|
||||||
+ ->disableCache();
|
+ ->disableCache();
|
||||||
|
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ class Page_Controller extends ContentController
|
|||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
- HTTP::set_cache_age(60);
|
- HTTP::set_cache_age(60);
|
||||||
+ HTTPCacheControl::inst()
|
+ HTTPCacheControl::singleton()
|
||||||
+ ->enableCache($force=true) // DANGER ZONE
|
+ ->enableCache($force=true) // DANGER ZONE
|
||||||
+ ->setMaxAge(60); // 1 minute
|
+ ->setMaxAge(60); // 1 minute
|
||||||
|
|
||||||
|
@ -1215,9 +1215,13 @@ class Versioned extends DataExtension implements TemplateGlobalProvider {
|
|||||||
* @param SS_HTTPRequest|null $request
|
* @param SS_HTTPRequest|null $request
|
||||||
*/
|
*/
|
||||||
public static function choose_site_stage(SS_HTTPRequest $request = null) {
|
public static function choose_site_stage(SS_HTTPRequest $request = null) {
|
||||||
|
if (!$request && Controller::has_curr()) {
|
||||||
|
$request = Controller::curr()->getRequest();
|
||||||
|
}
|
||||||
if (!$request) {
|
if (!$request) {
|
||||||
throw new InvalidArgumentException("Request not found");
|
throw new InvalidArgumentException("Request not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
$mode = static::get_default_reading_mode();
|
$mode = static::get_default_reading_mode();
|
||||||
|
|
||||||
// Check any pre-existing session 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 = '',
|
public static function get_by_stage($class, $stage, $filter = '', $sort = '', $join = '', $limit = '',
|
||||||
$containerClass = 'DataList') {
|
$containerClass = 'DataList') {
|
||||||
|
VersionedReadingMode::validateStage($stage);
|
||||||
$result = DataObject::get($class, $filter, $sort, $join, $limit, $containerClass);
|
$result = DataObject::get($class, $filter, $sort, $join, $limit, $containerClass);
|
||||||
return $result->setDataQueryParam(array(
|
return $result->setDataQueryParam(array(
|
||||||
'Versioned.mode' => 'stage',
|
'Versioned.mode' => 'stage',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user