mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX: Move stage choosing into a pre-request filter.
This ensures that the correct stage is selected, even if the request does not come through the model as controller system. This fixes an issue where custom controllers would always be on the "Stage" stage.
This commit is contained in:
parent
ea5b3e4269
commit
156bb87d57
8
_config/requestprocessors.yml
Normal file
8
_config/requestprocessors.yml
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
Name: requestprocessors
|
||||
---
|
||||
Injector:
|
||||
RequestProcessor:
|
||||
properties:
|
||||
filters:
|
||||
- '%$VersionedRequestFilter'
|
17
control/VersionedRequestFilter.php
Normal file
17
control/VersionedRequestFilter.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* Initialises the versioned stage when a request is made.
|
||||
*
|
||||
* @package framework
|
||||
* @subpackage control
|
||||
*/
|
||||
class VersionedRequestFilter {
|
||||
|
||||
public function preRequest() {
|
||||
Versioned::choose_site_stage();
|
||||
}
|
||||
|
||||
public function postRequest() {
|
||||
}
|
||||
|
||||
}
|
@ -1290,20 +1290,6 @@ class Versioned extends DataExtension {
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Controller $controller
|
||||
*/
|
||||
public function contentcontrollerInit($controller) {
|
||||
self::choose_site_stage();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Controller $controller
|
||||
*/
|
||||
public function modelascontrollerInit($controller) {
|
||||
self::choose_site_stage();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $labels
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user