Parcourir la source

Reorganize FreshRSS init

See https://github.com/FreshRSS/FreshRSS/issues/730
Marien Fressinaud il y a 11 ans
Parent
commit
4c128e05a4
1 fichiers modifiés avec 13 ajouts et 14 suppressions
  1. 13 14
      app/FreshRSS.php

+ 13 - 14
app/FreshRSS.php

@@ -6,15 +6,25 @@ class FreshRSS extends Minz_FrontController {
 			Minz_Session::init('FreshRSS');
 		}
 
+		$this->initConfiguration();
+		$this->initAuth();
+		FreshRSS_Context::init();
+		$this->initI18n();
+		FreshRSS_Share::load(join_path(DATA_PATH, 'shares.php'));
+		$this->loadStylesAndScripts();
+		$this->loadNotifications();
+		$this->loadExtensions();
+	}
+
+	private function initConfiguration() {
 		$current_user = Minz_Session::param('currentUser', '_');
 		Minz_Configuration::register('user',
 		                             join_path(USERS_PATH, $current_user, 'config.php'),
 		                             join_path(USERS_PATH, '_', 'config.default.php'));
+	}
 
-		// Need to be called just after session init because it initializes
-		// current user.
+	private function initAuth() {
 		FreshRSS_Auth::init();
-
 		if (Minz_Request::isPost() && !is_referer_from_same_domain()) {
 			// Basic protection against XSRF attacks
 			FreshRSS_Auth::removeAccess();
@@ -27,17 +37,6 @@ class FreshRSS extends Minz_FrontController {
 				))
 			);
 		}
-
-		// Load context and configuration.
-		FreshRSS_Context::init();
-
-		$this->initI18n();
-
-		FreshRSS_Share::load(join_path(DATA_PATH, 'shares.php'));
-
-		$this->loadStylesAndScripts();
-		$this->loadNotifications();
-		$this->loadExtensions();
 	}
 
 	private function initI18n() {