Skip to content

Commit

Permalink
Minor improvements to the front controller
Browse files Browse the repository at this point in the history
  • Loading branch information
ravage84 committed Oct 4, 2015
1 parent 6819564 commit 86da57d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
10 changes: 3 additions & 7 deletions app/webroot/index.php
@@ -1,7 +1,5 @@
<?php
/**
* Index
*
* The Front Controller for handling every request
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
Expand Down Expand Up @@ -82,7 +80,7 @@
define('WWW_ROOT', dirname(__FILE__) . DS);
}

// for built-in server
// For the built-in server
if (PHP_SAPI === 'cli-server') {
if ($_SERVER['REQUEST_URI'] !== '/' && file_exists(WWW_ROOT . $_SERVER['PHP_SELF'])) {
return false;
Expand All @@ -97,10 +95,8 @@
if (!include 'Cake' . DS . 'bootstrap.php') {
$failed = true;
}
} else {
if (!include CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php') {
$failed = true;
}
} elseif (!include CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php') {
$failed = true;
}
if (!empty($failed)) {
trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
Expand Down
19 changes: 12 additions & 7 deletions lib/Cake/Console/Templates/skel/webroot/index.php
@@ -1,12 +1,19 @@
<?php
/**
* Index
*
* The Front Controller for handling every request
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package app.webroot
* @since CakePHP(tm) v 0.2.9
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/

/**
Expand Down Expand Up @@ -73,7 +80,7 @@
define('WWW_ROOT', dirname(__FILE__) . DS);
}

// for built-in server
// For the built-in server
if (PHP_SAPI === 'cli-server') {
if ($_SERVER['REQUEST_URI'] !== '/' && file_exists(WWW_ROOT . $_SERVER['PHP_SELF'])) {
return false;
Expand All @@ -88,10 +95,8 @@
if (!include 'Cake' . DS . 'bootstrap.php') {
$failed = true;
}
} else {
if (!include CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php') {
$failed = true;
}
} elseif (!include CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php') {
$failed = true;
}
if (!empty($failed)) {
trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
Expand Down

0 comments on commit 86da57d

Please sign in to comment.