updated routing to fix several issues.

This commit is contained in:
Taylor Otwell
2012-02-12 14:48:36 -06:00
parent 31cf44c374
commit 3a92facc76
31 changed files with 960 additions and 772 deletions

View File

@@ -30,6 +30,40 @@ require path('sys').'autoloader'.EXT;
*/
spl_autoload_register(array('Laravel\\Autoloader', 'load'));
/**
* Register the Laravel namespace so that the auto-loader loads it
* according to the PSR-0 naming conventions. This should provide
* fast resolution of all core classes.
*/
Autoloader::namespaces(array('Laravel' => 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.
*/
if (defined('STDIN'))
{
$console = CLI\Command::options($_SERVER['argv']);
list($arguments, $options) = $console;
$options = array_change_key_case($options, CASE_UPPER);
$_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.
*/
if (isset($_SERVER['CLI']['ENV']))
{
$_SERVER['LARAVEL_ENV'] = $_SERVER['CLI']['ENV'];
}
/**
* Register all of the core class aliases. These aliases provide a
* convenient way of working with the Laravel core classes without
@@ -38,35 +72,6 @@ spl_autoload_register(array('Laravel\\Autoloader', 'load'));
*/
Autoloader::$aliases = Config::get('application.aliases');
/**
* Register the Laravel namespace so that the auto-loader loads it
* according to the PSR-0 naming conventions. This should provide
* fast resolution of all core classes.
*/
Autoloader::namespaces(array('Laravel' => path('sys')));
/**
* Grab the bundle manifest for the application. This contains an
* array of all of the installed bundles, plus information about
* each of them. If it's not cached, we'll detect them and then
* cache it to save time later.
*/
$bundles = Cache::remember(Bundle::manifest, function()
{
return Bundle::detect(path('bundle'));
}, Config::get('application.bundle.cache'));
/**
* Register all of the bundles that are defined in the main bundle
* manifest. This informs the framework where the bundle lives
* and which URIs it can respnod to.
*/
foreach ($bundles as $bundle)
{
Bundle::register($bundle);
}
/**
* Register the default timezone for the application. This will
* be the default timezone used by all date functions through
@@ -74,4 +79,16 @@ foreach ($bundles as $bundle)
*/
$timezone = Config::get('application.timezone');
date_default_timezone_set($timezone);
date_default_timezone_set($timezone);
/**
* 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.
*/
$bundles = require path('app').'bundles'.EXT;
foreach ($bundles as $bundle => $config)
{
Bundle::register($bundle, $config);
}