Permalink
Browse files

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.
  • Loading branch information...
1 parent ea5b3e4 commit 156bb87d57d2e6edda8360a96494bae545871b0f @ajshort ajshort committed with ss23 Oct 3, 2013
Showing with 25 additions and 14 deletions.
  1. +8 −0 _config/requestprocessors.yml
  2. +17 −0 control/VersionedRequestFilter.php
  3. +0 −14 model/Versioned.php
@@ -0,0 +1,8 @@
+---
+Name: requestprocessors
+---
+Injector:
+ RequestProcessor:
+ properties:
+ filters:
+ - '%$VersionedRequestFilter'
@@ -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() {
+ }
+
+}
View
@@ -1289,21 +1289,7 @@ public static function get_all_versions($class, $id) {
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
*/

0 comments on commit 156bb87

Please sign in to comment.