getMessage() . "\n"); } // Load an environment local configuration file. // You can use a file like app_local.php to provide local overrides to your // shared configuration. //Configure::load('app_local', 'default'); // When debug = false the metadata cache should last // for a very very long time, as we don't want // to refresh the cache while users are doing requests. if (!Configure::read('debug')) { Configure::write('Cache._cake_model_.duration', '+1 years'); Configure::write('Cache._cake_core_.duration', '+1 years'); } /** * Set server timezone to UTC. You can change it to another timezone of your * choice but using UTC makes time calculations / conversions easier. */ date_default_timezone_set('UTC'); /** * Configure the mbstring extension to use the correct encoding. */ mb_internal_encoding(Configure::read('App.encoding')); /** * Set the default locale. This controls how dates, number and currency is * formatted and sets the default language to use for translations. */ ini_set('intl.default_locale', 'en_US'); /** * Register application error and exception handlers. */ $isCli = php_sapi_name() === 'cli'; if ($isCli) { (new ConsoleErrorHandler(Configure::read('Error')))->register(); } else { (new ErrorHandler(Configure::read('Error')))->register(); } // Include the CLI bootstrap overrides. if ($isCli) { require __DIR__ . '/bootstrap_cli.php'; } /** * Set the full base URL. * This URL is used as the base of all absolute links. * * If you define fullBaseUrl in your config file you can remove this. */ if (!Configure::read('App.fullBaseUrl')) { $s = null; if (env('HTTPS')) { $s = 's'; } $httpHost = env('HTTP_HOST'); if (isset($httpHost)) { Configure::write('App.fullBaseUrl', 'http' . $s . '://' . $httpHost); } unset($httpHost, $s); } Cache::config(Configure::consume('Cache')); ConnectionManager::config(Configure::consume('Datasources')); Email::configTransport(Configure::consume('EmailTransport')); Email::config(Configure::consume('Email')); Log::config(Configure::consume('Log')); Security::salt(Configure::consume('Security.salt')); /** * The default crypto extension in 3.0 is OpenSSL. * If you are migrating from 2.x uncomment this code to * use a more compatible Mcrypt based implementation */ // Security::engine(new \Cake\Utility\Crypto\Mcrypt()); /** * Setup detectors for mobile and tablet. */ Request::addDetector('mobile', function ($request) { $detector = new \Detection\MobileDetect(); return $detector->isMobile(); }); Request::addDetector('tablet', function ($request) { $detector = new \Detection\MobileDetect(); return $detector->isTablet(); }); /** * Custom Inflector rules, can be set to correctly pluralize or singularize * table, model, controller names or whatever other string is passed to the * inflection functions. * * Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']); * Inflector::rules('irregular' => ['red' => 'redlings']); * Inflector::rules('uninflected', ['dontinflectme']); * Inflector::rules('transliteration', ['/å/' => 'aa']); */ /** * Plugins need to be loaded manually, you can either load them one by one or all of them in a single call * Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more * advanced ways of loading plugins * * Plugin::loadAll(); // Loads all plugins at once * Plugin::load('Migrations'); //Loads a single plugin named Migrations * */ Plugin::load('Migrations'); // Only try to load DebugKit in development mode // Debug Kit should not be installed on a production system if (Configure::read('debug')) { Plugin::load('DebugKit', ['bootstrap' => true]); } /** * Connect middleware/dispatcher filters. */ DispatcherFactory::add('Asset'); DispatcherFactory::add('Routing'); DispatcherFactory::add('ControllerFactory');