Yaffs site version 1.1
[yaffs-website] / vendor / drupal / console / bin / drupal.php
1 <?php
2
3 use Drupal\Console\Core\Utils\DrupalFinder;
4 use Drupal\Console\Core\Utils\ArgvInputReader;
5 use Drupal\Console\Bootstrap\Drupal;
6 use Drupal\Console\Application;
7 use Drupal\Console\Core\Utils\ConfigurationManager;
8
9 set_time_limit(0);
10
11 $autoloaders = [];
12
13 if (file_exists(__DIR__ . '/../autoload.local.php')) {
14     include_once __DIR__ . '/../autoload.local.php';
15 } else {
16     $autoloaders = [
17         __DIR__ . '/../../../autoload.php',
18         __DIR__ . '/../vendor/autoload.php'
19     ];
20 }
21
22 foreach ($autoloaders as $file) {
23     if (file_exists($file)) {
24         $autoloader = $file;
25         break;
26     }
27 }
28
29 if (isset($autoloader)) {
30     $autoload = include_once $autoloader;
31 } else {
32     echo ' You must set up the project dependencies using `composer install`' . PHP_EOL;
33     exit(1);
34 }
35
36 $drupalFinder = new DrupalFinder();
37 if (!$drupalFinder->locateRoot(getcwd())) {
38     echo ' DrupalConsole must be executed within a Drupal Site.'.PHP_EOL;
39
40     exit(1);
41 }
42
43 chdir($drupalFinder->getDrupalRoot());
44
45 $configurationManager = new ConfigurationManager();
46 $configuration = $configurationManager
47     ->loadConfigurationFromDirectory($drupalFinder->getComposerRoot());
48
49 $argvInputReader = new ArgvInputReader();
50 if ($configuration && $options = $configuration->get('application.options') ?: []) {
51     $argvInputReader->setOptionsFromConfiguration($options);
52 }
53 $argvInputReader->setOptionsAsArgv();
54
55 $drupal = new Drupal($autoload, $drupalFinder);
56 $container = $drupal->boot();
57
58 if (!$container) {
59     echo ' Something was wrong. Drupal can not be bootstrap.';
60
61     exit(1);
62 }
63
64 $application = new Application($container);
65 $application->setDefaultCommand('about');
66 $application->run();