return $root; } } function find_app() { if (is_dir(ROOT . '/App')) { return 'App'; } if (is_dir(ROOT . '/vendor/cakephp/app/App')) { return 'vendor/cakephp/app/App'; } } if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } define('ROOT', find_root()); define('APP_DIR', find_app()); define('WEBROOT_DIR', 'webroot'); define('CONFIG', ROOT . DS . 'config' . DS); define('APP', ROOT . DS . APP_DIR . DS); define('WWW_ROOT', ROOT . DS . WEBROOT_DIR . DS); define('TESTS', ROOT . DS . 'Test' . DS); define('TMP', ROOT . DS . 'tmp' . DS); define('LOGS', TMP . 'logs' . DS); define('CACHE', TMP . 'cache' . DS); define('CAKE_CORE_INCLUDE_PATH', ROOT . '/vendor/cakephp/cakephp'); define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS); define('CAKE', CORE_PATH . 'src' . DS); require ROOT . '/vendor/autoload.php'; require CORE_PATH . 'config/bootstrap.php'; Cake\Core\Configure::write('App', ['namespace' => 'App']);
<?php if (PHP_SAPI !== 'cli') { echo 'This script must be run from the command line.' . PHP_EOL; exit; } $root = find_root(); if (!$root) { echo 'ERROR: Drupal root not found. This command must be run from inside a Drupal installation.' . PHP_EOL; exit; } require __DIR__ . '/../src/JsonFile.php'; require __DIR__ . '/../composer_manager.module'; composer_manager_initialize($root); echo 'Composer Manager has been successfuly initialized.' . PHP_EOL; /** * Returns the absolute path to Drupal's root directory. */ function find_root() { $currentPath = __DIR__ . '/'; $relativePath = ''; $rootPath = ''; $found = FALSE; while (!$found) { $rootPath = $relativePath . $currentPath; echo $rootPath . ';'; if (is_dir($rootPath . 'vendor')) { $found = TRUE; break; } else {