Defer controller initialization
Defer controller initialization

--- a/include/controller/ControllerBase.class.php
+++ b/include/controller/ControllerBase.class.php
@@ -88,9 +88,9 @@
 	protected $exe;
 
 	/**
-	 * Constructor
-	 */
-	public function __construct()
+	 * Initialize controller
+	 */
+	public function Initialize()
 	{
 		$this->InitializeConfig();
 

--- a/include/controller/Controller_Feed.class.php
+++ b/include/controller/Controller_Feed.class.php
@@ -32,11 +32,11 @@
 	const AtomFormat = 'atom';
 
 	/**
-	 * Constructor
+	 * Initialize controller
 	 */
-	public function __construct()
+	public function Initialize()
 	{
-		parent::__construct();
+		parent::Initialize();
 		$this->preserveWhitespace = true;
 		$this->DisableLogging();
 	}

--- a/include/controller/Controller_Graph.class.php
+++ b/include/controller/Controller_Graph.class.php
@@ -10,11 +10,11 @@
 class GitPHP_Controller_Graph extends GitPHP_ControllerBase
 {
 	/**
-	 * Constructor
+	 * Initialize controller
 	 */
-	public function __construct()
+	public function Initialize()
 	{
-		parent::__construct();
+		parent::Initialize();
 
 		if (!$this->config->GetValue('graphs')) {
 			throw new Exception('Graphing has been disabled');

--- a/include/controller/Controller_GraphData.class.php
+++ b/include/controller/Controller_GraphData.class.php
@@ -10,11 +10,11 @@
 class GitPHP_Controller_GraphData extends GitPHP_ControllerBase
 {
 	/**
-	 * Constructor
+	 * Initialize controller
 	 */
-	public function __construct()
+	public function Initialize()
 	{
-		parent::__construct();
+		parent::Initialize();
 
 		if (!$this->config->GetValue('graphs')) {
 			throw new Exception('Graphing has been disabled');

--- a/include/controller/Controller_Message.class.php
+++ b/include/controller/Controller_Message.class.php
@@ -12,7 +12,7 @@
 	/**
 	 * Constructor
 	 */
-	public function __construct()
+	public function Initialize()
 	{
 		try {
 			$this->InitializeConfig();

--- a/include/controller/Controller_ProjectList.class.php
+++ b/include/controller/Controller_ProjectList.class.php
@@ -11,12 +11,12 @@
 {
 
 	/**
-	 * Constructor
+	 * Initialize controller
 	 */
-	public function __construct()
+	public function Initialize()
 	{
 		$this->multiProject = true;
-		parent::__construct();
+		parent::Initialize();
 	}
 
 	/**

--- a/include/controller/Controller_Search.class.php
+++ b/include/controller/Controller_Search.class.php
@@ -39,11 +39,11 @@
 	const FileSearch = 'file';
 
 	/**
-	 * Constructor
+	 * Initialize controller
 	 */
-	public function __construct()
+	public function Initialize()
 	{
-		parent::__construct();
+		parent::Initialize();
 
 		if (!$this->config->GetValue('search')) {
 			throw new GitPHP_SearchDisabledException();

--- a/include/controller/Controller_Snapshot.class.php
+++ b/include/controller/Controller_Snapshot.class.php
@@ -32,9 +32,9 @@
 	private $cachedFile;
 
 	/**
-	 * Constructor
-	 */
-	public function __construct()
+	 * Initialize controller
+	 */
+	public function Initialize()
 	{
 		$this->InitializeConfig();
 

file:a/index.php -> file:b/index.php
--- a/index.php
+++ b/index.php
@@ -46,6 +46,7 @@
 
 	$controller = GitPHP_Router::GetController();
 	if ($controller) {
+		$controller->Initialize();
 		$controller->RenderHeaders();
 		$controller->Render();
 	}
@@ -53,6 +54,7 @@
 } catch (Exception $e) {
 
 	$messageController = new GitPHP_Controller_Message();
+	$messageController->Initialize();
 
 	$config = $messageController->GetConfig();
 	if ($config && $config->GetValue('debug') && !($e instanceof GitPHP_MessageException)) {

comments