diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-07-16 00:09:33 +0200 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-07-16 00:09:33 +0200 |
commit | 4a3ec0ca3f7d0ca8776a6ee7f2a2615234395eb8 (patch) | |
tree | 8869134f1c3b5f7c3841578fbcaa4ff9cee7e2bc /fai_gestion/src/Application.php | |
parent | a6104f47f7a0534664f8f3740f303f01e7e7399e (diff) | |
download | chd_gestion-4a3ec0ca3f7d0ca8776a6ee7f2a2615234395eb8.zip chd_gestion-4a3ec0ca3f7d0ca8776a6ee7f2a2615234395eb8.tar.gz chd_gestion-4a3ec0ca3f7d0ca8776a6ee7f2a2615234395eb8.tar.bz2 |
Cake 3.6.7 fresh install
Diffstat (limited to 'fai_gestion/src/Application.php')
-rw-r--r-- | fai_gestion/src/Application.php | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/fai_gestion/src/Application.php b/fai_gestion/src/Application.php new file mode 100644 index 0000000..48484b4 --- /dev/null +++ b/fai_gestion/src/Application.php @@ -0,0 +1,89 @@ +<?php +/** + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://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. (https://cakefoundation.org) + * @link https://cakephp.org CakePHP(tm) Project + * @since 3.3.0 + * @license https://opensource.org/licenses/mit-license.php MIT License + */ +namespace App; + +use Cake\Core\Configure; +use Cake\Core\Exception\MissingPluginException; +use Cake\Error\Middleware\ErrorHandlerMiddleware; +use Cake\Http\BaseApplication; +use Cake\Http\Middleware\CsrfProtectionMiddleware; +use Cake\Routing\Middleware\AssetMiddleware; +use Cake\Routing\Middleware\RoutingMiddleware; + +/** + * Application setup class. + * + * This defines the bootstrapping logic and middleware layers you + * want to use in your application. + */ +class Application extends BaseApplication +{ + /** + * {@inheritDoc} + */ + public function bootstrap() + { + // Call parent to load bootstrap from files. + parent::bootstrap(); + + if (PHP_SAPI === 'cli') { + try { + $this->addPlugin('Bake'); + } catch (MissingPluginException $e) { + // Do not halt if the plugin is missing + } + + $this->addPlugin('Migrations'); + } + + /* + * Only try to load DebugKit in development mode + * Debug Kit should not be installed on a production system + */ + if (Configure::read('debug')) { + $this->addPlugin(\DebugKit\Plugin::class); + } + } + + /** + * Setup the middleware queue your application will use. + * + * @param \Cake\Http\MiddlewareQueue $middlewareQueue The middleware queue to setup. + * @return \Cake\Http\MiddlewareQueue The updated middleware queue. + */ + public function middleware($middlewareQueue) + { + $middlewareQueue + // Catch any exceptions in the lower layers, + // and make an error page/response + ->add(ErrorHandlerMiddleware::class) + + // Handle plugin/theme assets like CakePHP normally does. + ->add(AssetMiddleware::class) + + // Add routing middleware. + // Routes collection cache enabled by default, to disable route caching + // pass null as cacheConfig, example: `new RoutingMiddleware($this)` + // you might want to disable this cache in case your routing is extremely simple + ->add(new RoutingMiddleware($this, '_cake_routes_')) + + // Add csrf middleware. + ->add(new CsrfProtectionMiddleware([ + 'httpOnly' => true + ])); + + return $middlewareQueue; + } +} |