Skip to content

Commit

Permalink
[Foundation] moved some Kernel initializations in the boot() method t…
Browse files Browse the repository at this point in the history
…o speed up creation of Kernel instances
  • Loading branch information
fabpot committed May 3, 2010
1 parent 0858289 commit a9d8f39
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 24 deletions.
22 changes: 10 additions & 12 deletions src/Symfony/Foundation/Kernel.php
Expand Up @@ -50,28 +50,23 @@ abstract class Kernel implements RequestHandlerInterface, \Serializable
*/
public function __construct($environment, $debug)
{
$this->environment = $environment;
$this->debug = (Boolean) $debug;
$this->booted = false;
$this->rootDir = realpath($this->registerRootDir());
$this->name = basename($this->rootDir);

if ($this->debug)
{
ini_set('display_errors', 1);
error_reporting(-1);

$this->startTime = microtime(true);
}
else
{
ini_set('display_errors', 0);
}

if ($this->debug)
{
$this->startTime = microtime(true);
}

$this->booted = false;
$this->environment = $environment;
$this->bundles = $this->registerBundles();
$this->bundleDirs = $this->registerBundleDirs();
$this->rootDir = realpath($this->registerRootDir());
$this->name = basename($this->rootDir);
}

abstract public function registerRootDir();
Expand Down Expand Up @@ -111,6 +106,9 @@ public function boot()
throw new \LogicException('The kernel is already booted.');
}

$this->bundles = $this->registerBundles();
$this->bundleDirs = $this->registerBundleDirs();

// initialize the container
$this->container = $this->initializeContainer();
$this->container->setService('kernel', $this);
Expand Down
22 changes: 10 additions & 12 deletions src/Symfony/Foundation/bootstrap.php
Expand Up @@ -390,28 +390,23 @@ abstract class Kernel implements RequestHandlerInterface, \Serializable

public function __construct($environment, $debug)
{
$this->environment = $environment;
$this->debug = (Boolean) $debug;
$this->booted = false;
$this->rootDir = realpath($this->registerRootDir());
$this->name = basename($this->rootDir);

if ($this->debug)
{
ini_set('display_errors', 1);
error_reporting(-1);

$this->startTime = microtime(true);
}
else
{
ini_set('display_errors', 0);
}

if ($this->debug)
{
$this->startTime = microtime(true);
}

$this->booted = false;
$this->environment = $environment;
$this->bundles = $this->registerBundles();
$this->bundleDirs = $this->registerBundleDirs();
$this->rootDir = realpath($this->registerRootDir());
$this->name = basename($this->rootDir);
}

abstract public function registerRootDir();
Expand All @@ -438,6 +433,9 @@ public function boot()
throw new \LogicException('The kernel is already booted.');
}

$this->bundles = $this->registerBundles();
$this->bundleDirs = $this->registerBundleDirs();

$this->container = $this->initializeContainer();
$this->container->setService('kernel', $this);

Expand Down

0 comments on commit a9d8f39

Please sign in to comment.