From f473e4418ad75a944f16ad759b490188fd5211eb Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 1 Mar 2012 13:06:27 -0600 Subject: [PATCH] Cleaning up the core bootstrap file. Signed-off-by: Taylor Otwell --- laravel/core.php | 118 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 81 insertions(+), 37 deletions(-) diff --git a/laravel/core.php b/laravel/core.php index 4947cdf6..d2b8128e 100644 --- a/laravel/core.php +++ b/laravel/core.php @@ -1,46 +1,78 @@ path('sys'))); -/** - * Set the CLI options on the $_SERVER global array so we can easily - * retrieve them from the various parts of the CLI code. We can use - * the Request class to access them conveniently. - */ +/* +|-------------------------------------------------------------------------- +| Set The CLI Options Array +|-------------------------------------------------------------------------- +| +| If the current request is from the Artisan command-line interface, we +| will parse the command line arguments and options and set them the +| array of options in the $_SERVER global array for convenience. +| +*/ + if (defined('STDIN')) { $console = CLI\Command::options($_SERVER['argv']); @@ -52,22 +84,34 @@ $_SERVER['CLI'] = $options; } -/** - * The Laravel environment may be specified on the CLI using the env - * option, allowing the developer to easily use local configuration - * files from the CLI since the environment is usually controlled - * by server environmenet variables. - */ +/* +|-------------------------------------------------------------------------- +| Set The CLI Laravel Environment +|-------------------------------------------------------------------------- +| +| Next we'll set the LARAVEL_ENV variable if the current request is from +| the Artisan command-line interface. Since the environment is often +| specified within an Apache .htaccess file, we need to set it here +| when the request is not coming through Apache. +| +*/ + if (isset($_SERVER['CLI']['ENV'])) { $_SERVER['LARAVEL_ENV'] = $_SERVER['CLI']['ENV']; } -/** - * Finally we'll grab all of the bundles and register them with the - * bundle class. All of the bundles are stored in an array within - * the application directory which defines all bundles. - */ +/* +|-------------------------------------------------------------------------- +| Register The Laravel Bundles +|-------------------------------------------------------------------------- +| +| Finally we will register all of the bundles that have been defined for +| the application. None of them will be started, yet but will be setup +| so that they may be started by the develop at any time. +| +*/ + $bundles = require path('app').'bundles'.EXT; foreach ($bundles as $bundle => $config)