bootstrap.php 1.8 KB

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