From 8a5f18e139c9cbbe57a2d3de7be73cadbf99fa3b Mon Sep 17 00:00:00 2001 From: Ben Corlett Date: Thu, 7 Feb 2013 09:12:56 +1100 Subject: [PATCH 1/2] Moving start.php to bootstrap/start.php to collate all bootstrapping files. Signed-off-by: Ben Corlett --- app/tests/TestCase.php | 4 ++-- artisan | 4 ++-- bootstrap/autoload.php | 2 +- start.php => bootstrap/start.php | 6 +++--- public/index.php | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) rename start.php => bootstrap/start.php (95%) diff --git a/app/tests/TestCase.php b/app/tests/TestCase.php index 1af7071e..8b1ef7da 100644 --- a/app/tests/TestCase.php +++ b/app/tests/TestCase.php @@ -13,7 +13,7 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase { $testEnvironment = 'testing'; - return require __DIR__.'/../../start.php'; + return require __DIR__.'/../../bootstrap/start.php'; } -} \ No newline at end of file +} diff --git a/artisan b/artisan index f47ca23d..ce2189de 100644 --- a/artisan +++ b/artisan @@ -27,7 +27,7 @@ require __DIR__.'/bootstrap/autoload.php'; | */ -$app = require_once __DIR__.'/start.php'; +$app = require_once __DIR__.'/bootstrap/start.php'; $app->boot(); @@ -56,4 +56,4 @@ $artisan = Illuminate\Console\Application::start($app); | */ -$artisan->run(); \ No newline at end of file +$artisan->run(); diff --git a/bootstrap/autoload.php b/bootstrap/autoload.php index 5030dae4..461a1a80 100644 --- a/bootstrap/autoload.php +++ b/bootstrap/autoload.php @@ -41,4 +41,4 @@ Illuminate\Support\ClassLoader::register(); if (is_dir($workbench = __DIR__.'/../workbench')) { Illuminate\Workbench\Starter::start($workbench); -} \ No newline at end of file +} diff --git a/start.php b/bootstrap/start.php similarity index 95% rename from start.php rename to bootstrap/start.php index 1320a86c..25e90653 100644 --- a/start.php +++ b/bootstrap/start.php @@ -24,9 +24,9 @@ $app = new Illuminate\Foundation\Application; | */ -$app->instance('path', $appPath = __DIR__.'/app'); +$app->instance('path', $appPath = __DIR__.'/../app'); -$app->instance('path.base', __DIR__); +$app->instance('path.base', __DIR__.'/..'); /* |-------------------------------------------------------------------------- @@ -69,4 +69,4 @@ require $app->getBootstrapFile(); | */ -return $app; \ No newline at end of file +return $app; diff --git a/public/index.php b/public/index.php index d11628e3..030db7d1 100644 --- a/public/index.php +++ b/public/index.php @@ -34,7 +34,7 @@ require __DIR__.'/../bootstrap/autoload.php'; | */ -$app = require_once __DIR__.'/../start.php'; +$app = require_once __DIR__.'/../bootstrap/start.php'; /* |-------------------------------------------------------------------------- From 24e158e88929f397a4b418222bc23a1e619176ba Mon Sep 17 00:00:00 2001 From: Ben Corlett Date: Thu, 7 Feb 2013 10:58:28 +1100 Subject: [PATCH 2/2] Adding bootstrap/paths.php to allow specification of custom paths for sections of Laravel. Signed-off-by: Ben Corlett --- bootstrap/paths.php | 42 ++++++++++++++++++++++++++++++++++++++++++ bootstrap/start.php | 15 +++++++++------ composer.json | 2 +- server.php | 6 ++++-- 4 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 bootstrap/paths.php diff --git a/bootstrap/paths.php b/bootstrap/paths.php new file mode 100644 index 00000000..c4a965e7 --- /dev/null +++ b/bootstrap/paths.php @@ -0,0 +1,42 @@ + __DIR__.'/../app', + + /* + |-------------------------------------------------------------------------- + | Public Path + |-------------------------------------------------------------------------- + | + | We understand that not all hosting environments allow flexibility with + | public paths. That's why we allow you to change where your public path + | is below. + | + */ + + 'public' => __DIR__.'/../public', + + /* + |-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* + | Base Path + |-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* + | + | You probably shouldn't be editing this. + | + */ + + 'base' => __DIR__.'/..', + +); diff --git a/bootstrap/start.php b/bootstrap/start.php index 25e90653..643e1017 100644 --- a/bootstrap/start.php +++ b/bootstrap/start.php @@ -15,18 +15,21 @@ $app = new Illuminate\Foundation\Application; /* |-------------------------------------------------------------------------- -| Define The Application Path +| Bind Paths |-------------------------------------------------------------------------- | -| Here we just defined the path to the application directory. Most likely -| you will never need to change this value as the default setup should -| work perfectly fine for the vast majority of all our applications. +| Here we are binding the paths configured in paths.php to the app. You +| should not be changing these here but rather in paths.php. | */ -$app->instance('path', $appPath = __DIR__.'/../app'); +$paths = require __DIR__.'/paths.php'; -$app->instance('path.base', __DIR__.'/..'); +$app->instance('path', $appPath = $paths['app']); + +$app->instance('path.base', $paths['base']); + +$app->instance('path.public', $paths['public']); /* |-------------------------------------------------------------------------- diff --git a/composer.json b/composer.json index d4a91bf9..9afd6c00 100644 --- a/composer.json +++ b/composer.json @@ -12,4 +12,4 @@ ] }, "minimum-stability": "dev" -} \ No newline at end of file +} diff --git a/server.php b/server.php index 2084099c..5f187f34 100644 --- a/server.php +++ b/server.php @@ -4,7 +4,9 @@ $uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); $uri = urldecode($uri); -$requested = __DIR__.'/public'.$uri; +$paths = require __DIR__.'/bootstrap/paths.php'; + +$requested = $paths['public'].$uri; // This file allows us to emulate Apache's "mod_rewrite" functionality from the // built-in PHP web server. This provides a convenient way to test a Laravel @@ -14,4 +16,4 @@ if ($uri !== '/' and file_exists($requested)) return false; } -require_once(__DIR__ . '/public/index.php'); \ No newline at end of file +require_once $paths['public'].'/index.php';