if (isset($autoloader)) { $autoload = (require_once $autoloader); } else { echo ' You must set up the project dependencies using `composer install`' . PHP_EOL; exit(1); } $drupalFinder = new DrupalFinder(); $drupalFinder->locateRoot(getcwd()); $composerRoot = $drupalFinder->getComposerRoot(); $drupalRoot = $drupalFinder->getDrupalRoot(); if (!$drupalRoot || !$composerRoot) { echo ' DrupalConsole must be executed within a Drupal Site.' . PHP_EOL; exit(1); } chdir($drupalRoot); $drupal = new Drupal($autoload, $composerRoot, $drupalRoot); $container = $drupal->boot(); if (!$container) { echo ' Something goes wrong. Drupal can not be bootstrapped.'; exit(1); } $configuration = $container->get('console.configuration_manager')->getConfiguration(); $translator = $container->get('console.translator_manager'); $argvInputReader = new ArgvInputReader(); if ($options = $configuration->get('application.options') ?: []) { $argvInputReader->setOptionsFromConfiguration($options); } $argvInputReader->setOptionsAsArgv(); $application = new Application($container); $application->setDefaultCommand('about'); $application->run();