use Drupal\Console\Helper\RemoteHelper; use Drupal\Console\Helper\HttpClientHelper; set_time_limit(0); $consoleRoot = __DIR__ . '/../'; if (file_exists($consoleRoot . '/vendor/autoload.php')) { include_once $consoleRoot . '/vendor/autoload.php'; } elseif (file_exists($consoleRoot . '/../../autoload.php')) { include_once $consoleRoot . '/../../autoload.php'; } else { echo 'Something goes wrong with your archive' . PHP_EOL . 'Try downloading again' . PHP_EOL; exit(1); } $config = new Config(); $translatorHelper = new TranslatorHelper(); $translatorHelper->loadResource($config->get('application.language'), $consoleRoot); $application = new Application($config, $translatorHelper); $application->setDirectoryRoot($consoleRoot); $helpers = ['nested-array' => new NestedArrayHelper(), 'kernel' => new KernelHelper(), 'string' => new StringHelper(), 'validator' => new ValidatorHelper(), 'translator' => $translatorHelper, 'site' => new SiteHelper(), 'renderer' => new TwigRendererHelper(), 'message' => new MessageHelper(), 'chain' => new ChainCommandHelper(), 'drupal' => new DrupalHelper(), 'commandDiscovery' => new CommandDiscoveryHelper($config->get('application.develop')), 'remote' => new RemoteHelper(), 'httpClient' => new HttpClientHelper()]; $application->addHelpers($helpers); $dispatcher = new EventDispatcher(); $dispatcher->addSubscriber(new ValidateDependenciesListener()); $dispatcher->addSubscriber(new ShowWelcomeMessageListener()); $dispatcher->addSubscriber(new ShowGenerateDocListener()); $dispatcher->addSubscriber(new DefaultValueEventListener()); $dispatcher->addSubscriber(new ShowGeneratedFilesListener()); $dispatcher->addSubscriber(new CallCommandListener()); $dispatcher->addSubscriber(new ShowGenerateChainListener()); $dispatcher->addSubscriber(new ShowGenerateInlineListener()); $dispatcher->addSubscriber(new ShowTerminateMessageListener()); $application->setDispatcher($dispatcher); $defaultCommand = $config->get('application.command') ?: 'about';
if (file_exists($consoleRoot . '/vendor/autoload.php')) { include_once $consoleRoot . '/vendor/autoload.php'; } elseif (file_exists($consoleRoot . '/../../autoload.php')) { include_once $consoleRoot . '/../../autoload.php'; } else { echo 'Something goes wrong with your archive' . PHP_EOL . 'Try downloading again' . PHP_EOL; exit(1); } $container = new ContainerBuilder(); $loader = new YamlFileLoader($container, new FileLocator($consoleRoot)); $loader->load('services.yml'); $config = $container->get('config'); $translatorHelper = new TranslatorHelper(); $translatorHelper->loadResource($config->get('application.language'), $consoleRoot); $helpers = ['nested-array' => new NestedArrayHelper(), 'kernel' => new KernelHelper(), 'string' => new StringHelper(), 'validator' => new ValidatorHelper(), 'translator' => $translatorHelper, 'site' => new SiteHelper(), 'renderer' => new TwigRendererHelper(), 'showFile' => new ShowFileHelper(), 'chain' => new ChainCommandHelper(), 'drupal' => new DrupalHelper(), 'commandDiscovery' => new CommandDiscoveryHelper($config->get('application.develop')), 'remote' => new RemoteHelper(), 'httpClient' => new HttpClientHelper(), 'api' => new DrupalApiHelper(), 'container' => new ContainerHelper($container)]; $application = new Application($helpers); $application->setDirectoryRoot($consoleRoot); $dispatcher = new EventDispatcher(); $dispatcher->addSubscriber(new ValidateDependenciesListener()); $dispatcher->addSubscriber(new ShowWelcomeMessageListener()); $dispatcher->addSubscriber(new ShowGenerateDocListener()); $dispatcher->addSubscriber(new DefaultValueEventListener()); $dispatcher->addSubscriber(new ShowGeneratedFilesListener()); $dispatcher->addSubscriber(new CallCommandListener()); $dispatcher->addSubscriber(new ShowGenerateChainListener()); $dispatcher->addSubscriber(new ShowGenerateInlineListener()); $dispatcher->addSubscriber(new ShowTerminateMessageListener()); $application->setDispatcher($dispatcher); $defaultCommand = 'about'; if ($config->get('application.command') && $application->has($config->get('application.command'))) { $defaultCommand = $config->get('application.command');
use Drupal\Console\Application; use Drupal\Console\Bootstrap\Drupal; set_time_limit(0); $consoleRoot = realpath(__DIR__ . '/../') . '/'; $appRoot = getcwd() . '/'; $siteRoot = realpath(__DIR__ . '/../../../../') . '/'; $root = $appRoot; $autoLoadFile = $appRoot . '/autoload.php'; if (file_exists($autoLoadFile)) { $autoload = (include_once $autoLoadFile); } else { echo PHP_EOL . ' Something goes wrong with your package.' . PHP_EOL . ' Try downloading again.' . PHP_EOL . ' Executing:' . PHP_EOL . ' composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader' . PHP_EOL; exit(1); } if (!file_exists($appRoot . 'composer.json')) { $root = realpath($appRoot . '../') . '/'; } if (!file_exists($root . 'composer.json')) { echo 'No composer.json file found at:' . PHP_EOL . $root . PHP_EOL . 'you should try run this command,' . PHP_EOL . 'from project root directory.' . PHP_EOL; exit(1); } $drupal = new Drupal($autoload, $root, $appRoot); $container = $drupal->boot(); if (!$container) { echo 'In order to list all of the available commands,' . PHP_EOL . 'you should install drupal first.' . PHP_EOL; exit(1); } $application = new Application($container); $application->setDefaultCommand('about'); $application->run();