continuing to refactor the bootstrap process.

This commit is contained in:
Taylor Otwell
2011-10-18 21:03:13 -05:00
parent 9fc9f88a41
commit d5d9776298
5 changed files with 117 additions and 61 deletions

View File

@@ -1,8 +1,17 @@
<?php
/**
* Define the extensions used by the framework.
*/
define('EXT', '.php');
define('BLADE_EXT', '.blade.php');
/**
* Define a function that registers an array of constants
* if they haven't already been registered. This allows the
* constants to be changed from their default values when
* unit testing the framework.
*/
function constants($constants)
{
foreach ($constants as $key => $value)
@@ -11,6 +20,11 @@ function constants($constants)
}
}
/**
* Register the core framework paths. All other paths are
* built on top of these core paths. All of these paths are
* changable by the developer in the front controller.
*/
$constants = array(
'APP_PATH' => realpath($application).'/',
'BASE_PATH' => realpath("$laravel/..").'/',
@@ -22,6 +36,10 @@ $constants = array(
constants($constants);
/**
* Register all of the other framework paths. All of these
* paths are built on top of the core paths above.
*/
$constants = array(
'CACHE_PATH' => STORAGE_PATH.'cache/',
'CONFIG_PATH' => APP_PATH.'config/',
@@ -41,4 +59,15 @@ $constants = array(
constants($constants);
unset($constants);
unset($constants);
/**
* Set the Laravel environment configuration path constant.
* The environment is controller by setting an environment
* variable on the server running Laravel.
*/
$environment = (isset($_SERVER['LARAVEL_ENV'])) ? $_SERVER['LARAVEL_ENV'] : '';
define('ENV_CONFIG_PATH', $environment);
unset($environment);