bootstrap.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. //require dirname(__DIR__) . '/../Config/bootstrap.php';
  3. define('DS', DIRECTORY_SEPARATOR);
  4. define('ROOT', dirname(dirname(dirname(dirname(__FILE__)))));
  5. define('APP_DIR', 'App');
  6. define('WEBROOT_DIR', 'webroot');
  7. define('APP', ROOT . DS . APP_DIR . DS);
  8. define('WWW_ROOT', ROOT . DS . WEBROOT_DIR . DS);
  9. define('TESTS', ROOT . DS . 'Test' . DS);
  10. define('TMP', ROOT . DS . 'tmp' . DS);
  11. define('LOGS', TMP . 'logs' . DS);
  12. define('CACHE', TMP . 'cache' . DS);
  13. define('CAKE_CORE_INCLUDE_PATH', ROOT . '/vendor/cakephp/cakephp');
  14. define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
  15. define('CAKE', CORE_PATH . 'src' . DS);
  16. //require ROOT . '/vendor/cakephp/cakephp/src/basics.php';
  17. require ROOT . '/vendor/autoload.php';
  18. $TMP = new \Cake\Utility\Folder(TMP);
  19. $TMP->create(TMP . 'cache/models', 0777);
  20. $TMP->create(TMP . 'cache/persistent', 0777);
  21. $TMP->create(TMP . 'cache/views', 0777);
  22. $cache = [
  23. 'default' => [
  24. 'engine' => 'File'
  25. ],
  26. '_cake_core_' => [
  27. 'className' => 'File',
  28. 'prefix' => 'crud_myapp_cake_core_',
  29. 'path' => CACHE . 'persistent/',
  30. 'serialize' => true,
  31. 'duration' => '+10 seconds'
  32. ],
  33. '_cake_model_' => [
  34. 'className' => 'File',
  35. 'prefix' => 'crud_my_app_cake_model_',
  36. 'path' => CACHE . 'models/',
  37. 'serialize' => 'File',
  38. 'duration' => '+10 seconds'
  39. ]
  40. ];
  41. Cake\Cache\Cache::config($cache);
  42. Cake\Core\Plugin::load('Tools', ['path' => './']);
  43. $datasources = [
  44. 'test' => [
  45. 'className' => 'Cake\Database\Connection',
  46. 'driver' => 'Cake\Database\Driver\Mysql',
  47. 'persistent' => false,
  48. 'host' => 'localhost',
  49. 'login' => 'tools',
  50. 'password' => 'tools',
  51. 'database' => 'tools',
  52. 'prefix' => false,
  53. 'encoding' => 'utf8',
  54. ]
  55. ];
  56. $datasources['default'] = $datasources['test'];
  57. Cake\Datasource\ConnectionManager::config($datasources);