improved config loading performance.

This commit is contained in:
Taylor Otwell 2011-10-07 16:05:48 -05:00
parent 4edcc321aa
commit 845bdc58fa
2 changed files with 21 additions and 2 deletions

View File

@ -41,7 +41,26 @@
*/
if (isset($_SERVER['LARAVEL_ENV']))
{
Config::glance(CONFIG_PATH.$_SERVER['LARAVEL_ENV'].'/');
define('ENV_CONFIG_PATH', CONFIG_PATH.$_SERVER['LARAVEL_ENV'].'/');
Config::glance(ENV_CONFIG_PATH);
}
/**
* Load some core configuration files by default so we don't have to
* let them fall through the Config loader. This will allow us to
* load these files faster for each request.
*/
foreach (array('application', 'session', 'aliases') as $file)
{
$config = require CONFIG_PATH.$file.EXT;
if (isset($_SERVER['LARAVEL_ENV']))
{
$config = array_merge($config, require ENV_CONFIG_PATH.$file.EXT);
}
Config::$items[$file] = $config;
}
/**

View File

@ -16,7 +16,7 @@ class Config {
*
* @var array
*/
protected static $items = array();
public static $items = array();
/**
* Determine if a configuration item or file exists.