Skip to content
Browse files

Start new bootstrapping prototype.

  • Loading branch information...
1 parent e1ee8d6 commit ef7cc5aa763218479ba8838cae16267c2e781189 @markstory markstory committed Aug 5, 2012
View
47 App/Config/app.php
@@ -0,0 +1,47 @@
+<?php
+namespace App\Config;
+
+use Cake\Core\Configure;
+
+/**
+ * CakePHP Debug Level:
+ *
+ * Production Mode:
+ * 0: No error messages, errors, or warnings shown. Flash messages redirect.
+ *
+ * Development Mode:
+ * 1: Errors and warnings shown, model caches refreshed, flash messages halted.
+ * 2: As in 1, but also with full debug messages and SQL output.
+ *
+ * In production mode, flash messages redirect after a time interval.
+ * In development mode, you need to click the flash message to continue.
+ */
+ Configure::write('debug', 2);
+
+/**
+ * Configure basic information about the application.
+ *
+ * - namespace - The namespace to find app classes under.
+ * - encoding - The encoding used for HTML + database connections.
+ * - baseUrl - To configure CakePHP *not* to use mod_rewrite and to
+ * use CakePHP pretty URLs, remove these .htaccess
+ * files:
+ * /.htaccess
+ * /app/.htaccess
+ * /app/webroot/.htaccess
+ * And uncomment the baseUrl key below.
+ * - base - The base directory the app resides in. If false this
+ * will be auto detected.
+ * - webroot - The webroot directory.
+ * - www_root - The file path to webroot.
+ */
+ Configure::write('App', array(
+ 'namespace' => 'App',
+ 'encoding' => 'UTF-8',
+ 'baseUrl' => false,
+ //'baseUrl' => env('SCRIPT_NAME'),
+ 'base' => false,
+ 'dir' => APP_DIR,
+ 'webroot' => WEBROOT_DIR,
+ 'www_root' => WWW_ROOT,
+ ));
View
147 App/Config/bootstrap.php
@@ -1,15 +1,5 @@
<?php
/**
- * This file is loaded automatically by the app/webroot/index.php file after core.php
- *
- * This file should load/create any application wide configuration settings, such as
- * Caching, Logging, loading additional configuration files.
- *
- * You should also use this file to include any files that provide global functions/constants
- * that your application uses.
- *
- * PHP 5
- *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
@@ -23,87 +13,59 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
namespace App\Config;
-use Cake\Cache\Cache;
-use Cake\Core\App;
-use Cake\Core\Configure;
-use Cake\Core\Plugin;
-use Cake\Log\Log;
-use Cake\Utility\Inflector;
/**
- * Cache Engine Configuration
- * Default settings provided below
- *
- * File storage engine.
- *
- * Cache::config('default', array(
- * 'engine' => 'File', //[required]
- * 'duration'=> 3600, //[optional]
- * 'probability'=> 100, //[optional]
- * 'path' => CACHE, //[optional] use system tmp directory - remember to use absolute path
- * 'prefix' => 'cake_', //[optional] prefix every cache file with this string
- * 'lock' => false, //[optional] use file locking
- * 'serialize' => true, // [optional]
- * 'mask' => 0666, // [optional] permission mask to use when creating cache files
- * ));
- *
- * APC (http://pecl.php.net/package/APC)
- *
- * Cache::config('default', array(
- * 'engine' => 'Apc', //[required]
- * 'duration'=> 3600, //[optional]
- * 'probability'=> 100, //[optional]
- * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
- * ));
- *
- * Xcache (http://xcache.lighttpd.net/)
- *
- * Cache::config('default', array(
- * 'engine' => 'Xcache', //[required]
- * 'duration'=> 3600, //[optional]
- * 'probability'=> 100, //[optional]
- * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
- * 'user' => 'user', //user from xcache.admin.user settings
- * 'password' => 'password', //plaintext password (xcache.admin.pass)
- * ));
- *
- * Memcache (http://memcached.org/)
- *
- * Cache::config('default', array(
- * 'engine' => 'Memcache', //[required]
- * 'duration'=> 3600, //[optional]
- * 'probability'=> 100, //[optional]
- * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
- * 'servers' => array(
- * '127.0.0.1:11211' // localhost, default port 11211
- * ), //[optional]
- * 'persistent' => true, // [optional] set this to false for non-persistent connections
- * 'compress' => false, // [optional] compress data in Memcache (slower, but uses less memory)
- * ));
- *
- * Wincache (http://php.net/wincache)
- *
- * Cache::config('default', array(
- * 'engine' => 'Wincache', //[required]
- * 'duration'=> 3600, //[optional]
- * 'probability'=> 100, //[optional]
- * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
- * ));
+ * Configure paths required to find CakePHP + general filepath
+ * constants
+ */
+require __DIR__ . '/paths.php';
+
+/**
+ * Bootstrap CakePHP.
*
- * Redis (http://http://redis.io/)
+ * Does the various bits of setup that CakePHP needs to do.
+ * This includes:
*
- * Cache::config('default', array(
- * 'engine' => 'Redis', //[required]
- * 'duration'=> 3600, //[optional]
- * 'probability'=> 100, //[optional]
- * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
- * 'server' => '127.0.0.1' // localhost
- * 'port' => 6379 // default port 6379
- * 'timeout' => 0 // timeout in seconds, 0 = unlimited
- * 'persistent' => true, // [optional] set this to false for non-persistent connections
- * ));
+ * - Registering the CakePHP autoloader.
+ * - Setting the default application paths.
+ */
+require CORE_PATH . 'Cake/bootstrap.php';
+
+/**
+ * Configure the App and debug values.
*/
-Cache::config('default', array('engine' => 'File'));
+require __DIR__ . '/app.php';
+
+/**
+ * Load caching configuration.
+ */
+require __DIR__ . '/cache.php';
+
+/**
+ * Load error handler configuration.
+ */
+require __DIR__ . '/error.php';
+
+/**
+ * Load datasource connections.
+ */
+require __DIR__ . '/datasources.php';
+
+/**
+ * Load logging configuration.
+ */
+require __DIR__ . '/logging.php';
+
+/**
+ * Load session configuration.
+ */
+require __DIR__ . '/session.php';
+
+
+use Cake\Core\App;
+use Cake\Core\Configure;
+use Cake\Core\Plugin;
+use Cake\Utility\Inflector;
/**
* The settings below can be used to set additional paths to models, views and controllers.
@@ -172,16 +134,3 @@
'CacheDispatcher'
));
-/**
- * Configures default file logging options
- */
-Log::config('debug', array(
- 'engine' => 'Cake\Log\Engine\FileLog',
- 'types' => array('notice', 'info', 'debug'),
- 'file' => 'debug',
-));
-Log::config('error', array(
- 'engine' => 'Cake\Log\Engine\FileLog',
- 'types' => array('warning', 'error', 'critical', 'alert', 'emergency'),
- 'file' => 'error',
-));
View
127 App/Config/cache.php
@@ -0,0 +1,127 @@
+<?php
+/**
+ * Pick the caching engine to use. If APC is enabled use it.
+ * If running via cli - apc is disabled by default. ensure it's available and enabled in this case
+ *
+ * Note: 'default' and other application caches should be configured in app/Config/bootstrap.php.
+ * Please check the comments in boostrap.php for more info on the cache engines available
+ * and their setttings.
+ */
+namespace App\Config;
+
+use Cake\Core\Configure;
+use Cake\Cache\Cache;
+
+// In development mode, caches should expire quickly.
+$duration = '+999 days';
+if (Configure::read('debug') >= 1) {
+ $duration = '+10 seconds';
+}
+
+/**
+ * Engine used for core cache configurations.
+ * For improved performance APC, Redis, or Memcache should be used.
+ */
+$engine = 'File';
+
+// Prefix each application on the same server with a different string, to avoid Memcache and APC conflicts.
+$prefix = 'myapp_';
+
+/**
+ * Configure the cache used for general framework caching. Path information,
+ * object listings, and translation cache files are stored with this configuration.
+ */
+Cache::config('_cake_core_', array(
+ 'engine' => $engine,
+ 'prefix' => $prefix . 'cake_core_',
+ 'path' => CACHE . 'persistent' . DS,
+ 'serialize' => ($engine === 'File'),
+ 'duration' => $duration
+));
+
+/**
+ * Configure the cache for model and datasource caches. This cache configuration
+ * is used to store schema descriptions, and table listings in connections.
+ */
+Cache::config('_cake_model_', array(
+ 'engine' => $engine,
+ 'prefix' => $prefix . 'cake_model_',
+ 'path' => CACHE . 'models' . DS,
+ 'serialize' => ($engine === 'File'),
+ 'duration' => $duration
+));
+
+/**
+ * Cache Engine Configuration
+ * Default settings provided below
+ *
+ * File storage engine.
+ *
+ * Cache::config('default', array(
+ * 'engine' => 'File', //[required]
+ * 'duration'=> 3600, //[optional]
+ * 'probability'=> 100, //[optional]
+ * 'path' => CACHE, //[optional] use system tmp directory - remember to use absolute path
+ * 'prefix' => 'cake_', //[optional] prefix every cache file with this string
+ * 'lock' => false, //[optional] use file locking
+ * 'serialize' => true, // [optional]
+ * 'mask' => 0666, // [optional] permission mask to use when creating cache files
+ * ));
+ *
+ * APC (http://pecl.php.net/package/APC)
+ *
+ * Cache::config('default', array(
+ * 'engine' => 'Apc', //[required]
+ * 'duration'=> 3600, //[optional]
+ * 'probability'=> 100, //[optional]
+ * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
+ * ));
+ *
+ * Xcache (http://xcache.lighttpd.net/)
+ *
+ * Cache::config('default', array(
+ * 'engine' => 'Xcache', //[required]
+ * 'duration'=> 3600, //[optional]
+ * 'probability'=> 100, //[optional]
+ * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
+ * 'user' => 'user', //user from xcache.admin.user settings
+ * 'password' => 'password', //plaintext password (xcache.admin.pass)
+ * ));
+ *
+ * Memcache (http://memcached.org/)
+ *
+ * Cache::config('default', array(
+ * 'engine' => 'Memcache', //[required]
+ * 'duration'=> 3600, //[optional]
+ * 'probability'=> 100, //[optional]
+ * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
+ * 'servers' => array(
+ * '127.0.0.1:11211' // localhost, default port 11211
+ * ), //[optional]
+ * 'persistent' => true, // [optional] set this to false for non-persistent connections
+ * 'compress' => false, // [optional] compress data in Memcache (slower, but uses less memory)
+ * ));
+ *
+ * Wincache (http://php.net/wincache)
+ *
+ * Cache::config('default', array(
+ * 'engine' => 'Wincache', //[required]
+ * 'duration'=> 3600, //[optional]
+ * 'probability'=> 100, //[optional]
+ * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
+ * ));
+ *
+ * Redis (http://http://redis.io/)
+ *
+ * Cache::config('default', array(
+ * 'engine' => 'Redis', //[required]
+ * 'duration'=> 3600, //[optional]
+ * 'probability'=> 100, //[optional]
+ * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
+ * 'server' => '127.0.0.1' // localhost
+ * 'port' => 6379 // default port 6379
+ * 'timeout' => 0 // timeout in seconds, 0 = unlimited
+ * 'persistent' => true, // [optional] set this to false for non-persistent connections
+ * ));
+ */
+Cache::config('default', array('engine' => 'File'));
View
171 App/Config/core.php
@@ -23,86 +23,6 @@
use Cake\Core\Configure;
/**
- * CakePHP Debug Level:
- *
- * Production Mode:
- * 0: No error messages, errors, or warnings shown. Flash messages redirect.
- *
- * Development Mode:
- * 1: Errors and warnings shown, model caches refreshed, flash messages halted.
- * 2: As in 1, but also with full debug messages and SQL output.
- *
- * In production mode, flash messages redirect after a time interval.
- * In development mode, you need to click the flash message to continue.
- */
- Configure::write('debug', 2);
-
-/**
- * Configure the Error handler used to handle errors for your application. By default
- * ErrorHandler::handleError() is used. It will display errors using Debugger, when debug > 0
- * and log errors with Cake Log when debug = 0.
- *
- * Options:
- *
- * - `handler` - callback - The callback to handle errors. You can set this to any callable type,
- * including anonymous functions.
- * - `level` - int - The level of errors you are interested in capturing.
- * - `trace` - boolean - Include stack traces for errors in log files.
- *
- * @see ErrorHandler for more information on error handling and configuration.
- */
- Configure::write('Error', array(
- 'handler' => 'Cake\Error\ErrorHandler::handleError',
- 'level' => E_ALL & ~E_DEPRECATED,
- 'trace' => true
- ));
-
-/**
- * Configure the Exception handler used for uncaught exceptions. By default,
- * ErrorHandler::handleException() is used. It will display a HTML page for the exception, and
- * while debug > 0, framework errors like Missing Controller will be displayed. When debug = 0,
- * framework errors will be coerced into generic HTTP errors.
- *
- * Options:
- *
- * - `handler` - callback - The callback to handle exceptions. You can set this to any callback type,
- * including anonymous functions.
- * - `renderer` - string - The class responsible for rendering uncaught exceptions. If you choose a custom class you
- * should place the file for that class in app/Lib/Error. This class needs to implement a render method.
- * - `log` - boolean - Should Exceptions be logged?
- *
- * @see ErrorHandler for more information on exception handling and configuration.
- */
- Configure::write('Exception', array(
- 'handler' => 'Cake\Error\ErrorHandler::handleException',
- 'renderer' => 'Cake\Error\ExceptionRenderer',
- 'log' => true
- ));
-
-/**
- * Application namespace
- */
- Configure::write('App.namespace', 'App');
-
-/**
- * Application wide charset encoding
- */
- Configure::write('App.encoding', 'UTF-8');
-
-/**
- * To configure CakePHP *not* to use mod_rewrite and to
- * use CakePHP pretty URLs, remove these .htaccess
- * files:
- *
- * /.htaccess
- * /app/.htaccess
- * /app/webroot/.htaccess
- *
- * And uncomment the App.baseUrl below:
- */
- //Configure::write('App.baseUrl', env('SCRIPT_NAME'));
-
-/**
* Uncomment the define below to use CakePHP prefix routes.
*
* The value of the define determines the names of the routes
@@ -138,53 +58,6 @@
//Configure::write('Cache.check', true);
/**
- * Defines the default error type when using the log() function. Used for
- * differentiating error logging and debugging. Currently PHP supports LOG_DEBUG.
- */
- define('LOG_ERROR', LOG_ERR);
-
-/**
- * Session configuration.
- *
- * Contains an array of settings to use for session configuration. The defaults key is
- * used to define a default preset to use for sessions, any settings declared here will override
- * the settings of the default config.
- *
- * ## Options
- *
- * - `Session.cookie` - The name of the cookie to use. Defaults to 'CAKEPHP'
- * - `Session.timeout` - The number of minutes you want sessions to live for. This timeout is handled by CakePHP
- * - `Session.cookieTimeout` - The number of minutes you want session cookies to live for.
- * - `Session.checkAgent` - Do you want the user agent to be checked when starting sessions? You might want to set the
- * value to false, when dealing with older versions of IE, Chrome Frame or certain web-browsing devices and AJAX
- * - `Session.defaults` - The default configuration set to use as a basis for your session.
- * There are four builtins: php, cake, cache, database.
- * - `Session.handler` - Can be used to enable a custom session handler. Expects an array of of callables,
- * that can be used with `session_save_handler`. Using this option will automatically add `session.save_handler`
- * to the ini array.
- * - `Session.autoRegenerate` - Enabling this setting, turns on automatic renewal of sessions, and
- * sessionids that change frequently. See Cake\Model\Datasource\Session::$requestCountdown.
- * - `Session.ini` - An associative array of additional ini values to set.
- *
- * The built in defaults are:
- *
- * - 'php' - Uses settings defined in your php.ini.
- * - 'cake' - Saves session files in CakePHP's /tmp directory.
- * - 'database' - Uses CakePHP's database sessions.
- * - 'cache' - Use the Cache class to save sessions.
- *
- * To define a custom session handler, save it at /app/Model/Datasource/Session/<name>.php.
- * Make sure the class implements `Cake\Model\Datasource\Session\SessionHandlerInterface` and set Session.handler to <name>
- *
- * To use database sessions, run the app/Config/Schema/sessions.php schema using
- * the cake shell command: cake schema create Sessions
- *
- */
- Configure::write('Session', array(
- 'defaults' => 'php'
- ));
-
-/**
* The level of CakePHP security.
*/
Configure::write('Security.level', 'medium');
@@ -239,47 +112,3 @@
*/
//date_default_timezone_set('UTC');
-/**
- * Configure the cache handlers that CakePHP will use for internal
- * metadata like class maps, and model schema.
- *
- * By default File is used, but for improved performance you should use APC.
- *
- * Note: 'default' and other application caches should be configured in app/Config/bootstrap.php.
- * Please check the comments in boostrap.php for more info on the cache engines available
- * and their setttings.
- */
-$engine = 'File';
-
-// In development mode, caches should expire quickly.
-$duration = '+999 days';
-if (Configure::read('debug') >= 1) {
- $duration = '+10 seconds';
-}
-
-// Prefix each application on the same server with a different string, to avoid Memcache and APC conflicts.
-$prefix = 'myapp_';
-
-/**
- * Configure the cache used for general framework caching. Path information,
- * object listings, and translation cache files are stored with this configuration.
- */
-Cache::config('_cake_core_', array(
- 'engine' => $engine,
- 'prefix' => $prefix . 'cake_core_',
- 'path' => CACHE . 'persistent/',
- 'serialize' => ($engine === 'File'),
- 'duration' => $duration
-));
-
-/**
- * Configure the cache for model and datasource caches. This cache configuration
- * is used to store schema descriptions, and table listings in connections.
- */
-Cache::config('_cake_model_', array(
- 'engine' => $engine,
- 'prefix' => $prefix . 'cake_model_',
- 'path' => CACHE . 'models/',
- 'serialize' => ($engine === 'File'),
- 'duration' => $duration
-));
View
0 App/Config/datasources.php
No changes.
View
48 App/Config/error.php
@@ -0,0 +1,48 @@
+<?php
+namespace App\Config;
+
+use Cake\Core\Configure;
+
+/**
+ * Configure the Error handler used to handle errors for your application. By default
+ * ErrorHandler::handleError() is used. It will display errors using Debugger, when debug > 0
+ * and log errors with Cake Log when debug = 0.
+ *
+ * Options:
+ *
+ * - `handler` - callback - The callback to handle errors. You can set this to any callable type,
+ * including anonymous functions.
+ * - `level` - int - The level of errors you are interested in capturing.
+ * - `trace` - boolean - Include stack traces for errors in log files.
+ *
+ * @see ErrorHandler for more information on error handling and configuration.
+ */
+ Configure::write('Error', array(
+ 'handler' => 'Cake\Error\ErrorHandler::handleError',
+ 'level' => E_ALL & ~E_DEPRECATED,
+ 'trace' => true
+ ));
+
+/**
+ * Configure the Exception handler used for uncaught exceptions. By default,
+ * ErrorHandler::handleException() is used. It will display a HTML page for the exception, and
+ * while debug > 0, framework errors like Missing Controller will be displayed. When debug = 0,
+ * framework errors will be coerced into generic HTTP errors.
+ *
+ * Options:
+ *
+ * - `handler` - callback - The callback to handle exceptions. You can set this to any callback type,
+ * including anonymous functions.
+ * - `renderer` - string - The class responsible for rendering uncaught exceptions. If you choose a custom class you
+ * should place the file for that class in app/Lib/Error. This class needs to implement a render method.
+ * - `log` - boolean - Should Exceptions be logged?
+ *
+ * @see ErrorHandler for more information on exception handling and configuration.
+ */
+ Configure::write('Exception', array(
+ 'handler' => 'Cake\Error\ErrorHandler::handleException',
+ 'renderer' => 'Cake\Error\ExceptionRenderer',
+ 'log' => true
+ ));
+
+ Configure::setErrorHandlers();
View
24 App/Config/logging.php
@@ -0,0 +1,24 @@
+<?php
+namespace App\Config;
+
+use Cake\Log\Log;
+
+/**
+ * Defines the default error type when using the log() function. Used for
+ * differentiating error logging and debugging. Currently PHP supports LOG_DEBUG.
+ */
+ define('LOG_ERROR', LOG_ERR);
+
+/**
+ * Configures default file logging options
+ */
+Log::config('debug', array(
+ 'engine' => 'Cake\Log\Engine\FileLog',
+ 'types' => array('notice', 'info', 'debug'),
+ 'file' => 'debug',
+));
+Log::config('error', array(
+ 'engine' => 'Cake\Log\Engine\FileLog',
+ 'types' => array('warning', 'error', 'critical', 'alert', 'emergency'),
+ 'file' => 'error',
+));
View
113 App/Config/paths.php
@@ -0,0 +1,113 @@
+<?php
+/**
+ * Use the DS to separate the directories in other defines
+ */
+define('DS', DIRECTORY_SEPARATOR);
+
+/**
+ * These defines should only be edited if you have cake installed in
+ * a directory layout other than the way it is distributed.
+ * When using custom settings be sure to use the DS and do not add a trailing DS.
+ */
+
+/**
+ * The full path to the directory which holds "App", WITHOUT a trailing DS.
+ */
+define('ROOT', dirname(dirname(dirname(__FILE__))));
+
+/**
+ * The actual directory name for the "App".
+ */
+define('APP_DIR', basename(dirname(dirname(__FILE__))));
+
+/**
+ * The name of the webroot dir. Defaults to 'webroot'
+ */
+define('WEBROOT_DIR', basename(dirname(__FILE__)));
+
+/**
+ * File path to the webroot directory.
+ */
+define('WWW_ROOT', dirname(__FILE__) . DS);
+
+
+/**
+ * Path to the application's directory.
+ */
+define('APP', ROOT . DS . APP_DIR . DS);
+
+/**
+ * Path to the application's libs directory.
+ */
+define('APPLIBS', APP . 'Lib' . DS);
+
+/**
+ * Path to the public CSS directory.
+ */
+define('CSS', WWW_ROOT . 'css' . DS);
+
+/**
+ * Path to the public JavaScript directory.
+ */
+define('JS', WWW_ROOT . 'js' . DS);
+
+/**
+ * Path to the public images directory.
+ */
+define('IMAGES', WWW_ROOT . 'img' . DS);
+
+/**
+ * Path to the tests directory.
+ */
+define('TESTS', APP . 'Test' . DS);
+
+/**
+ * Path to the temporary files directory.
+ */
+define('TMP', APP . 'tmp' . DS);
+
+/**
+ * Path to the logs directory.
+ */
+define('LOGS', TMP . 'logs' . DS);
+
+/**
+ * Path to the cache files directory. It can be shared between hosts in a multi-server setup.
+ */
+define('CACHE', TMP . 'cache' . DS);
+
+/**
+ * Web path to the public images directory.
+ */
+define('IMAGES_URL', 'img/');
+
+/**
+ * Web path to the CSS files directory.
+ */
+define('CSS_URL', 'css/');
+
+/**
+ * Web path to the js files directory.
+ */
+define('JS_URL', 'js/');
+
+/**
+ * The absolute path to the "cake" directory, WITHOUT a trailing DS.
+ *
+ * Un-comment this line to specify a fixed path to CakePHP.
+ * This should point at the directory containing `Cake`.
+ *
+ * For ease of development CakePHP uses PHP's include_path. If you
+ * cannot modify your include_path set this value.
+ *
+ * Leaving this constant undefined will result in it being defined in Cake/bootstrap.php
+ */
+//TODO include_path support.
+define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
+
+define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
+
+/**
+ * Path to the cake directory.
+ */
+define('CAKE', CORE_PATH . 'Cake' . DS);
View
45 App/Config/session.php
@@ -0,0 +1,45 @@
+<?php
+namespace App\Config;
+
+use Cake\Core\Configure;
+
+/**
+ * Session configuration.
+ *
+ * Contains an array of settings to use for session configuration. The defaults key is
+ * used to define a default preset to use for sessions, any settings declared here will override
+ * the settings of the default config.
+ *
+ * ## Options
+ *
+ * - `Session.cookie` - The name of the cookie to use. Defaults to 'CAKEPHP'
+ * - `Session.timeout` - The number of minutes you want sessions to live for. This timeout is handled by CakePHP
+ * - `Session.cookieTimeout` - The number of minutes you want session cookies to live for.
+ * - `Session.checkAgent` - Do you want the user agent to be checked when starting sessions? You might want to set the
+ * value to false, when dealing with older versions of IE, Chrome Frame or certain web-browsing devices and AJAX
+ * - `Session.defaults` - The default configuration set to use as a basis for your session.
+ * There are four builtins: php, cake, cache, database.
+ * - `Session.handler` - Can be used to enable a custom session handler. Expects an array of of callables,
+ * that can be used with `session_save_handler`. Using this option will automatically add `session.save_handler`
+ * to the ini array.
+ * - `Session.autoRegenerate` - Enabling this setting, turns on automatic renewal of sessions, and
+ * sessionids that change frequently. See Cake\Model\Datasource\Session::$requestCountdown.
+ * - `Session.ini` - An associative array of additional ini values to set.
+ *
+ * The built in defaults are:
+ *
+ * - 'php' - Uses settings defined in your php.ini.
+ * - 'cake' - Saves session files in CakePHP's /tmp directory.
+ * - 'database' - Uses CakePHP's database sessions.
+ * - 'cache' - Use the Cache class to save sessions.
+ *
+ * To define a custom session handler, save it at /app/Model/Datasource/Session/<name>.php.
+ * Make sure the class implements `Cake\Model\Datasource\Session\SessionHandlerInterface` and set Session.handler to <name>
+ *
+ * To use database sessions, run the app/Config/Schema/sessions.php schema using
+ * the cake shell command: cake schema create Sessions
+ *
+ */
+ Configure::write('Session', array(
+ 'defaults' => 'php'
+ ));
View
74 App/webroot/index.php
@@ -18,83 +18,19 @@
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
-/**
- * Use the DS to separate the directories in other defines
- */
-if (!defined('DS')) {
- define('DS', DIRECTORY_SEPARATOR);
-}
-/**
- * These defines should only be edited if you have cake installed in
- * a directory layout other than the way it is distributed.
- * When using custom settings be sure to use the DS and do not add a trailing DS.
- */
-
-/**
- * The full path to the directory which holds "app", WITHOUT a trailing DS.
- *
- */
-if (!defined('ROOT')) {
- define('ROOT', dirname(dirname(__DIR__)));
-}
-/**
- * The actual directory name for the "App".
- *
- */
-if (!defined('APP_DIR')) {
- define('APP_DIR', basename(dirname(__DIR__)));
-}
-
-/**
- * The absolute path to the "cake" directory, WITHOUT a trailing DS.
- *
- * Un-comment this line to specify a fixed path to CakePHP.
- * This should point at the directory containing `Cake`.
- *
- * For ease of development CakePHP uses PHP's include_path. If you
- * cannot modify your include_path set this value.
- *
- * Leaving this constant undefined will result in it being defined in Cake/bootstrap.php
- */
- //define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
-
-/**
- * Editing below this line should NOT be necessary.
- * Change at your own risk.
- *
- */
-if (!defined('WEBROOT_DIR')) {
- define('WEBROOT_DIR', basename(__DIR__));
-}
-if (!defined('WWW_ROOT')) {
- define('WWW_ROOT', __DIR__ . DS);
-}
-
// for built-in server
if (php_sapi_name() == 'cli-server') {
$_SERVER['PHP_SELF'] = '/' . basename(__FILE__);
}
-
-if (!defined('CAKE_CORE_INCLUDE_PATH')) {
- if (function_exists('ini_set')) {
- ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
- }
- if (!include ('Cake/bootstrap.php')) {
- $failed = true;
- }
-} else {
- if (!include (CAKE_CORE_INCLUDE_PATH . DS . 'Cake/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);
-}
+require dirname(__DIR__) . '/Config/bootstrap.php';
use Cake\Core\Configure;
use Cake\Network\Request;
use Cake\Network\Response;
use Cake\Routing\Dispatcher;
$Dispatcher = new Dispatcher();
-$Dispatcher->dispatch(Request::createFromGlobals(), new Response(array('charset' => Configure::read('App.encoding'))));
+$Dispatcher->dispatch(
+ Request::createFromGlobals(),
+ new Response(array('charset' => Configure::read('App.encoding')))
+);
View
21 index.php
@@ -20,23 +20,4 @@
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
-
-/**
- * Get Cake's root directory
- */
-define('APP_DIR', 'App');
-define('DS', DIRECTORY_SEPARATOR);
-define('ROOT', __DIR__);
-define('WEBROOT_DIR', 'webroot');
-define('WWW_ROOT', ROOT . DS . APP_DIR . DS . WEBROOT_DIR . DS);
-
-/**
- * This only needs to be changed if the "cake" directory is located
- * outside of the distributed structure.
- * Full path to the directory containing "cake". Do not add trailing directory separator
- */
-if (!defined('CAKE_CORE_INCLUDE_PATH')) {
- define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
-}
-
-require APP_DIR . DS . WEBROOT_DIR . DS . 'index.php';
+require 'App/webroot/index.php';
View
29 lib/Cake/Core/Configure.php
@@ -73,30 +73,9 @@ public static function bootstrap($boot = true) {
'www_root' => WWW_ROOT
));
- if (!include APP . 'Config/core.php') {
- trigger_error(__d('cake_dev', "Can't find application core file. Please create %score.php, and make sure it is readable by PHP.", APP . 'Config' . DS), E_USER_ERROR);
- }
App::init();
App::build();
- $exception = array(
- 'handler' => 'Cake\Error\ErrorHandler::handleException',
- );
- $error = array(
- 'handler' => 'Cake\Error\ErrorHandler::handleError',
- 'level' => E_ALL & ~E_DEPRECATED,
- );
- static::_setErrorHandlers($error, $exception);
-
- if (!include APP . 'Config/bootstrap.php') {
- trigger_error(__d('cake_dev', "Can't find application bootstrap file. Please create %sbootstrap.php, and make sure it is readable by PHP.", APP . 'Config' . DS), E_USER_ERROR);
- }
- restore_error_handler();
-
- static::_setErrorHandlers(
- static::$_values['Error'],
- static::$_values['Exception']
- );
}
}
@@ -406,7 +385,13 @@ public static function clear() {
* @param array $exception The exception handling configuration.
* @return void
*/
- protected static function _setErrorHandlers($error, $exception) {
+ public static function setErrorHandlers($error = null, $exception = null) {
+ if (!$error) {
+ $error = self::$_values['Error'];
+ }
+ if (!$exception) {
+ $exception = self::$_values['Exception'];
+ }
$level = -1;
if (isset($error['level'])) {
error_reporting($error['level']);
View
100 lib/Cake/bootstrap.php
@@ -22,106 +22,6 @@
error_reporting(E_ALL & ~E_DEPRECATED);
-if (!defined('CAKE_CORE_INCLUDE_PATH')) {
- define('CAKE_CORE_INCLUDE_PATH', dirname(__DIR__));
-}
-
-if (!defined('CORE_PATH')) {
- define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
-}
-
-if (!defined('WEBROOT_DIR')) {
- define('WEBROOT_DIR', 'webroot');
-}
-
-/**
- * Path to the cake directory.
- */
- define('CAKE', CORE_PATH . 'Cake/');
-
-/**
- * Path to the application's directory.
- */
-if (!defined('APP')) {
- define('APP', ROOT . DS . APP_DIR . DS);
-}
-
-/**
- * Path to the application's libs directory.
- */
- define('APPLIBS', APP . 'Lib/');
-
-/**
- * Path to the public CSS directory.
- */
- define('CSS', WWW_ROOT . 'css/');
-
-/**
- * Path to the public JavaScript directory.
- */
- define('JS', WWW_ROOT . 'js/');
-
-/**
- * Path to the public images directory.
- */
- define('IMAGES', WWW_ROOT . 'img/');
-
-/**
- * Path to the tests directory.
- */
-if (!defined('TESTS')) {
- define('TESTS', APP . 'Test/');
-}
-
-/**
- * Path to the temporary files directory.
- */
-if (!defined('TMP')) {
- define('TMP', APP . 'tmp/');
-}
-
-/**
- * Path to the logs directory.
- */
-if (!defined('LOGS')) {
- define('LOGS', TMP . 'logs/');
-}
-
-/**
- * Path to the cache files directory. It can be shared between hosts in a multi-server setup.
- */
-if (!defined('CACHE')) {
- define('CACHE', TMP . 'cache/');
-}
-
-/**
- * Path to the vendors directory.
- */
-if (!defined('VENDORS')) {
- define('VENDORS', ROOT . DS . 'vendors/');
-}
-
-/**
- * Web path to the public images directory.
- */
-if (!defined('IMAGES_URL')) {
- define('IMAGES_URL', 'img/');
-}
-
-/**
- * Web path to the CSS files directory.
- */
-if (!defined('CSS_URL')) {
- define('CSS_URL', 'css/');
-}
-
-/**
- * Web path to the js files directory.
- */
-if (!defined('JS_URL')) {
- define('JS_URL', 'js/');
-}
-
require CAKE . 'basics.php';
require CAKE . 'Core/ClassLoader.php';
$loader = new \Cake\Core\ClassLoader('Cake', CORE_PATH);

0 comments on commit ef7cc5a

Please sign in to comment.
Something went wrong with that request. Please try again.