bootstrap.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (http://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. (http://cakefoundation.org)
  11. * @link http://cakephp.org CakePHP(tm) Project
  12. * @since CakePHP(tm) v 0.10.8.2117
  13. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  14. */
  15. namespace App\Config;
  16. if (file_exists(dirname(__DIR__) . 'vendor/autoload.php')) {
  17. require dirname(__DIR__) . 'vendor/autoload.php';
  18. }
  19. /**
  20. * Configure paths required to find CakePHP + general filepath
  21. * constants
  22. */
  23. require __DIR__ . '/paths.php';
  24. /**
  25. * Bootstrap CakePHP.
  26. *
  27. * Does the various bits of setup that CakePHP needs to do.
  28. * This includes:
  29. *
  30. * - Registering the CakePHP autoloader.
  31. * - Setting the default application paths.
  32. */
  33. require CORE_PATH . 'Cake/bootstrap.php';
  34. use Cake\Core\App;
  35. use Cake\Cache\Cache;
  36. use Cake\Console\ConsoleErrorHandler;
  37. use Cake\Core\Configure;
  38. use Cake\Configure\Engine\PhpConfig;
  39. use Cake\Core\Plugin;
  40. use Cake\Database\ConnectionManager;
  41. use Cake\Error\ErrorHandler;
  42. use Cake\Log\Log;
  43. use Cake\Network\Email\Email;
  44. use Cake\Utility\Inflector;
  45. /**
  46. * Read configuration file and inject configuration into various
  47. * CakePHP classes.
  48. *
  49. * By default there is only one configuration file. It is often a good
  50. * idea to create multiple configuration files, and separate the configuration
  51. * that changes from configuration that does not. This makes deployment simpler.
  52. */
  53. try {
  54. Configure::config('default', new PhpConfig());
  55. Configure::load('app.php', 'default', false);
  56. /**
  57. * Load an environment local configuration file.
  58. * You can use this file to provide local overrides to your
  59. * shared configuration.
  60. */
  61. // Configure::load('app.local.php', 'default');
  62. } catch (\Exception $e) {
  63. die('Unable to load Config/app.php ensure it exists.');
  64. }
  65. /**
  66. * Configure an autoloader for the App namespace.
  67. *
  68. * Use App\Controller\AppController as a test to see if composer
  69. * support is being used.
  70. */
  71. if (!class_exists('App\Controller\AppController')) {
  72. (new \Cake\Core\ClassLoader(Configure::read('App.namespace'), dirname(APP)))->register();
  73. }
  74. /**
  75. * Uncomment this line and correct your server timezone to fix
  76. * any date & time related errors.
  77. */
  78. //date_default_timezone_set('UTC');
  79. /**
  80. * Configure the mbstring extension to use the correct encoding.
  81. */
  82. mb_internal_encoding(Configure::read('App.encoding'));
  83. /**
  84. * Register application error and exception handlers.
  85. */
  86. if (php_sapi_name() == 'cli') {
  87. (new ConsoleErrorHandler(Configure::consume('Error')))->register();
  88. } else {
  89. (new ErrorHandler(Configure::consume('Error')))->register();
  90. }
  91. /**
  92. * Set the full base url.
  93. * This URL is used as the base of all absolute links.
  94. *
  95. * If you define fullBaseUrl in your config file you can remove this.
  96. */
  97. if (!Configure::read('App.fullBaseUrl')) {
  98. $s = null;
  99. if (env('HTTPS')) {
  100. $s = 's';
  101. }
  102. $httpHost = env('HTTP_HOST');
  103. if (isset($httpHost)) {
  104. Configure::write('App.fullBaseUrl', 'http' . $s . '://' . $httpHost);
  105. }
  106. unset($httpHost, $s);
  107. }
  108. Cache::config(Configure::consume('Cache'));
  109. ConnectionManager::config(Configure::consume('Datasources'));
  110. Email::configTransport(Configure::consume('EmailTransport'));
  111. Email::config(Configure::consume('Email'));
  112. Log::config(Configure::consume('Log'));
  113. /**
  114. * Custom Inflector rules, can be set to correctly pluralize or singularize table, model, controller names or whatever other
  115. * string is passed to the inflection functions
  116. *
  117. * Inflector::rules('singular', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
  118. * Inflector::rules('plural', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
  119. *
  120. */
  121. /**
  122. * Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
  123. * Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more
  124. * advanced ways of loading plugins
  125. *
  126. * Plugin::loadAll(); // Loads all plugins at once
  127. * Plugin::load('DebugKit'); //Loads a single plugin named DebugKit
  128. *
  129. */