mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-06 01:31:22 +02:00
Merge pull request #8154 from xini/patch-4
fix Versioned::choose_site_stage() if no request given
This commit is contained in:
commit
1acb80851c
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user