From f0e93664cb58145705195ae714d2ca6785c41c47 Mon Sep 17 00:00:00 2001 From: Kristian Kriehl Date: Sun, 18 May 2014 00:41:04 +0200 Subject: [PATCH] Moved stopwatch and extension initialization. Resolves #1193 Moves the creation of the stopwatch component inside the provider initialization and the initialization of extensions inside it's own method. Added the call to initExtensions to the latest possible position - after mountpoint initialization and before processing "before" handler (which may have additional handler added by extensions). --- app/src/Bolt/Application.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/src/Bolt/Application.php b/app/src/Bolt/Application.php index 702f4b381ec..725e293f745 100644 --- a/app/src/Bolt/Application.php +++ b/app/src/Bolt/Application.php @@ -77,6 +77,9 @@ public function initialize() // Initialise the Mount points for 'frontend', 'backend' and 'async'. $this->initMountpoints(); + // Initialize enabled extensions before executing handlers. + $this->initExtensions(); + // Initialise the global 'before' handler. $this->before(array($this, 'BeforeHandler')); @@ -218,12 +221,18 @@ public function initProviders() $this['twig']->addTokenParser(new SetcontentTokenParser()); - // Initialize enabled extensions. - $this['extensions']->initialize(); + // Initialize stopwatch even if debug is not enabled. + $this['stopwatch'] = $this->share(function () { + return new Stopwatch\Stopwatch(); + }); // @todo: make a provider for the Integrity checker and Random generator.. } + public function initExtensions() { + $this['extensions']->initialize(); + } + public function initMountpoints() { $app = $this; @@ -361,11 +370,6 @@ public function initAfterHandler() } }); } else { - // Even if debug is not enabled, - $this['stopwatch'] = $this->share(function () { - return new Stopwatch\Stopwatch(); - }); - error_reporting(E_ALL &~ E_NOTICE &~ E_DEPRECATED &~ E_USER_DEPRECATED); }