Skip to content

Commit

Permalink
Moved stopwatch and extension initialization. Resolves #1193
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
Kristian Kriehl authored and bobdenotter committed May 20, 2014
1 parent 99ec85f commit f0e9366
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions app/src/Bolt/Application.php
Expand Up @@ -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'));

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit f0e9366

Please sign in to comment.