From 82315f31d5c69fa5454555139cf018197786d1f3 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 15 Feb 2012 13:02:38 -0600 Subject: [PATCH] added configurable automatic key generation. --- application/views/home/index.php | 65 ++++++++++++-------------------- laravel/core.php | 12 ++++++ laravel/laravel.php | 14 +++++++ paths.php | 8 ++++ 4 files changed, 59 insertions(+), 40 deletions(-) diff --git a/application/views/home/index.php b/application/views/home/index.php index 78da7f87..156c36ab 100644 --- a/application/views/home/index.php +++ b/application/views/home/index.php @@ -89,56 +89,41 @@
- +

Welcome To Laravel

-

Whoops!

+

A Framework For Web Artisans

-
+

+ You have successfully installed the Laravel framework. Laravel is a simple framework + that helps web artisans create beautiful, creative applications using elegant, expressive + syntax. You'll love using it. +

-
- Please set an application key in application/config/application.php! -
+

Learn the terrain.

- +

+ You've landed yourself on our default home page. The route that + is generating this page lives at: +

-

Welcome To Laravel

+
APP_PATH/routes.php
-

A Framework For Web Artisans

+

And the view sitting before you can be found at:

-

- You have successfully installed the Laravel framework. Laravel is a simple framework - that helps web artisans create beautiful, creative applications using elegant, expressive - syntax. You'll love using it. -

+
APP_PATH/views/home/index.php
-

Learn the terrain.

+

Create something beautiful.

-

- You've landed yourself on our default home page. The route that - is generating this page lives at: -

- -
APP_PATH/routes.php
- -

And the view sitting before you can be found at:

- -
APP_PATH/views/home/index.php
- -

Create something beautiful.

- -

- Now that you're up and running, it's time to start creating! - Here are some links to help you get started: -

- - - - +

+ Now that you're up and running, it's time to start creating! + Here are some links to help you get started: +

+
\ No newline at end of file diff --git a/laravel/core.php b/laravel/core.php index 2c37c458..c4134a77 100644 --- a/laravel/core.php +++ b/laravel/core.php @@ -64,6 +64,18 @@ if (isset($_SERVER['CLI']['ENV'])) $_SERVER['LARAVEL_ENV'] = $_SERVER['CLI']['ENV']; } +/** + * Call the bootstrap Closure that was defined in the start.php + * file for the framework. This allows events and more to be + * registered extremely early in the life cycle. + */ +if (isset($bootstrap)) +{ + call_user_func($bootstrap); + + unset($bootstrap); +} + /** * Register all of the core class aliases. These aliases provide a * convenient way of working with the Laravel core classes without diff --git a/laravel/laravel.php b/laravel/laravel.php index fa4b82cd..21ece416 100644 --- a/laravel/laravel.php +++ b/laravel/laravel.php @@ -52,6 +52,20 @@ error_reporting(-1); ini_set('display_errors', Config::get('error.display')); +/** + * Determine if we need to set the application key to a random + * string for the developer. This provides the developer with + * a zero configuration install process. + */ +$key = Config::get('application.key'); + +if ($key == '' and Config::get('key.auto')) +{ + ob_start() and with(new CLI\Tasks\Key)->generate(); + + ob_end_clean(); +} + /** * Even though "Magic Quotes" are deprecated in PHP 5.3, they may * still be enabled on the server. To account for this, we will diff --git a/paths.php b/paths.php index b18b0671..5de6573d 100644 --- a/paths.php +++ b/paths.php @@ -58,6 +58,14 @@ else $paths['public'] = 'public'; } +// -------------------------------------------------------------- +// Define a bootstrap Closure that runs on core load. +// -------------------------------------------------------------- +$bootstrap = function() +{ + Laravel\Config::set('key.auto', true); +}; + // -------------------------------------------------------------- // Define each constant if it hasn't been defined. // --------------------------------------------------------------