Skip to content

Commit

Permalink
Merge pull request cakephp#26 from rchavik/classloader
Browse files Browse the repository at this point in the history
Trimming bootstrap.php
  • Loading branch information
markstory committed Jan 19, 2014
2 parents 14bd8d4 + 27b500f commit 3371710
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 38 deletions.
53 changes: 17 additions & 36 deletions App/Config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,28 @@
*/
namespace App\Config;

// Use composer to load the autoloader.
$root = dirname(dirname(__DIR__));
if (file_exists($root . '/vendor/autoload.php')) {
require $root . '/vendor/autoload.php';
}

// If you can't use composer, you can use CakePHP's classloader
// to autoload your application and the framework. You will
// also need to add autoloaders for each Plugin you use.
// This code expects that cakephp will be
// setup in vendor/cakephp/cakephp.
/*
require $root . '/vendor/cakephp/cakephp/src/Core/ClassLoader.php';
$loader = new \Cake\Core\ClassLoader;
$loader->register();
$loader->addNamespace('App', $root . '/App');
$loader->addNamespace('Cake', $root . '/vendor/cakephp/cakephp/src');
*/
unset($root);

/**
* Configure paths required to find CakePHP + general filepath
* constants
*/
require __DIR__ . '/paths.php';

// Use composer to load the autoloader.
if (file_exists(ROOT . '/vendor/autoload.php')) {
require ROOT . '/vendor/autoload.php';
}

// If composer is not used, use CakePHP's classloader to autoload the framework
// and the application. You will also need setup autoloading for plugins by
// passing `autoload' => true for `Plugin::loadAll()` or `Plugin::load()`
if (!class_exists('Cake\Core\Configure')) {
require CAKE . 'Core/ClassLoader.php';
$loader = new \Cake\Core\ClassLoader;
$loader->register();
$loader->addNamespace('Cake', CAKE);
$loader->addNamespace(\Cake\Core\Configure::read('App.namespace'), APP);
}

/**
* Bootstrap CakePHP.
*
Expand All @@ -51,7 +45,7 @@
* - Registering the CakePHP autoloader.
* - Setting the default application paths.
*/
require CORE_PATH . 'src/bootstrap.php';
require CAKE . 'bootstrap.php';

use Cake\Cache\Cache;
use Cake\Configure\Engine\PhpConfig;
Expand Down Expand Up @@ -85,19 +79,6 @@
die('Unable to load Config/app.php. Create it by copying Config/app.default.php to Config/app.php.');
}

/**
* Configure an autoloader for the App namespace.
*
* Use App\Controller\AppController as a test to see if composer
* support is being used.
*/
if (!class_exists('App\Controller\AppController')) {
$loader = new \Cake\Core\ClassLoader;
$loader->register();

$loader->addNamespace(Configure::read('App.namespace'), APP);
}

/**
* Uncomment this line and correct your server timezone to fix
* any date & time related errors.
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ If Composer is installed globally, run
1. Clone this repository at desired location.
2. Clone [CakePHP](https://github.com/cakephp/cakephp) into `vendor/cakephp/cakephp`.
3. Checkout the `3.0` branch in the new CakePHP clone.
4. In `App/Config/bootstrap.php` uncomment the section using `Cake\Core\ClassLoader`.
5. Copy `App/Config/app.default.php` to `App/Config/app.php`
4. Copy `App/Config/app.default.php` to `App/Config/app.php`

You should now be able to visit the path to where you installed the app and see
the setup traffic lights.
Expand Down

0 comments on commit 3371710

Please sign in to comment.