Web Interfaces of PROSUME

Application.php 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * For full copyright and license information, please see the LICENSE.txt
  8. * Redistributions of files must retain the above copyright notice.
  9. *
  10. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  11. * @link https://cakephp.org CakePHP(tm) Project
  12. * @since 3.3.0
  13. * @license https://opensource.org/licenses/mit-license.php MIT License
  14. */
  15. namespace App;
  16. use Cake\Core\Configure;
  17. use Cake\Core\Exception\MissingPluginException;
  18. use Cake\Error\Middleware\ErrorHandlerMiddleware;
  19. use Cake\Http\BaseApplication;
  20. use Cake\Routing\Middleware\AssetMiddleware;
  21. use Cake\Routing\Middleware\RoutingMiddleware;
  22. /**
  23. * Application setup class.
  24. *
  25. * This defines the bootstrapping logic and middleware layers you
  26. * want to use in your application.
  27. */
  28. class Application extends BaseApplication
  29. {
  30. /**
  31. * {@inheritDoc}
  32. */
  33. public function bootstrap()
  34. {
  35. // Call parent to load bootstrap from files.
  36. parent::bootstrap();
  37. if (PHP_SAPI === 'cli') {
  38. try {
  39. $this->addPlugin('Bake');
  40. } catch (MissingPluginException $e) {
  41. // Do not halt if the plugin is missing
  42. }
  43. $this->addPlugin('Migrations');
  44. }
  45. /*
  46. * Only try to load DebugKit in development mode
  47. * Debug Kit should not be installed on a production system
  48. */
  49. if (Configure::read('debug')) {
  50. $this->addPlugin(\DebugKit\Plugin::class);
  51. }
  52. }
  53. /**
  54. * Setup the middleware queue your application will use.
  55. *
  56. * @param \Cake\Http\MiddlewareQueue $middlewareQueue The middleware queue to setup.
  57. * @return \Cake\Http\MiddlewareQueue The updated middleware queue.
  58. */
  59. public function middleware($middlewareQueue)
  60. {
  61. $middlewareQueue
  62. // Catch any exceptions in the lower layers,
  63. // and make an error page/response
  64. ->add(new ErrorHandlerMiddleware(null, Configure::read('Error')))
  65. // Handle plugin/theme assets like CakePHP normally does.
  66. ->add(new AssetMiddleware([
  67. 'cacheTime' => Configure::read('Asset.cacheTime')
  68. ]))
  69. // Add routing middleware.
  70. // Routes collection cache enabled by default, to disable route caching
  71. // pass null as cacheConfig, example: `new RoutingMiddleware($this)`
  72. // you might want to disable this cache in case your routing is extremely simple
  73. ->add(new RoutingMiddleware($this, '_cake_routes_'));
  74. return $middlewareQueue;
  75. }
  76. }