From fdf625d00d915e924c7edd4ace0542b265bce8cb Mon Sep 17 00:00:00 2001 From: enzo - Eduardo Garcia Date: Wed, 2 Nov 2016 17:24:43 +1100 Subject: [PATCH 001/321] Fix config:export:content:type (#2870) --- config/services/drupal-console/config.yml | 2 +- src/Command/Config/ExportContentTypeCommand.php | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/config/services/drupal-console/config.yml b/config/services/drupal-console/config.yml index 469d1ef3f..2923bacd2 100644 --- a/config/services/drupal-console/config.yml +++ b/config/services/drupal-console/config.yml @@ -26,7 +26,7 @@ services: - { name: drupal.command } console.config_export_content_type: class: Drupal\Console\Command\Config\ExportContentTypeCommand - arguments: ['@entity_type.manager', '@config.storage'] + arguments: ['@entity_type.manager', '@config.storage', '@console.extension_manager'] tags: - { name: drupal.command } console.config_export_single: diff --git a/src/Command/Config/ExportContentTypeCommand.php b/src/Command/Config/ExportContentTypeCommand.php index a233a8b08..b8d938e9d 100644 --- a/src/Command/Config/ExportContentTypeCommand.php +++ b/src/Command/Config/ExportContentTypeCommand.php @@ -18,6 +18,7 @@ use Drupal\Console\Command\Shared\CommandTrait; use Drupal\Console\Style\DrupalStyle; use Drupal\Console\Command\Shared\ExportTrait; +use Drupal\Console\Extension\Manager; class ExportContentTypeCommand extends Command { @@ -30,19 +31,26 @@ class ExportContentTypeCommand extends Command /** @var CachedStorage */ protected $configStorage; + + /** @var Manager */ + protected $extensionManager; + protected $configExport; /** * ExportContentTypeCommand constructor. * @param EntityTypeManagerInterface $entityTypeManager * @param CachedStorage $configStorage + * @param Manager $extensionManager */ public function __construct( EntityTypeManagerInterface $entityTypeManager, - CachedStorage $configStorage + CachedStorage $configStorage, + Manager $extensionManager ) { $this->entityTypeManager = $entityTypeManager; $this->configStorage = $configStorage; + $this->extensionManager = $extensionManager; parent::__construct(); } @@ -87,8 +95,7 @@ protected function interact(InputInterface $input, OutputInterface $output) // --content-type argument $contentType = $input->getArgument('content-type'); if (!$contentType) { - $entityTypeManager = $this->getDrupalService('entity_type.manager'); - $bundles_entities = $entityTypeManager->getStorage('node_type')->loadMultiple(); + $bundles_entities = $this->entityTypeManager->getStorage('node_type')->loadMultiple(); $bundles = array(); foreach ($bundles_entities as $entity) { $bundles[$entity->id()] = $entity->label(); From 454d874dbc8823d8a4373e949d74cbaa931e4ab6 Mon Sep 17 00:00:00 2001 From: Joe Shindelar Date: Wed, 2 Nov 2016 10:38:57 -0500 Subject: [PATCH 002/321] Do not add ".processor" to end of plugin manager serivce name when generating a new annotation based plugin type. (#2867) --- templates/module/plugin-annotation-services.yml.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/module/plugin-annotation-services.yml.twig b/templates/module/plugin-annotation-services.yml.twig index e943535fb..ce51001ee 100644 --- a/templates/module/plugin-annotation-services.yml.twig +++ b/templates/module/plugin-annotation-services.yml.twig @@ -1,6 +1,6 @@ {% if not file_exists %} services: {% endif %} - plugin.manager.{{ machine_name | lower }}.processor: + plugin.manager.{{ machine_name | lower }}: class: Drupal\{{ module }}\Plugin\{{ class_name }}Manager parent: default_plugin_manager From b1533e94584ac7c3ef1c6397f01ca7a78a6df995 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 2 Nov 2016 08:50:19 -0700 Subject: [PATCH 003/321] [console Support root option on pre-boostrap. (#2871) --- bin/drupal.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/bin/drupal.php b/bin/drupal.php index 8775aeabc..19e367976 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -1,8 +1,9 @@ loadConfiguration($root) + ->getConfiguration(); +if ($options = $configuration->get('application.options') ?: []) { + $argvInputReader->setOptionsFromConfiguration($options); +} +$argvInputReader->setOptionsAsArgv(); + if ($root === $appRoot && $argvInputReader->get('root')) { $appRoot = $argvInputReader->get('root'); if (is_dir($appRoot)) { @@ -49,7 +59,6 @@ $appRoot = $root; } } -$argvInputReader->setOptionsAsArgv(); $drupal = new Drupal($autoload, $root, $appRoot); $container = $drupal->boot(); From b46e61113ee621603d55b5a74098a9d145d4df8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20PERRIN?= Date: Wed, 2 Nov 2016 17:12:22 +0100 Subject: [PATCH 004/321] [BUGFIX #2002] uri parameter not used (#2850) - PB: it looks like the uri parameter is not taken in account anymore and the multisite doesn't work - FIX: read the uri option and generate a symfony request accordingly before initializing the drupal container --- src/Bootstrap/Drupal.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index b38cf861e..102ade418 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -4,6 +4,7 @@ use Doctrine\Common\Annotations\AnnotationRegistry; use Symfony\Component\HttpFoundation\Request; +use Drupal\Console\Utils\ArgvInputReader; class Drupal { @@ -31,8 +32,20 @@ public function boot() } try { - $request = Request::createFromGlobals(); - $drupalKernel = DrupalKernel::createFromRequest( + $argvInputReader = new ArgvInputReader(); + if ($argvInputReader->get('uri')) { + $uri = $argvInputReader->get('uri'); + if (substr($uri, -1) != '/') { + $uri .= '/'; + } + $uri .= 'index.php'; + $request = Request::create($uri, 'GET', array() , array(), array(), array('SCRIPT_NAME' => $this->appRoot . '/index.php')); + } + else { + $request = Request::createFromGlobals(); + } + + $drupalKernel = DrupalKernel::createFromRequest ( $request, $this->autoload, 'prod', From 2c16be7eaac0ad51236a134032cabe922b8942f0 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 2 Nov 2016 11:39:30 -0700 Subject: [PATCH 005/321] Tag new release 1.0.0 rc7 (#2873) * [console] Tag 1.0.0-rc7 release. * [console] Tag 1.0.0-rc7 release. --- bin/drupal.php | 34 ++++++++++++++++++++++++++++++++-- composer.lock | 20 ++++++++++---------- src/Application.php | 2 +- src/Bootstrap/Drupal.php | 9 ++++++++- 4 files changed, 51 insertions(+), 14 deletions(-) diff --git a/bin/drupal.php b/bin/drupal.php index 19e367976..9f8e49678 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -1,10 +1,13 @@ loadConfiguration($root) ->getConfiguration(); @@ -60,9 +84,15 @@ } } -$drupal = new Drupal($autoload, $root, $appRoot); +$drupal = new Drupal($autoload, $root, $appRoot, $loggerOutput); $container = $drupal->boot(); +/* relocate to a class */ +if ($handle) { + fclose($handle); +} +/* relocate to a class */ + if (!$container) { echo ' In order to list all of the available commands you should try: ' . PHP_EOL . ' Copy config files: drupal init ' . PHP_EOL . diff --git a/composer.lock b/composer.lock index b6b7b98e0..875886a1d 100644 --- a/composer.lock +++ b/composer.lock @@ -532,16 +532,16 @@ }, { "name": "drupal/console-core", - "version": "1.0.0-rc6", + "version": "1.0.0-rc7", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "105bf5845f17b336c9a62fbd3e576eaea0eb91d5" + "reference": "d374466b3cdbe58d0d8bd369131639e9fde27b4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/105bf5845f17b336c9a62fbd3e576eaea0eb91d5", - "reference": "105bf5845f17b336c9a62fbd3e576eaea0eb91d5", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/d374466b3cdbe58d0d8bd369131639e9fde27b4e", + "reference": "d374466b3cdbe58d0d8bd369131639e9fde27b4e", "shasum": "" }, "require": { @@ -607,20 +607,20 @@ "drupal", "symfony" ], - "time": "2016-10-17 16:55:41" + "time": "2016-11-02 17:02:32" }, { "name": "drupal/console-en", - "version": "1.0.0-rc2", + "version": "1.0.0-rc3", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", - "reference": "94dd8e47309d4cbcdf39bb631f9bc4c51884bcfd" + "reference": "82413163a701d7a6e8f29c13c39f399a8fed8b33" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/94dd8e47309d4cbcdf39bb631f9bc4c51884bcfd", - "reference": "94dd8e47309d4cbcdf39bb631f9bc4c51884bcfd", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/82413163a701d7a6e8f29c13c39f399a8fed8b33", + "reference": "82413163a701d7a6e8f29c13c39f399a8fed8b33", "shasum": "" }, "type": "drupal-console-language", @@ -661,7 +661,7 @@ "drupal", "symfony" ], - "time": "2016-10-12 01:53:34" + "time": "2016-11-01 03:29:49" }, { "name": "gabordemooij/redbean", diff --git a/src/Application.php b/src/Application.php index 8b9b21722..4294e4164 100644 --- a/src/Application.php +++ b/src/Application.php @@ -22,7 +22,7 @@ class Application extends ConsoleApplication /** * @var string */ - const VERSION = '1.0.0-rc6'; + const VERSION = '1.0.0-rc7'; public function __construct(ContainerInterface $container) { diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index 102ade418..02417e499 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -2,6 +2,7 @@ namespace Drupal\Console\Bootstrap; +use Symfony\Component\Console\Output\OutputInterface; use Doctrine\Common\Annotations\AnnotationRegistry; use Symfony\Component\HttpFoundation\Request; use Drupal\Console\Utils\ArgvInputReader; @@ -11,22 +12,27 @@ class Drupal protected $autoload; protected $root; protected $appRoot; + protected $loggerOutput; /** * Drupal constructor. * @param $autoload * @param $root + * @param $appRoot + * @param $loggerOutput */ - public function __construct($autoload, $root, $appRoot) + public function __construct($autoload, $root, $appRoot, OutputInterface $loggerOutput) { $this->autoload = $autoload; $this->root = $root; $this->appRoot = $appRoot; + $this->loggerOutput = $loggerOutput; } public function boot() { if (!class_exists('Drupal\Core\DrupalKernel')) { + $this->loggerOutput->writeln('Class Drupal\Core\DrupalKernel not found.'); $drupal = new DrupalConsoleCore($this->root, $this->appRoot); return $drupal->boot(); } @@ -90,6 +96,7 @@ public function boot() return $container; } catch (\Exception $e) { + $this->loggerOutput->writeln('Error ' . $e->getCode() . ': ' . $e->getMessage()); $drupal = new DrupalConsoleCore($this->root, $this->appRoot); return $drupal->boot(); } From 4d60ce6cfc3a1bc9c8d61cc35ed0f6e3469b20db Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 2 Nov 2016 12:04:20 -0700 Subject: [PATCH 006/321] [console] Fix logger. (#2874) --- bin/drupal.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/drupal.php b/bin/drupal.php index 9f8e49678..d43b7a77e 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -47,21 +47,28 @@ $today = date('Y-m-d'); $loggerFile = $root.'console/log/' . $today . '.log'; $handle = null; -if (!file_exists($loggerFile)){ + +if (!is_file($loggerFile)) { try { - mkdir(dirname($loggerFile), 0777, TRUE); + $directoryName = dirname($loggerFile); + if (!is_dir($directoryName )) { + mkdir($directoryName, 0777, TRUE); + } + touch($loggerFile); } catch (\Exception $e) { $loggerFile = null; $loggerOutput = new ConsoleOutput(); } } -if ($loggerFile) { +if ($loggerFile && is_writable($loggerFile)) { try { $handle = fopen($loggerFile, 'a+'); $loggerOutput = new StreamOutput($handle); } catch (\Exception $e) { $loggerOutput = new ConsoleOutput(); } +} else { + $loggerOutput = new ConsoleOutput(); } /* relocate to a class */ From 0cd6028fb9274c580dc14fc97dd9c1d72c3f4f8e Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 2 Nov 2016 12:32:18 -0700 Subject: [PATCH 007/321] [console] Update dependencies. (#2876) --- composer.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/composer.lock b/composer.lock index 875886a1d..af13efa9a 100644 --- a/composer.lock +++ b/composer.lock @@ -536,12 +536,12 @@ "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "d374466b3cdbe58d0d8bd369131639e9fde27b4e" + "reference": "b2bdf84ba1e93a31f7228a22c1a20ef458a76b40" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/d374466b3cdbe58d0d8bd369131639e9fde27b4e", - "reference": "d374466b3cdbe58d0d8bd369131639e9fde27b4e", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/b2bdf84ba1e93a31f7228a22c1a20ef458a76b40", + "reference": "b2bdf84ba1e93a31f7228a22c1a20ef458a76b40", "shasum": "" }, "require": { @@ -607,20 +607,20 @@ "drupal", "symfony" ], - "time": "2016-11-02 17:02:32" + "time": "2016-11-02 19:26:55" }, { "name": "drupal/console-en", - "version": "1.0.0-rc3", + "version": "1.0.0-rc4", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", - "reference": "82413163a701d7a6e8f29c13c39f399a8fed8b33" + "reference": "475e19d40a498d40f5a9183e05341c8ec7d8d96d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/82413163a701d7a6e8f29c13c39f399a8fed8b33", - "reference": "82413163a701d7a6e8f29c13c39f399a8fed8b33", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/475e19d40a498d40f5a9183e05341c8ec7d8d96d", + "reference": "475e19d40a498d40f5a9183e05341c8ec7d8d96d", "shasum": "" }, "type": "drupal-console-language", @@ -661,7 +661,7 @@ "drupal", "symfony" ], - "time": "2016-11-01 03:29:49" + "time": "2016-11-02 19:18:53" }, { "name": "gabordemooij/redbean", From 071c4dd9b2130045f29122f69d593b5c2235da02 Mon Sep 17 00:00:00 2001 From: Dennis B Date: Thu, 3 Nov 2016 17:25:31 +0100 Subject: [PATCH 008/321] Update yaml.yml (#2878) Fixes wrong intendation on console.yaml_unset_key --- config/services/drupal-console/yaml.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/services/drupal-console/yaml.yml b/config/services/drupal-console/yaml.yml index 0e0c60944..436986d60 100644 --- a/config/services/drupal-console/yaml.yml +++ b/config/services/drupal-console/yaml.yml @@ -29,7 +29,7 @@ services: tags: - { name: drupal.command } console.yaml_unset_key: - class: Drupal\Console\Command\Yaml\UnsetKeyCommand - arguments: ['@console.nested_array'] - tags: - - { name: drupal.command } + class: Drupal\Console\Command\Yaml\UnsetKeyCommand + arguments: ['@console.nested_array'] + tags: + - { name: drupal.command } From 4c6f93115ce96ee237045be52c02d2ca64014bfc Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Fri, 4 Nov 2016 08:26:27 -0700 Subject: [PATCH 009/321] [console] Add logger class. (#2882) --- bin/drupal.php | 40 +--------------------- src/Bootstrap/Drupal.php | 31 ++++++++++++----- src/Utils/Logger.php | 72 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 48 deletions(-) create mode 100644 src/Utils/Logger.php diff --git a/bin/drupal.php b/bin/drupal.php index d43b7a77e..c72ac5c26 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -1,13 +1,10 @@ loadConfiguration($root) @@ -91,15 +59,9 @@ } } -$drupal = new Drupal($autoload, $root, $appRoot, $loggerOutput); +$drupal = new Drupal($autoload, $root, $appRoot); $container = $drupal->boot(); -/* relocate to a class */ -if ($handle) { - fclose($handle); -} -/* relocate to a class */ - if (!$container) { echo ' In order to list all of the available commands you should try: ' . PHP_EOL . ' Copy config files: drupal init ' . PHP_EOL . diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index 02417e499..b7ac04c0d 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -2,39 +2,42 @@ namespace Drupal\Console\Bootstrap; -use Symfony\Component\Console\Output\OutputInterface; use Doctrine\Common\Annotations\AnnotationRegistry; use Symfony\Component\HttpFoundation\Request; use Drupal\Console\Utils\ArgvInputReader; +use Drupal\Console\Utils\Logger; class Drupal { protected $autoload; protected $root; protected $appRoot; - protected $loggerOutput; /** * Drupal constructor. * @param $autoload * @param $root * @param $appRoot - * @param $loggerOutput */ - public function __construct($autoload, $root, $appRoot, OutputInterface $loggerOutput) + public function __construct($autoload, $root, $appRoot) { $this->autoload = $autoload; $this->root = $root; $this->appRoot = $appRoot; - $this->loggerOutput = $loggerOutput; } public function boot() { + $logger = new Logger($this->root); if (!class_exists('Drupal\Core\DrupalKernel')) { - $this->loggerOutput->writeln('Class Drupal\Core\DrupalKernel not found.'); + $logger->writeln('Class Drupal\Core\DrupalKernel not found.'); $drupal = new DrupalConsoleCore($this->root, $this->appRoot); - return $drupal->boot(); + $container = $drupal->boot(); + $container->set( + 'console.logger', + $logger + ); + return $container; } try { @@ -74,6 +77,11 @@ public function boot() $container->set('console.root', $this->root); + $container->set( + 'console.logger', + $logger + ); + AnnotationRegistry::registerLoader([$this->autoload, "loadClass"]); $configuration = $container->get('console.configuration_manager') @@ -96,9 +104,14 @@ public function boot() return $container; } catch (\Exception $e) { - $this->loggerOutput->writeln('Error ' . $e->getCode() . ': ' . $e->getMessage()); + $logger->writeln($e->getMessage()); $drupal = new DrupalConsoleCore($this->root, $this->appRoot); - return $drupal->boot(); + $container = $drupal->boot(); + $container->set( + 'console.logger', + $logger + ); + return $container; } } } diff --git a/src/Utils/Logger.php b/src/Utils/Logger.php new file mode 100644 index 000000000..9f9ad8249 --- /dev/null +++ b/src/Utils/Logger.php @@ -0,0 +1,72 @@ +handle = null; + $this->init($root); + } + + protected function init($root) { + $loggerFile = $root.'console/log/' . date('Y-m-d') . '.log'; + if (!is_file($loggerFile)) { + try { + $directoryName = dirname($loggerFile); + if (!is_dir($directoryName )) { + mkdir($directoryName, 0777, TRUE); + } + touch($loggerFile); + } catch (\Exception $e) { + $this->output = new ConsoleOutput(); + return; + } + } + + if (!is_writable($loggerFile)) { + $this->output = new ConsoleOutput(); + return; + } + + try { + $this->handle = fopen($loggerFile, 'a+'); + $this->output = new StreamOutput($this->handle); + return; + } catch (\Exception $e) { + $this->output = new ConsoleOutput(); + return; + } + } + + public function writeln($message) { + if ($this->handle) { + $message = sprintf( + '%s %s', + date('h:i:s'), + $message + ); + } + $this->output->writeln($message); + } + +// public function closeHandler() { +// if ($this->handle) { +// fclose($this->handle); +// } +// } +} \ No newline at end of file From 05a27a908581ceb1aa6afe38078eabd69dbf8bd0 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Fri, 4 Nov 2016 10:27:15 -0700 Subject: [PATCH 010/321] [console] Use logger service. (#2883) --- src/Application.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Application.php b/src/Application.php index 4294e4164..706ed44d8 100644 --- a/src/Application.php +++ b/src/Application.php @@ -90,6 +90,7 @@ private function registerGenerators() private function registerCommands() { + $logger = $this->container->get('console.logger'); if ($this->container->hasParameter('drupal.commands')) { $consoleCommands = $this->container->getParameter( 'drupal.commands' @@ -102,6 +103,8 @@ private function registerCommands() 'console.warning', 'application.site.errors.settings' ); + + $logger->writeln($this->trans('application.site.errors.settings')); } $serviceDefinitions = []; @@ -135,6 +138,7 @@ private function registerCommands() try { $command = $this->container->get($name); } catch (\Exception $e) { + $logger->writeln($e->getMessage()); continue; } From b94ab35254d48c912fe37f190fad42f40e11243c Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sat, 5 Nov 2016 00:00:11 -0700 Subject: [PATCH 011/321] Tag new release 1.0.0 rc8 (#2886) * [console] Tag 1.0.0-rc8 release. * [console] Update dependencies. --- composer.lock | 20 ++++++++++---------- src/Application.php | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/composer.lock b/composer.lock index af13efa9a..ca4839832 100644 --- a/composer.lock +++ b/composer.lock @@ -532,16 +532,16 @@ }, { "name": "drupal/console-core", - "version": "1.0.0-rc7", + "version": "v1.0.0-rc8", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "b2bdf84ba1e93a31f7228a22c1a20ef458a76b40" + "reference": "44d2b0e7772a7f6bf25e0ff07944d15797ffb0f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/b2bdf84ba1e93a31f7228a22c1a20ef458a76b40", - "reference": "b2bdf84ba1e93a31f7228a22c1a20ef458a76b40", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/44d2b0e7772a7f6bf25e0ff07944d15797ffb0f2", + "reference": "44d2b0e7772a7f6bf25e0ff07944d15797ffb0f2", "shasum": "" }, "require": { @@ -607,20 +607,20 @@ "drupal", "symfony" ], - "time": "2016-11-02 19:26:55" + "time": "2016-11-05 06:47:58" }, { "name": "drupal/console-en", - "version": "1.0.0-rc4", + "version": "1.0.0-rc7", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", - "reference": "475e19d40a498d40f5a9183e05341c8ec7d8d96d" + "reference": "5807dce9efd84ccb1198a926eea03b600b8a93e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/475e19d40a498d40f5a9183e05341c8ec7d8d96d", - "reference": "475e19d40a498d40f5a9183e05341c8ec7d8d96d", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/5807dce9efd84ccb1198a926eea03b600b8a93e6", + "reference": "5807dce9efd84ccb1198a926eea03b600b8a93e6", "shasum": "" }, "type": "drupal-console-language", @@ -661,7 +661,7 @@ "drupal", "symfony" ], - "time": "2016-11-02 19:18:53" + "time": "2016-11-05 06:21:34" }, { "name": "gabordemooij/redbean", diff --git a/src/Application.php b/src/Application.php index 706ed44d8..13289855b 100644 --- a/src/Application.php +++ b/src/Application.php @@ -22,7 +22,7 @@ class Application extends ConsoleApplication /** * @var string */ - const VERSION = '1.0.0-rc7'; + const VERSION = '1.0.0-rc8'; public function __construct(ContainerInterface $container) { From c5478a1d7e013cc44356edc6f3e97c91654ff769 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sat, 5 Nov 2016 15:03:15 -0700 Subject: [PATCH 012/321] [console] Update stecman/symfony-console-completion version. (#2889) --- composer.json | 3 +- composer.lock | 150 +++++++++++++++++++++++++------------------------- 2 files changed, 77 insertions(+), 76 deletions(-) diff --git a/composer.json b/composer.json index 34a31c3d3..52b2d8b58 100644 --- a/composer.json +++ b/composer.json @@ -39,13 +39,12 @@ "php": "^5.5.9 || ^7.0", "alchemy/zippy": "0.3.5", "composer/installers": "~1.0", - "drupal/console-core" : "^1.0", + "drupal/console-core" : "dev-master", "symfony/css-selector": "~2.8", "symfony/debug": "~2.6|~2.8", "symfony/dom-crawler": "~2.7|~2.8", "symfony/http-foundation": "~2.8", "phpseclib/phpseclib": "2.*", - "stecman/symfony-console-completion": "^0.5.1", "guzzlehttp/guzzle": "~6.1", "gabordemooij/redbean": "~4.3", "doctrine/annotations": "1.2.*", diff --git a/composer.lock b/composer.lock index ca4839832..9d32769ee 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "803f824a32a24c59359a15eda3c17054", - "content-hash": "b7886c6c69584031bb4c6d192472086a", + "hash": "0a232e599b010d0f6a2b341d2e2302ea", + "content-hash": "9f62c96590096176a7b4406cf133265e", "packages": [ { "name": "alchemy/zippy", @@ -532,23 +532,23 @@ }, { "name": "drupal/console-core", - "version": "v1.0.0-rc8", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "44d2b0e7772a7f6bf25e0ff07944d15797ffb0f2" + "reference": "08a16550ccd3ad579c30661fdff121281fbdbc76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/44d2b0e7772a7f6bf25e0ff07944d15797ffb0f2", - "reference": "44d2b0e7772a7f6bf25e0ff07944d15797ffb0f2", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/08a16550ccd3ad579c30661fdff121281fbdbc76", + "reference": "08a16550ccd3ad579c30661fdff121281fbdbc76", "shasum": "" }, "require": { "dflydev/dot-access-configuration": "1.*", "drupal/console-en": "~1.0", "php": "^5.5.9 || ^7.0", - "stecman/symfony-console-completion": "^0.5.1", + "stecman/symfony-console-completion": "~0.7", "symfony/config": "~2.8", "symfony/console": "~2.8", "symfony/dependency-injection": "~2.8", @@ -607,7 +607,7 @@ "drupal", "symfony" ], - "time": "2016-11-05 06:47:58" + "time": "2016-11-05 20:58:22" }, { "name": "drupal/console-en", @@ -665,16 +665,16 @@ }, { "name": "gabordemooij/redbean", - "version": "v4.3.2", + "version": "v4.3.3", "source": { "type": "git", "url": "https://github.com/gabordemooij/redbean.git", - "reference": "72368f15cedfa7990c7fb228e47d2f00c7f49d4f" + "reference": "1c7ec69850e9f7966ff7feb87b01d8f43a9753d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/gabordemooij/redbean/zipball/72368f15cedfa7990c7fb228e47d2f00c7f49d4f", - "reference": "72368f15cedfa7990c7fb228e47d2f00c7f49d4f", + "url": "https://api.github.com/repos/gabordemooij/redbean/zipball/1c7ec69850e9f7966ff7feb87b01d8f43a9753d3", + "reference": "1c7ec69850e9f7966ff7feb87b01d8f43a9753d3", "shasum": "" }, "require": { @@ -702,7 +702,7 @@ "keywords": [ "orm" ], - "time": "2016-05-01 10:27:43" + "time": "2016-10-03 21:25:17" }, { "name": "guzzlehttp/guzzle", @@ -1108,29 +1108,29 @@ }, { "name": "stecman/symfony-console-completion", - "version": "0.5.1", + "version": "0.7.0", "source": { "type": "git", "url": "https://github.com/stecman/symfony-console-completion.git", - "reference": "1a9fc7ab4820cd1aabbdc584c6b25d221e7b6cb5" + "reference": "5461d43e53092b3d3b9dbd9d999f2054730f4bbb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/stecman/symfony-console-completion/zipball/1a9fc7ab4820cd1aabbdc584c6b25d221e7b6cb5", - "reference": "1a9fc7ab4820cd1aabbdc584c6b25d221e7b6cb5", + "url": "https://api.github.com/repos/stecman/symfony-console-completion/zipball/5461d43e53092b3d3b9dbd9d999f2054730f4bbb", + "reference": "5461d43e53092b3d3b9dbd9d999f2054730f4bbb", "shasum": "" }, "require": { "php": ">=5.3.2", - "symfony/console": "~2.2" + "symfony/console": "~2.3 || ~3.0" }, "require-dev": { - "phpunit/phpunit": "~4.1" + "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "0.5.x-dev" + "dev-master": "0.6.x-dev" } }, "autoload": { @@ -1149,11 +1149,11 @@ } ], "description": "Automatic BASH completion for Symfony Console Component based applications.", - "time": "2015-05-07 12:21:50" + "time": "2016-02-24 05:08:54" }, { "name": "symfony/config", - "version": "v2.8.12", + "version": "v2.8.13", "source": { "type": "git", "url": "https://github.com/symfony/config.git", @@ -1206,16 +1206,16 @@ }, { "name": "symfony/console", - "version": "v2.8.12", + "version": "v2.8.13", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "d7a5a88178f94dcc29531ea4028ea614e35452d4" + "reference": "7350016c8abcab897046f1aead2b766b84d3eff8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/d7a5a88178f94dcc29531ea4028ea614e35452d4", - "reference": "d7a5a88178f94dcc29531ea4028ea614e35452d4", + "url": "https://api.github.com/repos/symfony/console/zipball/7350016c8abcab897046f1aead2b766b84d3eff8", + "reference": "7350016c8abcab897046f1aead2b766b84d3eff8", "shasum": "" }, "require": { @@ -1263,11 +1263,11 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-09-28 00:10:16" + "time": "2016-10-06 01:43:09" }, { "name": "symfony/css-selector", - "version": "v2.8.12", + "version": "v2.8.13", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", @@ -1320,7 +1320,7 @@ }, { "name": "symfony/debug", - "version": "v2.8.12", + "version": "v2.8.13", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", @@ -1377,16 +1377,16 @@ }, { "name": "symfony/dependency-injection", - "version": "v2.8.12", + "version": "v2.8.13", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "ee9ec9ac2b046462d341e9de7c4346142d335e75" + "reference": "3d61c765daa1a5832f1d7c767f48886b8d8ea64c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/ee9ec9ac2b046462d341e9de7c4346142d335e75", - "reference": "ee9ec9ac2b046462d341e9de7c4346142d335e75", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/3d61c765daa1a5832f1d7c767f48886b8d8ea64c", + "reference": "3d61c765daa1a5832f1d7c767f48886b8d8ea64c", "shasum": "" }, "require": { @@ -1436,20 +1436,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2016-09-24 09:47:20" + "time": "2016-10-24 15:52:36" }, { "name": "symfony/dom-crawler", - "version": "v2.8.12", + "version": "v2.8.13", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "aac03b7ea2a7adff10a3599d614e79e6101230ab" + "reference": "a94f3fe6f179d6453e5ed8188cf4bfdf933d85f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/aac03b7ea2a7adff10a3599d614e79e6101230ab", - "reference": "aac03b7ea2a7adff10a3599d614e79e6101230ab", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/a94f3fe6f179d6453e5ed8188cf4bfdf933d85f4", + "reference": "a94f3fe6f179d6453e5ed8188cf4bfdf933d85f4", "shasum": "" }, "require": { @@ -1492,20 +1492,20 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2016-07-30 07:20:35" + "time": "2016-10-18 15:35:45" }, { "name": "symfony/event-dispatcher", - "version": "v2.8.12", + "version": "v2.8.13", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "889983a79a043dfda68f38c38b6dba092dd49cd8" + "reference": "25c576abd4e0f212e678fe8b2bd9a9a98c7ea934" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/889983a79a043dfda68f38c38b6dba092dd49cd8", - "reference": "889983a79a043dfda68f38c38b6dba092dd49cd8", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/25c576abd4e0f212e678fe8b2bd9a9a98c7ea934", + "reference": "25c576abd4e0f212e678fe8b2bd9a9a98c7ea934", "shasum": "" }, "require": { @@ -1552,11 +1552,11 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2016-07-28 16:56:28" + "time": "2016-10-13 01:43:15" }, { "name": "symfony/expression-language", - "version": "v2.8.12", + "version": "v2.8.13", "source": { "type": "git", "url": "https://github.com/symfony/expression-language.git", @@ -1605,16 +1605,16 @@ }, { "name": "symfony/filesystem", - "version": "v2.8.12", + "version": "v2.8.13", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "44b499521defddf2eae17a18c811bbdae4f98bdf" + "reference": "a3784111af9f95f102b6411548376e1ae7c93898" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/44b499521defddf2eae17a18c811bbdae4f98bdf", - "reference": "44b499521defddf2eae17a18c811bbdae4f98bdf", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/a3784111af9f95f102b6411548376e1ae7c93898", + "reference": "a3784111af9f95f102b6411548376e1ae7c93898", "shasum": "" }, "require": { @@ -1650,11 +1650,11 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2016-09-06 10:55:00" + "time": "2016-10-18 04:28:30" }, { "name": "symfony/finder", - "version": "v2.8.12", + "version": "v2.8.13", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -1703,16 +1703,16 @@ }, { "name": "symfony/http-foundation", - "version": "v2.8.12", + "version": "v2.8.13", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "91f87d27e9fe99435278c337375b0dce292fe0e2" + "reference": "a6e6c34d337f3c74c39b29c5f54d33023de8897c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/91f87d27e9fe99435278c337375b0dce292fe0e2", - "reference": "91f87d27e9fe99435278c337375b0dce292fe0e2", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/a6e6c34d337f3c74c39b29c5f54d33023de8897c", + "reference": "a6e6c34d337f3c74c39b29c5f54d33023de8897c", "shasum": "" }, "require": { @@ -1754,7 +1754,7 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2016-09-21 19:04:07" + "time": "2016-10-24 15:52:36" }, { "name": "symfony/polyfill-mbstring", @@ -1931,7 +1931,7 @@ }, { "name": "symfony/process", - "version": "v2.8.12", + "version": "v2.8.13", "source": { "type": "git", "url": "https://github.com/symfony/process.git", @@ -1980,16 +1980,16 @@ }, { "name": "symfony/translation", - "version": "v2.8.12", + "version": "v2.8.13", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "bf0ff95faa9b6c0708efc1986255e3608d0ed3c7" + "reference": "cca6ff892355876534b01a927f789bac9601c935" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/bf0ff95faa9b6c0708efc1986255e3608d0ed3c7", - "reference": "bf0ff95faa9b6c0708efc1986255e3608d0ed3c7", + "url": "https://api.github.com/repos/symfony/translation/zipball/cca6ff892355876534b01a927f789bac9601c935", + "reference": "cca6ff892355876534b01a927f789bac9601c935", "shasum": "" }, "require": { @@ -2040,20 +2040,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2016-09-06 10:55:00" + "time": "2016-10-18 04:28:30" }, { "name": "symfony/yaml", - "version": "v2.8.12", + "version": "v2.8.13", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "e7540734bad981fe59f8ef14b6fc194ae9df8d9c" + "reference": "396784cd06b91f3db576f248f2402d547a077787" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/e7540734bad981fe59f8ef14b6fc194ae9df8d9c", - "reference": "e7540734bad981fe59f8ef14b6fc194ae9df8d9c", + "url": "https://api.github.com/repos/symfony/yaml/zipball/396784cd06b91f3db576f248f2402d547a077787", + "reference": "396784cd06b91f3db576f248f2402d547a077787", "shasum": "" }, "require": { @@ -2089,20 +2089,20 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-09-02 01:57:56" + "time": "2016-10-21 20:59:10" }, { "name": "twig/twig", - "version": "v1.26.1", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "a09d8ee17ac1cfea29ed60c83960ad685c6a898d" + "reference": "3c6c0033fd3b5679c6e1cb60f4f9766c2b424d97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/a09d8ee17ac1cfea29ed60c83960ad685c6a898d", - "reference": "a09d8ee17ac1cfea29ed60c83960ad685c6a898d", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/3c6c0033fd3b5679c6e1cb60f4f9766c2b424d97", + "reference": "3c6c0033fd3b5679c6e1cb60f4f9766c2b424d97", "shasum": "" }, "require": { @@ -2115,7 +2115,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.26-dev" + "dev-master": "1.27-dev" } }, "autoload": { @@ -2150,13 +2150,15 @@ "keywords": [ "templating" ], - "time": "2016-10-05 18:57:41" + "time": "2016-10-25 19:17:17" } ], "packages-dev": [], "aliases": [], "minimum-stability": "dev", - "stability-flags": [], + "stability-flags": { + "drupal/console-core": 20 + }, "prefer-stable": true, "prefer-lowest": false, "platform": { From b53e1d5046f4bef369ca6e83b07ff88a1b3ca30a Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sat, 5 Nov 2016 17:01:34 -0700 Subject: [PATCH 013/321] [console] Update readme & rollback comspoer. (#2890) --- README.md | 39 ++++++++++++++++----------------------- composer.json | 4 ++-- composer.lock | 36 +++++++++++++++++------------------- 3 files changed, 35 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 046b27cd5..a1b49e4bb 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ - [Required PHP version](#required-php-version) - [Drupal Console documentation](#documentation) - [Download as new dependency](#download-as-new-dependency) - - [Fix download the latest version](#fix-download-the-latest-version) - [Download using DrupalComposer](#download-using-drupalcomposer) + - [Update DrupalConsole](#update-drupalconsole) - [Install Drupal Console Launcher](#install-drupal-console-launcher) - [Run Drupal Console](#running-drupal-console) - [Supporting organizations](#supporting-organizations) @@ -24,7 +24,7 @@ Drupal Console [![Software License](https://img.shields.io/badge/license-GPL%202.0+-blue.svg)](https://packagist.org/packages/drupal/console) [![SensioLabsInsight](https://insight.sensiolabs.com/projects/d0f089ff-a6e9-4ba4-b353-cb68173c7d90/mini.png)](https://insight.sensiolabs.com/projects/d0f089ff-a6e9-4ba4-b353-cb68173c7d90) -The Drupal Console is a CLI tool to generate boilerplate code, interact and debug Drupal 8. +The Drupal CLI. A tool to generate boilerplate code, interact with and debug Drupal. ## Latest Version Details of the latest version can be found on the Drupal Console project page under https://drupalconsole.com/. @@ -52,15 +52,6 @@ composer require drupal/console:~1.0 \ --sort-packages ``` -## Fix download the latest version - -Drupal 8 include some outdated libraries of Symfony 2.7.x, as result you get an old release of Drupal Console. - -To fix that, execute the following command and you will get the latest release of Drupal Console. -``` -composer update drupal/console --with-dependencies -``` - ## Download using DrupalComposer ``` composer create-project \ @@ -71,6 +62,12 @@ drupal8.dev \ --no-interaction ``` +## Update DrupalConsole + +``` +composer update drupal/console --with-dependencies +``` + ## Install Drupal Console Launcher ``` # Run this in your terminal to get the latest version: @@ -81,31 +78,27 @@ php -r "readfile('https://drupalconsole.com/installer');" > drupal.phar # Accessing from anywhere on your system: mv drupal.phar /usr/local/bin/drupal - -# Apply executable permissions on the downloaded file: -chmod +x /usr/local/bin/drupal - -# Copy configuration files. -drupal init --override - -# Check and validate system requirements -drupal check ``` ## Run Drupal Console +Using the DrupalConsole Launcher +``` +drupal +``` +> NOTE: If using a DrupalComposer make sure you execute the `init` command and answer yest to ` Copy at current directory console/config.yml? (yes/no) [yes]:` question. + We highly recommend you to install the global executable, but if is not installed, then you can run DrupalConsole by: Using default Drupal + DrupalConsole ``` vendor/bin/drupal ``` -Using DrupalComposer -Change directory `web`, `docroot` or any other. + +Using DrupalComposer you can also change directory `web`, `docroot` and ``` ../vendor/bin/drupal ``` - ## Drupal Console Support You can ask for support at Drupal Console gitter chat room [http://bit.ly/console-support](http://bit.ly/console-support). diff --git a/composer.json b/composer.json index 52b2d8b58..64e4823cb 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "drupal/console", - "description": "The Drupal Console is a CLI tool to generate boilerplate code, interact and debug Drupal 8.", + "description": "The Drupal CLI. A tool to generate boilerplate code, interact with and debug Drupal.", "keywords": ["Drupal", "Console", "Development", "Symfony"], "homepage": "http://drupalconsole.com/", "type": "project", @@ -39,7 +39,7 @@ "php": "^5.5.9 || ^7.0", "alchemy/zippy": "0.3.5", "composer/installers": "~1.0", - "drupal/console-core" : "dev-master", + "drupal/console-core" : "~1.0", "symfony/css-selector": "~2.8", "symfony/debug": "~2.6|~2.8", "symfony/dom-crawler": "~2.7|~2.8", diff --git a/composer.lock b/composer.lock index 9d32769ee..b0bffe922 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "0a232e599b010d0f6a2b341d2e2302ea", - "content-hash": "9f62c96590096176a7b4406cf133265e", + "hash": "ad8d831b8d26f5842aa4ab1fcb3fc421", + "content-hash": "4db5aa142dde37801d8ee421b9395c0e", "packages": [ { "name": "alchemy/zippy", @@ -532,23 +532,23 @@ }, { "name": "drupal/console-core", - "version": "dev-master", + "version": "v1.0.0-rc8", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "08a16550ccd3ad579c30661fdff121281fbdbc76" + "reference": "44d2b0e7772a7f6bf25e0ff07944d15797ffb0f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/08a16550ccd3ad579c30661fdff121281fbdbc76", - "reference": "08a16550ccd3ad579c30661fdff121281fbdbc76", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/44d2b0e7772a7f6bf25e0ff07944d15797ffb0f2", + "reference": "44d2b0e7772a7f6bf25e0ff07944d15797ffb0f2", "shasum": "" }, "require": { "dflydev/dot-access-configuration": "1.*", "drupal/console-en": "~1.0", "php": "^5.5.9 || ^7.0", - "stecman/symfony-console-completion": "~0.7", + "stecman/symfony-console-completion": "^0.5.1", "symfony/config": "~2.8", "symfony/console": "~2.8", "symfony/dependency-injection": "~2.8", @@ -607,7 +607,7 @@ "drupal", "symfony" ], - "time": "2016-11-05 20:58:22" + "time": "2016-11-05 06:47:58" }, { "name": "drupal/console-en", @@ -1108,29 +1108,29 @@ }, { "name": "stecman/symfony-console-completion", - "version": "0.7.0", + "version": "0.5.1", "source": { "type": "git", "url": "https://github.com/stecman/symfony-console-completion.git", - "reference": "5461d43e53092b3d3b9dbd9d999f2054730f4bbb" + "reference": "1a9fc7ab4820cd1aabbdc584c6b25d221e7b6cb5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/stecman/symfony-console-completion/zipball/5461d43e53092b3d3b9dbd9d999f2054730f4bbb", - "reference": "5461d43e53092b3d3b9dbd9d999f2054730f4bbb", + "url": "https://api.github.com/repos/stecman/symfony-console-completion/zipball/1a9fc7ab4820cd1aabbdc584c6b25d221e7b6cb5", + "reference": "1a9fc7ab4820cd1aabbdc584c6b25d221e7b6cb5", "shasum": "" }, "require": { "php": ">=5.3.2", - "symfony/console": "~2.3 || ~3.0" + "symfony/console": "~2.2" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "~4.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "0.6.x-dev" + "dev-master": "0.5.x-dev" } }, "autoload": { @@ -1149,7 +1149,7 @@ } ], "description": "Automatic BASH completion for Symfony Console Component based applications.", - "time": "2016-02-24 05:08:54" + "time": "2015-05-07 12:21:50" }, { "name": "symfony/config", @@ -2156,9 +2156,7 @@ "packages-dev": [], "aliases": [], "minimum-stability": "dev", - "stability-flags": { - "drupal/console-core": 20 - }, + "stability-flags": [], "prefer-stable": true, "prefer-lowest": false, "platform": { From c48373d4eeb6f8b8c7b2613f03eaf4afbdce335d Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 7 Nov 2016 19:50:04 -0800 Subject: [PATCH 014/321] [console] Improve config loader. (#2898) --- bin/drupal.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/drupal.php b/bin/drupal.php index c72ac5c26..cdb909237 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -42,8 +42,8 @@ $argvInputReader = new ArgvInputReader(); $configurationManager = new ConfigurationManager(); -$configuration = $configurationManager->loadConfiguration($root) - ->getConfiguration(); +$configuration = $configurationManager + ->loadConfigurationFromDirectory($root); if ($options = $configuration->get('application.options') ?: []) { $argvInputReader->setOptionsFromConfiguration($options); } From 34c6a6f3b6a9bb172de66be84977b8b89f50831a Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 7 Nov 2016 20:14:40 -0800 Subject: [PATCH 015/321] [console] Set command aliases. (#2899) --- src/Application.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Application.php b/src/Application.php index 13289855b..e9c88a728 100644 --- a/src/Application.php +++ b/src/Application.php @@ -120,6 +120,10 @@ private function registerCommands() ->get('console.annotation_validator'); } + $aliases = $this->container->get('console.configuration_manager') + ->getConfiguration() + ->get('application.commands.aliases')?:[]; + foreach ($consoleCommands as $name) { if (!$this->container->has($name)) { continue; @@ -158,6 +162,11 @@ private function registerCommands() ); } + if (array_key_exists($command->getName(), $aliases)) { + $commandAliases = $aliases[$command->getName()]; + $command->setAliases([$commandAliases]); + } + $this->add($command); } } From d404ec9489cf10a34c40301592e8ba267277b0c2 Mon Sep 17 00:00:00 2001 From: Luis Eduardo Telaya Escobedo Date: Wed, 9 Nov 2016 17:57:26 -0500 Subject: [PATCH 016/321] [permission:debug] new command #2895 (#2896) * [permission:debug] WIP new command * [permission:debug] Add service * [permission:debug] List all permissions and filter by user role * [permission:debug] Add better error handle and cleanup --- config/services/drupal-console/misc.yml | 4 ++ src/Command/PermissionDebugCommand.php | 94 +++++++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 src/Command/PermissionDebugCommand.php diff --git a/config/services/drupal-console/misc.yml b/config/services/drupal-console/misc.yml index ebc903e73..2eca7df79 100644 --- a/config/services/drupal-console/misc.yml +++ b/config/services/drupal-console/misc.yml @@ -7,6 +7,10 @@ services: class: Drupal\Console\Command\PluginDebugCommand tags: - { name: drupal.command } + console.permission_debug: + class: Drupal\Console\Command\PermissionDebugCommand + tags: + - { name: drupal.command } console.event_debug: class: Drupal\Console\Command\EventDebugCommand arguments: ['@event_dispatcher'] diff --git a/src/Command/PermissionDebugCommand.php b/src/Command/PermissionDebugCommand.php new file mode 100644 index 000000000..772aad321 --- /dev/null +++ b/src/Command/PermissionDebugCommand.php @@ -0,0 +1,94 @@ +setName('permission:debug') + ->setDescription($this->trans('commands.permission.debug.description')) + ->setHelp($this->trans('commands.permission.debug.help')) + ->addArgument( + 'role', + InputArgument::OPTIONAL, + $this->trans('commands.permission.debug.arguments.role') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $role = $input->getArgument('role'); + // No role specified, show a list of ALL permissions. + if (!$role) { + $tableHeader = [ + $this->trans('commands.permission.debug.table-headers.permission-name'), + $this->trans('commands.permission.debug.table-headers.permission-label') + ]; + $tableRows = []; + $permissions = \Drupal::service('user.permissions')->getPermissions(); + foreach ($permissions as $permission_name => $permission) { + $tableRows[$permission_name] = [ + $permission_name, + $permission['title']->__toString() + ]; + } + + ksort($tableRows); + $io->table($tableHeader, array_values($tableRows)); + + return true; + } + else { + $tableHeader = [ + $this->trans('commands.permission.debug.table-headers.permission-name'), + $this->trans('commands.permission.debug.table-headers.permission-label') + ]; + $tableRows = []; + $permissions = \Drupal::service('user.permissions')->getPermissions(); + $roles = user_roles(); + if (empty($roles[$role])) { + $message = sprintf($this->trans('commands.permission.debug.messages.role-error'), $role); + $io->error($message); + return true; + } + $user_permission = $roles[$role]->getPermissions(); + foreach ($permissions as $permission_name => $permission) { + if (in_array($permission_name, $user_permission)) { + $tableRows[$permission_name] = [ + $permission_name, + $permission['title']->__toString() + ]; + } + } + ksort($tableRows); + $io->table($tableHeader, array_values($tableRows)); + return true; + } + } +} From a2a35236b9f9ccdbc3cd6264cc9a7b6772c405e8 Mon Sep 17 00:00:00 2001 From: Luis Eduardo Telaya Escobedo Date: Thu, 10 Nov 2016 11:29:30 -0500 Subject: [PATCH 017/321] [permission:debug] Remove unnecesary html tags to permission label (#2907) * [permission:debug] WIP new command * [permission:debug] Add service * [permission:debug] List all permissions and filter by user role * [permission:debug] Add better error handle and cleanup * [permission:debug] Remove unnecesary html tags to permission label --- src/Command/PermissionDebugCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Command/PermissionDebugCommand.php b/src/Command/PermissionDebugCommand.php index 772aad321..9bcb66a14 100644 --- a/src/Command/PermissionDebugCommand.php +++ b/src/Command/PermissionDebugCommand.php @@ -55,7 +55,7 @@ protected function execute(InputInterface $input, OutputInterface $output) foreach ($permissions as $permission_name => $permission) { $tableRows[$permission_name] = [ $permission_name, - $permission['title']->__toString() + strip_tags($permission['title']->__toString()) ]; } @@ -82,7 +82,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if (in_array($permission_name, $user_permission)) { $tableRows[$permission_name] = [ $permission_name, - $permission['title']->__toString() + strip_tags($permission['title']->__toString()) ]; } } From bc32b76e6354baf8a990d8a438d97f6bc4558b2f Mon Sep 17 00:00:00 2001 From: Luis Eduardo Telaya Escobedo Date: Fri, 11 Nov 2016 09:13:40 -0500 Subject: [PATCH 018/321] [rest:disable] Fix rest disable functionality (#2916) --- src/Command/Rest/DisableCommand.php | 58 ++++++++++++++++++----------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/src/Command/Rest/DisableCommand.php b/src/Command/Rest/DisableCommand.php index c1fa98901..d437491f5 100644 --- a/src/Command/Rest/DisableCommand.php +++ b/src/Command/Rest/DisableCommand.php @@ -30,13 +30,13 @@ class DisableCommand extends Command use RestTrait; /** - * @var ConfigFactory -*/ + * @var ConfigFactory + */ protected $configFactory; /** - * @var ResourcePluginManager -*/ + * @var ResourcePluginManager + */ protected $pluginManagerRest; /** @@ -53,7 +53,6 @@ public function __construct( parent::__construct(); } - /** * @DrupalCommand( * dependencies = { @@ -96,23 +95,38 @@ protected function execute(InputInterface $input, OutputInterface $output) $rest_resources_ids, $this->translator ); - $input->setArgument('resource-id', $resource_id); - $rest_settings = $this->getRestDrupalConfig(); - - unset($rest_settings[$resource_id]); - - $config = $this->configFactory->getEditable('rest.settings'); - - $config->set('resources', $rest_settings); - $config->save(); - - $io->success( - sprintf( - $this->trans('commands.rest.disable.messages.success'), - $resource_id - ) - ); + $resources = \Drupal::service('entity_type.manager') + ->getStorage('rest_resource_config')->loadMultiple(); + if ($resources[$this->getResourceKey($resource_id)]) { + $routeBuilder = \Drupal::service('router.builder'); + $resources[$this->getResourceKey($resource_id)]->delete(); + // Rebuild routing cache. + $routeBuilder->rebuild(); + + $io->success( + sprintf( + $this->trans('commands.rest.disable.messages.success'), + $resource_id + ) + ); + return true; + } + $message = sprintf($this->trans('commands.rest.disable.messages.already-disabled'), $resource_id); + $io->info($message); + return true; + } - return 0; + /** + * The key used in the form. + * + * @param string $resource_id + * The resource ID. + * + * @return string + * The resource key in the form. + */ + protected function getResourceKey($resource_id) { + return str_replace(':', '.', $resource_id); } + } From 177705e6fde39724be391124d4c17a55acbb27d6 Mon Sep 17 00:00:00 2001 From: Ryan Bitting Date: Fri, 11 Nov 2016 15:20:32 -0500 Subject: [PATCH 019/321] Rename getControllerDirectory() to getControllerPath() in Extension Manager. Use new name in Controller Generator. (#2910) --- src/Extension/Extension.php | 4 ++-- src/Generator/ControllerGenerator.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Extension/Extension.php b/src/Extension/Extension.php index 4c01152af..3e774295d 100644 --- a/src/Extension/Extension.php +++ b/src/Extension/Extension.php @@ -27,9 +27,9 @@ public function getPath($fullPath = false) * @param bool $fullPath * @return string */ - public function getControllerDirectory($fullPath = false) + public function getControllerPath($fullPath = false) { - return $this->getSourcePath($fullPath) . '/Controller/'; + return $this->getSourcePath($fullPath) . '/Controller'; } /** diff --git a/src/Generator/ControllerGenerator.php b/src/Generator/ControllerGenerator.php index 0736b0168..3c925ba05 100644 --- a/src/Generator/ControllerGenerator.php +++ b/src/Generator/ControllerGenerator.php @@ -37,7 +37,7 @@ public function generate($module, $class, $routes, $test, $services) $this->renderFile( 'module/src/Controller/controller.php.twig', - $this->extensionManager->getModule($module)->getControllerDirectory().'/'.$class.'.php', + $this->extensionManager->getModule($module)->getControllerPath().'/'.$class.'Controller.php', $parameters ); From 030f504080ef0232ee3ea600548019e7c6bd9472 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Fri, 11 Nov 2016 23:59:50 -0800 Subject: [PATCH 020/321] [console] Read alias as array. --- src/Application.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Application.php b/src/Application.php index e9c88a728..26bd798cb 100644 --- a/src/Application.php +++ b/src/Application.php @@ -164,7 +164,10 @@ private function registerCommands() if (array_key_exists($command->getName(), $aliases)) { $commandAliases = $aliases[$command->getName()]; - $command->setAliases([$commandAliases]); + if (!is_array($commandAliases)) { + $commandAliases = [$commandAliases]; + } + $command->setAliases($commandAliases); } $this->add($command); From 555fd3c97a2e524114cf27f518a14c60e4d7c46c Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sat, 12 Nov 2016 00:06:51 -0800 Subject: [PATCH 021/321] [console] Read alias as array. (#2920) --- src/Application.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Application.php b/src/Application.php index e9c88a728..26bd798cb 100644 --- a/src/Application.php +++ b/src/Application.php @@ -164,7 +164,10 @@ private function registerCommands() if (array_key_exists($command->getName(), $aliases)) { $commandAliases = $aliases[$command->getName()]; - $command->setAliases([$commandAliases]); + if (!is_array($commandAliases)) { + $commandAliases = [$commandAliases]; + } + $command->setAliases($commandAliases); } $this->add($command); From 1f98773379e9e8e75bd9da230c6edc686c9c3856 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sat, 12 Nov 2016 00:17:31 -0800 Subject: [PATCH 022/321] Use drupal finder (#2921) * [console] Read alias as array. * [console] Make DrupalConsole executable from any directory within your site. --- bin/drupal.php | 75 +++++++++++++++++--------------------------------- 1 file changed, 26 insertions(+), 49 deletions(-) diff --git a/bin/drupal.php b/bin/drupal.php index cdb909237..47906e546 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -1,71 +1,47 @@ loadConfigurationFromDirectory($root); -if ($options = $configuration->get('application.options') ?: []) { - $argvInputReader->setOptionsFromConfiguration($options); -} -$argvInputReader->setOptionsAsArgv(); +$drupalFinder = new DrupalFinder(); +$drupalFinder->locateRoot(getcwd()); -if ($root === $appRoot && $argvInputReader->get('root')) { - $appRoot = $argvInputReader->get('root'); - if (is_dir($appRoot)) { - chdir($appRoot); - } - else { - $appRoot = $root; - } -} +$composerRoot = $drupalFinder->getComposerRoot(); +$drupalRoot = $drupalFinder->getDrupalRoot(); + +chdir($drupalRoot); -$drupal = new Drupal($autoload, $root, $appRoot); +$drupal = new Drupal($autoload, $composerRoot, $drupalRoot); $container = $drupal->boot(); +echo $composerRoot . PHP_EOL; + if (!$container) { - echo ' In order to list all of the available commands you should try: ' . PHP_EOL . - ' Copy config files: drupal init ' . PHP_EOL . - ' Install Drupal site: drupal site:install ' . PHP_EOL; + echo ' Something goes wrong, try checking the log file at:' . PHP_EOL . + ' ' . $composerRoot . '/console/log/' . date('Y-m-d') . '.log' . PHP_EOL; exit(1); } @@ -75,6 +51,7 @@ $translator = $container->get('console.translator_manager'); +$argvInputReader = new ArgvInputReader(); if ($options = $configuration->get('application.options') ?: []) { $argvInputReader->setOptionsFromConfiguration($options); } From 3bb9f61d5f67464724ba7ed78f020f1e2c0486c9 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sat, 12 Nov 2016 17:31:11 -0800 Subject: [PATCH 023/321] Relocate console root service (#2929) * [console] Read alias as array. * [console] Relocate console.root service definition. --- services-drupal-install.yml | 2 -- services.yml | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services-drupal-install.yml b/services-drupal-install.yml index 50ece8702..6d8034052 100644 --- a/services-drupal-install.yml +++ b/services-drupal-install.yml @@ -1,7 +1,5 @@ services: # Installer services - console.root: - class: SplString console.site: class: Drupal\Console\Utils\Site arguments: ['@app.root'] diff --git a/services.yml b/services.yml index 912ff2369..f10c23871 100644 --- a/services.yml +++ b/services.yml @@ -1,6 +1,8 @@ imports: - { resource: 'services-drupal-install.yml' } services: + console.root: + class: SplString console.redbean: class: RedBeanPHP\R console.validator: From 305977b4d297206d7b3139f06d51ce0cd10c0314 Mon Sep 17 00:00:00 2001 From: Esolitos Marlon Date: Sun, 13 Nov 2016 14:06:07 +0100 Subject: [PATCH 024/321] Require correct '.install' file for each module during updates (#2900) --- src/Command/Update/ExecuteCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Command/Update/ExecuteCommand.php b/src/Command/Update/ExecuteCommand.php index 24abf462c..ccfba07ec 100644 --- a/src/Command/Update/ExecuteCommand.php +++ b/src/Command/Update/ExecuteCommand.php @@ -183,7 +183,7 @@ private function runUpdates(DrupalStyle $io, $updates) { foreach ($updates as $module_name => $module_updates) { $this->site - ->loadLegacyFile($this->extensionManager->getModule($this->module)->getPath() . '/'. $this->module . '.install', false); + ->loadLegacyFile($this->extensionManager->getModule($module_name)->getPath() . '/'. $module_name . '.install', false); foreach ($module_updates['pending'] as $update_number => $update) { if ($this->module != 'all' && $this->update_n !== null && $this->update_n != $update_number) { From c53646a06f119051fbb22603a4e94c4ca305880a Mon Sep 17 00:00:00 2001 From: Dennis B Date: Sun, 13 Nov 2016 16:32:30 +0100 Subject: [PATCH 025/321] Fixes wrong template path on generate:entity:content (#2880) --- src/Extension/Extension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Extension/Extension.php b/src/Extension/Extension.php index 3e774295d..484f83dc4 100644 --- a/src/Extension/Extension.php +++ b/src/Extension/Extension.php @@ -111,6 +111,6 @@ public function getEntityPath($fullPath = false) */ public function getTemplatePath($fullPath = false) { - return $this->getSourcePath($fullPath) . '/templates'; + return $this->getPath($fullPath) . '/templates'; } } From 086991b1f609a7632dac881927385f2d2723fb80 Mon Sep 17 00:00:00 2001 From: Dennis B Date: Sun, 13 Nov 2016 16:33:54 +0100 Subject: [PATCH 026/321] Declare data_table in annotation only if entity is translatable see https://www.drupal.org/node/1498674 (#2879) --- templates/module/src/Entity/entity-content.php.twig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/module/src/Entity/entity-content.php.twig b/templates/module/src/Entity/entity-content.php.twig index 640e1d97e..862e01a20 100644 --- a/templates/module/src/Entity/entity-content.php.twig +++ b/templates/module/src/Entity/entity-content.php.twig @@ -56,7 +56,9 @@ use Drupal\user\UserInterface; * }, * }, * base_table = "{{ entity_name }}", +{% if is_translatable %} * data_table = "{{ entity_name }}_field_data", +{% endif %} {% if revisionable %} * revision_table = "{{ entity_name }}_revision", * revision_data_table = "{{ entity_name }}_field_revision", From 6a5b84571ed06be1760b7a8330003b1eb444f0fd Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 13 Nov 2016 07:37:27 -0800 Subject: [PATCH 027/321] Minor fixes binary drupal (#2930) * [console] Read alias as array. * [console] Minor fixes binary drupal. --- bin/drupal.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/bin/drupal.php b/bin/drupal.php index 47906e546..9b078b32b 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -28,7 +28,6 @@ $drupalFinder = new DrupalFinder(); $drupalFinder->locateRoot(getcwd()); - $composerRoot = $drupalFinder->getComposerRoot(); $drupalRoot = $drupalFinder->getDrupalRoot(); @@ -37,8 +36,6 @@ $drupal = new Drupal($autoload, $composerRoot, $drupalRoot); $container = $drupal->boot(); -echo $composerRoot . PHP_EOL; - if (!$container) { echo ' Something goes wrong, try checking the log file at:' . PHP_EOL . ' ' . $composerRoot . '/console/log/' . date('Y-m-d') . '.log' . PHP_EOL; From 2a6033224e71edaea3f9dd2e4125ae2651a550df Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 13 Nov 2016 08:05:37 -0800 Subject: [PATCH 028/321] Tag new release 1.0.0 rc9 (#2931) * [console] Read alias as array. * [console] Show error message if getcwd is not valid within a drupal site. * [console] Update dependencies core and core-en. * [console] Tag 1.0.0-rc9 release. --- bin/drupal.php | 5 +++ composer.lock | 78 +++++++++++++++++++++++++++++++++------------ src/Application.php | 2 +- 3 files changed, 64 insertions(+), 21 deletions(-) diff --git a/bin/drupal.php b/bin/drupal.php index 9b078b32b..fc275d8c6 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -31,6 +31,11 @@ $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); diff --git a/composer.lock b/composer.lock index b0bffe922..405e6db0a 100644 --- a/composer.lock +++ b/composer.lock @@ -532,23 +532,23 @@ }, { "name": "drupal/console-core", - "version": "v1.0.0-rc8", + "version": "1.0.0-rc9", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "44d2b0e7772a7f6bf25e0ff07944d15797ffb0f2" + "reference": "4c57bef658801d336c83a9e7f13d86af54607d10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/44d2b0e7772a7f6bf25e0ff07944d15797ffb0f2", - "reference": "44d2b0e7772a7f6bf25e0ff07944d15797ffb0f2", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/4c57bef658801d336c83a9e7f13d86af54607d10", + "reference": "4c57bef658801d336c83a9e7f13d86af54607d10", "shasum": "" }, "require": { "dflydev/dot-access-configuration": "1.*", "drupal/console-en": "~1.0", "php": "^5.5.9 || ^7.0", - "stecman/symfony-console-completion": "^0.5.1", + "stecman/symfony-console-completion": "~0.7", "symfony/config": "~2.8", "symfony/console": "~2.8", "symfony/dependency-injection": "~2.8", @@ -558,7 +558,8 @@ "symfony/process": "~2.8", "symfony/translation": "~2.8", "symfony/yaml": "~2.8", - "twig/twig": "^1.23.1" + "twig/twig": "^1.23.1", + "webflo/drupal-finder": "0.*" }, "type": "project", "autoload": { @@ -607,20 +608,20 @@ "drupal", "symfony" ], - "time": "2016-11-05 06:47:58" + "time": "2016-11-13 15:43:30" }, { "name": "drupal/console-en", - "version": "1.0.0-rc7", + "version": "1.0.0-rc8", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", - "reference": "5807dce9efd84ccb1198a926eea03b600b8a93e6" + "reference": "789a088b3b6ecf77bc245d905a86387ada105245" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/5807dce9efd84ccb1198a926eea03b600b8a93e6", - "reference": "5807dce9efd84ccb1198a926eea03b600b8a93e6", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/789a088b3b6ecf77bc245d905a86387ada105245", + "reference": "789a088b3b6ecf77bc245d905a86387ada105245", "shasum": "" }, "type": "drupal-console-language", @@ -661,7 +662,7 @@ "drupal", "symfony" ], - "time": "2016-11-05 06:21:34" + "time": "2016-11-13 00:44:14" }, { "name": "gabordemooij/redbean", @@ -1108,29 +1109,29 @@ }, { "name": "stecman/symfony-console-completion", - "version": "0.5.1", + "version": "0.7.0", "source": { "type": "git", "url": "https://github.com/stecman/symfony-console-completion.git", - "reference": "1a9fc7ab4820cd1aabbdc584c6b25d221e7b6cb5" + "reference": "5461d43e53092b3d3b9dbd9d999f2054730f4bbb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/stecman/symfony-console-completion/zipball/1a9fc7ab4820cd1aabbdc584c6b25d221e7b6cb5", - "reference": "1a9fc7ab4820cd1aabbdc584c6b25d221e7b6cb5", + "url": "https://api.github.com/repos/stecman/symfony-console-completion/zipball/5461d43e53092b3d3b9dbd9d999f2054730f4bbb", + "reference": "5461d43e53092b3d3b9dbd9d999f2054730f4bbb", "shasum": "" }, "require": { "php": ">=5.3.2", - "symfony/console": "~2.2" + "symfony/console": "~2.3 || ~3.0" }, "require-dev": { - "phpunit/phpunit": "~4.1" + "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "0.5.x-dev" + "dev-master": "0.6.x-dev" } }, "autoload": { @@ -1149,7 +1150,7 @@ } ], "description": "Automatic BASH completion for Symfony Console Component based applications.", - "time": "2015-05-07 12:21:50" + "time": "2016-02-24 05:08:54" }, { "name": "symfony/config", @@ -2151,6 +2152,43 @@ "templating" ], "time": "2016-10-25 19:17:17" + }, + { + "name": "webflo/drupal-finder", + "version": "0.1.1", + "source": { + "type": "git", + "url": "https://github.com/webflo/drupal-finder.git", + "reference": "4dcd3281e9be9e9b89d33c5153f80ae1a16c3275" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webflo/drupal-finder/zipball/4dcd3281e9be9e9b89d33c5153f80ae1a16c3275", + "reference": "4dcd3281e9be9e9b89d33c5153f80ae1a16c3275", + "shasum": "" + }, + "require-dev": { + "mikey179/vfsstream": "^1.6", + "phpunit/phpunit": "^4.8" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/DrupalFinder.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0+" + ], + "authors": [ + { + "name": "Florian Weber", + "email": "florian@webflo.org" + } + ], + "description": "Helper class to locate a Drupal installation from a given path.", + "time": "2016-11-12 15:50:13" } ], "packages-dev": [], diff --git a/src/Application.php b/src/Application.php index 26bd798cb..c97c62749 100644 --- a/src/Application.php +++ b/src/Application.php @@ -22,7 +22,7 @@ class Application extends ConsoleApplication /** * @var string */ - const VERSION = '1.0.0-rc8'; + const VERSION = '1.0.0-rc9'; public function __construct(ContainerInterface $container) { From 57caf0e73b46eae7e3af6af2f713455b684bf654 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 13 Nov 2016 14:33:08 -0800 Subject: [PATCH 029/321] Update readme install update instructions (#2933) * [console] Read alias as array. * [console] Update install/udpate instructions. --- README.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index a1b49e4bb..c9cae5341 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,14 @@ **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* -- [Drupal Console](#drupal-console) + - [Drupal Console](#drupal-console) - [Required PHP version](#required-php-version) - [Drupal Console documentation](#documentation) - [Download as new dependency](#download-as-new-dependency) - [Download using DrupalComposer](#download-using-drupalcomposer) - [Update DrupalConsole](#update-drupalconsole) - [Install Drupal Console Launcher](#install-drupal-console-launcher) + - [Update DrupalConsole Launcher](#update-drupalconsole-launcher) - [Run Drupal Console](#running-drupal-console) - [Supporting organizations](#supporting-organizations) @@ -80,6 +81,12 @@ php -r "readfile('https://drupalconsole.com/installer');" > drupal.phar mv drupal.phar /usr/local/bin/drupal ``` +## Update DrupalConsole Launcher  +``` +drupal self-update +``` +> NOTE: `drupal` is the alias name you used when installed the DrupalConsole Launcher. + ## Run Drupal Console Using the DrupalConsole Launcher ``` @@ -89,14 +96,10 @@ drupal We highly recommend you to install the global executable, but if is not installed, then you can run DrupalConsole by: -Using default Drupal + DrupalConsole ``` vendor/bin/drupal -``` - -Using DrupalComposer you can also change directory `web`, `docroot` and -``` -../vendor/bin/drupal +# or +vendor/drupal/console/bin/drupal ``` ## Drupal Console Support From 184f7b2e368bfa2f9828eb7685f23685c9ab3a5f Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 13 Nov 2016 14:44:41 -0800 Subject: [PATCH 030/321] [console] Remove no longer required instruction. --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index c9cae5341..cfe798778 100644 --- a/README.md +++ b/README.md @@ -91,8 +91,7 @@ drupal self-update Using the DrupalConsole Launcher ``` drupal -``` -> NOTE: If using a DrupalComposer make sure you execute the `init` command and answer yest to ` Copy at current directory console/config.yml? (yes/no) [yes]:` question. +``` We highly recommend you to install the global executable, but if is not installed, then you can run DrupalConsole by: From ff216ac5d0365916c5c151de68009bb45425736e Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 13 Nov 2016 14:48:09 -0800 Subject: [PATCH 031/321] [console] Remove no longer required instruction. (#2934) * [console] Read alias as array. * [console] Remove no longer required instruction. --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index c9cae5341..cfe798778 100644 --- a/README.md +++ b/README.md @@ -91,8 +91,7 @@ drupal self-update Using the DrupalConsole Launcher ``` drupal -``` -> NOTE: If using a DrupalComposer make sure you execute the `init` command and answer yest to ` Copy at current directory console/config.yml? (yes/no) [yes]:` question. +``` We highly recommend you to install the global executable, but if is not installed, then you can run DrupalConsole by: From 13f2b089194a93a126929a358de397e16c738c15 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 13 Nov 2016 15:04:16 -0800 Subject: [PATCH 032/321] Fix logger path (#2935) * [console] Read alias as array. * [console] Remove no longer required instruction. * [logger] Fix log file path. --- src/Utils/Logger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Utils/Logger.php b/src/Utils/Logger.php index 9f9ad8249..1820502d6 100644 --- a/src/Utils/Logger.php +++ b/src/Utils/Logger.php @@ -24,7 +24,7 @@ public function __construct($root) { } protected function init($root) { - $loggerFile = $root.'console/log/' . date('Y-m-d') . '.log'; + $loggerFile = $root.'/console/log/' . date('Y-m-d') . '.log'; if (!is_file($loggerFile)) { try { $directoryName = dirname($loggerFile); From 62f59b1c9b7d48a8c4199b473141e6601b6e0e4f Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 14 Nov 2016 11:03:36 -0800 Subject: [PATCH 033/321] [console] Add DevDesktop Support. --- src/Bootstrap/Drupal.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index b7ac04c0d..5e740bdbe 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -41,6 +41,14 @@ public function boot() } try { + + // Add support for Acquia Dev Desktop sites on Mac OS X + // @TODO: Check if this condition works in Windows + $devDesktopSettingsDir = getenv('HOME') . "/.acquia/DevDesktop/DrupalSettings"; + if (file_exists($devDesktopSettingsDir)) { + $_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR'] = $devDesktopSettingsDir; + } + $argvInputReader = new ArgvInputReader(); if ($argvInputReader->get('uri')) { $uri = $argvInputReader->get('uri'); From aa4da2db51d06881278b0af6e45e8a67d8384cd2 Mon Sep 17 00:00:00 2001 From: Luis Eduardo Telaya Escobedo Date: Tue, 15 Nov 2016 09:01:50 -0500 Subject: [PATCH 034/321] [permission_debug] Add role column (#2940) * [permission_debug] Add role column * [permission_debug] Refactor code so that order is done via weight. --- src/Command/PermissionDebugCommand.php | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/Command/PermissionDebugCommand.php b/src/Command/PermissionDebugCommand.php index 9bcb66a14..4ab2f3216 100644 --- a/src/Command/PermissionDebugCommand.php +++ b/src/Command/PermissionDebugCommand.php @@ -48,14 +48,16 @@ protected function execute(InputInterface $input, OutputInterface $output) if (!$role) { $tableHeader = [ $this->trans('commands.permission.debug.table-headers.permission-name'), - $this->trans('commands.permission.debug.table-headers.permission-label') + $this->trans('commands.permission.debug.table-headers.permission-label'), + $this->trans('commands.permission.debug.table-headers.permission-role') ]; $tableRows = []; $permissions = \Drupal::service('user.permissions')->getPermissions(); foreach ($permissions as $permission_name => $permission) { $tableRows[$permission_name] = [ $permission_name, - strip_tags($permission['title']->__toString()) + strip_tags($permission['title']->__toString()), + implode(', ', $this->getRolesAssignedByPermission($permission_name)) ]; } @@ -91,4 +93,24 @@ protected function execute(InputInterface $input, OutputInterface $output) return true; } } + + /** + * Get user roles Assigned by Permission. + * + * @param string $permission_name + * Permission Name. + * + * @return array + * User roles filtered by permission else empty array. + */ + public function getRolesAssignedByPermission($permission_name) { + $roles = user_roles(); + $roles_found = []; + foreach ($roles as $role) { + if ($role->hasPermission($permission_name)) { + $roles_found[] = $role->getOriginalId(); + } + } + return $roles_found; + } } From ad5b3b4f5b77f710571b80356939803a2ebc7ea0 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Tue, 15 Nov 2016 09:50:21 -0800 Subject: [PATCH 035/321] [generate:controller] Fix class name on controller generation. (#2948) --- src/Generator/ControllerGenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator/ControllerGenerator.php b/src/Generator/ControllerGenerator.php index 3c925ba05..9ebb2c476 100644 --- a/src/Generator/ControllerGenerator.php +++ b/src/Generator/ControllerGenerator.php @@ -37,7 +37,7 @@ public function generate($module, $class, $routes, $test, $services) $this->renderFile( 'module/src/Controller/controller.php.twig', - $this->extensionManager->getModule($module)->getControllerPath().'/'.$class.'Controller.php', + $this->extensionManager->getModule($module)->getControllerPath().'/'.$class.'.php', $parameters ); From 73fc4856838929ffa1757411344f3d4d9462ab24 Mon Sep 17 00:00:00 2001 From: Tyler Struyk Date: Wed, 16 Nov 2016 12:27:32 -0500 Subject: [PATCH 036/321] Period remove from generated .module file file block. (#2424) --- templates/module/module.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/module/module.twig b/templates/module/module.twig index c6b55b356..53540372f 100644 --- a/templates/module/module.twig +++ b/templates/module/module.twig @@ -1,6 +1,6 @@ {% extends "base/file.php.twig" %} -{% block file_path %}{{machine_name}}.module.{% endblock %} +{% block file_path %}{{machine_name}}.module{% endblock %} {% block use_class %} use Drupal\Core\Routing\RouteMatchInterface; From a68301c1e9e33ec4e34fd7ff92649dd6bab37f50 Mon Sep 17 00:00:00 2001 From: enzo - Eduardo Garcia Date: Wed, 16 Nov 2016 11:38:54 -0600 Subject: [PATCH 037/321] entity:debug New command (#2952) * Add new command entity:debug * New command entity:debug --- config/services/drupal-console/entity.yml | 5 ++ src/Command/Entity/DebugCommand.php | 95 +++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 src/Command/Entity/DebugCommand.php diff --git a/config/services/drupal-console/entity.yml b/config/services/drupal-console/entity.yml index a81a0eaa3..447852951 100644 --- a/config/services/drupal-console/entity.yml +++ b/config/services/drupal-console/entity.yml @@ -1,4 +1,9 @@ services: + console.entity_debug: + class: Drupal\Console\Command\Entity\DebugCommand + arguments: ['@entity_type.repository', '@entity_type.manager'] + tags: + - { name: drupal.command } console.entity_delete: class: Drupal\Console\Command\Entity\DeleteCommand arguments: ['@entity_type.repository', '@entity_type.manager'] diff --git a/src/Command/Entity/DebugCommand.php b/src/Command/Entity/DebugCommand.php new file mode 100644 index 000000000..d837049b1 --- /dev/null +++ b/src/Command/Entity/DebugCommand.php @@ -0,0 +1,95 @@ +entityTypeRepository = $entityTypeRepository; + $this->entityTypeManager = $entityTypeManager; + parent::__construct(); + } + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('entity:debug') + ->setDescription($this->trans('commands.entity.debug.description')) + ->addArgument( + 'entity-type', + InputArgument::OPTIONAL, + $this->trans('commands.entity.debug.arguments.entity-type') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $entityType = $input->getArgument('entity-type'); + + $tableHeader = [ + $this->trans('commands.entity.debug.table-headers.entity-name'), + $this->trans('commands.entity.debug.table-headers.entity-type') + ]; + $tableRows = []; + + $entityTypesLabels = $this->entityTypeRepository->getEntityTypeLabels(true); + + if ($entityType) { + $entityTypes = [$entityType => $entityType]; + } else { + $entityTypes = array_keys($entityTypesLabels); + } + + foreach($entityTypes as $entityTypeId){ + $entities = array_keys($entityTypesLabels[$entityTypeId]); + foreach($entities as $entity) { + $tableRows[$entity] = [ + $entity, + $entityTypeId + ]; + } + } + + $io->table($tableHeader, array_values($tableRows)); + } +} From a9d1f6c55be0de8f8dbc7cf1a652c492ec33a52a Mon Sep 17 00:00:00 2001 From: enzo - Eduardo Garcia Date: Wed, 16 Nov 2016 13:46:22 -0600 Subject: [PATCH 038/321] site:status remove html markup (#2954) --- src/Command/Site/StatusCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Command/Site/StatusCommand.php b/src/Command/Site/StatusCommand.php index 3898176f1..a764625c0 100644 --- a/src/Command/Site/StatusCommand.php +++ b/src/Command/Site/StatusCommand.php @@ -156,7 +156,7 @@ protected function getSystemData() $title = $requirement['title']; } - $systemData['system'][$title] = $requirement['value']; + $systemData['system'][$title] = strip_tags($requirement['value']); } if ($this->settings) { From a77c30614c7d3b1696ba4c366d3f6477a351e966 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 16 Nov 2016 16:40:25 -0800 Subject: [PATCH 039/321] [console] Add develop.patch file. (#2958) --- .gitignore | 1 + develop.patch | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 develop.patch diff --git a/.gitignore b/.gitignore index 4390c8460..ca5f8cf62 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ /bin/pdepend /bin/php-cs-fixer /bin/phpmd +PATCHES.txt # Binaries /box.phar diff --git a/develop.patch b/develop.patch new file mode 100644 index 000000000..e27ca70e7 --- /dev/null +++ b/develop.patch @@ -0,0 +1,12 @@ +diff --git a/bin/drupal.php b/bin/drupal.php +index fc275d8..6929c8f 100644 +--- a/bin/drupal.php ++++ b/bin/drupal.php +@@ -8,6 +8,7 @@ use Drupal\Console\Application; + set_time_limit(0); + + $autoloaders = [ ++ getcwd() . '/vendor/autoload.php', + __DIR__ . '/../../../autoload.php', + __DIR__ . '/../vendor/autoload.php' + ]; From dffdc7cd464e3888118bf01ec809f1e20a601f10 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 16 Nov 2016 21:52:12 -0800 Subject: [PATCH 040/321] [generate:permissions] Fix not generating file. (#2959) --- config/services/drupal-console/generate.yml | 2 +- src/Command/Generate/PermissionCommand.php | 19 +++++++++++++------ src/Generator/PermissionGenerator.php | 13 +++++++------ 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/config/services/drupal-console/generate.yml b/config/services/drupal-console/generate.yml index a3524d7bd..b16112a07 100644 --- a/config/services/drupal-console/generate.yml +++ b/config/services/drupal-console/generate.yml @@ -41,7 +41,7 @@ services: - { name: drupal.command } console.generate_permissions: class: Drupal\Console\Command\Generate\PermissionCommand - arguments: ['@console.extension_manager', '@console.string_converter'] + arguments: ['@console.extension_manager', '@console.string_converter', '@console.permission_generator'] tags: - { name: drupal.command } console.generate_event_subscriber: diff --git a/src/Command/Generate/PermissionCommand.php b/src/Command/Generate/PermissionCommand.php index 2a7b045cc..107a95786 100644 --- a/src/Command/Generate/PermissionCommand.php +++ b/src/Command/Generate/PermissionCommand.php @@ -27,7 +27,9 @@ class PermissionCommand extends Command use PermissionTrait; use ConfirmationTrait; - /** @var Manager */ + /** + * @var Manager + */ protected $extensionManager; /** @@ -35,6 +37,11 @@ class PermissionCommand extends Command */ protected $stringConverter; + /** + * @var PermissionGenerator; + */ + protected $generator; + /** * PermissionCommand constructor. * @param Manager $extensionManager @@ -42,10 +49,12 @@ class PermissionCommand extends Command */ public function __construct( Manager $extensionManager, - StringConverter $stringConverter + StringConverter $stringConverter, + PermissionGenerator $permissionGenerator ) { $this->extensionManager = $extensionManager; $this->stringConverter = $stringConverter; + $this->generator = $permissionGenerator; parent::__construct(); } @@ -79,12 +88,10 @@ protected function execute(InputInterface $input, OutputInterface $output) { $module = $input->getOption('module'); $permissions = $input->getOption('permissions'); + $learning = $input->hasOption('learning'); - $learning = $input->hasOption('learning')?$input->getOption('learning'):false; - //@TODO: $this->generator - //$generator->setLearning($learning); - //$generator->generate($module, $permissions); + $this->generator->generate($module, $permissions, $learning); } /** diff --git a/src/Generator/PermissionGenerator.php b/src/Generator/PermissionGenerator.php index 70a511f53..97ab54403 100644 --- a/src/Generator/PermissionGenerator.php +++ b/src/Generator/PermissionGenerator.php @@ -11,11 +11,11 @@ class PermissionGenerator extends Generator { - - /** @var Manager */ + /** + * @var Manager + */ protected $extensionManager; - /** * PermissionGenerator constructor. * @param Manager $extensionManager @@ -29,8 +29,9 @@ public function __construct( /** * @param $module * @param $permissions + * @param $learning */ - public function generate($module, $permissions) + public function generate($module, $permissions, $learning) { $parameters = array( 'module_name' => $module, @@ -44,12 +45,12 @@ public function generate($module, $permissions) FILE_APPEND ); - $content = $this->getRenderHelper()->render( + $content = $this->renderer->render( 'module/permission-routing.yml.twig', $parameters ); - if ($this->isLearning()) { + if ($learning) { echo 'You can use this permission in the routing file like this:'.PHP_EOL; echo $content; } From a113df13453c53d9e813246debc43e356e32e0ff Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 16 Nov 2016 23:04:26 -0800 Subject: [PATCH 041/321] [config:export:*] Fix exported files indentation. (#2960) --- src/Command/Config/SettingsDebugCommand.php | 5 ++--- src/Command/Shared/ExportTrait.php | 17 +++++------------ 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/Command/Config/SettingsDebugCommand.php b/src/Command/Config/SettingsDebugCommand.php index a9cc8fb81..33de258ef 100644 --- a/src/Command/Config/SettingsDebugCommand.php +++ b/src/Command/Config/SettingsDebugCommand.php @@ -9,7 +9,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Yaml\Dumper; +use Drupal\Component\Serialization\Yaml; use Drupal\Console\Style\DrupalStyle; use Symfony\Component\Console\Command\Command; use Drupal\Console\Command\Shared\CommandTrait; @@ -53,7 +53,6 @@ protected function execute(InputInterface $input, OutputInterface $output) $io = new DrupalStyle($input, $output); $settingKeys = array_keys($this->settings->getAll()); - $dumper = new Dumper(); $io->newLine(); $io->info($this->trans('commands.config.settings.debug.messages.current')); @@ -61,7 +60,7 @@ protected function execute(InputInterface $input, OutputInterface $output) foreach ($settingKeys as $settingKey) { $io->comment($settingKey, false); - $io->simple($dumper->dump($this->settings->get($settingKey), 10)); + $io->simple(Yaml::encode($this->settings->get($settingKey))); } $io->newLine(); } diff --git a/src/Command/Shared/ExportTrait.php b/src/Command/Shared/ExportTrait.php index a6bb18644..e1d6692bc 100644 --- a/src/Command/Shared/ExportTrait.php +++ b/src/Command/Shared/ExportTrait.php @@ -7,8 +7,7 @@ namespace Drupal\Console\Command\Shared; -use Symfony\Component\Yaml\Dumper; -use \Symfony\Component\Yaml\Yaml; +use Drupal\Component\Serialization\Yaml; use Drupal\Console\Style\DrupalStyle; /** @@ -35,17 +34,15 @@ protected function getConfiguration($configName, $uuid = false) } /** - * @param string $module + * @param string $directory * @param DrupalStyle $io */ protected function exportConfig($directory, DrupalStyle $io, $message) { - $dumper = new Dumper(); - $io->info($message); foreach ($this->configExport as $fileName => $config) { - $yamlConfig = $dumper->dump($config['data'], 10); + $yamlConfig = Yaml::encode($config['data']); $configFile = sprintf( '%s/%s.yml', @@ -73,14 +70,12 @@ protected function exportConfig($directory, DrupalStyle $io, $message) */ protected function exportConfigToModule($module, DrupalStyle $io, $message) { - $dumper = new Dumper(); - $io->info($message); $module = $this->extensionManager->getModule($module); foreach ($this->configExport as $fileName => $config) { - $yamlConfig = $dumper->dump($config['data'], 10); + $yamlConfig = Yaml::encode($config['data']); if ($config['optional']) { $configDirectory = $module->getConfigOptionalDirectory(false); @@ -131,8 +126,6 @@ protected function resolveDependencies($dependencies, $optional = false) protected function exportModuleDependencies($io, $module, $dependencies) { - $yaml = new Yaml(); - $module = $this->extensionManager->getModule($module); $info_yaml = $module->info; @@ -142,7 +135,7 @@ protected function exportModuleDependencies($io, $module, $dependencies) $info_yaml['dependencies'] = array_unique(array_merge($info_yaml['dependencies'], $dependencies)); } - if (file_put_contents($module->getPathname(), $yaml->dump($info_yaml))) { + if (file_put_contents($module->getPathname(), Yaml::encode($info_yaml))) { $io->info( '[+] ' . sprintf( From ba9953517c25249740e3b37adfce0c0c2a345007 Mon Sep 17 00:00:00 2001 From: Luis Eduardo Telaya Escobedo Date: Thu, 17 Nov 2016 09:42:53 -0500 Subject: [PATCH 042/321] [rest:enable] Fix enable rest resource (#2919) * [rest:debug] Add serializer format options * [rest:enable] Fix enable rest resource --- config/services/drupal-core/rest.yml | 2 +- src/Command/Rest/EnableCommand.php | 81 ++++++++++++++++++++-------- 2 files changed, 60 insertions(+), 23 deletions(-) diff --git a/config/services/drupal-core/rest.yml b/config/services/drupal-core/rest.yml index 37667c040..a5446b6ac 100644 --- a/config/services/drupal-core/rest.yml +++ b/config/services/drupal-core/rest.yml @@ -11,6 +11,6 @@ services: - { name: drupal.command } rest_enable: class: Drupal\Console\Command\Rest\EnableCommand - arguments: ['@plugin.manager.rest', '@authentication_collector', '@config.factory'] + arguments: ['@plugin.manager.rest', '@authentication_collector', '@config.factory', '%serializer.formats%', '@entity.manager'] tags: - { name: drupal.command } diff --git a/src/Command/Rest/EnableCommand.php b/src/Command/Rest/EnableCommand.php index 1f6e28901..91ecad1fb 100644 --- a/src/Command/Rest/EnableCommand.php +++ b/src/Command/Rest/EnableCommand.php @@ -13,11 +13,13 @@ use Symfony\Component\Console\Command\Command; use Drupal\Console\Command\Shared\CommandTrait; use Drupal\Console\Annotations\DrupalCommand; +use Drupal\rest\RestResourceConfigInterface; use Drupal\Console\Style\DrupalStyle; use Drupal\Console\Command\Shared\RestTrait; use Drupal\rest\Plugin\Type\ResourcePluginManager; use Drupal\Core\Authentication\AuthenticationCollector; use Drupal\Core\Config\ConfigFactory; +use Drupal\Core\Entity\EntityManager; /** * @DrupalCommand( @@ -41,28 +43,49 @@ class EnableCommand extends Command protected $authenticationCollector; /** - * @var ConfigFactory -*/ + * @var ConfigFactory + */ protected $configFactory; + /** + * The available serialization formats. + * + * @var array + */ + protected $formats; + + /** + * The entity manager. + * + * @var \Drupal\Core\Entity\EntityManagerInterface + */ + protected $entityManager; + /** * EnableCommand constructor. * @param ResourcePluginManager $pluginManagerRest * @param AuthenticationCollector $authenticationCollector * @param ConfigFactory $configFactory + * @param array $formats + * The available serialization formats. + * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager + * The entity manager. */ public function __construct( ResourcePluginManager $pluginManagerRest, AuthenticationCollector $authenticationCollector, - ConfigFactory $configFactory + ConfigFactory $configFactory, + array $formats, + EntityManager $entity_manager ) { $this->pluginManagerRest = $pluginManagerRest; $this->authenticationCollector = $authenticationCollector; $this->configFactory = $configFactory; + $this->formats = $formats; + $this->entityManager = $entity_manager; parent::__construct(); } - protected function configure() { $this @@ -81,12 +104,10 @@ protected function execute(InputInterface $input, OutputInterface $output) $resource_id = $input->getArgument('resource-id'); $rest_resources = $this->getRestResources(); - $rest_resources_ids = array_merge( array_keys($rest_resources['enabled']), array_keys($rest_resources['disabled']) ); - if (!$resource_id) { $resource_id = $io->choiceNoList( $this->trans('commands.rest.enable.arguments.resource-id'), @@ -101,17 +122,24 @@ protected function execute(InputInterface $input, OutputInterface $output) ); $input->setArgument('resource-id', $resource_id); - // Calculate states available by resource and generate the question + // Calculate states available by resource and generate the question. $plugin = $this->pluginManagerRest->getInstance(['id' => $resource_id]); - $states = $plugin->availableMethods(); + $methods = $plugin->availableMethods(); + $method = $io->choice( + $this->trans('commands.rest.enable.arguments.methods'), + $methods + ); + $io->writeln( + $this->trans('commands.rest.enable.messages.selected-method') . ' ' . $method + ); - $state = $io->choice( - $this->trans('commands.rest.enable.arguments.states'), - $states + $format = $io->choice( + $this->trans('commands.rest.enable.arguments.formats'), + $this->formats ); $io->writeln( - $this->trans('commands.rest.enable.messages.selected-state').' '.$state + $this->trans('commands.rest.enable.messages.selected-format') . ' ' . $format ); // Get Authentication Provider and generate the question @@ -125,21 +153,30 @@ protected function execute(InputInterface $input, OutputInterface $output) ); $io->writeln( - $this->trans('commands.rest.enable.messages.selected-authentication-providers').' '.implode( + $this->trans('commands.rest.enable.messages.selected-authentication-providers') . ' ' . implode( ', ', $authenticationProvidersSelected ) ); - $rest_settings = $this->getRestDrupalConfig(); - - $rest_settings[$resource_id][$state]['supported_formats'] = $formats; - $rest_settings[$resource_id][$state]['supported_auth'] = $authenticationProvidersSelected; - - $config = $this->configFactory->getEditable('rest.settings'); - $config->set('resources', $rest_settings); + $format_resource_id = str_replace(':', '.', $resource_id); + $config = $this->entityManager->getStorage('rest_resource_config')->load($format_resource_id); + if (!$config) { + $config = $this->entityManager->getStorage('rest_resource_config')->create([ + 'id' => $format_resource_id, + 'granularity' => RestResourceConfigInterface::METHOD_GRANULARITY, + 'configuration' => [] + ]); + } + $configuration = $config->get('configuration') ?: []; + $configuration[$method] = [ + 'supported_formats' => [$format], + 'supported_auth' => $authenticationProvidersSelected, + ]; + $config->set('configuration', $configuration); $config->save(); - - return 0; + $message = sprintf($this->trans('commands.rest.enable.messages.success'), $resource_id); + $io->info($message); + return true; } } From 8e4e502280aabf068c79e7b5ca9493ee71ac0ca9 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Fri, 18 Nov 2016 12:22:51 -0800 Subject: [PATCH 043/321] [console] Add autoload.local.php.dist file. (#2966) * [console] Add autoload.local.php.dist file. * [console] Add new end line. --- .gitignore | 3 +++ autoload.local.php.dist | 3 +++ bin/drupal.php | 14 ++++++++++---- develop.patch | 12 ------------ 4 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 autoload.local.php.dist delete mode 100644 develop.patch diff --git a/.gitignore b/.gitignore index ca5f8cf62..10262dcc8 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,9 @@ /bin/phpmd PATCHES.txt +# Develop +autoload.local.php + # Binaries /box.phar /console.phar diff --git a/autoload.local.php.dist b/autoload.local.php.dist new file mode 100644 index 000000000..d73d40900 --- /dev/null +++ b/autoload.local.php.dist @@ -0,0 +1,3 @@ + Date: Fri, 18 Nov 2016 16:01:36 -0800 Subject: [PATCH 044/321] Update Readme add chmod +x instruction. (#2967) --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cfe798778..0ec03f826 100644 --- a/README.md +++ b/README.md @@ -71,15 +71,15 @@ composer update drupal/console --with-dependencies ## Install Drupal Console Launcher ``` -# Run this in your terminal to get the latest version: curl https://drupalconsole.com/installer -L -o drupal.phar - -# Or if you don't have curl: -php -r "readfile('https://drupalconsole.com/installer');" > drupal.phar - -# Accessing from anywhere on your system: mv drupal.phar /usr/local/bin/drupal +chmod +x /usr/local/bin/drupal +``` +NOTE: If you don't have curl you can try ``` +php -r "readfile('https://drupalconsole.com/installer');" > drupal.phar +``` + ## Update DrupalConsole Launcher  ``` From ed4e7e888e04f6f7ea5078a91e51966da5077150 Mon Sep 17 00:00:00 2001 From: enzo - Eduardo Garcia Date: Sat, 19 Nov 2016 16:37:08 -0600 Subject: [PATCH 045/321] Include service option for http.response.debug_cacheability_headers (#2968) --- src/Command/Site/ModeCommand.php | 42 +++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/src/Command/Site/ModeCommand.php b/src/Command/Site/ModeCommand.php index a8738d4c2..d7501da03 100644 --- a/src/Command/Site/ModeCommand.php +++ b/src/Command/Site/ModeCommand.php @@ -107,6 +107,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } $servicesOverrideResult = $this->overrideServices( + $environment, $loadedConfigurations['services'], $io ); @@ -172,7 +173,7 @@ protected function overrideConfigurations($configurations) return $result; } - protected function overrideServices($servicesSettings, DrupalStyle $io) + protected function overrideServices($environment, $servicesSettings, DrupalStyle $io) { $directory = sprintf( '%s/%s', @@ -198,19 +199,32 @@ protected function overrideServices($servicesSettings, DrupalStyle $io) } $yaml = new Yaml(); + $services = $yaml->parse(file_get_contents($settingsServicesFile)); $result = []; foreach ($servicesSettings as $service => $parameters) { - foreach ($parameters as $parameter => $value) { - $services['parameters'][$service][$parameter] = $value; + if(is_array($parameters)) { + foreach ($parameters as $parameter => $value) { + print 'parameters: ' . $parameter . "\n"; + $services['parameters'][$service][$parameter] = $value; + // Set values for output + $result[$parameter]['service'] = $service; + $result[$parameter]['parameter'] = $parameter; + if (is_bool($value)) { + $value = $value ? 'true' : 'false'; + } + $result[$parameter]['value'] = $value; + } + } else { + $services['parameters'][$service] = $parameters; // Set values for output - $result[$parameter]['service'] = $service; - $result[$parameter]['parameter'] = $parameter; - if (is_bool($value)) { - $value = $value? 'true' : 'false'; + $result[$service]['service'] = $service; + $result[$service]['parameter'] = ''; + if (is_bool($parameters)) { + $value = $parameters ? 'true' : 'false'; } - $result[$parameter]['value'] = $value; + $result[$service]['value'] = $value; } } @@ -247,19 +261,23 @@ protected function loadConfigurations($env) if (!file_exists($configFile)) { $configFile = sprintf( '%s/config/dist/site.mode.yml', - $this->appRoot + $this->configurationManager->getApplicationDirectory() . DRUPAL_CONSOLE_CORE ); } - $siteModeConfiguration = Yaml::dump(file_get_contents($configFile)); + $siteModeConfiguration = Yaml::parse(file_get_contents($configFile)); $configKeys = array_keys($siteModeConfiguration); $configurationSettings = []; foreach ($configKeys as $configKey) { $siteModeConfigurationItem = $siteModeConfiguration[$configKey]; foreach ($siteModeConfigurationItem as $setting => $parameters) { - foreach ($parameters as $parameter => $value) { - $configurationSettings[$configKey][$setting][$parameter] = $value[$env]; + if(array_key_exists($env, $parameters)) { + $configurationSettings[$configKey][$setting] = $parameters[$env]; + } else { + foreach ($parameters as $parameter => $value) { + $configurationSettings[$configKey][$setting][$parameter] = $value[$env]; + } } } } From f79509f69cd12716b21b566c82d13a681e9a87d9 Mon Sep 17 00:00:00 2001 From: enzo - Eduardo Garcia Date: Sun, 20 Nov 2016 19:35:32 -0600 Subject: [PATCH 046/321] devel:dumper re-emable (#2970) --- config/services/drupal-console/misc.yml | 10 ++++---- ...mperCommand.php => DevelDumperCommand.php} | 23 +++++++++++++++---- 2 files changed, 24 insertions(+), 9 deletions(-) rename src/Command/{DumperCommand.php => DevelDumperCommand.php} (85%) diff --git a/config/services/drupal-console/misc.yml b/config/services/drupal-console/misc.yml index 2eca7df79..5073a2823 100644 --- a/config/services/drupal-console/misc.yml +++ b/config/services/drupal-console/misc.yml @@ -16,8 +16,8 @@ services: arguments: ['@event_dispatcher'] tags: - { name: drupal.command } -# console.devel_dumper: -# class: Drupal\Console\Command\DumperCommand -# arguments: ['@app.root'] -# tags: -# - { name: drupal.command } + console.devel_dumper: + class: Drupal\Console\Command\DevelDumperCommand + arguments: ['@?plugin.manager.devel_dumper'] + tags: + - { name: drupal.command } diff --git a/src/Command/DumperCommand.php b/src/Command/DevelDumperCommand.php similarity index 85% rename from src/Command/DumperCommand.php rename to src/Command/DevelDumperCommand.php index 94d89425b..2e06dd01b 100644 --- a/src/Command/DumperCommand.php +++ b/src/Command/DevelDumperCommand.php @@ -14,7 +14,7 @@ use Drupal\devel\DevelDumperManager; /** - * Class DumperCommand. + * Class DevelDumperCommand. * Command to quickly change between devel dumpers from the command line * * @package Drupal\Console\Command @@ -23,10 +23,26 @@ * @todo Move to namespace Devel * @todo Load devel.module legacy file */ -class DumperCommand extends Command +class DevelDumperCommand extends Command { use ContainerAwareCommandTrait; + /** + * @var DevelDumperPluginManager + */ + protected $develDumperPluginManager; + + /** + * DevelDumperCommand constructor. + */ + public function __construct( + DevelDumperPluginManager $develDumperPluginManager + ) { + $this->develDumperPluginManager = $develDumperPluginManager; + + parent::__construct(); + } + /** * {@inheritdoc} */ @@ -101,8 +117,7 @@ protected function execute(InputInterface $input, OutputInterface $output) protected function getDumperKeys() { /* @var DevelDumperPluginManager $manager */ - $manager = \Drupal::service('plugin.manager.devel_dumper'); - $plugins = $manager->getDefinitions(); + $plugins = $this->develDumperPluginManager->getDefinitions(); return array_keys($plugins); } } From b0486450ca8d04f86ecb3bf27e89a5e4a7cd24a1 Mon Sep 17 00:00:00 2001 From: enzo - Eduardo Garcia Date: Mon, 21 Nov 2016 10:11:59 -0600 Subject: [PATCH 047/321] [yaml:merge] Improvide interactive UI (#2971) --- src/Command/DevelDumperCommand.php | 2 +- src/Command/Yaml/MergeCommand.php | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/Command/DevelDumperCommand.php b/src/Command/DevelDumperCommand.php index 2e06dd01b..33d8ee4d8 100644 --- a/src/Command/DevelDumperCommand.php +++ b/src/Command/DevelDumperCommand.php @@ -36,7 +36,7 @@ class DevelDumperCommand extends Command * DevelDumperCommand constructor. */ public function __construct( - DevelDumperPluginManager $develDumperPluginManager + DevelDumperPluginManager $develDumperPluginManager = null ) { $this->develDumperPluginManager = $develDumperPluginManager; diff --git a/src/Command/Yaml/MergeCommand.php b/src/Command/Yaml/MergeCommand.php index 53e1fd60d..fa5a50ee6 100644 --- a/src/Command/Yaml/MergeCommand.php +++ b/src/Command/Yaml/MergeCommand.php @@ -45,7 +45,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $dumper = new Dumper(); $final_yaml = array(); - $yaml_destination = $input->getArgument('yaml-destination'); + $yaml_destination = realpath($input->getArgument('yaml-destination')); $yaml_files = $input->getArgument('yaml-files'); if (count($yaml_files) < 2) { @@ -158,15 +158,22 @@ protected function interact(InputInterface $input, OutputInterface $output) $yaml_files = array(); while (true) { + // Set the string key based on among files provided + if(count($yaml_files) >= 2) { + $questionStringKey = 'commands.yaml.merge.questions.other-file'; + } + else { + $questionStringKey = 'commands.yaml.merge.questions.file'; + } + $yaml_file = $io->ask( - $this->trans('commands.yaml.merge.questions.file'), + $this->trans($questionStringKey), '', function ($file) use ($yaml_files, $io) { if (count($yaml_files) < 2 && empty($file)) { $io->error($this->trans('commands.yaml.merge.questions.invalid-file')); - return false; - } elseif (in_array($file, $yaml_files)) { + } elseif (!empty($file) && in_array($file, $yaml_files)) { $io->error( sprintf($this->trans('commands.yaml.merge.questions.file-already-added'), $file) ); @@ -185,7 +192,7 @@ function ($file) use ($yaml_files, $io) { } if ($yaml_file) { - $yaml_files[] = $yaml_file; + $yaml_files[] = realpath($yaml_file); } } From 0ebc77d7a9a2a3e81cef39ea043f35683e10fc42 Mon Sep 17 00:00:00 2001 From: enzo - Eduardo Garcia Date: Mon, 21 Nov 2016 19:13:14 -0600 Subject: [PATCH 048/321] [config:export:*] exclude _core because its site specific (#2975) --- src/Command/Config/ExportCommand.php | 4 ++++ src/Command/Shared/ExportTrait.php | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/Command/Config/ExportCommand.php b/src/Command/Config/ExportCommand.php index c379a82e9..f0c6e999e 100644 --- a/src/Command/Config/ExportCommand.php +++ b/src/Command/Config/ExportCommand.php @@ -91,6 +91,10 @@ protected function execute(InputInterface $input, OutputInterface $output) foreach ($this->configManager->getConfigFactory()->listAll() as $name) { $configData = $this->configManager->getConfigFactory()->get($name)->getRawData(); $configName = sprintf('%s.yml', $name); + + // The _core is site-specific, so don't export it. + unset($configData['_core']); + $ymlData = Yaml::encode($configData); if ($tar) { diff --git a/src/Command/Shared/ExportTrait.php b/src/Command/Shared/ExportTrait.php index e1d6692bc..58e6f1516 100644 --- a/src/Command/Shared/ExportTrait.php +++ b/src/Command/Shared/ExportTrait.php @@ -30,6 +30,9 @@ protected function getConfiguration($configName, $uuid = false) unset($config['uuid']); } + // The _core is site-specific, so don't export it. + unset($config['_core']); + return $config; } From 47356e25bab1773d092d1c8043a5f9372aa35f42 Mon Sep 17 00:00:00 2001 From: enzo - Eduardo Garcia Date: Tue, 22 Nov 2016 08:54:44 -0600 Subject: [PATCH 049/321] Add option to remove or not uuid from config (#2977) --- src/Command/Config/ExportCommand.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Command/Config/ExportCommand.php b/src/Command/Config/ExportCommand.php index f0c6e999e..33d6fda81 100644 --- a/src/Command/Config/ExportCommand.php +++ b/src/Command/Config/ExportCommand.php @@ -54,6 +54,11 @@ protected function configure() false, InputOption::VALUE_NONE, $this->trans('commands.config.export.arguments.tar') + )->addOption( + 'remove-uuid', + '', + InputOption::VALUE_NONE, + $this->trans('commands.config.export.single.options.remove-uuid') ); } @@ -66,6 +71,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $directory = $input->getOption('directory'); $tar = $input->getOption('tar'); + $removeUuid = $input->getOption('remove-uuid'); if (!$directory) { $directory = config_get_config_directory(CONFIG_SYNC_DIRECTORY); @@ -95,6 +101,10 @@ protected function execute(InputInterface $input, OutputInterface $output) // The _core is site-specific, so don't export it. unset($configData['_core']); + if ($removeUuid) { + unset($configData['uuid']); + } + $ymlData = Yaml::encode($configData); if ($tar) { From 627879b7ca8b33e0a33781ac5ce190c3a89acd6a Mon Sep 17 00:00:00 2001 From: Marcelo Date: Thu, 24 Nov 2016 06:00:43 +0000 Subject: [PATCH 050/321] Commented lines pr (#2963) * Temporarily changing the namespace * Ignore commented lines * Change namespace for pr --- src/Command/Chain/ChainCommand.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/Command/Chain/ChainCommand.php b/src/Command/Chain/ChainCommand.php index fe64a849b..9f3d33f26 100644 --- a/src/Command/Chain/ChainCommand.php +++ b/src/Command/Chain/ChainCommand.php @@ -115,7 +115,7 @@ protected function interact(InputInterface $input, OutputInterface $output) $file = calculateRealPath($file); $input->setOption('file', $file); - $chainContent = file_get_contents($file); + $chainContent = $this->getFileContents($file); $placeholder = $input->getOption('placeholder'); $inlinePlaceHolders = $this->extractInlinePlaceHolders($chainContent); @@ -184,7 +184,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $placeholder = $this->inlineValueAsArray($placeholder); } - $chainContent = file_get_contents($file); + $chainContent = $this->getFileContents($file); $environmentPlaceHolders = $this->extractEnvironmentPlaceHolders($chainContent); $envPlaceHolderMap = []; @@ -313,4 +313,22 @@ protected function execute(InputInterface $input, OutputInterface $output) return 0; } + + /** + * Helper to load and clean up the chain file. + * + * @param string $file The file name + * + * @return string $contents The contents of the file + */ + function getFileContents($file) { + $contents = file_get_contents($file); + + // Remove lines with comments. + $contents = preg_replace('![ \t]*#.*[ \t]*[\r|\r\n|\n]!', PHP_EOL, $contents); + // Strip blank lines + $contents = preg_replace("/(^[\r\n]*|[\r\n]+)[\t]*[\r\n]+/", PHP_EOL, $contents); + + return $contents; + } } From 7badac17189386a24684ea891fe1d8049be994ab Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 23 Nov 2016 22:12:57 -0800 Subject: [PATCH 051/321] Update valid method name. (#2979) --- src/Command/Generate/ModuleCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Command/Generate/ModuleCommand.php b/src/Command/Generate/ModuleCommand.php index 584d88320..375f9d743 100644 --- a/src/Command/Generate/ModuleCommand.php +++ b/src/Command/Generate/ModuleCommand.php @@ -298,7 +298,7 @@ function ($module) use ($validator) { try { $machineName = $input->getOption('machine-name') ? - $this->validate->validateModule( + $this->validator->validateModuleName( $input->getOption('machine-name') ) : null; } catch (\Exception $error) { From d0335e89d0de9f84852bc844e6c59d7015f8222f Mon Sep 17 00:00:00 2001 From: Pablo Lopez Date: Thu, 24 Nov 2016 07:14:41 +0100 Subject: [PATCH 052/321] Include TranslationRevertRoute only when content entity is translatable (#2932) --- templates/module/src/entity-content-route-provider.php.twig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/module/src/entity-content-route-provider.php.twig b/templates/module/src/entity-content-route-provider.php.twig index 0a316ace6..ebe0aceea 100644 --- a/templates/module/src/entity-content-route-provider.php.twig +++ b/templates/module/src/entity-content-route-provider.php.twig @@ -51,10 +51,12 @@ class {{ entity_class }}HtmlRouteProvider extends AdminHtmlRouteProvider {% endb if ($delete_route = $this->getRevisionDeleteRoute($entity_type)) { $collection->add("{$entity_type_id}.revision_delete_confirm", $delete_route); } +{% if is_translatable %} if ($translation_route = $this->getRevisionTranslationRevertRoute($entity_type)) { $collection->add("{$entity_type_id}.revision_revert_translation_confirm", $translation_route); } +{% endif %} {% endif %} if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) { From 9ec28866068f902220a2ee0aeb36526488a3b0e1 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 23 Nov 2016 23:23:06 -0800 Subject: [PATCH 053/321] [console] Tag 1.0.0-rc10 release. (#2980) --- composer.json | 3 +- composer.lock | 117 ++++++++++++++++++++++---------------------- src/Application.php | 2 +- 3 files changed, 61 insertions(+), 61 deletions(-) diff --git a/composer.json b/composer.json index 64e4823cb..72a881e1f 100644 --- a/composer.json +++ b/composer.json @@ -40,11 +40,10 @@ "alchemy/zippy": "0.3.5", "composer/installers": "~1.0", "drupal/console-core" : "~1.0", - "symfony/css-selector": "~2.8", + "symfony/css-selector": "~2.7|~2.8", "symfony/debug": "~2.6|~2.8", "symfony/dom-crawler": "~2.7|~2.8", "symfony/http-foundation": "~2.8", - "phpseclib/phpseclib": "2.*", "guzzlehttp/guzzle": "~6.1", "gabordemooij/redbean": "~4.3", "doctrine/annotations": "1.2.*", diff --git a/composer.lock b/composer.lock index 405e6db0a..bbafbb5e9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "ad8d831b8d26f5842aa4ab1fcb3fc421", - "content-hash": "4db5aa142dde37801d8ee421b9395c0e", + "hash": "1742758177c164b93d4de8b99bb9d272", + "content-hash": "bb6114b0c3bdd3eb5b3e6bc282d991fa", "packages": [ { "name": "alchemy/zippy", @@ -532,22 +532,23 @@ }, { "name": "drupal/console-core", - "version": "1.0.0-rc9", + "version": "1.0.0-rc10", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "4c57bef658801d336c83a9e7f13d86af54607d10" + "reference": "45cb9ef7777540de23fd727e9c76d21b8e82cc2b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/4c57bef658801d336c83a9e7f13d86af54607d10", - "reference": "4c57bef658801d336c83a9e7f13d86af54607d10", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/45cb9ef7777540de23fd727e9c76d21b8e82cc2b", + "reference": "45cb9ef7777540de23fd727e9c76d21b8e82cc2b", "shasum": "" }, "require": { "dflydev/dot-access-configuration": "1.*", "drupal/console-en": "~1.0", "php": "^5.5.9 || ^7.0", + "phpseclib/phpseclib": "2.*", "stecman/symfony-console-completion": "~0.7", "symfony/config": "~2.8", "symfony/console": "~2.8", @@ -608,20 +609,20 @@ "drupal", "symfony" ], - "time": "2016-11-13 15:43:30" + "time": "2016-11-24 07:06:28" }, { "name": "drupal/console-en", - "version": "1.0.0-rc8", + "version": "1.0.0-rc9", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", - "reference": "789a088b3b6ecf77bc245d905a86387ada105245" + "reference": "8a2a490cd99f9e47ff4a3d88d88b6c5044ae20ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/789a088b3b6ecf77bc245d905a86387ada105245", - "reference": "789a088b3b6ecf77bc245d905a86387ada105245", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/8a2a490cd99f9e47ff4a3d88d88b6c5044ae20ad", + "reference": "8a2a490cd99f9e47ff4a3d88d88b6c5044ae20ad", "shasum": "" }, "type": "drupal-console-language", @@ -662,7 +663,7 @@ "drupal", "symfony" ], - "time": "2016-11-13 00:44:14" + "time": "2016-11-24 06:04:33" }, { "name": "gabordemooij/redbean", @@ -1154,16 +1155,16 @@ }, { "name": "symfony/config", - "version": "v2.8.13", + "version": "v2.8.14", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "f8b1922bbda9d2ac86aecd649399040bce849fde" + "reference": "1361bc4e66f97b6202ae83f4190e962c624b5e61" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/f8b1922bbda9d2ac86aecd649399040bce849fde", - "reference": "f8b1922bbda9d2ac86aecd649399040bce849fde", + "url": "https://api.github.com/repos/symfony/config/zipball/1361bc4e66f97b6202ae83f4190e962c624b5e61", + "reference": "1361bc4e66f97b6202ae83f4190e962c624b5e61", "shasum": "" }, "require": { @@ -1203,20 +1204,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2016-09-14 20:31:12" + "time": "2016-11-03 07:52:58" }, { "name": "symfony/console", - "version": "v2.8.13", + "version": "v2.8.14", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "7350016c8abcab897046f1aead2b766b84d3eff8" + "reference": "a871ba00e0f604dceac64c56c27f99fbeaf4854e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/7350016c8abcab897046f1aead2b766b84d3eff8", - "reference": "7350016c8abcab897046f1aead2b766b84d3eff8", + "url": "https://api.github.com/repos/symfony/console/zipball/a871ba00e0f604dceac64c56c27f99fbeaf4854e", + "reference": "a871ba00e0f604dceac64c56c27f99fbeaf4854e", "shasum": "" }, "require": { @@ -1264,7 +1265,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-10-06 01:43:09" + "time": "2016-11-15 23:02:12" }, { "name": "symfony/css-selector", @@ -1378,16 +1379,16 @@ }, { "name": "symfony/dependency-injection", - "version": "v2.8.13", + "version": "v2.8.14", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "3d61c765daa1a5832f1d7c767f48886b8d8ea64c" + "reference": "9d2c5033ca70ceade8d7584f997a9d3943f0fe5f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/3d61c765daa1a5832f1d7c767f48886b8d8ea64c", - "reference": "3d61c765daa1a5832f1d7c767f48886b8d8ea64c", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/9d2c5033ca70ceade8d7584f997a9d3943f0fe5f", + "reference": "9d2c5033ca70ceade8d7584f997a9d3943f0fe5f", "shasum": "" }, "require": { @@ -1437,7 +1438,7 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2016-10-24 15:52:36" + "time": "2016-11-18 21:10:01" }, { "name": "symfony/dom-crawler", @@ -1497,7 +1498,7 @@ }, { "name": "symfony/event-dispatcher", - "version": "v2.8.13", + "version": "v2.8.14", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -1606,7 +1607,7 @@ }, { "name": "symfony/filesystem", - "version": "v2.8.13", + "version": "v2.8.14", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", @@ -1655,16 +1656,16 @@ }, { "name": "symfony/finder", - "version": "v2.8.13", + "version": "v2.8.14", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "bc24c8f5674c6f6841f2856b70e5d60784be5691" + "reference": "0023b024363dfc0cd21262e556f25a291fe8d7fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/bc24c8f5674c6f6841f2856b70e5d60784be5691", - "reference": "bc24c8f5674c6f6841f2856b70e5d60784be5691", + "url": "https://api.github.com/repos/symfony/finder/zipball/0023b024363dfc0cd21262e556f25a291fe8d7fd", + "reference": "0023b024363dfc0cd21262e556f25a291fe8d7fd", "shasum": "" }, "require": { @@ -1700,7 +1701,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2016-09-28 00:10:16" + "time": "2016-11-03 07:52:58" }, { "name": "symfony/http-foundation", @@ -1759,16 +1760,16 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.2.0", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "dff51f72b0706335131b00a7f49606168c582594" + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594", - "reference": "dff51f72b0706335131b00a7f49606168c582594", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", "shasum": "" }, "require": { @@ -1780,7 +1781,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.3-dev" } }, "autoload": { @@ -1814,7 +1815,7 @@ "portable", "shim" ], - "time": "2016-05-18 14:26:46" + "time": "2016-11-14 01:06:16" }, { "name": "symfony/polyfill-php54", @@ -1932,7 +1933,7 @@ }, { "name": "symfony/process", - "version": "v2.8.13", + "version": "v2.8.14", "source": { "type": "git", "url": "https://github.com/symfony/process.git", @@ -1981,16 +1982,16 @@ }, { "name": "symfony/translation", - "version": "v2.8.13", + "version": "v2.8.14", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "cca6ff892355876534b01a927f789bac9601c935" + "reference": "edbe67e8f729885b55421d5cc58223d48540df07" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/cca6ff892355876534b01a927f789bac9601c935", - "reference": "cca6ff892355876534b01a927f789bac9601c935", + "url": "https://api.github.com/repos/symfony/translation/zipball/edbe67e8f729885b55421d5cc58223d48540df07", + "reference": "edbe67e8f729885b55421d5cc58223d48540df07", "shasum": "" }, "require": { @@ -2041,20 +2042,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2016-10-18 04:28:30" + "time": "2016-11-18 21:10:01" }, { "name": "symfony/yaml", - "version": "v2.8.13", + "version": "v2.8.14", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "396784cd06b91f3db576f248f2402d547a077787" + "reference": "befb26a3713c97af90d25dd12e75621ef14d91ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/396784cd06b91f3db576f248f2402d547a077787", - "reference": "396784cd06b91f3db576f248f2402d547a077787", + "url": "https://api.github.com/repos/symfony/yaml/zipball/befb26a3713c97af90d25dd12e75621ef14d91ff", + "reference": "befb26a3713c97af90d25dd12e75621ef14d91ff", "shasum": "" }, "require": { @@ -2090,20 +2091,20 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-10-21 20:59:10" + "time": "2016-11-14 16:15:57" }, { "name": "twig/twig", - "version": "v1.27.0", + "version": "v1.28.2", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "3c6c0033fd3b5679c6e1cb60f4f9766c2b424d97" + "reference": "b22ce0eb070e41f7cba65d78fe216de29726459c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/3c6c0033fd3b5679c6e1cb60f4f9766c2b424d97", - "reference": "3c6c0033fd3b5679c6e1cb60f4f9766c2b424d97", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/b22ce0eb070e41f7cba65d78fe216de29726459c", + "reference": "b22ce0eb070e41f7cba65d78fe216de29726459c", "shasum": "" }, "require": { @@ -2111,12 +2112,12 @@ }, "require-dev": { "symfony/debug": "~2.7", - "symfony/phpunit-bridge": "~2.7" + "symfony/phpunit-bridge": "~3.2@dev" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.27-dev" + "dev-master": "1.28-dev" } }, "autoload": { @@ -2151,7 +2152,7 @@ "keywords": [ "templating" ], - "time": "2016-10-25 19:17:17" + "time": "2016-11-23 18:41:40" }, { "name": "webflo/drupal-finder", diff --git a/src/Application.php b/src/Application.php index c97c62749..1524ce876 100644 --- a/src/Application.php +++ b/src/Application.php @@ -22,7 +22,7 @@ class Application extends ConsoleApplication /** * @var string */ - const VERSION = '1.0.0-rc9'; + const VERSION = '1.0.0-rc10'; public function __construct(ContainerInterface $container) { From da648e8ea3e7ac7f30d01788e9438683f54cbec6 Mon Sep 17 00:00:00 2001 From: Florian Weber Date: Sat, 26 Nov 2016 19:31:07 +0100 Subject: [PATCH 054/321] Dump route requirements in route:debug (#2976) --- src/Command/Router/DebugCommand.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Command/Router/DebugCommand.php b/src/Command/Router/DebugCommand.php index a620340c7..4c5a6bb79 100644 --- a/src/Command/Router/DebugCommand.php +++ b/src/Command/Router/DebugCommand.php @@ -99,6 +99,12 @@ protected function getRouteByNames(DrupalStyle $io, $route_name) $tableRows[] = $attribute; } + $tableRows[] = [''.$this->trans('commands.router.debug.messages.requirements').'']; + $requirements = $this->addRouteAttributes($route->getRequirements()); + foreach ($requirements as $requirement) { + $tableRows[] = $requirement; + } + $tableRows[] = [''.$this->trans('commands.router.debug.messages.options').'']; $options = $this->addRouteAttributes($route->getOptions()); foreach ($options as $option) { From 21ccdd152a06fa98dee7de14960016929245384d Mon Sep 17 00:00:00 2001 From: leandro Date: Sat, 26 Nov 2016 20:20:27 +0100 Subject: [PATCH 055/321] [database:client] "query" option (#2860) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * added «query» option for executing directly via option SQL sentences when using database:client * [database:client] allow «query» option for direct sql input as option. Cleaner, smoother, nicer * string for option * string for option [2] * :jack_o_lantern: 1st approximation to database:query * :jack_o_lantern: add QueryCommand.php * :spy: command database:query working * added several options --- config/services/drupal-console/database.yml | 4 + src/Command/Database/ClientCommand.php | 18 +-- src/Command/Database/QueryCommand.php | 133 ++++++++++++++++++++ 3 files changed, 146 insertions(+), 9 deletions(-) create mode 100644 src/Command/Database/QueryCommand.php diff --git a/config/services/drupal-console/database.yml b/config/services/drupal-console/database.yml index ffeb73e6e..348f5d394 100644 --- a/config/services/drupal-console/database.yml +++ b/config/services/drupal-console/database.yml @@ -3,6 +3,10 @@ services: class: Drupal\Console\Command\Database\ClientCommand tags: - { name: drupal.command } + console.database_query: + class: Drupal\Console\Command\Database\QueryCommand + tags: + - { name: drupal.command } console.database_connect: class: Drupal\Console\Command\Database\ConnectCommand tags: diff --git a/src/Command/Database/ClientCommand.php b/src/Command/Database/ClientCommand.php index d6a4a494f..0f9b13b9d 100644 --- a/src/Command/Database/ClientCommand.php +++ b/src/Command/Database/ClientCommand.php @@ -50,15 +50,15 @@ protected function execute(InputInterface $input, OutputInterface $output) $databaseConnection = $this->resolveConnection($io, $database); - $connection = sprintf( - '%s -A --database=%s --user=%s --password=%s --host=%s --port=%s', - $databaseConnection['driver'], - $databaseConnection['database'], - $databaseConnection['username'], - $databaseConnection['password'], - $databaseConnection['host'], - $databaseConnection['port'] - ); + $connection = sprintf( + '%s -A --database=%s --user=%s --password=%s --host=%s --port=%s', + $databaseConnection['driver'], + $databaseConnection['database'], + $databaseConnection['username'], + $databaseConnection['password'], + $databaseConnection['host'], + $databaseConnection['port'] + ); if ($learning) { $io->commentBlock( diff --git a/src/Command/Database/QueryCommand.php b/src/Command/Database/QueryCommand.php new file mode 100644 index 000000000..e32809675 --- /dev/null +++ b/src/Command/Database/QueryCommand.php @@ -0,0 +1,133 @@ +setName('database:query') + ->setDescription($this->trans('commands.database.query.description')) + ->addArgument( + 'query', + InputArgument::REQUIRED, + $this->trans('commands.database.query.arguments.query') + ) + ->addArgument( + 'database', + InputArgument::OPTIONAL, + $this->trans('commands.database.query.arguments.database'), + 'default' + ) + ->addOption('quick', '', InputOption::VALUE_NONE, $this->trans('commands.database.query.options.quick')) + ->addOption('debug', '', InputOption::VALUE_NONE, $this->trans('commands.database.query.options.debug')) + ->addOption('html', '', InputOption::VALUE_NONE, $this->trans('commands.database.query.options.html')) + ->addOption('xml', '', InputOption::VALUE_NONE, $this->trans('commands.database.query.options.xml')) + ->addOption('raw', '', InputOption::VALUE_NONE, $this->trans('commands.database.query.options.raw')) + ->addOption('vertical', '', InputOption::VALUE_NONE, $this->trans('commands.database.query.options.vertical')) + ->addOption('batch', '', InputOption::VALUE_NONE, $this->trans('commands.database.query.options.batch')) + + ->setHelp($this->trans('commands.database.query.help')); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $query = $input->getArgument('query'); + $database = $input->getArgument('database'); + $learning = $input->getOption('learning'); + + $databaseConnection = $this->resolveConnection($io, $database); + + $connection = sprintf( + '%s -A --database=%s --user=%s --password=%s --host=%s --port=%s', + $databaseConnection['driver'], + $databaseConnection['database'], + $databaseConnection['username'], + $databaseConnection['password'], + $databaseConnection['host'], + $databaseConnection['port'] + ); + + $args = explode(' ', $connection); + $args[] = sprintf('--execute=%s', $query); + + $opts = ["quick", "debug", "html", "xml", "raw", "vertical", "batch"]; + array_walk($opts, function($opt) use ($input, &$args) { + if ($input->getOption($opt)) { + switch ($opt) { + case "quick": + $args[] = "--quick"; + break; + case "debug": + $args[] = "-T"; + break; + case "html": + $args[] = "-H"; + break; + case "xml": + $args[] = "-X"; + break; + case "raw": + $args[] = "--raw"; + break; + case "vertical": + $args[] = "-E"; + break; + case "batch": + $args[] = "--batch"; + break; + } + } + }); + + if ($learning) { + $io->commentBlock( + implode(" ", $args) + ); + } + + $processBuilder = new ProcessBuilder([]); + $processBuilder->setArguments($args); + $process = $processBuilder->getProcess(); + $process->setTty('true'); + $process->run(); + + if (!$process->isSuccessful()) { + throw new \RuntimeException($process->getErrorOutput()); + } + + return 0; + } +} From da62fd5728a9447774e8297e1935922417be876f Mon Sep 17 00:00:00 2001 From: Adam Balsam Date: Tue, 29 Nov 2016 17:54:05 -0500 Subject: [PATCH 056/321] Update symfony/dom-crawler constraints (#2983) re https://github.com/acquia/lightning-project/issues/15 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 72a881e1f..947e29b50 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ "drupal/console-core" : "~1.0", "symfony/css-selector": "~2.7|~2.8", "symfony/debug": "~2.6|~2.8", - "symfony/dom-crawler": "~2.7|~2.8", + "symfony/dom-crawler": "~2.8|~3.0", "symfony/http-foundation": "~2.8", "guzzlehttp/guzzle": "~6.1", "gabordemooij/redbean": "~4.3", From d83d11e6fc41157a51d36bf00c76a5df41c53798 Mon Sep 17 00:00:00 2001 From: Marcelo Date: Thu, 1 Dec 2016 03:40:22 +0000 Subject: [PATCH 057/321] Chain register (#2961) * Temporarily changing package name * Added template option * Implemented template option * Added file * Added ChainRegister * Check if file exists * Added example of usage of ChainRegister * Use chain.yml with ChainRegister * No need to check * Do not check if file exists * Removing these changes * Prep pull request * Chain for site:new * Removed chain.yml * Removed get config * Removed get config * Temporarily changing the namespace * reset namespace --- src/Application.php | 7 +++ src/Command/Chain/ChainCommand.php | 55 ++++++++++++----- src/Command/Chain/ChainRegister.php | 93 +++++++++++++++++++++++++++++ 3 files changed, 140 insertions(+), 15 deletions(-) create mode 100644 src/Command/Chain/ChainRegister.php diff --git a/src/Application.php b/src/Application.php index 1524ce876..770241f48 100644 --- a/src/Application.php +++ b/src/Application.php @@ -7,6 +7,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Console\Utils\AnnotationValidator; use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Command\Chain\ChainRegister; /** * Class Application @@ -107,6 +108,12 @@ private function registerCommands() $logger->writeln($this->trans('application.site.errors.settings')); } + foreach ($chainCommands as $name => $chainCommand) { + $file = $chainCommand['file']; + $command = new ChainRegister($name, $file); + $this->add($command); + } + $serviceDefinitions = []; $annotationValidator = null; if ($this->container->hasParameter('console.service_definitions')) { diff --git a/src/Command/Chain/ChainCommand.php b/src/Command/Chain/ChainCommand.php index 9f3d33f26..6b5543e82 100644 --- a/src/Command/Chain/ChainCommand.php +++ b/src/Command/Chain/ChainCommand.php @@ -33,6 +33,11 @@ class ChainCommand extends Command use ChainFilesTrait; use InputTrait; + /** + * @var string + */ + protected $file = null; + /** * @var ChainQueue */ @@ -78,21 +83,31 @@ public function __construct( */ protected function configure() { + if (is_null($this->getName())) { + $this + ->setName('chain') + ->setDescription($this->trans('commands.chain.description')); + } + else { + // ChainRegister passes name and file in the constructor. + $this + ->setName(sprintf('chain:%s', $this->getName())) + ->setDescription(sprintf('Custom chain: %s', $this->getName())); + } + $this - ->setName('chain') - ->setDescription($this->trans('commands.chain.description')) - ->addOption( - 'file', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.chain.options.file') - ) - ->addOption( - 'placeholder', - null, - InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, - $this->trans('commands.chain.options.placeholder') - ); + ->addOption( + 'file', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.chain.options.file') + ) + ->addOption( + 'placeholder', + null, + InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, + $this->trans('commands.chain.options.placeholder') + ); } /** @@ -101,7 +116,8 @@ protected function configure() protected function interact(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); - $file = $input->getOption('file'); + // Check if the constructor passed a value for file. + $file = !is_null($this->file) ? $this->file : $input->getOption('file'); if (!$file) { $files = $this->getChainFiles(true); @@ -314,6 +330,15 @@ protected function execute(InputInterface $input, OutputInterface $output) return 0; } + /** + * Setter for $file. + * + * @param $file + */ + public function setFile($file) { + $this->file = $file; + } + /** * Helper to load and clean up the chain file. * diff --git a/src/Command/Chain/ChainRegister.php b/src/Command/Chain/ChainRegister.php new file mode 100644 index 000000000..1f58111e9 --- /dev/null +++ b/src/Command/Chain/ChainRegister.php @@ -0,0 +1,93 @@ +setName($name); + $this->setFile($file); + + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() { + parent::configure(); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) { + parent::interact($input, $output); + + $io = new DrupalStyle($input, $output); + + // Populate placeholders. + $placeholders = ''; + foreach ($input->getOption('placeholder') as $placeholder) { + $placeholders .= sprintf('--placeholder="%s" ', + $placeholder + ); + } + + $command = sprintf('drupal chain --file %s %s', + $this->file, + $placeholders + ); + + // Run. + $shellProcess = $this->get('shell_process'); + + if (!$shellProcess->exec($command, TRUE)) { + $io->error( + sprintf( + $this->trans('commands.exec.messages.invalid-bin') + ) + ); + + return 1; + } + } +} From 32f1851d92d2a68396b67036c420e867ddc02714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20PERRIN?= Date: Thu, 1 Dec 2016 07:46:14 +0400 Subject: [PATCH 058/321] [BUGFIX 2581] Ensure AnnotationRegistry::registerLoader is correctly defined (#2946) --- src/Application.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Application.php b/src/Application.php index 770241f48..9b39f71d6 100644 --- a/src/Application.php +++ b/src/Application.php @@ -2,6 +2,7 @@ namespace Drupal\Console; +use Doctrine\Common\Annotations\AnnotationRegistry; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -132,6 +133,11 @@ private function registerCommands() ->get('application.commands.aliases')?:[]; foreach ($consoleCommands as $name) { + // Some commands call AnnotationRegistry::reset, we need to ensure that + // the AnnotationRegistry is correctly defined. + AnnotationRegistry::reset(); + AnnotationRegistry::registerLoader([\Drupal::service('class_loader'), "loadClass"]); + if (!$this->container->has($name)) { continue; } From 4c9e2b03115d67ab20384371683d7222eb83f6ec Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 1 Dec 2016 02:48:50 -0800 Subject: [PATCH 059/321] [site:install] Allow re-install using database settings. (#2984) --- src/Command/Site/InstallCommand.php | 113 +++++++++++++++++----------- 1 file changed, 68 insertions(+), 45 deletions(-) diff --git a/src/Command/Site/InstallCommand.php b/src/Command/Site/InstallCommand.php index 86ab3d992..53ca3421a 100644 --- a/src/Command/Site/InstallCommand.php +++ b/src/Command/Site/InstallCommand.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Command\Site; +use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Config\Definition\Exception\Exception; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; @@ -67,31 +68,33 @@ public function __construct( parent::__construct(); } - // protected $connection; - protected function configure() { $this ->setName('site:install') ->setDescription($this->trans('commands.site.install.description')) - ->addArgument('profile', InputArgument::OPTIONAL, $this->trans('commands.site.install.arguments.profile')) + ->addArgument( + 'profile', + InputArgument::OPTIONAL, + $this->trans('commands.site.install.arguments.profile') + ) ->addOption( 'langcode', '', InputOption::VALUE_REQUIRED, - $this->trans('commands.site.install.arguments.langcode') + $this->trans('commands.site.install.options.langcode') ) ->addOption( 'db-type', '', InputOption::VALUE_REQUIRED, - $this->trans('commands.site.install.arguments.db-type') + $this->trans('commands.site.install.options.db-type') ) ->addOption( 'db-file', '', InputOption::VALUE_REQUIRED, - $this->trans('commands.site.install.arguments.db-file') + $this->trans('commands.site.install.options.db-file') ) ->addOption( 'db-host', @@ -133,31 +136,37 @@ protected function configure() 'site-name', '', InputOption::VALUE_REQUIRED, - $this->trans('commands.site.install.arguments.site-name') + $this->trans('commands.site.install.options.site-name') ) ->addOption( 'site-mail', '', InputOption::VALUE_REQUIRED, - $this->trans('commands.site.install.arguments.site-mail') + $this->trans('commands.site.install.options.site-mail') ) ->addOption( 'account-name', '', InputOption::VALUE_REQUIRED, - $this->trans('commands.site.install.arguments.account-name') + $this->trans('commands.site.install.options.account-name') ) ->addOption( 'account-mail', '', InputOption::VALUE_REQUIRED, - $this->trans('commands.site.install.arguments.account-mail') + $this->trans('commands.site.install.options.account-mail') ) ->addOption( 'account-pass', '', InputOption::VALUE_REQUIRED, - $this->trans('commands.site.install.arguments.account-pass') + $this->trans('commands.site.install.options.account-pass') + ) + ->addOption( + 'force', + '', + InputOption::VALUE_NONE, + $this->trans('commands.site.install.options.force') ); } @@ -188,13 +197,13 @@ function ($profile) { $profile = $io->choice( $this->trans('commands.site.install.questions.profile'), - $profiles + array_values($profiles) ); $input->setArgument('profile', $profile); } - // // --langcode option + // --langcode option $langcode = $input->getOption('langcode'); if (!$langcode) { $languages = $this->site->getStandardLanguages(); @@ -214,7 +223,6 @@ function ($profile) { // Use default database setting if is available $database = Database::getConnectionInfo(); if (empty($database['default'])) { - // --db-type option $dbType = $input->getOption('db-type'); if (!$dbType) { @@ -309,7 +317,7 @@ function ($profile) { if (!$siteName) { $siteName = $io->ask( $this->trans('commands.site.install.questions.site-name'), - 'Drupal 8 Site Install' + 'Drupal 8' ); $input->setOption('site-name', $siteName); } @@ -362,26 +370,32 @@ protected function execute(InputInterface $input, OutputInterface $output) $io = new DrupalStyle($input, $output); // Database options - $dbType = $input->getOption('db-type'); + $dbType = $input->getOption('db-type')?:'mysql'; $dbFile = $input->getOption('db-file'); - $dbHost = $input->getOption('db-host'); - $dbName = $input->getOption('db-name'); - $dbUser = $input->getOption('db-user'); - $dbPass = $input->getOption('db-pass'); + $dbHost = $input->getOption('db-host')?:'127.0.0.1'; + $dbName = $input->getOption('db-name')?:'drupal_'.time(); + $dbUser = $input->getOption('db-user')?:'root'; + $dbPass = $input->getOption('db-pass')?:'root'; $dbPrefix = $input->getOption('db-prefix'); - $dbPort = $input->getOption('db-port'); + $dbPort = $input->getOption('db-port')?:'3306'; + $force = $input->getOption('force'); $databases = $this->site->getDatabaseTypes(); if ($dbType === 'sqlite') { - $database = array( + $database = [ 'database' => $dbFile, 'prefix' => $dbPrefix, 'namespace' => $databases[$dbType]['namespace'], 'driver' => $dbType, - ); + ]; + + if ($force) { + $fs = new Filesystem(); + $fs->remove($dbFile); + } } else { - $database = array( + $database = [ 'database' => $dbName, 'username' => $dbUser, 'password' => $dbPass, @@ -390,7 +404,15 @@ protected function execute(InputInterface $input, OutputInterface $output) 'host' => $dbHost, 'namespace' => $databases[$dbType]['namespace'], 'driver' => $dbType, - ); + ]; + + if ($force && Database::getConnectionInfo()) { + $schema = Database::getConnection()->schema(); + $tables = $schema->findTables('%'); + foreach ($tables as $table) { + $schema->dropTable($table); + } + } } $this->backupSitesFile($io); @@ -398,7 +420,7 @@ protected function execute(InputInterface $input, OutputInterface $output) try { $this->runInstaller($io, $input, $database); } catch (Exception $e) { - $output->error($e->getMessage()); + $io->error($e->getMessage()); return; } @@ -442,7 +464,7 @@ protected function restoreSitesFile(DrupalStyle $output) } protected function runInstaller( - DrupalStyle $output, + DrupalStyle $io, InputInterface $input, $database ) { @@ -451,8 +473,8 @@ protected function runInstaller( $driver = (string) $database['driver']; $settings = [ 'parameters' => [ - 'profile' => $input->getArgument('profile'), - 'langcode' => $input->getOption('langcode'), + 'profile' => $input->getArgument('profile')?:'standard', + 'langcode' => $input->getOption('langcode')?:'en', ], 'forms' => [ 'install_settings_form' => [ @@ -461,39 +483,40 @@ protected function runInstaller( 'op' => 'Save and continue', ], 'install_configure_form' => [ - 'site_name' => $input->getOption('site-name'), - 'site_mail' => $input->getOption('site-mail'), - 'account' => array( - 'name' => $input->getOption('account-name'), - 'mail' => $input->getOption('account-mail'), - 'pass' => array( - 'pass1' => $input->getOption('account-pass'), - 'pass2' => $input->getOption('account-pass') - ), - ), - 'update_status_module' => array( + 'site_name' => $input->getOption('site-name')?:'Drupal 8', + 'site_mail' => $input->getOption('site-mail')?:'admin@example.org', + 'account' => [ + 'name' => $input->getOption('account-name')?:'admin', + 'mail' => $input->getOption('account-mail')?:'admin@example.org', + 'pass' => [ + 'pass1' => $input->getOption('account-pass')?:'admin', + 'pass2' => $input->getOption('account-pass')?:'admin' + ], + ], + 'update_status_module' => [ 1 => true, 2 => true, - ), + ], 'clean_url' => true, 'op' => 'Save and continue', ], ] ]; - $output->info($this->trans('commands.site.install.messages.installing')); + $io->newLine(); + $io->info($this->trans('commands.site.install.messages.installing')); try { $autoload = $this->site->getAutoload(); install_drupal($autoload, $settings); } catch (AlreadyInstalledException $e) { - $output->error($this->trans('commands.site.install.messages.already-installed')); + $io->error($this->trans('commands.site.install.messages.already-installed')); return; } catch (\Exception $e) { - $output->error($e->getMessage()); + $io->error($e->getMessage()); return; } - $output->success($this->trans('commands.site.install.messages.installed')); + $io->success($this->trans('commands.site.install.messages.installed')); } } From b7d4b38a83e76dc4ef0ad2edb9b160efc2422c8f Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 1 Dec 2016 03:01:18 -0800 Subject: [PATCH 060/321] [logger] Remover logger. (#2985) --- bin/drupal.php | 3 +- src/Application.php | 23 ++++++------- src/Bootstrap/Drupal.php | 23 ++----------- src/Utils/Logger.php | 72 ---------------------------------------- 4 files changed, 14 insertions(+), 107 deletions(-) delete mode 100644 src/Utils/Logger.php diff --git a/bin/drupal.php b/bin/drupal.php index b4a5ae327..2a2389662 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -48,8 +48,7 @@ $container = $drupal->boot(); if (!$container) { - echo ' Something goes wrong, try checking the log file at:' . PHP_EOL . - ' ' . $composerRoot . '/console/log/' . date('Y-m-d') . '.log' . PHP_EOL; + echo ' Something goes wrong. Drupal can not be bootstrapped.'; exit(1); } diff --git a/src/Application.php b/src/Application.php index 9b39f71d6..36ed140c9 100644 --- a/src/Application.php +++ b/src/Application.php @@ -92,7 +92,6 @@ private function registerGenerators() private function registerCommands() { - $logger = $this->container->get('console.logger'); if ($this->container->hasParameter('drupal.commands')) { $consoleCommands = $this->container->getParameter( 'drupal.commands' @@ -105,15 +104,13 @@ private function registerCommands() 'console.warning', 'application.site.errors.settings' ); - - $logger->writeln($this->trans('application.site.errors.settings')); } - foreach ($chainCommands as $name => $chainCommand) { - $file = $chainCommand['file']; - $command = new ChainRegister($name, $file); - $this->add($command); - } +// foreach ($chainCommands as $name => $chainCommand) { +// $file = $chainCommand['file']; +// $command = new ChainRegister($name, $file); +// $this->add($command); +// } $serviceDefinitions = []; $annotationValidator = null; @@ -133,10 +130,13 @@ private function registerCommands() ->get('application.commands.aliases')?:[]; foreach ($consoleCommands as $name) { - // Some commands call AnnotationRegistry::reset, we need to ensure that - // the AnnotationRegistry is correctly defined. + // Some commands call AnnotationRegistry::reset, + // we need to ensure the AnnotationRegistry is correctly defined. AnnotationRegistry::reset(); - AnnotationRegistry::registerLoader([\Drupal::service('class_loader'), "loadClass"]); + AnnotationRegistry::registerLoader([ + \Drupal::service('class_loader'), + "loadClass"] + ); if (!$this->container->has($name)) { continue; @@ -155,7 +155,6 @@ private function registerCommands() try { $command = $this->container->get($name); } catch (\Exception $e) { - $logger->writeln($e->getMessage()); continue; } diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index 5e740bdbe..70328dfbf 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -5,7 +5,6 @@ use Doctrine\Common\Annotations\AnnotationRegistry; use Symfony\Component\HttpFoundation\Request; use Drupal\Console\Utils\ArgvInputReader; -use Drupal\Console\Utils\Logger; class Drupal { @@ -28,16 +27,9 @@ public function __construct($autoload, $root, $appRoot) public function boot() { - $logger = new Logger($this->root); if (!class_exists('Drupal\Core\DrupalKernel')) { - $logger->writeln('Class Drupal\Core\DrupalKernel not found.'); $drupal = new DrupalConsoleCore($this->root, $this->appRoot); - $container = $drupal->boot(); - $container->set( - 'console.logger', - $logger - ); - return $container; + return $drupal->boot(); } try { @@ -85,11 +77,6 @@ public function boot() $container->set('console.root', $this->root); - $container->set( - 'console.logger', - $logger - ); - AnnotationRegistry::registerLoader([$this->autoload, "loadClass"]); $configuration = $container->get('console.configuration_manager') @@ -112,14 +99,8 @@ public function boot() return $container; } catch (\Exception $e) { - $logger->writeln($e->getMessage()); $drupal = new DrupalConsoleCore($this->root, $this->appRoot); - $container = $drupal->boot(); - $container->set( - 'console.logger', - $logger - ); - return $container; + return $drupal->boot(); } } } diff --git a/src/Utils/Logger.php b/src/Utils/Logger.php deleted file mode 100644 index 1820502d6..000000000 --- a/src/Utils/Logger.php +++ /dev/null @@ -1,72 +0,0 @@ -handle = null; - $this->init($root); - } - - protected function init($root) { - $loggerFile = $root.'/console/log/' . date('Y-m-d') . '.log'; - if (!is_file($loggerFile)) { - try { - $directoryName = dirname($loggerFile); - if (!is_dir($directoryName )) { - mkdir($directoryName, 0777, TRUE); - } - touch($loggerFile); - } catch (\Exception $e) { - $this->output = new ConsoleOutput(); - return; - } - } - - if (!is_writable($loggerFile)) { - $this->output = new ConsoleOutput(); - return; - } - - try { - $this->handle = fopen($loggerFile, 'a+'); - $this->output = new StreamOutput($this->handle); - return; - } catch (\Exception $e) { - $this->output = new ConsoleOutput(); - return; - } - } - - public function writeln($message) { - if ($this->handle) { - $message = sprintf( - '%s %s', - date('h:i:s'), - $message - ); - } - $this->output->writeln($message); - } - -// public function closeHandler() { -// if ($this->handle) { -// fclose($this->handle); -// } -// } -} \ No newline at end of file From 35bd1f53cd0b8ead76922716722bf897c730ab26 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 1 Dec 2016 03:44:52 -0800 Subject: [PATCH 061/321] [chain] FIx command register. (#2986) --- src/Application.php | 13 +++- src/Command/Chain/ChainCommand.php | 57 ++++++----------- src/Command/Chain/ChainRegister.php | 95 ++++++++++++++--------------- 3 files changed, 74 insertions(+), 91 deletions(-) diff --git a/src/Application.php b/src/Application.php index 36ed140c9..daa6232f5 100644 --- a/src/Application.php +++ b/src/Application.php @@ -106,6 +106,11 @@ private function registerCommands() ); } +// // @TODO add auto-discovery of chain files +// $chainCommands['create:bulk:data'] = [ +// 'file' => '/Users/jmolivas/.console/chain/create-data.yml' +// ]; +// // foreach ($chainCommands as $name => $chainCommand) { // $file = $chainCommand['file']; // $command = new ChainRegister($name, $file); @@ -133,9 +138,11 @@ private function registerCommands() // Some commands call AnnotationRegistry::reset, // we need to ensure the AnnotationRegistry is correctly defined. AnnotationRegistry::reset(); - AnnotationRegistry::registerLoader([ - \Drupal::service('class_loader'), - "loadClass"] + AnnotationRegistry::registerLoader( + [ + \Drupal::service('class_loader'), + "loadClass" + ] ); if (!$this->container->has($name)) { diff --git a/src/Command/Chain/ChainCommand.php b/src/Command/Chain/ChainCommand.php index 6b5543e82..34a1d6e11 100644 --- a/src/Command/Chain/ChainCommand.php +++ b/src/Command/Chain/ChainCommand.php @@ -33,11 +33,6 @@ class ChainCommand extends Command use ChainFilesTrait; use InputTrait; - /** - * @var string - */ - protected $file = null; - /** * @var ChainQueue */ @@ -83,31 +78,21 @@ public function __construct( */ protected function configure() { - if (is_null($this->getName())) { - $this - ->setName('chain') - ->setDescription($this->trans('commands.chain.description')); - } - else { - // ChainRegister passes name and file in the constructor. - $this - ->setName(sprintf('chain:%s', $this->getName())) - ->setDescription(sprintf('Custom chain: %s', $this->getName())); - } - $this - ->addOption( - 'file', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.chain.options.file') - ) - ->addOption( - 'placeholder', - null, - InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, - $this->trans('commands.chain.options.placeholder') - ); + ->setName('chain') + ->setDescription($this->trans('commands.chain.description')) + ->addOption( + 'file', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.chain.options.file') + ) + ->addOption( + 'placeholder', + null, + InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, + $this->trans('commands.chain.options.placeholder') + ); } /** @@ -117,7 +102,7 @@ protected function interact(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); // Check if the constructor passed a value for file. - $file = !is_null($this->file) ? $this->file : $input->getOption('file'); + $file = $input->getOption('file'); if (!$file) { $files = $this->getChainFiles(true); @@ -330,15 +315,6 @@ protected function execute(InputInterface $input, OutputInterface $output) return 0; } - /** - * Setter for $file. - * - * @param $file - */ - public function setFile($file) { - $this->file = $file; - } - /** * Helper to load and clean up the chain file. * @@ -346,7 +322,8 @@ public function setFile($file) { * * @return string $contents The contents of the file */ - function getFileContents($file) { + public function getFileContents($file) + { $contents = file_get_contents($file); // Remove lines with comments. diff --git a/src/Command/Chain/ChainRegister.php b/src/Command/Chain/ChainRegister.php index 1f58111e9..de165b643 100644 --- a/src/Command/Chain/ChainRegister.php +++ b/src/Command/Chain/ChainRegister.php @@ -18,76 +18,75 @@ namespace Drupal\Console\Command\Chain; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Yaml\Parser; -use Symfony\Component\Console\Application; -use Drupal\Console\Utils\ConfigurationManager; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Command\Command; use Drupal\Console\Command\Shared\ChainFilesTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Command\Shared\CommandTrait; + /** * Class ChainRegister * * @package Drupal\Console\Command\ChainRegister */ -class ChainRegister extends ChainCommand { - use ChainFilesTrait; +class ChainRegister extends Command +{ + use CommandTrait; + use ChainFilesTrait; - /** + protected $name; + + protected $file; + + /** * ChainRegister constructor. * - * @param $name Chain name - * @param $file File name + * @param $name + * @param $file */ - public function __construct($name, $file) { - $this->setName($name); - $this->setFile($file); + public function __construct($name, $file) + { + $this->name = $name; + $this->file = $file; - parent::__construct(); - } + parent::__construct(); + } - /** + /** * {@inheritdoc} */ - protected function configure() { - parent::configure(); - } + protected function configure() + { + $this + ->setName($this->name) + ->setDescription(sprintf('Custom chain command (%s)', $this->name)) + ->addOption( + 'placeholder', + null, + InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, + $this->trans('commands.chain.options.placeholder') + ); + } - /** + /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) { - parent::interact($input, $output); - - $io = new DrupalStyle($input, $output); - - // Populate placeholders. - $placeholders = ''; - foreach ($input->getOption('placeholder') as $placeholder) { - $placeholders .= sprintf('--placeholder="%s" ', - $placeholder - ); - } - - $command = sprintf('drupal chain --file %s %s', - $this->file, - $placeholders - ); + protected function execute(InputInterface $input, OutputInterface $output) + { + $command = $this->getApplication()->find('chain'); - // Run. - $shellProcess = $this->get('shell_process'); + $arguments = [ + 'command' => 'chain', + '--file' => $this->file, + '--placeholder' => $input->getOption('placeholder'), + '--generate-inline' => $input->hasOption('generate-inline'), + '--no-interaction' => $input->hasOption('no-interaction') + ]; - if (!$shellProcess->exec($command, TRUE)) { - $io->error( - sprintf( - $this->trans('commands.exec.messages.invalid-bin') - ) - ); + $commandInput = new ArrayInput($arguments); - return 1; + return $command->run($commandInput, $output); } - } } From 1c6020c2716ffa7d0fee8d8df619266b731c42b2 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 1 Dec 2016 19:06:35 -0800 Subject: [PATCH 062/321] Update to Symfony 3. (#2988) --- composer.json | 10 +- composer.lock | 368 ++++++++++++---------------- src/Command/CommandDependencies.php | 53 ---- src/Utils/YamlFileDumper.php | 88 ------- 4 files changed, 167 insertions(+), 352 deletions(-) delete mode 100644 src/Command/CommandDependencies.php delete mode 100644 src/Utils/YamlFileDumper.php diff --git a/composer.json b/composer.json index 947e29b50..9ef16af9e 100644 --- a/composer.json +++ b/composer.json @@ -40,15 +40,15 @@ "alchemy/zippy": "0.3.5", "composer/installers": "~1.0", "drupal/console-core" : "~1.0", - "symfony/css-selector": "~2.7|~2.8", - "symfony/debug": "~2.6|~2.8", - "symfony/dom-crawler": "~2.8|~3.0", - "symfony/http-foundation": "~2.8", + "symfony/css-selector": "~2.7|~3.1", + "symfony/debug": "~2.6|~3.1", + "symfony/dom-crawler": "~2.8|~3.1", + "symfony/http-foundation": "~2.8|~3.1", "guzzlehttp/guzzle": "~6.1", "gabordemooij/redbean": "~4.3", "doctrine/annotations": "1.2.*", "dflydev/placeholder-resolver": "~1.0", - "symfony/expression-language": "^2.8" + "symfony/expression-language": "~2.8|~3.1" }, "bin": ["bin/drupal"], "config": { diff --git a/composer.lock b/composer.lock index bbafbb5e9..be9c353f5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "1742758177c164b93d4de8b99bb9d272", - "content-hash": "bb6114b0c3bdd3eb5b3e6bc282d991fa", + "hash": "cf4cb7fae99a73d6d41df03b30866a1a", + "content-hash": "35a2eb230857d08ea3feb83062d52955", "packages": [ { "name": "alchemy/zippy", @@ -770,16 +770,16 @@ }, { "name": "guzzlehttp/promises", - "version": "1.2.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579" + "reference": "2693c101803ca78b27972d84081d027fca790a1e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/c10d860e2a9595f8883527fa0021c7da9e65f579", - "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579", + "url": "https://api.github.com/repos/guzzle/promises/zipball/2693c101803ca78b27972d84081d027fca790a1e", + "reference": "2693c101803ca78b27972d84081d027fca790a1e", "shasum": "" }, "require": { @@ -817,7 +817,7 @@ "keywords": [ "promise" ], - "time": "2016-05-18 16:56:05" + "time": "2016-11-18 17:47:58" }, { "name": "guzzlehttp/psr7", @@ -877,48 +877,6 @@ ], "time": "2016-06-24 23:00:38" }, - { - "name": "ircmaxell/password-compat", - "version": "v1.0.4", - "source": { - "type": "git", - "url": "https://github.com/ircmaxell/password_compat.git", - "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ircmaxell/password_compat/zipball/5c5cde8822a69545767f7c7f3058cb15ff84614c", - "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c", - "shasum": "" - }, - "require-dev": { - "phpunit/phpunit": "4.*" - }, - "type": "library", - "autoload": { - "files": [ - "lib/password.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Anthony Ferrara", - "email": "ircmaxell@php.net", - "homepage": "http://blog.ircmaxell.com" - } - ], - "description": "A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash", - "homepage": "https://github.com/ircmaxell/password_compat", - "keywords": [ - "hashing", - "password" - ], - "time": "2014-11-20 16:49:30" - }, { "name": "phpseclib/phpseclib", "version": "2.0.4", @@ -1011,6 +969,52 @@ ], "time": "2016-10-04 00:57:04" }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "time": "2016-08-06 20:24:11" + }, { "name": "psr/http-message", "version": "1.0.1", @@ -1153,6 +1157,73 @@ "description": "Automatic BASH completion for Symfony Console Component based applications.", "time": "2016-02-24 05:08:54" }, + { + "name": "symfony/cache", + "version": "v3.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/cache.git", + "reference": "1e5b048afac6bb08454feb99f4a434ccb92c706d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/cache/zipball/1e5b048afac6bb08454feb99f4a434ccb92c706d", + "reference": "1e5b048afac6bb08454feb99f4a434ccb92c706d", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "psr/cache": "~1.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/cache-implementation": "1.0" + }, + "require-dev": { + "cache/integration-tests": "dev-master", + "doctrine/cache": "~1.6", + "doctrine/dbal": "~2.4", + "predis/predis": "~1.0" + }, + "suggest": { + "symfony/polyfill-apcu": "For using ApcuAdapter on HHVM" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Cache\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony implementation of PSR-6", + "homepage": "https://symfony.com", + "keywords": [ + "caching", + "psr6" + ], + "time": "2016-11-25 20:20:19" + }, { "name": "symfony/config", "version": "v2.8.14", @@ -1269,25 +1340,25 @@ }, { "name": "symfony/css-selector", - "version": "v2.8.13", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "71c8c3a04c126300c37089b1baa7c6322dfb845f" + "reference": "e1241f275814827c411d922ba8e64cf2a00b2994" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/71c8c3a04c126300c37089b1baa7c6322dfb845f", - "reference": "71c8c3a04c126300c37089b1baa7c6322dfb845f", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/e1241f275814827c411d922ba8e64cf2a00b2994", + "reference": "e1241f275814827c411d922ba8e64cf2a00b2994", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": ">=5.5.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1318,20 +1389,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2016-09-06 10:55:00" + "time": "2016-11-03 08:11:03" }, { "name": "symfony/debug", - "version": "v2.8.13", + "version": "v2.8.14", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "8c29235936a47473af16fb91c7c4b7b193c5693c" + "reference": "62a68f640456f6761d752c62d81631428ef0d8a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/8c29235936a47473af16fb91c7c4b7b193c5693c", - "reference": "8c29235936a47473af16fb91c7c4b7b193c5693c", + "url": "https://api.github.com/repos/symfony/debug/zipball/62a68f640456f6761d752c62d81631428ef0d8a1", + "reference": "62a68f640456f6761d752c62d81631428ef0d8a1", "shasum": "" }, "require": { @@ -1375,7 +1446,7 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2016-09-06 10:55:00" + "time": "2016-11-15 12:53:17" }, { "name": "symfony/dependency-injection", @@ -1442,24 +1513,24 @@ }, { "name": "symfony/dom-crawler", - "version": "v2.8.13", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "a94f3fe6f179d6453e5ed8188cf4bfdf933d85f4" + "reference": "c6b6111f5aae7c58698cdc10220785627ac44a2c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/a94f3fe6f179d6453e5ed8188cf4bfdf933d85f4", - "reference": "a94f3fe6f179d6453e5ed8188cf4bfdf933d85f4", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/c6b6111f5aae7c58698cdc10220785627ac44a2c", + "reference": "c6b6111f5aae7c58698cdc10220785627ac44a2c", "shasum": "" }, "require": { - "php": ">=5.3.9", + "php": ">=5.5.9", "symfony/polyfill-mbstring": "~1.0" }, "require-dev": { - "symfony/css-selector": "~2.8|~3.0.0" + "symfony/css-selector": "~2.8|~3.0" }, "suggest": { "symfony/css-selector": "" @@ -1467,7 +1538,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1494,7 +1565,7 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2016-10-18 15:35:45" + "time": "2016-11-25 12:32:42" }, { "name": "symfony/event-dispatcher", @@ -1558,25 +1629,26 @@ }, { "name": "symfony/expression-language", - "version": "v2.8.13", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/symfony/expression-language.git", - "reference": "50c990ebd047e78b754aefee7b657aa5744e7068" + "reference": "6ffbad90ac26e3aebc90798872a8b81979cf4fbd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/expression-language/zipball/50c990ebd047e78b754aefee7b657aa5744e7068", - "reference": "50c990ebd047e78b754aefee7b657aa5744e7068", + "url": "https://api.github.com/repos/symfony/expression-language/zipball/6ffbad90ac26e3aebc90798872a8b81979cf4fbd", + "reference": "6ffbad90ac26e3aebc90798872a8b81979cf4fbd", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": ">=5.5.9", + "symfony/cache": "~3.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1603,7 +1675,7 @@ ], "description": "Symfony ExpressionLanguage Component", "homepage": "https://symfony.com", - "time": "2016-09-06 10:55:00" + "time": "2016-11-03 08:11:03" }, { "name": "symfony/filesystem", @@ -1705,31 +1777,29 @@ }, { "name": "symfony/http-foundation", - "version": "v2.8.13", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "a6e6c34d337f3c74c39b29c5f54d33023de8897c" + "reference": "9963bc29d7f4398b137dd8efc480efe54fdbe5f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/a6e6c34d337f3c74c39b29c5f54d33023de8897c", - "reference": "a6e6c34d337f3c74c39b29c5f54d33023de8897c", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/9963bc29d7f4398b137dd8efc480efe54fdbe5f1", + "reference": "9963bc29d7f4398b137dd8efc480efe54fdbe5f1", "shasum": "" }, "require": { - "php": ">=5.3.9", - "symfony/polyfill-mbstring": "~1.1", - "symfony/polyfill-php54": "~1.0", - "symfony/polyfill-php55": "~1.0" + "php": ">=5.5.9", + "symfony/polyfill-mbstring": "~1.1" }, "require-dev": { - "symfony/expression-language": "~2.4|~3.0.0" + "symfony/expression-language": "~2.8|~3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1756,7 +1826,7 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2016-10-24 15:52:36" + "time": "2016-11-27 04:21:38" }, { "name": "symfony/polyfill-mbstring", @@ -1817,120 +1887,6 @@ ], "time": "2016-11-14 01:06:16" }, - { - "name": "symfony/polyfill-php54", - "version": "v1.2.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php54.git", - "reference": "34d761992f6f2cc6092cc0e5e93f38b53ba5e4f1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/34d761992f6f2cc6092cc0e5e93f38b53ba5e4f1", - "reference": "34d761992f6f2cc6092cc0e5e93f38b53ba5e4f1", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php54\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 5.4+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2016-05-18 14:26:46" - }, - { - "name": "symfony/polyfill-php55", - "version": "v1.2.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php55.git", - "reference": "bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d", - "reference": "bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d", - "shasum": "" - }, - "require": { - "ircmaxell/password-compat": "~1.0", - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php55\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2016-05-18 14:26:46" - }, { "name": "symfony/process", "version": "v2.8.14", @@ -2156,16 +2112,16 @@ }, { "name": "webflo/drupal-finder", - "version": "0.1.1", + "version": "0.2.1", "source": { "type": "git", "url": "https://github.com/webflo/drupal-finder.git", - "reference": "4dcd3281e9be9e9b89d33c5153f80ae1a16c3275" + "reference": "4bd98f7e7b1d30e284e55f51d5d0c8712f676348" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webflo/drupal-finder/zipball/4dcd3281e9be9e9b89d33c5153f80ae1a16c3275", - "reference": "4dcd3281e9be9e9b89d33c5153f80ae1a16c3275", + "url": "https://api.github.com/repos/webflo/drupal-finder/zipball/4bd98f7e7b1d30e284e55f51d5d0c8712f676348", + "reference": "4bd98f7e7b1d30e284e55f51d5d0c8712f676348", "shasum": "" }, "require-dev": { @@ -2189,7 +2145,7 @@ } ], "description": "Helper class to locate a Drupal installation from a given path.", - "time": "2016-11-12 15:50:13" + "time": "2016-11-28 18:50:45" } ], "packages-dev": [], diff --git a/src/Command/CommandDependencies.php b/src/Command/CommandDependencies.php deleted file mode 100644 index 35dbae092..000000000 --- a/src/Command/CommandDependencies.php +++ /dev/null @@ -1,53 +0,0 @@ -reader = $reader; - } - - /** - * @param ReflectionClass $class - * @return array - */ - public function read(ReflectionClass $class) - { - /** - * @var DrupalCommand $definition - */ - $definitions = $this->reader->getClassAnnotations($class); - - $dependencies = []; - foreach ($definitions as $definition) { - if ($definition instanceof DrupalCommand) { - // var_export($class); - foreach ($definition->dependencies as $dependency) { - // echo $definition->getName() . PHP_EOL; - $dependencies[] = $dependency; - } - } - } - - return $dependencies; - } -} diff --git a/src/Utils/YamlFileDumper.php b/src/Utils/YamlFileDumper.php deleted file mode 100644 index 0651dccf0..000000000 --- a/src/Utils/YamlFileDumper.php +++ /dev/null @@ -1,88 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Drupal\Console\Utils; - -use Symfony\Component\Translation\MessageCatalogue; -use Symfony\Component\Yaml\Yaml; -use Symfony\Component\Translation\Dumper\FileDumper; - -/** - * YamlFileDumper generates yaml files from a message catalogue. - * - * @author Michel Salib - */ -class YamlFileDumper extends FileDumper -{ - /** - * @var int Nesting depth. 0 means one line by message, 1 will - * indent at most one time, and so on. - */ - public $nestLevel = 0; - - /** - * {@inheritDoc} - */ - public function dump(MessageCatalogue $messages, $options = array()) - { - $this->nestLevel = array_key_exists('nest-level', $options) ? $options['nest-level'] : 0; - - parent::dump($messages, $options); - } - - /** - * {@inheritDoc} - */ - protected function format(MessageCatalogue $messages, $domain) - { - $m = $messages->all($domain); - - if ($this->nestLevel > 0) { - // build a message tree from the message list, with a max depth - // of $this->nestLevel - $tree = array(); - foreach ($m as $key => $message) { - // dots are ignored at the beginning and at the end of a key - $key = trim($key, "\t ."); - - if (strlen($key) > 0) { - $codes = explode('.', $key, $this->nestLevel + 1); - $node = &$tree; - - foreach ($codes as $code) { - if (strlen($code) > 0) { - if (!isset($node)) { - $node = array(); - } - $node = &$node[$code]; - } - } - $node = $message; - } - } - - return Yaml::dump( - $tree, - $this->nestLevel + 1 - ); // second parameter at 1 outputs normal line-by-line catalogue - } else { - return Yaml::dump($m, 1); - } - } - - /** - * {@inheritDoc} - */ - protected function getExtension() - { - return 'yml'; - } -} From c4c935ae4032a084867871715a01c0ac41475942 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Fri, 2 Dec 2016 07:12:25 -0800 Subject: [PATCH 063/321] [console] Relocate chain commands. (#2989) --- config/services/drupal-console/chain.yml | 11 - src/Application.php | 12 - src/Command/Chain/ChainCommand.php | 336 ----------------------- src/Command/Chain/ChainDebugCommand.php | 87 ------ src/Command/Chain/ChainRegister.php | 92 ------- src/Command/Shared/ChainFilesTrait.php | 112 -------- src/Command/Shared/InputTrait.php | 35 --- 7 files changed, 685 deletions(-) delete mode 100644 config/services/drupal-console/chain.yml delete mode 100644 src/Command/Chain/ChainCommand.php delete mode 100644 src/Command/Chain/ChainDebugCommand.php delete mode 100644 src/Command/Chain/ChainRegister.php delete mode 100644 src/Command/Shared/ChainFilesTrait.php delete mode 100644 src/Command/Shared/InputTrait.php diff --git a/config/services/drupal-console/chain.yml b/config/services/drupal-console/chain.yml deleted file mode 100644 index ea5d08b24..000000000 --- a/config/services/drupal-console/chain.yml +++ /dev/null @@ -1,11 +0,0 @@ -services: - console.chain: - class: Drupal\Console\Command\Chain\ChainCommand - arguments: ['@console.chain_queue', '@console.configuration_manager', '@app.root', '@console.extension_manager'] - tags: - - { name: drupal.command } - console.chain_debug: - class: Drupal\Console\Command\Chain\ChainDebugCommand - arguments: ['@console.configuration_manager', '@console.extension_manager'] - tags: - - { name: drupal.command } diff --git a/src/Application.php b/src/Application.php index daa6232f5..f31c90a94 100644 --- a/src/Application.php +++ b/src/Application.php @@ -8,7 +8,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Console\Utils\AnnotationValidator; use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Command\Chain\ChainRegister; /** * Class Application @@ -106,17 +105,6 @@ private function registerCommands() ); } -// // @TODO add auto-discovery of chain files -// $chainCommands['create:bulk:data'] = [ -// 'file' => '/Users/jmolivas/.console/chain/create-data.yml' -// ]; -// -// foreach ($chainCommands as $name => $chainCommand) { -// $file = $chainCommand['file']; -// $command = new ChainRegister($name, $file); -// $this->add($command); -// } - $serviceDefinitions = []; $annotationValidator = null; if ($this->container->hasParameter('console.service_definitions')) { diff --git a/src/Command/Chain/ChainCommand.php b/src/Command/Chain/ChainCommand.php deleted file mode 100644 index 34a1d6e11..000000000 --- a/src/Command/Chain/ChainCommand.php +++ /dev/null @@ -1,336 +0,0 @@ -chainQueue = $chainQueue; - $this->configurationManager = $configurationManager; - $this->appRoot = $appRoot; - $this->extensionManager = $extensionManager; - parent::__construct(); - } - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName('chain') - ->setDescription($this->trans('commands.chain.description')) - ->addOption( - 'file', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.chain.options.file') - ) - ->addOption( - 'placeholder', - null, - InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, - $this->trans('commands.chain.options.placeholder') - ); - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - // Check if the constructor passed a value for file. - $file = $input->getOption('file'); - - if (!$file) { - $files = $this->getChainFiles(true); - - $file = $io->choice( - $this->trans('commands.chain.questions.chain-file'), - array_values($files) - ); - } - - $file = calculateRealPath($file); - $input->setOption('file', $file); - - $chainContent = $this->getFileContents($file); - - $placeholder = $input->getOption('placeholder'); - $inlinePlaceHolders = $this->extractInlinePlaceHolders($chainContent); - - if (!$placeholder && $inlinePlaceHolders) { - foreach ($inlinePlaceHolders as $key => $inlinePlaceHolder) { - $inlinePlaceHolderDefault = ''; - if (strpos($inlinePlaceHolder, '|')>0) { - $placeholderParts = explode('|', $inlinePlaceHolder); - $inlinePlaceHolder = $placeholderParts[0]; - $inlinePlaceHolderDefault = $placeholderParts[1]; - $inlinePlaceHolders[$key] = $inlinePlaceHolder; - } - - $placeholder[] = sprintf( - '%s:%s', - $inlinePlaceHolder, - $io->ask( - sprintf( - 'Enter placeholder value for %s', - $inlinePlaceHolder - ), - $inlinePlaceHolderDefault - ) - ); - } - $input->setOption('placeholder', $placeholder); - } - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $interactive = false; - $learning = $input->hasOption('learning')?$input->getOption('learning'):false; - - $file = $input->getOption('file'); - - if (!$file) { - $io->error($this->trans('commands.chain.messages.missing_file')); - - return 1; - } - - $fileSystem = new Filesystem(); - - $file = calculateRealPath($file); - - if (!$fileSystem->exists($file)) { - $io->error( - sprintf( - $this->trans('commands.chain.messages.invalid_file'), - $file - ) - ); - - return 1; - } - - $placeholder = $input->getOption('placeholder'); - if ($placeholder) { - $placeholder = $this->inlineValueAsArray($placeholder); - } - - $chainContent = $this->getFileContents($file); - $environmentPlaceHolders = $this->extractEnvironmentPlaceHolders($chainContent); - - $envPlaceHolderMap = []; - $missingEnvironmentPlaceHolders = []; - foreach ($environmentPlaceHolders as $envPlaceHolder) { - if (!getenv($envPlaceHolder)) { - $missingEnvironmentPlaceHolders[$envPlaceHolder] = sprintf( - 'export %s=%s_VALUE', - $envPlaceHolder, - strtoupper($envPlaceHolder) - ); - - continue; - } - $envPlaceHolderMap[$envPlaceHolder] = getenv($envPlaceHolder); - } - - if ($missingEnvironmentPlaceHolders) { - $io->error( - sprintf( - $this->trans('commands.chain.messages.missing-environment-placeholders'), - implode(', ', array_keys($missingEnvironmentPlaceHolders)) - ) - ); - - $io->info($this->trans('commands.chain.messages.set-environment-placeholders')); - $io->block(array_values($missingEnvironmentPlaceHolders)); - - return 1; - } - - $envPlaceHolderData = new ArrayDataSource($envPlaceHolderMap); - $placeholderResolver = new RegexPlaceholderResolver($envPlaceHolderData, '${{', '}}'); - $chainContent = $placeholderResolver->resolvePlaceholder($chainContent); - - $inlinePlaceHolders = $this->extractInlinePlaceHolders($chainContent); - - $inlinePlaceHoldersReplacements = []; - foreach ($inlinePlaceHolders as $key => $inlinePlaceHolder) { - if (strpos($inlinePlaceHolder, '|') > 0) { - $placeholderParts = explode('|', $inlinePlaceHolder); - $inlinePlaceHoldersReplacements[] = $placeholderParts[0]; - continue; - } - $inlinePlaceHoldersReplacements[] = $inlinePlaceHolder; - } - - $chainContent = str_replace( - $inlinePlaceHolders, - $inlinePlaceHoldersReplacements, - $chainContent - ); - - $inlinePlaceHolders = $inlinePlaceHoldersReplacements; - - $inlinePlaceHolderMap = []; - foreach ($placeholder as $key => $placeholderItem) { - $inlinePlaceHolderMap = array_merge($inlinePlaceHolderMap, $placeholderItem); - } - - $missingInlinePlaceHolders = []; - foreach ($inlinePlaceHolders as $inlinePlaceHolder) { - if (!array_key_exists($inlinePlaceHolder, $inlinePlaceHolderMap)) { - $missingInlinePlaceHolders[$inlinePlaceHolder] = sprintf( - '--placeholder="%s:%s_VALUE"', - $inlinePlaceHolder, - strtoupper($inlinePlaceHolder) - ); - } - } - - if ($missingInlinePlaceHolders) { - $io->error( - sprintf( - $this->trans('commands.chain.messages.missing-inline-placeholders'), - implode(', ', array_keys($missingInlinePlaceHolders)) - ) - ); - - $io->info($this->trans('commands.chain.messages.set-inline-placeholders')); - $io->block(array_values($missingInlinePlaceHolders)); - - return 1; - } - - $inlinePlaceHolderData = new ArrayDataSource($inlinePlaceHolderMap); - $placeholderResolver = new RegexPlaceholderResolver($inlinePlaceHolderData, '%{{', '}}'); - $chainContent = $placeholderResolver->resolvePlaceholder($chainContent); - - $parser = new Parser(); - $configData = $parser->parse($chainContent); - - $commands = []; - if (array_key_exists('commands', $configData)) { - $commands = $configData['commands']; - } - - foreach ($commands as $command) { - $moduleInputs = []; - $arguments = !empty($command['arguments']) ? $command['arguments'] : []; - $options = !empty($command['options']) ? $command['options'] : []; - - foreach ($arguments as $key => $value) { - $moduleInputs[$key] = is_null($value) ? '' : $value; - } - - foreach ($options as $key => $value) { - $moduleInputs['--'.$key] = is_null($value) ? '' : $value; - } - - $parameterOptions = $input->getOptions(); - unset($parameterOptions['file']); - foreach ($parameterOptions as $key => $value) { - if ($value===true) { - $moduleInputs['--' . $key] = true; - } - } - - $this->chainQueue->addCommand( - $command['command'], - $moduleInputs, - $interactive, - $learning - ); - } - - return 0; - } - - /** - * Helper to load and clean up the chain file. - * - * @param string $file The file name - * - * @return string $contents The contents of the file - */ - public function getFileContents($file) - { - $contents = file_get_contents($file); - - // Remove lines with comments. - $contents = preg_replace('![ \t]*#.*[ \t]*[\r|\r\n|\n]!', PHP_EOL, $contents); - // Strip blank lines - $contents = preg_replace("/(^[\r\n]*|[\r\n]+)[\t]*[\r\n]+/", PHP_EOL, $contents); - - return $contents; - } -} diff --git a/src/Command/Chain/ChainDebugCommand.php b/src/Command/Chain/ChainDebugCommand.php deleted file mode 100644 index a98c45aba..000000000 --- a/src/Command/Chain/ChainDebugCommand.php +++ /dev/null @@ -1,87 +0,0 @@ -configurationManager = $configurationManager; - $this->extensionManager = $extensionManager; - parent::__construct(); - } - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName('chain:debug') - ->setDescription($this->trans('commands.chain.debug.description')); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - $files = $this->getChainFiles(); - - foreach ($files as $directory => $chainFiles) { - $io->info($this->trans('commands.chain.debug.messages.directory'), false); - $io->comment($directory); - - $tableHeader = [ - $this->trans('commands.chain.debug.messages.file') - ]; - - $tableRows = []; - foreach ($chainFiles as $file) { - $tableRows[] = $file; - } - - $io->table($tableHeader, $tableRows); - } - - return 0; - } -} diff --git a/src/Command/Chain/ChainRegister.php b/src/Command/Chain/ChainRegister.php deleted file mode 100644 index de165b643..000000000 --- a/src/Command/Chain/ChainRegister.php +++ /dev/null @@ -1,92 +0,0 @@ -name = $name; - $this->file = $file; - - parent::__construct(); - } - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName($this->name) - ->setDescription(sprintf('Custom chain command (%s)', $this->name)) - ->addOption( - 'placeholder', - null, - InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, - $this->trans('commands.chain.options.placeholder') - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $command = $this->getApplication()->find('chain'); - - $arguments = [ - 'command' => 'chain', - '--file' => $this->file, - '--placeholder' => $input->getOption('placeholder'), - '--generate-inline' => $input->hasOption('generate-inline'), - '--no-interaction' => $input->hasOption('no-interaction') - ]; - - $commandInput = new ArrayInput($arguments); - - return $command->run($commandInput, $output); - } -} diff --git a/src/Command/Shared/ChainFilesTrait.php b/src/Command/Shared/ChainFilesTrait.php deleted file mode 100644 index 254223234..000000000 --- a/src/Command/Shared/ChainFilesTrait.php +++ /dev/null @@ -1,112 +0,0 @@ -configurationManager->getHomeDirectory() . DIRECTORY_SEPARATOR . '.console'. DIRECTORY_SEPARATOR .'chain', - $this->appRoot . DIRECTORY_SEPARATOR . 'console'. DIRECTORY_SEPARATOR .'chain', - $this->appRoot . DIRECTORY_SEPARATOR . '.console'. DIRECTORY_SEPARATOR .'chain', - ]; - - $modules = $this->extensionManager->discoverModules() - ->showInstalled() - ->showNoCore() - ->getList(true); - - $themes = $this->extensionManager->discoverThemes() - ->showInstalled() - ->getList(true); - - foreach ($modules as $module) { - $modulePath = sprintf( - '%s/%s/console/chain/', - $this->appRoot, - $module - ); - - if (is_dir($modulePath)) { - $directories[] = $modulePath; - } - } - foreach ($themes as $theme) { - $themePath = sprintf( - '%s/%s/console/chain', - $this->appRoot, - $theme - ); - if (is_dir($themePath)) { - $directories[] = $themePath; - } - } - - $chainFiles = []; - foreach ($directories as $directory) { - if (!is_dir($directory)) { - continue; - } - $finder = new Finder(); - $finder->files() - ->name('*.yml') - ->in($directory); - foreach ($finder as $file) { - $chainFiles[$file->getPath()][] = sprintf( - '%s/%s', - $directory, - $file->getBasename() - ); - } - } - - if ($onlyFiles) { - $files = []; - foreach ($chainFiles as $chainDirectory => $chainFileList) { - $files = array_merge($files, $chainFileList); - } - return $files; - } - - return $chainFiles; - } - - private function extractPlaceHolders($chainContent, $identifier) - { - $placeHolders = []; - $regex = '/\\'.$identifier.'{{(.*?)}}/'; - preg_match_all( - $regex, - $chainContent, - $placeHolders - ); - - if (!$placeHolders) { - return []; - } - - return array_unique($placeHolders[1]); - } - - private function extractInlinePlaceHolders($chainContent) - { - return $this->extractPlaceHolders($chainContent, '%'); - } - - private function extractEnvironmentPlaceHolders($chainContent) - { - return $this->extractPlaceHolders($chainContent, '$'); - } -} diff --git a/src/Command/Shared/InputTrait.php b/src/Command/Shared/InputTrait.php deleted file mode 100644 index 82c716cd0..000000000 --- a/src/Command/Shared/InputTrait.php +++ /dev/null @@ -1,35 +0,0 @@ - $value) { - if (!is_array($value)) { - $inputValueItems = []; - foreach (explode(" ", $value) as $inputKeyValueItem) { - list($inputKeyItem, $inputValueItem) = explode(":", $inputKeyValueItem); - $inputValueItems[$inputKeyItem] = $inputValueItem; - } - $inputArrayValue[$key] = $inputValueItems; - } - } - - return $inputArrayValue?$inputArrayValue:$inputValue; - } -} From 10a2520657cc882f4c879f494c89a1691904106b Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Fri, 2 Dec 2016 08:10:39 -0800 Subject: [PATCH 064/321] [site:install] Bootstrap drupal after installation. (#2990) * [site:install] Bootstrap drupal after installation. * [site:install] Bootstrap drupal after installation. --- src/Application.php | 6 ++++++ src/Bootstrap/Drupal.php | 5 +++-- src/Command/Site/InstallCommand.php | 18 +++++++++++++++--- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/Application.php b/src/Application.php index f31c90a94..900af787c 100644 --- a/src/Application.php +++ b/src/Application.php @@ -345,4 +345,10 @@ private function commandData($commandName) return $data; } + + public function setContainer($container) { + $this->container = $container; + $this->registerGenerators(); + $this->registerCommands(); + } } diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index 70328dfbf..a43604245 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -33,7 +33,6 @@ public function boot() } try { - // Add support for Acquia Dev Desktop sites on Mac OS X // @TODO: Check if this condition works in Windows $devDesktopSettingsDir = getenv('HOME') . "/.acquia/DevDesktop/DrupalSettings"; @@ -100,7 +99,9 @@ public function boot() return $container; } catch (\Exception $e) { $drupal = new DrupalConsoleCore($this->root, $this->appRoot); - return $drupal->boot(); + $container = $drupal->boot(); + $container->set('class_loader', $this->autoload); + return $container; } } } diff --git a/src/Command/Site/InstallCommand.php b/src/Command/Site/InstallCommand.php index 53ca3421a..3990d268c 100644 --- a/src/Command/Site/InstallCommand.php +++ b/src/Command/Site/InstallCommand.php @@ -16,16 +16,18 @@ use Symfony\Component\Console\Command\Command; use Drupal\Core\Database\Database; use Drupal\Core\Installer\Exception\AlreadyInstalledException; +use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Command\Shared\DatabaseTrait; use Drupal\Console\Utils\ConfigurationManager; use Drupal\Console\Extension\Manager; -use Drupal\Console\Utils\Site; -use Drupal\Console\Command\Shared\CommandTrait; use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Bootstrap\Drupal; +use Drupal\Console\Utils\Site; +use DrupalFinder\DrupalFinder; class InstallCommand extends Command { - use CommandTrait; + use ContainerAwareCommandTrait; use DatabaseTrait; /** @@ -419,6 +421,16 @@ protected function execute(InputInterface $input, OutputInterface $output) try { $this->runInstaller($io, $input, $database); + + $drupalFinder = new DrupalFinder(); + $drupalFinder->locateRoot(getcwd()); + $composerRoot = $drupalFinder->getComposerRoot(); + $drupalRoot = $drupalFinder->getDrupalRoot(); + $autoload = $this->container->get('class_loader'); + $drupal = new Drupal($autoload, $composerRoot, $drupalRoot); + $container = $drupal->boot(); + $this->getApplication()->setContainer($container); + } catch (Exception $e) { $io->error($e->getMessage()); return; From cebb0b91428f97582447813dd9694118d5c550a8 Mon Sep 17 00:00:00 2001 From: GDrupal Date: Fri, 2 Dec 2016 15:57:04 -0300 Subject: [PATCH 065/321] Added new "remove-config-hash" option to config:export and config:export:single commands. (#2991) --- src/Command/Config/ExportCommand.php | 15 +++++++++++---- src/Command/Config/ExportSingleCommand.php | 20 +++++++++++++++----- src/Command/Shared/ExportTrait.php | 14 ++++++++------ 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/src/Command/Config/ExportCommand.php b/src/Command/Config/ExportCommand.php index 33d6fda81..e7dea0366 100644 --- a/src/Command/Config/ExportCommand.php +++ b/src/Command/Config/ExportCommand.php @@ -59,6 +59,11 @@ protected function configure() '', InputOption::VALUE_NONE, $this->trans('commands.config.export.single.options.remove-uuid') + )->addOption( + 'remove-config-hash', + '', + InputOption::VALUE_NONE, + $this->trans('commands.config.export.single.options.remove-config-hash') ); } @@ -72,7 +77,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $directory = $input->getOption('directory'); $tar = $input->getOption('tar'); $removeUuid = $input->getOption('remove-uuid'); - + $removeHash = $input->getOption('remove-config-hash'); + if (!$directory) { $directory = config_get_config_directory(CONFIG_SYNC_DIRECTORY); } @@ -98,12 +104,13 @@ protected function execute(InputInterface $input, OutputInterface $output) $configData = $this->configManager->getConfigFactory()->get($name)->getRawData(); $configName = sprintf('%s.yml', $name); - // The _core is site-specific, so don't export it. - unset($configData['_core']); - if ($removeUuid) { unset($configData['uuid']); } + + if ($removeHash) { + unset($configData['_core']['default_config_hash']); + } $ymlData = Yaml::encode($configData); diff --git a/src/Command/Config/ExportSingleCommand.php b/src/Command/Config/ExportSingleCommand.php index f217c44fc..d8f318f2f 100644 --- a/src/Command/Config/ExportSingleCommand.php +++ b/src/Command/Config/ExportSingleCommand.php @@ -89,6 +89,11 @@ protected function configure() '', InputOption::VALUE_NONE, $this->trans('commands.config.export.single.options.remove-uuid') + )->addOption( + 'remove-config-hash', + '', + InputOption::VALUE_NONE, + $this->trans('commands.config.export.single.options.remove-config-hash') ); } @@ -205,6 +210,13 @@ protected function interact(InputInterface $input, OutputInterface $output) ); $input->setOption('remove-uuid', $removeUuid); } + if (!$input->getOption('remove-config-hash')) { + $removeHash = $io->confirm( + $this->trans('commands.config.export.single.questions.remove-config-hash'), + true + ); + $input->setOption('remove-config-hash', $removeHash); + } } @@ -220,12 +232,10 @@ protected function execute(InputInterface $input, OutputInterface $output) $configName = $input->getArgument('config-name'); $optionalConfig = $input->getOption('optional-config'); $removeUuid = $input->getOption('remove-uuid'); + $removeHash = $input->getOption('remove-config-hash'); + + $config = $this->getConfiguration($configName, $removeUuid, $removeHash); - if (!$removeUuid) { - $config = $this->getConfiguration($configName, true); - } else { - $config = $this->getConfiguration($configName, false); - } if ($config) { if (!$directory) { $directory = config_get_config_directory(CONFIG_SYNC_DIRECTORY); diff --git a/src/Command/Shared/ExportTrait.php b/src/Command/Shared/ExportTrait.php index 58e6f1516..2a3f0aea5 100644 --- a/src/Command/Shared/ExportTrait.php +++ b/src/Command/Shared/ExportTrait.php @@ -21,18 +21,20 @@ trait ExportTrait * @param bool|false $uuid * @return mixed */ - protected function getConfiguration($configName, $uuid = false) + protected function getConfiguration($configName, $uuid = false, $hash = false) { $config = $this->configStorage->read($configName); // Exclude uuid base in parameter, useful to share configurations. - if (!$uuid) { + if ($uuid) { unset($config['uuid']); } - - // The _core is site-specific, so don't export it. - unset($config['_core']); - + + // Exclude default_config_hash inside _core is site-specific. + if ($hash) { + unset($config['_core']['default_config_hash']); + } + return $config; } From b7fb8d589c0c597578544054d6d44aa1602165cf Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sat, 3 Dec 2016 09:39:03 -0800 Subject: [PATCH 066/321] [console] Update readme. (#2994) --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0ec03f826..5851a45c6 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,8 @@ We highly recommend you to install the global executable, but if is not installe vendor/bin/drupal # or vendor/drupal/console/bin/drupal +# or +bin/drupal ``` ## Drupal Console Support From 039d00fc2bf6071acf5cb66290fd07849887eae9 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 7 Dec 2016 21:15:32 -0800 Subject: [PATCH 067/321] use container property instead of Drupal static. (#2999) --- src/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Application.php b/src/Application.php index 900af787c..49cdd74a0 100644 --- a/src/Application.php +++ b/src/Application.php @@ -128,7 +128,7 @@ private function registerCommands() AnnotationRegistry::reset(); AnnotationRegistry::registerLoader( [ - \Drupal::service('class_loader'), + $this->container->get('class_loader'), "loadClass" ] ); From 822e26cc77b2a2449cfe6d239a769d282f52ec49 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 11 Dec 2016 16:53:54 -0800 Subject: [PATCH 068/321] Update Symfony dependencies. (#3004) --- composer.json | 6 +++--- composer.lock | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 9ef16af9e..47807f9f7 100644 --- a/composer.json +++ b/composer.json @@ -42,13 +42,13 @@ "drupal/console-core" : "~1.0", "symfony/css-selector": "~2.7|~3.1", "symfony/debug": "~2.6|~3.1", - "symfony/dom-crawler": "~2.8|~3.1", - "symfony/http-foundation": "~2.8|~3.1", + "symfony/dom-crawler": "~2.7|~3.1", + "symfony/http-foundation": "~2.7|~3.1", "guzzlehttp/guzzle": "~6.1", "gabordemooij/redbean": "~4.3", "doctrine/annotations": "1.2.*", "dflydev/placeholder-resolver": "~1.0", - "symfony/expression-language": "~2.8|~3.1" + "symfony/expression-language": "~2.7|~3.1" }, "bin": ["bin/drupal"], "config": { diff --git a/composer.lock b/composer.lock index be9c353f5..e4010d544 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "cf4cb7fae99a73d6d41df03b30866a1a", - "content-hash": "35a2eb230857d08ea3feb83062d52955", + "hash": "c822c51771807fafe3f5bc9fa535b2d6", + "content-hash": "c915157507878fe8894ba078ec2e9fc5", "packages": [ { "name": "alchemy/zippy", From 3eb84e7c9ab99478252ff4654be1d616633b1fce Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 12 Dec 2016 00:46:45 -0800 Subject: [PATCH 069/321] [site:debug] Relocate commands. (#3005) --- config/services/drupal-console/site.yml | 5 - src/Command/Site/DebugCommand.php | 154 ------------------------ 2 files changed, 159 deletions(-) delete mode 100644 src/Command/Site/DebugCommand.php diff --git a/config/services/drupal-console/site.yml b/config/services/drupal-console/site.yml index a15e9d358..9479b5dce 100644 --- a/config/services/drupal-console/site.yml +++ b/config/services/drupal-console/site.yml @@ -1,9 +1,4 @@ services: - console.site_debug: - class: Drupal\Console\Command\Site\DebugCommand - arguments: ['@console.site','@console.configuration_manager'] - tags: - - { name: drupal.command } console.site_import_local: class: Drupal\Console\Command\Site\ImportLocalCommand arguments: ['@app.root','@console.configuration_manager'] diff --git a/src/Command/Site/DebugCommand.php b/src/Command/Site/DebugCommand.php deleted file mode 100644 index ef687bb17..000000000 --- a/src/Command/Site/DebugCommand.php +++ /dev/null @@ -1,154 +0,0 @@ -site = $site; - $this->configurationManager = $configurationManager; - parent::__construct(); - } - - /** - * @{@inheritdoc} - */ - public function configure() - { - $this - ->setName('site:debug') - ->setDescription($this->trans('commands.site.debug.description')) - ->addArgument( - 'target', - InputArgument::OPTIONAL, - $this->trans('commands.site.debug.options.target'), - null - ) - ->setHelp($this->trans('commands.site.debug.help')); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $sitesDirectory = $this->configurationManager->getSitesDirectory(); - - if (!is_dir($sitesDirectory)) { - $io->error( - sprintf( - $this->trans('commands.site.debug.messages.directory-not-found'), - $sitesDirectory - ) - ); - - return 1; - } - - // --target argument - $target = $input->getArgument('target'); - if ($target) { - $io->write( - $this->siteDetail($target) - ); - - return 0; - } - - $tableHeader =[ - $this->trans('commands.site.debug.messages.site'), - $this->trans('commands.site.debug.messages.host'), - $this->trans('commands.site.debug.messages.root') - ]; - - $tableRows = $this->siteList($sitesDirectory); - - $io->table($tableHeader, $tableRows); - return 0; - } - - /** - * @param string $target - * - * @return string - */ - private function siteDetail($target) - { - if ($targetConfig = $this->configurationManager->readTarget($target)) { - $dumper = new Dumper(); - - return $dumper->dump($targetConfig, 2); - } - } - - /** - * @param DrupalStyle $io - * @param string $sitesDirectory - * @return array - */ - private function siteList($sitesDirectory) - { - $finder = new Finder(); - $finder->in($sitesDirectory); - $finder->name("*.yml"); - - $tableRows = []; - foreach ($finder as $site) { - $siteName = $site->getBasename('.yml'); - $environments = $this->configurationManager - ->readSite($site->getRealPath()); - - foreach ($environments as $env => $config) { - $tableRows[] = [ - $siteName . '.' . $env, - array_key_exists('host', $config) ? $config['host'] : 'local', - array_key_exists('root', $config) ? $config['root'] : '' - ]; - } - } - - return $tableRows; - } -} From d6c749ce06f2002f897848acf900f8d393c40980 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 12 Dec 2016 00:57:03 -0800 Subject: [PATCH 070/321] [console] Tag 1.0.0-rc11 release. (#3006) --- composer.lock | 300 ++++++++++++++++---------------------------- src/Application.php | 4 +- 2 files changed, 110 insertions(+), 194 deletions(-) diff --git a/composer.lock b/composer.lock index e4010d544..3296b4f19 100644 --- a/composer.lock +++ b/composer.lock @@ -532,33 +532,32 @@ }, { "name": "drupal/console-core", - "version": "1.0.0-rc10", + "version": "1.0.0-rc11", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "45cb9ef7777540de23fd727e9c76d21b8e82cc2b" + "reference": "5761bb16e62b753196ca66e0e1e846dfd8449fff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/45cb9ef7777540de23fd727e9c76d21b8e82cc2b", - "reference": "45cb9ef7777540de23fd727e9c76d21b8e82cc2b", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/5761bb16e62b753196ca66e0e1e846dfd8449fff", + "reference": "5761bb16e62b753196ca66e0e1e846dfd8449fff", "shasum": "" }, "require": { "dflydev/dot-access-configuration": "1.*", "drupal/console-en": "~1.0", "php": "^5.5.9 || ^7.0", - "phpseclib/phpseclib": "2.*", "stecman/symfony-console-completion": "~0.7", - "symfony/config": "~2.8", - "symfony/console": "~2.8", - "symfony/dependency-injection": "~2.8", - "symfony/event-dispatcher": "~2.8", - "symfony/filesystem": "~2.8", - "symfony/finder": "~2.8", - "symfony/process": "~2.8", - "symfony/translation": "~2.8", - "symfony/yaml": "~2.8", + "symfony/config": "~2.7|~3.1", + "symfony/console": "~2.7|~3.1", + "symfony/dependency-injection": "~2.7|~3.1", + "symfony/event-dispatcher": "~2.7|~3.1", + "symfony/filesystem": "~2.7|~3.1", + "symfony/finder": "~2.7|~3.1", + "symfony/process": "~2.7|~3.1", + "symfony/translation": "~2.7|~3.1", + "symfony/yaml": "~2.7|~3.1", "twig/twig": "^1.23.1", "webflo/drupal-finder": "0.*" }, @@ -609,20 +608,20 @@ "drupal", "symfony" ], - "time": "2016-11-24 07:06:28" + "time": "2016-12-12 08:36:47" }, { "name": "drupal/console-en", - "version": "1.0.0-rc9", + "version": "1.0.0-rc10", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", - "reference": "8a2a490cd99f9e47ff4a3d88d88b6c5044ae20ad" + "reference": "6482b4e7102d91c6a3650ed3ed1f0081ceca5e99" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/8a2a490cd99f9e47ff4a3d88d88b6c5044ae20ad", - "reference": "8a2a490cd99f9e47ff4a3d88d88b6c5044ae20ad", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/6482b4e7102d91c6a3650ed3ed1f0081ceca5e99", + "reference": "6482b4e7102d91c6a3650ed3ed1f0081ceca5e99", "shasum": "" }, "type": "drupal-console-language", @@ -663,7 +662,7 @@ "drupal", "symfony" ], - "time": "2016-11-24 06:04:33" + "time": "2016-12-12 00:56:06" }, { "name": "gabordemooij/redbean", @@ -877,98 +876,6 @@ ], "time": "2016-06-24 23:00:38" }, - { - "name": "phpseclib/phpseclib", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "ab8028c93c03cc8d9c824efa75dc94f1db2369bf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/ab8028c93c03cc8d9c824efa75dc94f1db2369bf", - "reference": "ab8028c93c03cc8d9c824efa75dc94f1db2369bf", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phing/phing": "~2.7", - "phpunit/phpunit": "~4.0", - "sami/sami": "~2.0", - "squizlabs/php_codesniffer": "~2.0" - }, - "suggest": { - "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", - "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.", - "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", - "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." - }, - "type": "library", - "autoload": { - "files": [ - "phpseclib/bootstrap.php" - ], - "psr-4": { - "phpseclib\\": "phpseclib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jim Wigginton", - "email": "terrafrost@php.net", - "role": "Lead Developer" - }, - { - "name": "Patrick Monnerat", - "email": "pm@datasphere.ch", - "role": "Developer" - }, - { - "name": "Andreas Fischer", - "email": "bantu@phpbb.com", - "role": "Developer" - }, - { - "name": "Hans-Jürgen Petrich", - "email": "petrich@tronic-media.com", - "role": "Developer" - }, - { - "name": "Graham Campbell", - "email": "graham@alt-three.com", - "role": "Developer" - } - ], - "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.", - "homepage": "http://phpseclib.sourceforge.net", - "keywords": [ - "BigInteger", - "aes", - "asn.1", - "asn1", - "blowfish", - "crypto", - "cryptography", - "encryption", - "rsa", - "security", - "sftp", - "signature", - "signing", - "ssh", - "twofish", - "x.509", - "x509" - ], - "time": "2016-10-04 00:57:04" - }, { "name": "psr/cache", "version": "1.0.1", @@ -1226,21 +1133,24 @@ }, { "name": "symfony/config", - "version": "v2.8.14", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "1361bc4e66f97b6202ae83f4190e962c624b5e61" + "reference": "4a68f8953180bf77ea65f585020f4db0b18600b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/1361bc4e66f97b6202ae83f4190e962c624b5e61", - "reference": "1361bc4e66f97b6202ae83f4190e962c624b5e61", + "url": "https://api.github.com/repos/symfony/config/zipball/4a68f8953180bf77ea65f585020f4db0b18600b4", + "reference": "4a68f8953180bf77ea65f585020f4db0b18600b4", "shasum": "" }, "require": { - "php": ">=5.3.9", - "symfony/filesystem": "~2.3|~3.0.0" + "php": ">=5.5.9", + "symfony/filesystem": "~2.8|~3.0" + }, + "require-dev": { + "symfony/yaml": "~3.0" }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" @@ -1248,7 +1158,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1275,41 +1185,43 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2016-11-03 07:52:58" + "time": "2016-11-29 11:12:32" }, { "name": "symfony/console", - "version": "v2.8.14", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "a871ba00e0f604dceac64c56c27f99fbeaf4854e" + "reference": "09d0fd33560e3573185a2ea17614e37ba38716c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a871ba00e0f604dceac64c56c27f99fbeaf4854e", - "reference": "a871ba00e0f604dceac64c56c27f99fbeaf4854e", + "url": "https://api.github.com/repos/symfony/console/zipball/09d0fd33560e3573185a2ea17614e37ba38716c5", + "reference": "09d0fd33560e3573185a2ea17614e37ba38716c5", "shasum": "" }, "require": { - "php": ">=5.3.9", - "symfony/debug": "~2.7,>=2.7.2|~3.0.0", + "php": ">=5.5.9", + "symfony/debug": "~2.8|~3.0", "symfony/polyfill-mbstring": "~1.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1|~3.0.0", - "symfony/process": "~2.1|~3.0.0" + "symfony/event-dispatcher": "~2.8|~3.0", + "symfony/filesystem": "~2.8|~3.0", + "symfony/process": "~2.8|~3.0" }, "suggest": { "psr/log": "For using the console logger", "symfony/event-dispatcher": "", + "symfony/filesystem": "", "symfony/process": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1336,7 +1248,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-11-15 23:02:12" + "time": "2016-11-16 22:18:16" }, { "name": "symfony/css-selector", @@ -1450,28 +1362,28 @@ }, { "name": "symfony/dependency-injection", - "version": "v2.8.14", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "9d2c5033ca70ceade8d7584f997a9d3943f0fe5f" + "reference": "f5419adad083c90e0dfd8588ef83683d7dbcc20d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/9d2c5033ca70ceade8d7584f997a9d3943f0fe5f", - "reference": "9d2c5033ca70ceade8d7584f997a9d3943f0fe5f", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/f5419adad083c90e0dfd8588ef83683d7dbcc20d", + "reference": "f5419adad083c90e0dfd8588ef83683d7dbcc20d", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": ">=5.5.9" }, "conflict": { - "symfony/expression-language": "<2.6" + "symfony/yaml": "<3.2" }, "require-dev": { - "symfony/config": "~2.2|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", - "symfony/yaml": "~2.3.42|~2.7.14|~2.8.7|~3.0.7" + "symfony/config": "~2.8|~3.0", + "symfony/expression-language": "~2.8|~3.0", + "symfony/yaml": "~3.2" }, "suggest": { "symfony/config": "", @@ -1482,7 +1394,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1509,7 +1421,7 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2016-11-18 21:10:01" + "time": "2016-11-25 12:32:42" }, { "name": "symfony/dom-crawler", @@ -1569,27 +1481,27 @@ }, { "name": "symfony/event-dispatcher", - "version": "v2.8.14", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "25c576abd4e0f212e678fe8b2bd9a9a98c7ea934" + "reference": "e8f47a327c2f0fd5aa04fa60af2b693006ed7283" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/25c576abd4e0f212e678fe8b2bd9a9a98c7ea934", - "reference": "25c576abd4e0f212e678fe8b2bd9a9a98c7ea934", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/e8f47a327c2f0fd5aa04fa60af2b693006ed7283", + "reference": "e8f47a327c2f0fd5aa04fa60af2b693006ed7283", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": ">=5.5.9" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.0,>=2.0.5|~3.0.0", - "symfony/dependency-injection": "~2.6|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", - "symfony/stopwatch": "~2.3|~3.0.0" + "symfony/config": "~2.8|~3.0", + "symfony/dependency-injection": "~2.8|~3.0", + "symfony/expression-language": "~2.8|~3.0", + "symfony/stopwatch": "~2.8|~3.0" }, "suggest": { "symfony/dependency-injection": "", @@ -1598,7 +1510,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1625,7 +1537,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2016-10-13 01:43:15" + "time": "2016-10-13 06:29:04" }, { "name": "symfony/expression-language", @@ -1679,25 +1591,25 @@ }, { "name": "symfony/filesystem", - "version": "v2.8.14", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "a3784111af9f95f102b6411548376e1ae7c93898" + "reference": "8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/a3784111af9f95f102b6411548376e1ae7c93898", - "reference": "a3784111af9f95f102b6411548376e1ae7c93898", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4", + "reference": "8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": ">=5.5.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1724,29 +1636,29 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2016-10-18 04:28:30" + "time": "2016-11-24 00:46:43" }, { "name": "symfony/finder", - "version": "v2.8.14", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "0023b024363dfc0cd21262e556f25a291fe8d7fd" + "reference": "4263e35a1e342a0f195c9349c0dee38148f8a14f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/0023b024363dfc0cd21262e556f25a291fe8d7fd", - "reference": "0023b024363dfc0cd21262e556f25a291fe8d7fd", + "url": "https://api.github.com/repos/symfony/finder/zipball/4263e35a1e342a0f195c9349c0dee38148f8a14f", + "reference": "4263e35a1e342a0f195c9349c0dee38148f8a14f", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": ">=5.5.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1773,7 +1685,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2016-11-03 07:52:58" + "time": "2016-11-03 08:11:03" }, { "name": "symfony/http-foundation", @@ -1889,25 +1801,25 @@ }, { "name": "symfony/process", - "version": "v2.8.14", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "024de37f8a6b9e5e8244d9eb3fcf3e467dd2a93f" + "reference": "02ea84847aad71be7e32056408bb19f3a616cdd3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/024de37f8a6b9e5e8244d9eb3fcf3e467dd2a93f", - "reference": "024de37f8a6b9e5e8244d9eb3fcf3e467dd2a93f", + "url": "https://api.github.com/repos/symfony/process/zipball/02ea84847aad71be7e32056408bb19f3a616cdd3", + "reference": "02ea84847aad71be7e32056408bb19f3a616cdd3", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": ">=5.5.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1934,34 +1846,34 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2016-09-29 14:03:54" + "time": "2016-11-24 10:40:28" }, { "name": "symfony/translation", - "version": "v2.8.14", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "edbe67e8f729885b55421d5cc58223d48540df07" + "reference": "64ab6fc0b42e5386631f408e6adcaaff8eee5ba1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/edbe67e8f729885b55421d5cc58223d48540df07", - "reference": "edbe67e8f729885b55421d5cc58223d48540df07", + "url": "https://api.github.com/repos/symfony/translation/zipball/64ab6fc0b42e5386631f408e6adcaaff8eee5ba1", + "reference": "64ab6fc0b42e5386631f408e6adcaaff8eee5ba1", "shasum": "" }, "require": { - "php": ">=5.3.9", + "php": ">=5.5.9", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/config": "<2.7" + "symfony/config": "<2.8" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.8", - "symfony/intl": "~2.4|~3.0.0", - "symfony/yaml": "~2.2|~3.0.0" + "symfony/config": "~2.8|~3.0", + "symfony/intl": "~2.8|~3.0", + "symfony/yaml": "~2.8|~3.0" }, "suggest": { "psr/log": "To use logging capability in translator", @@ -1971,7 +1883,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1998,29 +1910,35 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2016-11-18 21:10:01" + "time": "2016-11-18 21:17:59" }, { "name": "symfony/yaml", - "version": "v2.8.14", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "befb26a3713c97af90d25dd12e75621ef14d91ff" + "reference": "f2300ba8fbb002c028710b92e1906e7457410693" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/befb26a3713c97af90d25dd12e75621ef14d91ff", - "reference": "befb26a3713c97af90d25dd12e75621ef14d91ff", + "url": "https://api.github.com/repos/symfony/yaml/zipball/f2300ba8fbb002c028710b92e1906e7457410693", + "reference": "f2300ba8fbb002c028710b92e1906e7457410693", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": ">=5.5.9" + }, + "require-dev": { + "symfony/console": "~2.8|~3.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -2047,7 +1965,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-11-14 16:15:57" + "time": "2016-11-18 21:17:59" }, { "name": "twig/twig", diff --git a/src/Application.php b/src/Application.php index 49cdd74a0..b3d9aa963 100644 --- a/src/Application.php +++ b/src/Application.php @@ -23,7 +23,7 @@ class Application extends ConsoleApplication /** * @var string */ - const VERSION = '1.0.0-rc10'; + const VERSION = '1.0.0-rc11'; public function __construct(ContainerInterface $container) { @@ -123,8 +123,6 @@ private function registerCommands() ->get('application.commands.aliases')?:[]; foreach ($consoleCommands as $name) { - // Some commands call AnnotationRegistry::reset, - // we need to ensure the AnnotationRegistry is correctly defined. AnnotationRegistry::reset(); AnnotationRegistry::registerLoader( [ From 7eb98a13458da1a63f87435ced4128cd15f34d9e Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 12 Dec 2016 14:41:41 -0800 Subject: [PATCH 071/321] [console] Update symfony dependencies. (#3011) --- composer.json | 11 +-- composer.lock | 259 ++++++++++++++++++++++++-------------------------- 2 files changed, 127 insertions(+), 143 deletions(-) diff --git a/composer.json b/composer.json index 47807f9f7..68da77952 100644 --- a/composer.json +++ b/composer.json @@ -40,15 +40,14 @@ "alchemy/zippy": "0.3.5", "composer/installers": "~1.0", "drupal/console-core" : "~1.0", - "symfony/css-selector": "~2.7|~3.1", - "symfony/debug": "~2.6|~3.1", - "symfony/dom-crawler": "~2.7|~3.1", - "symfony/http-foundation": "~2.7|~3.1", + "symfony/css-selector": ">=2.7 <3.2", + "symfony/dom-crawler": ">=2.7 <3.2", + "symfony/http-foundation": ">=2.7 <3.2", "guzzlehttp/guzzle": "~6.1", "gabordemooij/redbean": "~4.3", "doctrine/annotations": "1.2.*", - "dflydev/placeholder-resolver": "~1.0", - "symfony/expression-language": "~2.7|~3.1" + "symfony/expression-language": ">=2.7 <3.2", + "symfony/cache": ">=2.7 <3.2" }, "bin": ["bin/drupal"], "config": { diff --git a/composer.lock b/composer.lock index 3296b4f19..4525b68c8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "c822c51771807fafe3f5bc9fa535b2d6", - "content-hash": "c915157507878fe8894ba078ec2e9fc5", + "hash": "abc4204e3a3d233d485f486e24f25a8a", + "content-hash": "d87c94c69b0633a18e20de8337c4595d", "packages": [ { "name": "alchemy/zippy", @@ -178,16 +178,16 @@ }, { "name": "dflydev/dot-access-configuration", - "version": "v1.0.1", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/dflydev/dflydev-dot-access-configuration.git", - "reference": "9b65c83159c9003e00284ea1144ad96b69d9c8b9" + "reference": "ae6e7138b1d9063d343322cca63994ee1ac5161d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-configuration/zipball/9b65c83159c9003e00284ea1144ad96b69d9c8b9", - "reference": "9b65c83159c9003e00284ea1144ad96b69d9c8b9", + "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-configuration/zipball/ae6e7138b1d9063d343322cca63994ee1ac5161d", + "reference": "ae6e7138b1d9063d343322cca63994ee1ac5161d", "shasum": "" }, "require": { @@ -234,7 +234,7 @@ "config", "configuration" ], - "time": "2014-11-14 03:26:12" + "time": "2016-12-12 17:43:40" }, { "name": "dflydev/dot-access-data", @@ -536,28 +536,29 @@ "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "5761bb16e62b753196ca66e0e1e846dfd8449fff" + "reference": "b0b73776d6495d253ed1dfdda67a6e05bb5895f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/5761bb16e62b753196ca66e0e1e846dfd8449fff", - "reference": "5761bb16e62b753196ca66e0e1e846dfd8449fff", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/b0b73776d6495d253ed1dfdda67a6e05bb5895f6", + "reference": "b0b73776d6495d253ed1dfdda67a6e05bb5895f6", "shasum": "" }, "require": { - "dflydev/dot-access-configuration": "1.*", + "dflydev/dot-access-configuration": "dev-master#9dc52aeeab5ae99afcbb0d67bb5c1af8c87d03dc", "drupal/console-en": "~1.0", "php": "^5.5.9 || ^7.0", "stecman/symfony-console-completion": "~0.7", - "symfony/config": "~2.7|~3.1", - "symfony/console": "~2.7|~3.1", - "symfony/dependency-injection": "~2.7|~3.1", - "symfony/event-dispatcher": "~2.7|~3.1", - "symfony/filesystem": "~2.7|~3.1", - "symfony/finder": "~2.7|~3.1", - "symfony/process": "~2.7|~3.1", - "symfony/translation": "~2.7|~3.1", - "symfony/yaml": "~2.7|~3.1", + "symfony/config": ">=2.7 <3.2", + "symfony/console": ">=2.7 <3.2", + "symfony/debug": ">=2.6 <3.2", + "symfony/dependency-injection": ">=2.7 <3.2", + "symfony/event-dispatcher": ">=2.7 <3.2", + "symfony/filesystem": ">=2.7 <3.2", + "symfony/finder": ">=2.7 <3.2", + "symfony/process": ">=2.7 <3.2", + "symfony/translation": ">=2.7 <3.2", + "symfony/yaml": ">=2.7 <3.2", "twig/twig": "^1.23.1", "webflo/drupal-finder": "0.*" }, @@ -608,20 +609,20 @@ "drupal", "symfony" ], - "time": "2016-12-12 08:36:47" + "time": "2016-12-12 21:43:08" }, { "name": "drupal/console-en", - "version": "1.0.0-rc10", + "version": "1.0.0-rc11", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", - "reference": "6482b4e7102d91c6a3650ed3ed1f0081ceca5e99" + "reference": "694f46c5dfa69efc3f8a0bdc6eab4d63c306b1b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/6482b4e7102d91c6a3650ed3ed1f0081ceca5e99", - "reference": "6482b4e7102d91c6a3650ed3ed1f0081ceca5e99", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/694f46c5dfa69efc3f8a0bdc6eab4d63c306b1b6", + "reference": "694f46c5dfa69efc3f8a0bdc6eab4d63c306b1b6", "shasum": "" }, "type": "drupal-console-language", @@ -662,7 +663,7 @@ "drupal", "symfony" ], - "time": "2016-12-12 00:56:06" + "time": "2016-12-12 17:16:39" }, { "name": "gabordemooij/redbean", @@ -1066,16 +1067,16 @@ }, { "name": "symfony/cache", - "version": "v3.2.0", + "version": "v3.1.7", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "1e5b048afac6bb08454feb99f4a434ccb92c706d" + "reference": "0f5881c9b8a03cef13fdee381f8ee623d0429cf4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/1e5b048afac6bb08454feb99f4a434ccb92c706d", - "reference": "1e5b048afac6bb08454feb99f4a434ccb92c706d", + "url": "https://api.github.com/repos/symfony/cache/zipball/0f5881c9b8a03cef13fdee381f8ee623d0429cf4", + "reference": "0f5881c9b8a03cef13fdee381f8ee623d0429cf4", "shasum": "" }, "require": { @@ -1089,7 +1090,6 @@ "require-dev": { "cache/integration-tests": "dev-master", "doctrine/cache": "~1.6", - "doctrine/dbal": "~2.4", "predis/predis": "~1.0" }, "suggest": { @@ -1098,7 +1098,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1129,36 +1129,33 @@ "caching", "psr6" ], - "time": "2016-11-25 20:20:19" + "time": "2016-11-09 14:09:05" }, { "name": "symfony/config", - "version": "v3.2.0", + "version": "v3.1.7", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "4a68f8953180bf77ea65f585020f4db0b18600b4" + "reference": "ab4fa32ffe6e625f9b7444e5e8d4702a0bc3ad7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/4a68f8953180bf77ea65f585020f4db0b18600b4", - "reference": "4a68f8953180bf77ea65f585020f4db0b18600b4", + "url": "https://api.github.com/repos/symfony/config/zipball/ab4fa32ffe6e625f9b7444e5e8d4702a0bc3ad7a", + "reference": "ab4fa32ffe6e625f9b7444e5e8d4702a0bc3ad7a", "shasum": "" }, "require": { "php": ">=5.5.9", "symfony/filesystem": "~2.8|~3.0" }, - "require-dev": { - "symfony/yaml": "~3.0" - }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1185,20 +1182,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2016-11-29 11:12:32" + "time": "2016-11-03 08:04:31" }, { "name": "symfony/console", - "version": "v3.2.0", + "version": "v3.1.7", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "09d0fd33560e3573185a2ea17614e37ba38716c5" + "reference": "5be36e1f3ac7ecbe7e34fb641480ad8497b83aa6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/09d0fd33560e3573185a2ea17614e37ba38716c5", - "reference": "09d0fd33560e3573185a2ea17614e37ba38716c5", + "url": "https://api.github.com/repos/symfony/console/zipball/5be36e1f3ac7ecbe7e34fb641480ad8497b83aa6", + "reference": "5be36e1f3ac7ecbe7e34fb641480ad8497b83aa6", "shasum": "" }, "require": { @@ -1209,19 +1206,17 @@ "require-dev": { "psr/log": "~1.0", "symfony/event-dispatcher": "~2.8|~3.0", - "symfony/filesystem": "~2.8|~3.0", "symfony/process": "~2.8|~3.0" }, "suggest": { "psr/log": "For using the console logger", "symfony/event-dispatcher": "", - "symfony/filesystem": "", "symfony/process": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1248,20 +1243,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-11-16 22:18:16" + "time": "2016-11-16 22:17:09" }, { "name": "symfony/css-selector", - "version": "v3.2.0", + "version": "v3.1.7", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "e1241f275814827c411d922ba8e64cf2a00b2994" + "reference": "a37b3359566415a91cba55a2d95820b3fa1a9658" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/e1241f275814827c411d922ba8e64cf2a00b2994", - "reference": "e1241f275814827c411d922ba8e64cf2a00b2994", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/a37b3359566415a91cba55a2d95820b3fa1a9658", + "reference": "a37b3359566415a91cba55a2d95820b3fa1a9658", "shasum": "" }, "require": { @@ -1270,7 +1265,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1301,37 +1296,37 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2016-11-03 08:11:03" + "time": "2016-11-03 08:04:31" }, { "name": "symfony/debug", - "version": "v2.8.14", + "version": "v3.1.7", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "62a68f640456f6761d752c62d81631428ef0d8a1" + "reference": "c058661c32f5b462722e36d120905940089cbd9a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/62a68f640456f6761d752c62d81631428ef0d8a1", - "reference": "62a68f640456f6761d752c62d81631428ef0d8a1", + "url": "https://api.github.com/repos/symfony/debug/zipball/c058661c32f5b462722e36d120905940089cbd9a", + "reference": "c058661c32f5b462722e36d120905940089cbd9a", "shasum": "" }, "require": { - "php": ">=5.3.9", + "php": ">=5.5.9", "psr/log": "~1.0" }, "conflict": { "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" }, "require-dev": { - "symfony/class-loader": "~2.2|~3.0.0", - "symfony/http-kernel": "~2.3.24|~2.5.9|~2.6,>=2.6.2|~3.0.0" + "symfony/class-loader": "~2.8|~3.0", + "symfony/http-kernel": "~2.8|~3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1358,32 +1353,29 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2016-11-15 12:53:17" + "time": "2016-11-15 12:55:20" }, { "name": "symfony/dependency-injection", - "version": "v3.2.0", + "version": "v3.1.7", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "f5419adad083c90e0dfd8588ef83683d7dbcc20d" + "reference": "87598e21bb9020bd9ccd6df6936b9c369c72775d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/f5419adad083c90e0dfd8588ef83683d7dbcc20d", - "reference": "f5419adad083c90e0dfd8588ef83683d7dbcc20d", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/87598e21bb9020bd9ccd6df6936b9c369c72775d", + "reference": "87598e21bb9020bd9ccd6df6936b9c369c72775d", "shasum": "" }, "require": { "php": ">=5.5.9" }, - "conflict": { - "symfony/yaml": "<3.2" - }, "require-dev": { "symfony/config": "~2.8|~3.0", "symfony/expression-language": "~2.8|~3.0", - "symfony/yaml": "~3.2" + "symfony/yaml": "~2.8.7|~3.0.7|~3.1.1|~3.2" }, "suggest": { "symfony/config": "", @@ -1394,7 +1386,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1421,20 +1413,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2016-11-25 12:32:42" + "time": "2016-11-18 21:15:08" }, { "name": "symfony/dom-crawler", - "version": "v3.2.0", + "version": "v3.1.7", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "c6b6111f5aae7c58698cdc10220785627ac44a2c" + "reference": "1eb3b4d216e8db117218dd2bb7d23dfe67bdf518" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/c6b6111f5aae7c58698cdc10220785627ac44a2c", - "reference": "c6b6111f5aae7c58698cdc10220785627ac44a2c", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/1eb3b4d216e8db117218dd2bb7d23dfe67bdf518", + "reference": "1eb3b4d216e8db117218dd2bb7d23dfe67bdf518", "shasum": "" }, "require": { @@ -1450,7 +1442,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1477,20 +1469,20 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2016-11-25 12:32:42" + "time": "2016-11-14 16:20:02" }, { "name": "symfony/event-dispatcher", - "version": "v3.2.0", + "version": "v3.1.7", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "e8f47a327c2f0fd5aa04fa60af2b693006ed7283" + "reference": "28b0832b2553ffb80cabef6a7a812ff1e670c0bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/e8f47a327c2f0fd5aa04fa60af2b693006ed7283", - "reference": "e8f47a327c2f0fd5aa04fa60af2b693006ed7283", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/28b0832b2553ffb80cabef6a7a812ff1e670c0bc", + "reference": "28b0832b2553ffb80cabef6a7a812ff1e670c0bc", "shasum": "" }, "require": { @@ -1510,7 +1502,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1537,30 +1529,29 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2016-10-13 06:29:04" + "time": "2016-10-13 06:28:43" }, { "name": "symfony/expression-language", - "version": "v3.2.0", + "version": "v3.1.7", "source": { "type": "git", "url": "https://github.com/symfony/expression-language.git", - "reference": "6ffbad90ac26e3aebc90798872a8b81979cf4fbd" + "reference": "b39826dc179f4d45c6c9a3bd4b51912726c344a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/expression-language/zipball/6ffbad90ac26e3aebc90798872a8b81979cf4fbd", - "reference": "6ffbad90ac26e3aebc90798872a8b81979cf4fbd", + "url": "https://api.github.com/repos/symfony/expression-language/zipball/b39826dc179f4d45c6c9a3bd4b51912726c344a3", + "reference": "b39826dc179f4d45c6c9a3bd4b51912726c344a3", "shasum": "" }, "require": { - "php": ">=5.5.9", - "symfony/cache": "~3.1" + "php": ">=5.5.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1587,20 +1578,20 @@ ], "description": "Symfony ExpressionLanguage Component", "homepage": "https://symfony.com", - "time": "2016-11-03 08:11:03" + "time": "2016-11-03 08:04:31" }, { "name": "symfony/filesystem", - "version": "v3.2.0", + "version": "v3.1.7", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4" + "reference": "0565b61bf098cb4dc09f4f103f033138ae4f42c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4", - "reference": "8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/0565b61bf098cb4dc09f4f103f033138ae4f42c6", + "reference": "0565b61bf098cb4dc09f4f103f033138ae4f42c6", "shasum": "" }, "require": { @@ -1609,7 +1600,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1636,20 +1627,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2016-11-24 00:46:43" + "time": "2016-10-18 04:30:12" }, { "name": "symfony/finder", - "version": "v3.2.0", + "version": "v3.1.7", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "4263e35a1e342a0f195c9349c0dee38148f8a14f" + "reference": "9925935bf7144f9e4d2b976905881b4face036fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/4263e35a1e342a0f195c9349c0dee38148f8a14f", - "reference": "4263e35a1e342a0f195c9349c0dee38148f8a14f", + "url": "https://api.github.com/repos/symfony/finder/zipball/9925935bf7144f9e4d2b976905881b4face036fb", + "reference": "9925935bf7144f9e4d2b976905881b4face036fb", "shasum": "" }, "require": { @@ -1658,7 +1649,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1685,20 +1676,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2016-11-03 08:11:03" + "time": "2016-11-03 08:04:31" }, { "name": "symfony/http-foundation", - "version": "v3.2.0", + "version": "v3.1.7", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "9963bc29d7f4398b137dd8efc480efe54fdbe5f1" + "reference": "5a4c8099a1547fe451256e056180ad4624177017" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/9963bc29d7f4398b137dd8efc480efe54fdbe5f1", - "reference": "9963bc29d7f4398b137dd8efc480efe54fdbe5f1", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/5a4c8099a1547fe451256e056180ad4624177017", + "reference": "5a4c8099a1547fe451256e056180ad4624177017", "shasum": "" }, "require": { @@ -1711,7 +1702,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1738,7 +1729,7 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2016-11-27 04:21:38" + "time": "2016-11-16 22:17:09" }, { "name": "symfony/polyfill-mbstring", @@ -1801,16 +1792,16 @@ }, { "name": "symfony/process", - "version": "v3.2.0", + "version": "v3.1.7", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "02ea84847aad71be7e32056408bb19f3a616cdd3" + "reference": "66de154ae86b1a07001da9fbffd620206e4faf94" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/02ea84847aad71be7e32056408bb19f3a616cdd3", - "reference": "02ea84847aad71be7e32056408bb19f3a616cdd3", + "url": "https://api.github.com/repos/symfony/process/zipball/66de154ae86b1a07001da9fbffd620206e4faf94", + "reference": "66de154ae86b1a07001da9fbffd620206e4faf94", "shasum": "" }, "require": { @@ -1819,7 +1810,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1846,20 +1837,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2016-11-24 10:40:28" + "time": "2016-09-29 14:13:09" }, { "name": "symfony/translation", - "version": "v3.2.0", + "version": "v3.1.7", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "64ab6fc0b42e5386631f408e6adcaaff8eee5ba1" + "reference": "2f4b6114b75c506dd1ee7eb485b35facbcb2d873" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/64ab6fc0b42e5386631f408e6adcaaff8eee5ba1", - "reference": "64ab6fc0b42e5386631f408e6adcaaff8eee5ba1", + "url": "https://api.github.com/repos/symfony/translation/zipball/2f4b6114b75c506dd1ee7eb485b35facbcb2d873", + "reference": "2f4b6114b75c506dd1ee7eb485b35facbcb2d873", "shasum": "" }, "require": { @@ -1883,7 +1874,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1910,35 +1901,29 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2016-11-18 21:17:59" + "time": "2016-11-18 21:15:08" }, { "name": "symfony/yaml", - "version": "v3.2.0", + "version": "v3.1.7", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "f2300ba8fbb002c028710b92e1906e7457410693" + "reference": "9da375317228e54f4ea1b013b30fa47417e84943" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/f2300ba8fbb002c028710b92e1906e7457410693", - "reference": "f2300ba8fbb002c028710b92e1906e7457410693", + "url": "https://api.github.com/repos/symfony/yaml/zipball/9da375317228e54f4ea1b013b30fa47417e84943", + "reference": "9da375317228e54f4ea1b013b30fa47417e84943", "shasum": "" }, "require": { "php": ">=5.5.9" }, - "require-dev": { - "symfony/console": "~2.8|~3.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1965,7 +1950,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-11-18 21:17:59" + "time": "2016-11-18 21:05:29" }, { "name": "twig/twig", From 963fc315956dd48ae8513c8d536a05983b944568 Mon Sep 17 00:00:00 2001 From: Tom Whiston Date: Sun, 18 Dec 2016 00:10:36 +0100 Subject: [PATCH 072/321] config schema validation and debugging commands (#2993) * config schema validation and debugging commands * remove translations * update class name --- config/services/drupal-console/config.yml | 11 ++ .../Config/PrintConfigValidationTrait.php | 28 +++++ src/Command/Config/ValidateCommand.php | 74 ++++++++++++ src/Command/Config/ValidateDebugCommand.php | 105 ++++++++++++++++++ 4 files changed, 218 insertions(+) create mode 100644 src/Command/Config/PrintConfigValidationTrait.php create mode 100644 src/Command/Config/ValidateCommand.php create mode 100644 src/Command/Config/ValidateDebugCommand.php diff --git a/config/services/drupal-console/config.yml b/config/services/drupal-console/config.yml index 2923bacd2..f0156a685 100644 --- a/config/services/drupal-console/config.yml +++ b/config/services/drupal-console/config.yml @@ -59,3 +59,14 @@ services: arguments: ['@settings'] tags: - { name: drupal.command } + console.config_validate: + class: Drupal\Console\Command\Config\ValidateCommand + tags: + - { name: drupal.command } + console.config_validate_debug: + class: Drupal\Console\Command\Config\ValidateDebugCommand + tags: + - { name: drupal.command } + + + diff --git a/src/Command/Config/PrintConfigValidationTrait.php b/src/Command/Config/PrintConfigValidationTrait.php new file mode 100644 index 000000000..a0fcf2009 --- /dev/null +++ b/src/Command/Config/PrintConfigValidationTrait.php @@ -0,0 +1,28 @@ +info($this->trans('commands.config.validate.messages.success')); + return 0; + } + + foreach ($valid as $key => $error) { + $io->warning($key . ': ' . $error); + } + return 1; + } + +} \ No newline at end of file diff --git a/src/Command/Config/ValidateCommand.php b/src/Command/Config/ValidateCommand.php new file mode 100644 index 000000000..e8427a5bd --- /dev/null +++ b/src/Command/Config/ValidateCommand.php @@ -0,0 +1,74 @@ +setName('config:validate') + ->setDescription($this->trans('commands.config.default.description')) + ->addArgument('config.name',InputArgument::REQUIRED); + + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) { + + /** @var TypedConfigManagerInterface $typedConfigManager */ + $typedConfigManager = $this->get('config.typed'); + + $io = new DrupalStyle($input, $output); + + //Test the config name and see if a schema exists, if not it will fail + $name = $input->getArgument('config.name'); + if(!$typedConfigManager->hasConfigSchema($name)){ + $io->warning($this->trans('commands.config.default.messages.noconf')); + return 1; + } + + //Get the config data from the factory + $configFactory = $this->get('config.factory'); + $config_data = $configFactory->get($name)->get(); + + return $this->printResults($this->checkConfigSchema($typedConfigManager, $name, $config_data), $io); + + } +} diff --git a/src/Command/Config/ValidateDebugCommand.php b/src/Command/Config/ValidateDebugCommand.php new file mode 100644 index 000000000..efcf95be0 --- /dev/null +++ b/src/Command/Config/ValidateDebugCommand.php @@ -0,0 +1,105 @@ +setName('config:validate:debug') + ->setDescription($this->trans('commands.config.validate.debug.description')) + ->addArgument('config.filepath', InputArgument::REQUIRED) + ->addArgument('config.schema.filepath', InputArgument::REQUIRED) + ->addOption('schema-name', 'sch', InputOption::VALUE_REQUIRED); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) { + + /** @var TypedConfigManagerInterface $typedConfigManager */ + $typedConfigManager = $this->get('config.typed'); + + $io = new DrupalStyle($input, $output); + + //Validate config file path + $configFilePath = $input->getArgument('config.filepath'); + if (!file_exists($configFilePath)) { + $io->info($this->trans('commands.config.validate.debug.messages.noConfFile')); + return 1; + } + + //Validate schema path + $configSchemaFilePath = $input->getArgument('config.schema.filepath'); + if (!file_exists($configSchemaFilePath)) { + $io->info($this->trans('commands.config.validate.debug.messages.noConfSchema')); + return 1; + } + + $config = Yaml::decode(file_get_contents($configFilePath)); + $schema = Yaml::decode(file_get_contents($configSchemaFilePath)); + + //Get the schema name and check it exists in the schema array + $schemaName = $this->getSchemaName($input,$configFilePath); + if(!array_key_exists($schemaName,$schema)){ + $io->warning($this->trans('commands.config.validate.debug.messages.noSchemaName') . $schemaName ); + return 1; + } + + return $this->printResults($this->manualCheckConfigSchema($typedConfigManager,$config,$schema[$schemaName]), $io); + + } + + private function getSchemaName(InputInterface $input, $configFilePath) + { + $schemaName = $input->getOption('schema-name'); + if( $schemaName === null){ + $schema_name = end(explode('/',$configFilePath)); + $schemaName = substr($schema_name, 0, -4); + } + return $schemaName; + } + + private function manualCheckConfigSchema(TypedConfigManagerInterface $typed_config, $config_data, $config_schema) { + + $data_definition = $typed_config->buildDataDefinition($config_schema, $config_data); + $this->schema = $typed_config->create($data_definition, $config_data); + $errors = array(); + foreach ($config_data as $key => $value) { + $errors = array_merge($errors, $this->checkValue($key, $value)); + } + if (empty($errors)) { + return TRUE; + } + return $errors; + } +} From 1c980c12786c84127497cf54be40c3e3bc899cf0 Mon Sep 17 00:00:00 2001 From: Tim Plunkett Date: Sat, 17 Dec 2016 18:12:06 -0500 Subject: [PATCH 073/321] Replace deprecated urlInfo() with toUrl() (#3000) --- templates/module/src/Form/entity.php.twig | 2 +- .../src/Plugin/Field/FieldFormatter/imageformatter.php.twig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/module/src/Form/entity.php.twig b/templates/module/src/Form/entity.php.twig index 0b415c571..892e9411f 100644 --- a/templates/module/src/Form/entity.php.twig +++ b/templates/module/src/Form/entity.php.twig @@ -70,6 +70,6 @@ class {{ entity_class }}Form extends EntityForm {% endblock %} '%label' => ${{ entity_name | machine_name }}->label(), ])); } - $form_state->setRedirectUrl(${{ entity_name | machine_name }}->urlInfo('collection')); + $form_state->setRedirectUrl(${{ entity_name | machine_name }}->toUrl('collection')); } {% endblock %} diff --git a/templates/module/src/Plugin/Field/FieldFormatter/imageformatter.php.twig b/templates/module/src/Plugin/Field/FieldFormatter/imageformatter.php.twig index 34203bc4d..83e6b7fcc 100644 --- a/templates/module/src/Plugin/Field/FieldFormatter/imageformatter.php.twig +++ b/templates/module/src/Plugin/Field/FieldFormatter/imageformatter.php.twig @@ -177,7 +177,7 @@ class {{ class_name }} extends ImageFormatterBase implements ContainerFactoryPlu if ($image_link_setting == 'content') { $entity = $items->getEntity(); if (!$entity->isNew()) { - $url = $entity->urlInfo(); + $url = $entity->toUrl(); } } elseif ($image_link_setting == 'file') { From 328e0b86c9d77a2676039c9d9771f1202891d38b Mon Sep 17 00:00:00 2001 From: Perttu Ehn Date: Sun, 18 Dec 2016 01:12:55 +0200 Subject: [PATCH 074/321] [multisite:new] Use correct property in example.sites.php search (#3007) Use $this->appRoot, $this->root is empty, which breaks example.sites.php -file test. --- src/Command/Multisite/NewCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Command/Multisite/NewCommand.php b/src/Command/Multisite/NewCommand.php index fadcaafa1..1147f400c 100644 --- a/src/Command/Multisite/NewCommand.php +++ b/src/Command/Multisite/NewCommand.php @@ -151,7 +151,7 @@ protected function addToSitesFile(DrupalStyle $output, $uri) throw new FileNotFoundException($this->trans('commands.multisite.new.errors.sites-invalid')); } $sites_file_contents = file_get_contents($this->appRoot . '/sites/sites.php'); - } elseif ($this->fs->exists($this->root . '/sites/example.sites.php')) { + } elseif ($this->fs->exists($this->appRoot . '/sites/example.sites.php')) { $sites_file_contents = file_get_contents($this->appRoot . '/sites/example.sites.php'); $sites_file_contents .= "\n\$sites = [];"; } else { From 41da31cbb11f7b0c71a4443c6219a7522a1fdc53 Mon Sep 17 00:00:00 2001 From: enzo - Eduardo Garcia Date: Sat, 17 Dec 2016 17:13:36 -0600 Subject: [PATCH 075/321] Add logic to enable multisite installation (#3022) * Add logic to enable multisite installation * Enable multisite command if Drupal is not installed --- config/services/drupal-console/multisite.yml | 11 ---- services-drupal-install.yml | 10 ++++ src/Command/Site/InstallCommand.php | 56 ++++++++++++++------ src/Utils/Site.php | 35 ++++++++++++ 4 files changed, 86 insertions(+), 26 deletions(-) delete mode 100644 config/services/drupal-console/multisite.yml diff --git a/config/services/drupal-console/multisite.yml b/config/services/drupal-console/multisite.yml deleted file mode 100644 index 314d7a2db..000000000 --- a/config/services/drupal-console/multisite.yml +++ /dev/null @@ -1,11 +0,0 @@ -services: - console.multisite_debug: - class: Drupal\Console\Command\Multisite\DebugCommand - arguments: ['@app.root'] - tags: - - { name: drupal.command } - console.multisite_new: - class: Drupal\Console\Command\Multisite\NewCommand - arguments: ['@app.root'] - tags: - - { name: drupal.command } diff --git a/services-drupal-install.yml b/services-drupal-install.yml index 6d8034052..b338720a5 100644 --- a/services-drupal-install.yml +++ b/services-drupal-install.yml @@ -16,3 +16,13 @@ services: arguments: ['@console.extension_manager', '@console.site', '@console.configuration_manager', '@app.root'] tags: - { name: drupal.command } + console.multisite_debug: + class: Drupal\Console\Command\Multisite\DebugCommand + arguments: ['@app.root'] + tags: + - { name: drupal.command } + console.multisite_new: + class: Drupal\Console\Command\Multisite\NewCommand + arguments: ['@app.root'] + tags: + - { name: drupal.command } diff --git a/src/Command/Site/InstallCommand.php b/src/Command/Site/InstallCommand.php index 3990d268c..5907664bd 100644 --- a/src/Command/Site/InstallCommand.php +++ b/src/Command/Site/InstallCommand.php @@ -9,6 +9,7 @@ use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Config\Definition\Exception\Exception; +use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; @@ -25,6 +26,7 @@ use Drupal\Console\Utils\Site; use DrupalFinder\DrupalFinder; + class InstallCommand extends Command { use ContainerAwareCommandTrait; @@ -370,6 +372,19 @@ function ($profile) { protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); + $uri = parse_url($input->getParameterOption(['--uri', '-l']) ?: 'default', PHP_URL_HOST); + + if($this->site->multisiteMode($uri)) { + if(!$this->site->validMultisite($uri)) { + $io->error( + sprintf($this->trans('commands.site.install.messages.invalid-multisite'), $uri, $uri) + ); + exit(1); + } + + // Modify $_SERVER environment information to enable the Drupal installer use multisite configuration. + $_SERVER['HTTP_HOST'] = $uri; + } // Database options $dbType = $input->getOption('db-type')?:'mysql'; @@ -417,15 +432,15 @@ protected function execute(InputInterface $input, OutputInterface $output) } } - $this->backupSitesFile($io); - try { - $this->runInstaller($io, $input, $database); $drupalFinder = new DrupalFinder(); $drupalFinder->locateRoot(getcwd()); $composerRoot = $drupalFinder->getComposerRoot(); $drupalRoot = $drupalFinder->getDrupalRoot(); + + $this->runInstaller($io, $input, $database, $uri); + $autoload = $this->container->get('class_loader'); $drupal = new Drupal($autoload, $composerRoot, $drupalRoot); $container = $drupal->boot(); @@ -478,15 +493,18 @@ protected function restoreSitesFile(DrupalStyle $output) protected function runInstaller( DrupalStyle $io, InputInterface $input, - $database - ) { + $database, + $uri + ) + { $this->site->loadLegacyFile('/core/includes/install.core.inc'); - $driver = (string) $database['driver']; + $driver = (string)$database['driver']; + $settings = [ 'parameters' => [ - 'profile' => $input->getArgument('profile')?:'standard', - 'langcode' => $input->getOption('langcode')?:'en', + 'profile' => $input->getArgument('profile') ?: 'standard', + 'langcode' => $input->getOption('langcode') ?: 'en', ], 'forms' => [ 'install_settings_form' => [ @@ -495,26 +513,30 @@ protected function runInstaller( 'op' => 'Save and continue', ], 'install_configure_form' => [ - 'site_name' => $input->getOption('site-name')?:'Drupal 8', - 'site_mail' => $input->getOption('site-mail')?:'admin@example.org', + 'site_name' => $input->getOption('site-name') ?: 'Drupal 8', + 'site_mail' => $input->getOption('site-mail') ?: 'admin@example.org', 'account' => [ - 'name' => $input->getOption('account-name')?:'admin', - 'mail' => $input->getOption('account-mail')?:'admin@example.org', + 'name' => $input->getOption('account-name') ?: 'admin', + 'mail' => $input->getOption('account-mail') ?: 'admin@example.org', 'pass' => [ - 'pass1' => $input->getOption('account-pass')?:'admin', - 'pass2' => $input->getOption('account-pass')?:'admin' + 'pass1' => $input->getOption('account-pass') ?: 'admin', + 'pass2' => $input->getOption('account-pass') ?: 'admin' ], ], 'update_status_module' => [ 1 => true, 2 => true, ], - 'clean_url' => true, + 'clean_url' => true, 'op' => 'Save and continue', ], ] ]; + if (!$this->site->multisiteMode($uri)) { + $this->backupSitesFile($io); + } + $io->newLine(); $io->info($this->trans('commands.site.install.messages.installing')); @@ -529,6 +551,10 @@ protected function runInstaller( return; } + if (!$this->site->multisiteMode($uri)) { + $this->restoreSitesFile($io); + } + $io->success($this->trans('commands.site.install.messages.installed')); } } diff --git a/src/Utils/Site.php b/src/Utils/Site.php index a3bc8da70..c561f4cb7 100644 --- a/src/Utils/Site.php +++ b/src/Utils/Site.php @@ -135,4 +135,39 @@ public function getAutoload() return include $autoLoadFile; } + + /** + * @return boolean + */ + public function multisiteMode($uri) + { + if($uri != 'default') { + return true; + } + + return false; + } + + /** + * @return boolean + */ + public function validMultisite($uri) + { + $multiSiteFile = sprintf( + '%s/sites/sites.php', + $this->appRoot + ); + + if (file_exists($multiSiteFile)) { + include $multiSiteFile; + } else { + return false; + } + + if(isset($sites[$uri]) && is_dir($this->appRoot . "/sites/" . $sites[$uri])) { + return true; + } + + return false; + } } From 905748a9c440ac3b6f3b3c4750734907972510b4 Mon Sep 17 00:00:00 2001 From: Tom Whiston Date: Sun, 18 Dec 2016 00:15:10 +0100 Subject: [PATCH 076/321] update base class, refactor debug and poll commands (#3002) --- src/Command/Database/DatabaseLogBase.php | 276 +++++++++++++++ src/Command/Database/LogDebugCommand.php | 417 ++++++++--------------- src/Command/Database/LogPollCommand.php | 95 ++++++ 3 files changed, 514 insertions(+), 274 deletions(-) create mode 100644 src/Command/Database/DatabaseLogBase.php create mode 100644 src/Command/Database/LogPollCommand.php diff --git a/src/Command/Database/DatabaseLogBase.php b/src/Command/Database/DatabaseLogBase.php new file mode 100644 index 000000000..87bacc5b6 --- /dev/null +++ b/src/Command/Database/DatabaseLogBase.php @@ -0,0 +1,276 @@ +database = $database; + $this->dateFormatter = $dateFormatter; + $this->entityTypeManager = $entityTypeManager; + $this->stringTranslation = $stringTranslation; + $this->userStorage = $this->entityTypeManager->getStorage('user'); + $this->severityList = RfcLogLevel::getLevels(); + parent::__construct(); + } + + /** + * + */ + protected function addDefaultLoggingOptions() { + + $this + ->addOption( + 'type', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.database.log.common.options.type') + ) + ->addOption( + 'severity', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.database.log.common.options.severity') + ) + ->addOption( + 'user-id', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.database.log.common.options.user-id') + ); + + } + + /** + * @param \Symfony\Component\Console\Input\InputInterface $input + */ + protected function getDefaultOptions(InputInterface $input) { + + $this->eventType = $input->getOption('type'); + $this->eventSeverity = $input->getOption('severity'); + $this->userId = $input->getOption('user-id'); + + } + + /** + * @param \Drupal\Console\Style\DrupalStyle $io + * @param null $offset + * @param int $range + * @return bool|\Drupal\Core\Database\Query\SelectInterface + */ + protected function makeQuery(DrupalStyle $io, $offset = NULL, $range = 1000) { + + $query = $this->database->select('watchdog', 'w'); + $query->fields( + 'w', + [ + 'wid', + 'uid', + 'severity', + 'type', + 'timestamp', + 'message', + 'variables', + ] + ); + + if ($this->eventType) { + $query->condition('type', $this->eventType); + } + + if ($this->eventSeverity) { + if (!in_array($this->eventSeverity, $this->severityList)) { + $io->error( + sprintf( + $this->trans('database.log.common.messages.invalid-severity'), + $this->eventSeverity + ) + ); + return FALSE; + } + $query->condition('severity', + array_search($this->eventSeverity, + $this->severityList)); + } + + if ($this->userId) { + $query->condition('uid', $this->userId); + } + + $query->orderBy('wid', 'ASC'); + + if ($offset) { + $query->range($offset, $range); + } + + return $query; + + } + + /** + * Generic logging table header + * + * @return array + */ + protected function createTableHeader() { + return [ + $this->trans('commands.database.log.common.messages.event-id'), + $this->trans('commands.database.log.common.messages.type'), + $this->trans('commands.database.log.common.messages.date'), + $this->trans('commands.database.log.common.messages.message'), + $this->trans('commands.database.log.common.messages.user'), + $this->trans('commands.database.log.common.messages.severity'), + ]; + } + + + /** + * @param \stdClass $dblog + * @return array + */ + protected function createTableRow(\stdClass $dblog) { + + /** @var User $user */ + $user = $this->userStorage->load($dblog->uid); + + return [ + $dblog->wid, + $dblog->type, + $this->dateFormatter->format($dblog->timestamp, 'short'), + Unicode::truncate(Html::decodeEntities(strip_tags($this->formatMessage($dblog))), + 500, + TRUE, + TRUE), + $user->getUsername() . ' (' . $user->id() . ')', + $this->severityList[$dblog->severity]->render(), + ]; + } + + /** + * Formats a database log message. + * + * @param $event + * The record from the watchdog table. The object properties are: wid, uid, + * severity, type, timestamp, message, variables, link, name. + * + * @return string|false + * The formatted log message or FALSE if the message or variables properties + * are not set. + */ + protected function formatMessage(\stdClass $event) { + $message = FALSE; + + // Check for required properties. + if (isset($event->message, $event->variables)) { + // Messages without variables or user specified text. + if ($event->variables === 'N;') { + return $event->message; + } + + return $this->stringTranslation->translate( + $event->message, + unserialize($event->variables) + ); + } + + return $message; + } + + /** + * @param $dblog + * @return array + */ + protected function formatSingle($dblog) { + return array_combine($this->createTableHeader(), + $this->createTableRow($dblog)); + } + +} \ No newline at end of file diff --git a/src/Command/Database/LogDebugCommand.php b/src/Command/Database/LogDebugCommand.php index dc02baacf..a643eb7d4 100644 --- a/src/Command/Database/LogDebugCommand.php +++ b/src/Command/Database/LogDebugCommand.php @@ -11,295 +11,164 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Core\StringTranslation\Translator\TranslatorInterface; -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Datetime\DateFormatterInterface; -use Drupal\Core\Database\Connection; -use Drupal\Component\Utility\Unicode; use Drupal\Component\Serialization\Yaml; -use Drupal\Component\Utility\Html; -use Drupal\Core\Logger\RfcLogLevel; -use Drupal\Console\Command\Shared\CommandTrait; use Drupal\Console\Style\DrupalStyle; -class LogDebugCommand extends Command -{ - use CommandTrait; - - /** - * @var Connection - */ - protected $database; - - /** - * @var DateFormatterInterface - */ - protected $dateFormatter; - - /** - * @var EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * @var TranslatorInterface - */ - protected $stringTranslation; - - /** - * LogDebugCommand constructor. - * @param Connection $database - * @param DateFormatterInterface $dateFormatter - * @param EntityTypeManagerInterface $entityTypeManager - * @param TranslatorInterface $stringTranslation - */ - public function __construct( - Connection $database, - DateFormatterInterface $dateFormatter, - EntityTypeManagerInterface $entityTypeManager, - TranslatorInterface $stringTranslation - ) { - $this->database = $database; - $this->dateFormatter = $dateFormatter; - $this->entityTypeManager = $entityTypeManager; - $this->stringTranslation = $stringTranslation; - parent::__construct(); +/** + * Class LogDebugCommand + * + * @package Drupal\Console\Command\Database + */ +class LogDebugCommand extends DatabaseLogBase { + + /** + * @var + */ + protected $eventId; + + /** + * @var + */ + protected $asc; + /** + * @var + */ + protected $limit; + /** + * @var + */ + protected $offset; + + /** + * Print in yml style if true + * + * @var bool + */ + protected $ymlStyle; + + /** + * {@inheritdoc} + */ + protected function configure() { + $this + ->setName('database:log:debug') + ->setDescription($this->trans('commands.database.log.debug.description')); + + $this->addDefaultLoggingOptions(); + + $this + ->addArgument( + 'event-id', + InputArgument::OPTIONAL, + $this->trans('commands.database.log.debug.arguments.event-id') + ) + ->addOption( + 'asc', + FALSE, + InputOption::VALUE_NONE, + $this->trans('commands.database.log.debug.options.asc') + ) + ->addOption( + 'limit', + NULL, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.database.log.debug.options.limit') + ) + ->addOption( + 'offset', + NULL, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.database.log.debug.options.offset'), + 0 + ) + ->addOption( + 'yml', + NULL, + InputOption::VALUE_NONE, + $this->trans('commands.database.log.debug.options.yml'), + NULL + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) { + + $io = new DrupalStyle($input, $output); + + $this->getDefaultOptions($input); + $this->eventId = $input->getArgument('event-id'); + $this->asc = $input->getOption('asc'); + $this->limit = $input->getOption('limit'); + $this->offset = $input->getOption('offset'); + $this->ymlStyle = $input->getOption('yml'); + + + if ($this->eventId) { + return $this->getEventDetails($io); + } else { + return $this->getAllEvents($io); } - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName('database:log:debug') - ->setDescription($this->trans('commands.database.log.debug.description')) - ->addArgument( - 'event-id', - InputArgument::OPTIONAL, - $this->trans('commands.database.log.debug.arguments.event-id') - ) - ->addOption( - 'type', - '', - InputOption::VALUE_OPTIONAL, - $this->trans('commands.database.log.debug.options.type') - ) - ->addOption( - 'severity', - '', - InputOption::VALUE_OPTIONAL, - $this->trans('commands.database.log.debug.options.severity') - ) - ->addOption( - 'user-id', - '', - InputOption::VALUE_OPTIONAL, - $this->trans('commands.database.log.debug.options.user-id') - ) - ->addOption( - 'asc', - false, - InputOption::VALUE_NONE, - $this->trans('commands.database.log.debug.options.asc') - ) - ->addOption( - 'limit', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.database.log.debug.options.limit') - ) - ->addOption( - 'offset', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.database.log.debug.options.offset'), - 0 - ); - ; + } + + /** + * @param $io + * @param $eventId + * @return bool + */ + private function getEventDetails(DrupalStyle $io) { + + $dblog = $this->database + ->query( + 'SELECT w.*, u.uid FROM {watchdog} w LEFT JOIN {users} u ON u.uid = w.uid WHERE w.wid = :id', + [':id' => $this->eventId] + ) + ->fetchObject(); + + if (!$dblog) { + $io->error( + sprintf( + $this->trans('commands.database.log.debug.messages.not-found'), + $this->eventId + ) + ); + return 1; } - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $eventId = $input->getArgument('event-id'); - $eventType = $input->getOption('type'); - $eventSeverity = $input->getOption('severity'); - $userId = $input->getOption('user-id'); - $asc = $input->getOption('asc'); - $limit = $input->getOption('limit'); - $offset = $input->getOption('offset'); - - if ($eventId) { - $this->getEventDetails($io, $eventId); - } else { - $this->getAllEvents($io, $eventType, $eventSeverity, $userId, $asc, $offset, $limit); - } - - return 0; + if ($this->ymlStyle) { + $io->writeln(Yaml::encode($this->formatSingle($dblog))); + } else { + $io->table( + $this->createTableHeader(), + [$this->createTableRow($dblog)] + ); } - /** - * @param $io - * @param $eventId - * @return bool - */ - private function getEventDetails(DrupalStyle $io, $eventId) - { - $userStorage = $this->entityTypeManager->getStorage('user'); - $severity = RfcLogLevel::getLevels(); - - $dblog = $this->database - ->query( - 'SELECT w.*, u.uid FROM {watchdog} w LEFT JOIN {users} u ON u.uid = w.uid WHERE w.wid = :id', - [':id' => $eventId] - ) - ->fetchObject(); - if (!$dblog) { - $io->error( - sprintf( - $this->trans('commands.database.log.debug.messages.not-found'), - $eventId - ) - ); + } - return false; - } + /** + * @param \Drupal\Console\Style\DrupalStyle $io + * @return bool + */ + private function getAllEvents(DrupalStyle $io) { - $user = $userStorage->load($dblog->uid); + $query = $this->makeQuery($io); - $configuration = [ - $this->trans('commands.database.log.debug.messages.event-id') => $eventId, - $this->trans('commands.database.log.debug.messages.type') => $dblog->type, - $this->trans('commands.database.log.debug.messages.date') => $this->dateFormatter->format($dblog->timestamp, 'short'), - $this->trans('commands.database.log.debug.messages.user') => $user->getUsername() . ' (' . $user->id() .')', - $this->trans('commands.database.log.debug.messages.severity') => (string) $severity[$dblog->severity], - $this->trans('commands.database.log.debug.messages.message') => Html::decodeEntities(strip_tags($this->formatMessage($dblog))) - ]; + $result = $query->execute(); - $io->writeln(Yaml::encode($configuration)); - - return true; + $tableRows = []; + foreach ($result as $dblog) { + $tableRows[] = $this->createTableRow($dblog); } - private function getAllEvents(DrupalStyle $io, $eventType, $eventSeverity, $userId, $asc, $offset, $limit) - { - $userStorage = $this->entityTypeManager->getStorage('user'); - $severity = RfcLogLevel::getLevels(); - - $query = $this->database->select('watchdog', 'w'); - $query->fields( - 'w', - [ - 'wid', - 'uid', - 'severity', - 'type', - 'timestamp', - 'message', - 'variables', - ] - ); - - if ($eventType) { - $query->condition('type', $eventType); - } - - if ($eventSeverity) { - if (!in_array($eventSeverity, $severity)) { - $io->error( - sprintf( - $this->trans('commands.database.log.debug.messages.invalid-severity'), - $eventSeverity - ) - ); + $io->table( + $this->createTableHeader(), + $tableRows + ); - return false; - } + return TRUE; + } - $query->condition('severity', array_search($eventSeverity, $severity)); - } - - if ($userId) { - $query->condition('uid', $userId); - } - - if ($asc) { - $query->orderBy('wid', 'ASC'); - } else { - $query->orderBy('wid', 'DESC'); - } - - if ($limit) { - $query->range($offset, $limit); - } - - $result = $query->execute(); - - $tableHeader = [ - $this->trans('commands.database.log.debug.messages.event-id'), - $this->trans('commands.database.log.debug.messages.type'), - $this->trans('commands.database.log.debug.messages.date'), - $this->trans('commands.database.log.debug.messages.message'), - $this->trans('commands.database.log.debug.messages.user'), - $this->trans('commands.database.log.debug.messages.severity'), - ]; - - $tableRows = []; - foreach ($result as $dblog) { - $user= $userStorage->load($dblog->uid); - - $tableRows[] = [ - $dblog->wid, - $dblog->type, - $this->dateFormatter->format($dblog->timestamp, 'short'), - Unicode::truncate(Html::decodeEntities(strip_tags($this->formatMessage($dblog))), 56, true, true), - $user->getUsername() . ' (' . $user->id() .')', - $severity[$dblog->severity] - ]; - } - - $io->table( - $tableHeader, - $tableRows - ); - - return true; - } - - /** - * Formats a database log message. - * - * @param $event - * The record from the watchdog table. The object properties are: wid, uid, - * severity, type, timestamp, message, variables, link, name. - * - * @return string|false - * The formatted log message or FALSE if the message or variables properties - * are not set. - */ - private function formatMessage($event) - { - $message = false; - - // Check for required properties. - if (isset($event->message) && isset($event->variables)) { - // Messages without variables or user specified text. - if ($event->variables === 'N;') { - return $event->message; - } - - return $this->stringTranslation->translate( - $event->message, unserialize($event->variables) - ); - } - - return $message; - } } diff --git a/src/Command/Database/LogPollCommand.php b/src/Command/Database/LogPollCommand.php new file mode 100644 index 000000000..8e80e020e --- /dev/null +++ b/src/Command/Database/LogPollCommand.php @@ -0,0 +1,95 @@ +setName('database:log:poll') + ->setDescription($this->trans('commands.database.log.poll.description')); + + $this->addDefaultLoggingOptions(); + + $this->addArgument( + 'duration', + InputArgument::OPTIONAL, + $this->trans('commands.database.log.poll.arguments.duration'), + '10' + ); + + } + + /** + * @param \Symfony\Component\Console\Input\InputInterface $input + * @param \Symfony\Component\Console\Output\OutputInterface $output + */ + protected function execute(InputInterface $input, OutputInterface $output) { + + $io = new DrupalStyle($input, $output); + + $io->note($this->trans('commands.database.log.poll.messages.warning')); + + $this->getDefaultOptions($input); + $this->duration = $input->getArgument('duration'); + + $this->pollForEvents($io); + + } + + /** + * @param \Drupal\Console\Style\DrupalStyle $io + */ + protected function pollForEvents(DrupalStyle $io) { + + $query = $this->makeQuery($io)->countQuery(); + $results = $query->execute()->fetchAssoc(); + $count = $results['expression'] - 1;//minus 1 so the newest message always prints + + $tableHeader = $this->createTableHeader(); + + //Poll, force no wait on first loop + $lastExec = time() - $this->duration; + while (1) { + + if (time() > $lastExec + $this->duration) { + //Print out any new db logs + $query = $this->makeQuery($io, $count); + $results = $query->execute()->fetchAll(); + $count += count($results); + $tableRows = []; + foreach ($results as $r) { + $tableRows[] = $this->createTableRow($r); + } + if (!empty($tableRows)) { + $io->table($tableHeader, $tableRows); + } + //update the last exec time + $lastExec = time(); + } + } + + } + + +} From 43ee1cb72d1b240580c705beba47723cd89f5498 Mon Sep 17 00:00:00 2001 From: Jack Tonkin Date: Sat, 17 Dec 2016 23:16:24 +0000 Subject: [PATCH 077/321] Relax user:password:hash password service typehint (#3008) Sites may want to replace the default password service (e.g. to use a wrapper around password_hash() and friends). --- src/Command/User/PasswordHashCommand.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Command/User/PasswordHashCommand.php b/src/Command/User/PasswordHashCommand.php index 73a121574..6044a980e 100644 --- a/src/Command/User/PasswordHashCommand.php +++ b/src/Command/User/PasswordHashCommand.php @@ -12,7 +12,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Core\Password\PhpassHashedPassword; +use Drupal\Core\Password\PasswordInterface; use Drupal\Console\Command\Shared\ConfirmationTrait; use Drupal\Console\Style\DrupalStyle; @@ -22,15 +22,15 @@ class PasswordHashCommand extends Command use ConfirmationTrait; /** - * @var PhpassHashedPassword + * @var PasswordInterface */ protected $password; /** * PasswordHashCommand constructor. - * @param PhpassHashedPassword $password + * @param PasswordInterface $password */ - public function __construct(PhpassHashedPassword $password) { + public function __construct(PasswordInterface $password) { $this->password = $password; parent::__construct(); } From 4ef9f6f885ac5b783e8a2b142c71f7f56b0da1ff Mon Sep 17 00:00:00 2001 From: Jack Tonkin Date: Sat, 17 Dec 2016 23:16:49 +0000 Subject: [PATCH 078/321] Fix typo in user:password:hash (#3009) --- src/Command/User/PasswordHashCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Command/User/PasswordHashCommand.php b/src/Command/User/PasswordHashCommand.php index 6044a980e..795c9e410 100644 --- a/src/Command/User/PasswordHashCommand.php +++ b/src/Command/User/PasswordHashCommand.php @@ -65,7 +65,7 @@ protected function execute(InputInterface $input, OutputInterface $output) foreach ($passwords as $password) { $tableRows[] = [ $password, - $password->hash($password), + $this->password->hash($password), ]; } From ccbf22d7c3367042a7d171d506610db23fb1e37a Mon Sep 17 00:00:00 2001 From: Perttu Ehn Date: Sun, 18 Dec 2016 01:17:38 +0200 Subject: [PATCH 079/321] [database:dump help] Correct keys for translation lookup (#3012) --- src/Command/Database/DumpCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Command/Database/DumpCommand.php b/src/Command/Database/DumpCommand.php index c7f6bb67a..390dcd6da 100644 --- a/src/Command/Database/DumpCommand.php +++ b/src/Command/Database/DumpCommand.php @@ -61,13 +61,13 @@ protected function configure() 'file', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.database.dump.option.file') + $this->trans('commands.database.dump.options.file') ) ->addOption( 'gz', false, InputOption::VALUE_NONE, - $this->trans('commands.database.dump.option.gz') + $this->trans('commands.database.dump.options.gz') ) ->setHelp($this->trans('commands.database.dump.help')); } From f08361e4a3b9795bc7e0e1cff48f165767043fce Mon Sep 17 00:00:00 2001 From: Perttu Ehn Date: Sun, 18 Dec 2016 01:18:19 +0200 Subject: [PATCH 080/321] [database:dump] Don't duplicate .gz extension (#3014) * [database:dump] Don't duplicate .gz extension * [database:dump] Keep the overwritten file --- src/Command/Database/DumpCommand.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Command/Database/DumpCommand.php b/src/Command/Database/DumpCommand.php index 390dcd6da..349b44acd 100644 --- a/src/Command/Database/DumpCommand.php +++ b/src/Command/Database/DumpCommand.php @@ -127,7 +127,9 @@ protected function execute(InputInterface $input, OutputInterface $output) if ($this->shellProcess->exec($command, $this->appRoot)) { $resultFile = $file; if ($gz) { - $resultFile = $file . ".gz"; + if(substr($file, -3) != '.gz') { + $resultFile = $file . ".gz"; + } file_put_contents( $resultFile, gzencode( @@ -135,7 +137,9 @@ protected function execute(InputInterface $input, OutputInterface $output) $file) ) ); - unlink($file); + if($resultFile != $file) { + unlink($file); + } } $io->success( From 10d7d49621b9e0daad26f30f7e500aa8a3503bb7 Mon Sep 17 00:00:00 2001 From: bpresles Date: Sun, 18 Dec 2016 00:19:00 +0100 Subject: [PATCH 081/321] Fix incompatibility between webprofiler module and migrate:setup command (#3018) --- src/Command/Migrate/SetupCommand.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Command/Migrate/SetupCommand.php b/src/Command/Migrate/SetupCommand.php index 35db40e83..9dba61e83 100644 --- a/src/Command/Migrate/SetupCommand.php +++ b/src/Command/Migrate/SetupCommand.php @@ -8,6 +8,7 @@ namespace Drupal\Console\Command\Migrate; use Drupal\Console\Style\DrupalStyle; +use Drupal\Core\State\StateInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -15,7 +16,6 @@ use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Command\Shared\DatabaseTrait; use Drupal\Console\Command\Shared\MigrationTrait; -use Drupal\Core\State\State; use Drupal\migrate\Plugin\MigrationPluginManagerInterface; use Drupal\migrate\Plugin\RequirementsInterface; use Drupal\migrate\Exception\RequirementsException; @@ -28,7 +28,7 @@ class SetupCommand extends Command use MigrationTrait; /** - * @var State $state + * @var StateInterface $state */ protected $state; @@ -39,9 +39,9 @@ class SetupCommand extends Command /** * SetupCommand constructor. - * @param State $pluginManagerMigration + * @param StateInterface $pluginManagerMigration */ - public function __construct(State $state, MigrationPluginManagerInterface $pluginManagerMigration) + public function __construct(StateInterface $state, MigrationPluginManagerInterface $pluginManagerMigration) { $this->state = $state; $this->pluginManagerMigration = $pluginManagerMigration; From 896dfc3fd394ae829e0be7ebe9ecd2d65989b867 Mon Sep 17 00:00:00 2001 From: Chris Haynes Date: Sat, 17 Dec 2016 17:21:03 -0600 Subject: [PATCH 082/321] Additions to the generate module command (#2995) * Adding template folder and file creation to generate module command. * Undoing un needed changes. * Undoing un needed changes. * Formatting changes. --- src/Command/Generate/ModuleCommand.php | 29 +++++++++++- src/Generator/ModuleGenerator.php | 46 ++++++++++++++++++- .../module/module-twig-template-append.twig | 12 +++++ templates/module/twig-template-file.twig | 1 + 4 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 templates/module/module-twig-template-append.twig create mode 100644 templates/module/twig-template-file.twig diff --git a/src/Command/Generate/ModuleCommand.php b/src/Command/Generate/ModuleCommand.php index 375f9d743..826e1986c 100644 --- a/src/Command/Generate/ModuleCommand.php +++ b/src/Command/Generate/ModuleCommand.php @@ -59,6 +59,11 @@ class ModuleCommand extends Command */ protected $site; + /** + * @var string + */ + protected $twigtemplate; + /** * ModuleCommand constructor. @@ -69,6 +74,7 @@ class ModuleCommand extends Command * @param DrupalApi $drupalApi * @param Client $httpClient * @param Site $site + * @param $twigtemplate */ public function __construct( ModuleGenerator $generator, @@ -77,7 +83,8 @@ public function __construct( StringConverter $stringConverter, DrupalApi $drupalApi, Client $httpClient, - Site $site + Site $site, + $twigtemplate ) { $this->generator = $generator; $this->validator = $validator; @@ -86,6 +93,7 @@ public function __construct( $this->drupalApi = $drupalApi; $this->httpClient = $httpClient; $this->site = $site; + $this->twigtemplate = $twigtemplate; parent::__construct(); } @@ -163,6 +171,12 @@ protected function configure() '', InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.module.options.test') + ) + ->addOption( + 'twigtemplate', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.module.options.twigtemplate') ); } @@ -192,6 +206,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $featuresBundle = $input->getOption('features-bundle'); $composer = $input->getOption('composer'); $test = $input->getOption('test'); + $twigtemplate = $input->getOption('twigtemplate'); // Modules Dependencies, re-factor and share with other commands $dependencies = $this->validator->validateModuleDependencies($input->getOption('dependencies')); @@ -220,7 +235,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $featuresBundle, $composer, $dependencies, - $test + $test, + $twigtemplate ); } @@ -434,6 +450,15 @@ function ($core) { ); $input->setOption('test', $test); } + + $twigtemplate = $input->getOption('twigtemplate'); + if (!$twigtemplate) { + $twigtemplate = $io->confirm( + $this->trans('commands.generate.module.questions.twigtemplate'), + true + ); + $input->setOption('twigtemplate', $twigtemplate); + } } /** diff --git a/src/Generator/ModuleGenerator.php b/src/Generator/ModuleGenerator.php index 4ddbad95d..705453c9e 100644 --- a/src/Generator/ModuleGenerator.php +++ b/src/Generator/ModuleGenerator.php @@ -25,6 +25,7 @@ class ModuleGenerator extends Generator * @param $composer * @param $dependencies * @param $test + * @param $twigtemplate */ public function generate( $module, @@ -37,7 +38,8 @@ public function generate( $featuresBundle, $composer, $dependencies, - $test + $test, + $twigtemplate ) { $dir .= '/'.$machineName; if (file_exists($dir)) { @@ -77,6 +79,7 @@ public function generate( 'package' => $package, 'dependencies' => $dependencies, 'test' => $test, + 'twigtemplate' => $twigtemplate, ); $this->renderFile( @@ -118,5 +121,46 @@ public function generate( $parameters ); } + if ($twigtemplate) { + $this->renderFile( + 'module/module-twig-template-append.twig', + $dir .'/' . $machineName . '.module', + $parameters, + FILE_APPEND + ); + $dir .= '/templates/'; + if (file_exists($dir)) { + if (!is_dir($dir)) { + throw new \RuntimeException( + sprintf( + 'Unable to generate the templates directory as the target directory "%s" exists but is a file.', + realpath($dir) + ) + ); + } + $files = scandir($dir); + if ($files != array('.', '..')) { + throw new \RuntimeException( + sprintf( + 'Unable to generate the templates directory as the target directory "%s" is not empty.', + realpath($dir) + ) + ); + } + if (!is_writable($dir)) { + throw new \RuntimeException( + sprintf( + 'Unable to generate the templates directory as the target directory "%s" is not writable.', + realpath($dir) + ) + ); + } + } + $this->renderFile( + 'module/twig-template-file.twig', + $dir . $machineName . '.html.twig', + $parameters + ); + } } } diff --git a/templates/module/module-twig-template-append.twig b/templates/module/module-twig-template-append.twig new file mode 100644 index 000000000..42b3d687b --- /dev/null +++ b/templates/module/module-twig-template-append.twig @@ -0,0 +1,12 @@ + +/** + * Implements hook_theme(). + */ +function {{machine_name}}_theme() { + return [ + '{{machine_name}}' => [ + 'template' => '{{machine_name}}', + 'render element' => 'children', + ], + ]; +} diff --git a/templates/module/twig-template-file.twig b/templates/module/twig-template-file.twig new file mode 100644 index 000000000..91e43c8f8 --- /dev/null +++ b/templates/module/twig-template-file.twig @@ -0,0 +1 @@ + \ No newline at end of file From c6e8522815f11f5d624f1213a7a433482b4b62ab Mon Sep 17 00:00:00 2001 From: leandro Date: Sun, 18 Dec 2016 00:22:03 +0100 Subject: [PATCH 083/321] working disable cache page in site:mode dev (#2998) * working disable cache page in site:mode dev * added --local option for keeping settings.local.php and testing PROD in local --- src/Command/Site/ModeCommand.php | 198 +++++++++++++++++++++++++------ 1 file changed, 159 insertions(+), 39 deletions(-) diff --git a/src/Command/Site/ModeCommand.php b/src/Command/Site/ModeCommand.php index d7501da03..f39b6dd78 100644 --- a/src/Command/Site/ModeCommand.php +++ b/src/Command/Site/ModeCommand.php @@ -4,20 +4,24 @@ * @file * Contains \Drupal\Console\Command\Site\ModeCommand. */ - namespace Drupal\Console\Command\Site; use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Filesystem\Exception\IOExceptionInterface; use Symfony\Component\Yaml\Yaml; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Filesystem\Filesystem; +use Novia713\Maginot\Maginot; use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Style\DrupalStyle; use Drupal\Console\Utils\ConfigurationManager; use Drupal\Core\Config\ConfigFactory; use Drupal\Console\Utils\ChainQueue; + class ModeCommand extends Command { use ContainerAwareCommandTrait; @@ -44,9 +48,11 @@ class ModeCommand extends Command /** * DebugCommand constructor. - * @param ConfigFactory $configFactory + * + * @param ConfigFactory $configFactory * @param ConfigurationManager $configurationManager - * @param ChainQueue $chainQueue, + * @param $appRoot + * @param ChainQueue $chainQueue, */ public function __construct( ConfigFactory $configFactory, @@ -58,6 +64,30 @@ public function __construct( $this->configurationManager = $configurationManager; $this->appRoot = $appRoot; $this->chainQueue = $chainQueue; + + $this->local = null; + + $this->services_file = + $this->appRoot.'/sites/default/services.yml'; + + $this->local_services_file = + $this->appRoot.'/sites/development.services.yml'; + + $this->settings_file = + $this->appRoot.'/sites/default/settings.php'; + + $this->local_settings_file = + $this->appRoot.'/sites/default/settings.local.php'; + + $this->local_settings_file_original = + $this->appRoot.'/sites/example.settings.local.php'; + + $this->fs = new Filesystem(); + $this->maginot = new Maginot(); + $this->yaml = new Yaml(); + + $this->environment = null; + parent::__construct(); } @@ -70,6 +100,12 @@ protected function configure() 'environment', InputArgument::REQUIRED, $this->trans('commands.site.mode.arguments.environment') + ) + ->addOption( + 'local', + null, + InputOption::VALUE_NONE, + $this->trans('commands.site.mode.options.local') ); } @@ -77,22 +113,24 @@ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); - $environment = $input->getArgument('environment'); + $this->environment = $input->getArgument('environment'); + $this->local = $input->getOption('local'); $loadedConfigurations = []; - if (in_array($environment, array('dev', 'prod'))) { - $loadedConfigurations = $this->loadConfigurations($environment); + if (in_array($this->environment, array('dev', 'prod'))) { + $loadedConfigurations = $this->loadConfigurations($this->environment); } else { $io->error($this->trans('commands.site.mode.messages.invalid-env')); } $configurationOverrideResult = $this->overrideConfigurations( - $loadedConfigurations['configurations'] + $loadedConfigurations['configurations'], + $io ); foreach ($configurationOverrideResult as $configName => $result) { $io->info( - $this->trans('commands.site.mode.messages.configuration') . ':', + $this->trans('commands.site.mode.messages.configuration').':', false ); $io->comment($configName); @@ -107,7 +145,6 @@ protected function execute(InputInterface $input, OutputInterface $output) } $servicesOverrideResult = $this->overrideServices( - $environment, $loadedConfigurations['services'], $io ); @@ -129,7 +166,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); } - protected function overrideConfigurations($configurations) + protected function overrideConfigurations($configurations, $io) { $result = []; foreach ($configurations as $configName => $options) { @@ -137,11 +174,11 @@ protected function overrideConfigurations($configurations) foreach ($options as $key => $value) { $original = $config->get($key); if (is_bool($original)) { - $original = $original? 'true' : 'false'; + $original = $original ? 'true' : 'false'; } $updated = $value; if (is_bool($updated)) { - $updated = $updated? 'true' : 'false'; + $updated = $updated ? 'true' : 'false'; } $result[$configName][] = [ @@ -154,26 +191,111 @@ protected function overrideConfigurations($configurations) $config->save(); } - // $this->getDrupalService('settings');die(); - // - // $drupal = $this->getDrupalHelper(); - // $fs = $this->getApplication()->getContainerHelper()->get('filesystem'); - // - // $cache_render = '$settings = ["cache"]["bins"]["render"] = "cache.backend.null";'; - // $cache_dynamic = '$settings =["cache"]["bins"]["dynamic_page_cache"] = "cache.backend.null";'; - // - // $settings_file = $fs->exists($drupal->getRoot() . '/sites/default/local.settings.php')?:$drupal->getRoot() . '/sites/default/settings.php'; - // chmod($drupal->getRoot() . '/sites/default/', 0775); - // chmod($settings_file, 0775); - // $settings_file = $fs->dumpFile($settings_file, file_get_contents($settings_file) . $cache_render . $cache_dynamic); - // chmod($drupal->getRoot() . '/sites/default/', 0644); - // chmod($settings_file, 0644); - // @TODO: $io->commentBlock() + $line_include_settings = + ''; + + if ($this->environment == 'dev') { + + // copy sites/example.settings.local.php sites/default/settings.local.php + $this->fs->copy($this->local_settings_file_original, $this->local_settings_file, true); + + // uncomment cache bins in settings.local.php + $this->maginot->unCommentLine( + '# $settings[\'cache\'][\'bins\'][\'render\'] = \'cache.backend.null\';', + $this->local_settings_file + ); + + $this->maginot->unCommentLine( + '// $settings[\'cache\'][\'bins\'][\'render\'] = \'cache.backend.null\';', + $this->local_settings_file + ); + + $this->maginot->unCommentLine( + '# $settings[\'cache\'][\'bins\'][\'dynamic_page_cache\'] = \'cache.backend.null\';', + $this->local_settings_file + ); + + $this->maginot->unCommentLine( + '// $settings[\'cache\'][\'bins\'][\'dynamic_page_cache\'] = \'cache.backend.null\';', + $this->local_settings_file + ); + + // include settings.local.php in settings.php + // -- check first line if it is already this + if ( + $this->maginot->getFirstLine($this->settings_file) + != $line_include_settings + ) { + chmod($this->settings_file, (int)0775); + $this->maginot->setFirstLine( + $line_include_settings, + $this->settings_file + ); + } + + $io->commentBlock( + sprintf( + '%s', + $this->trans('commands.site.mode.messages.cachebins') + ) + ); + } + if ($this->environment == 'prod') { + if (!$this->local) { + + // comment local.settings.php in settings.php + if ( + $this->maginot->getFirstLine($this->settings_file) + == + $line_include_settings + ) { + $this->maginot->deleteFirstLine( + $this->settings_file + ); + } + + + try { + $this->fs->remove( + $this->local_settings_file + ); + //@TODO: msg user "local.settings.php deleted" + } catch (IOExceptionInterface $e) { + echo $e->getMessage(); + } + }else{ + + // comment cache bins in local.settings.php, + // we still use local.settings.php for testing PROD + // settings in local + + $this->maginot->CommentLine( + ' $settings[\'cache\'][\'bins\'][\'render\'] = \'cache.backend.null\';', + $this->local_settings_file + ); + + $this->maginot->CommentLine( + ' $settings[\'cache\'][\'bins\'][\'dynamic_page_cache\'] = \'cache.backend.null\';', + $this->local_settings_file + ); + } + } + + /** + * + * would be better if this were replaced by $config->save? + * + * + */ + //@TODO: 0444 should be a better permission for settings.php + chmod($this->settings_file, (int)0644); + //@TODO: 0555 should be a better permission for sites/default + chmod($this->appRoot.'/sites/default/', (int)0755); return $result; } - protected function overrideServices($environment, $servicesSettings, DrupalStyle $io) + protected function overrideServices($servicesSettings, DrupalStyle $io) { $directory = sprintf( '%s/%s', @@ -181,10 +303,10 @@ protected function overrideServices($environment, $servicesSettings, DrupalStyle \Drupal::service('site.path') ); - $settingsServicesFile = $directory . '/services.yml'; + $settingsServicesFile = $directory.'/services.yml'; if (!file_exists($settingsServicesFile)) { // Copying default services - $defaultServicesFile = $this->appRoot . '/sites/default/default.services.yml'; + $defaultServicesFile = $this->appRoot.'/sites/default/default.services.yml'; if (!copy($defaultServicesFile, $settingsServicesFile)) { $io->error( sprintf( @@ -198,15 +320,12 @@ protected function overrideServices($environment, $servicesSettings, DrupalStyle } } - $yaml = new Yaml(); - - $services = $yaml->parse(file_get_contents($settingsServicesFile)); + $services = $this->yaml->parse(file_get_contents($settingsServicesFile)); $result = []; foreach ($servicesSettings as $service => $parameters) { - if(is_array($parameters)) { + if (is_array($parameters)) { foreach ($parameters as $parameter => $value) { - print 'parameters: ' . $parameter . "\n"; $services['parameters'][$service][$parameter] = $value; // Set values for output $result[$parameter]['service'] = $service; @@ -228,7 +347,7 @@ protected function overrideServices($environment, $servicesSettings, DrupalStyle } } - if (file_put_contents($settingsServicesFile, $yaml->dump($services))) { + if (file_put_contents($settingsServicesFile, $this->yaml->dump($services))) { $io->commentBlock( sprintf( $this->trans('commands.site.mode.messages.services-file-overwritten'), @@ -248,6 +367,7 @@ protected function overrideServices($environment, $servicesSettings, DrupalStyle } sort($result); + return $result; } @@ -261,18 +381,18 @@ protected function loadConfigurations($env) if (!file_exists($configFile)) { $configFile = sprintf( '%s/config/dist/site.mode.yml', - $this->configurationManager->getApplicationDirectory() . DRUPAL_CONSOLE_CORE + $this->configurationManager->getApplicationDirectory().DRUPAL_CONSOLE_CORE ); } - $siteModeConfiguration = Yaml::parse(file_get_contents($configFile)); + $siteModeConfiguration = $this->yaml->parse(file_get_contents($configFile)); $configKeys = array_keys($siteModeConfiguration); $configurationSettings = []; foreach ($configKeys as $configKey) { $siteModeConfigurationItem = $siteModeConfiguration[$configKey]; foreach ($siteModeConfigurationItem as $setting => $parameters) { - if(array_key_exists($env, $parameters)) { + if (array_key_exists($env, $parameters)) { $configurationSettings[$configKey][$setting] = $parameters[$env]; } else { foreach ($parameters as $parameter => $value) { From fb26c8037cc6eb69987c88a958209f0c6efce5e0 Mon Sep 17 00:00:00 2001 From: "Colin McClure ( Solutions Architect EMEA)" Date: Sat, 17 Dec 2016 23:24:23 +0000 Subject: [PATCH 084/321] Create x.install instead of module when using generate:update (#2997) --- src/Generator/UpdateGenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator/UpdateGenerator.php b/src/Generator/UpdateGenerator.php index 5d879caa4..23de36b1a 100644 --- a/src/Generator/UpdateGenerator.php +++ b/src/Generator/UpdateGenerator.php @@ -41,7 +41,7 @@ public function generate($module, $update_number) $this->renderFile( 'module/src/update.php.twig', - $module_path .'/'.$module.'.module', + $module_path .'/'.$module.'.install', $parameters, FILE_APPEND ); From 259019c62a4833b57624814a665d5084762d3373 Mon Sep 17 00:00:00 2001 From: bpresles Date: Sun, 18 Dec 2016 00:27:39 +0100 Subject: [PATCH 085/321] Added new config:import:list and config:export:list commands. Fix no return on configImport method for config:import:single command (#2965) * Fix configImport not returning boolean * Added new config:import:list and config:export:list commands * Small adjustements * Added possibility to use absolute or relative to drupal root path for directory and config-list-file parameter/argument * Added ability to use chain command for importing or exporting multiple configs with the config:import:single and config:export:single commands --- export-config-list-sample.yml | 6 ++ import-config-list-sample.yml | 6 ++ src/Command/Config/ExportSingleCommand.php | 42 +++++---- src/Command/Config/ImportSingleCommand.php | 104 ++++++++++++++------- 4 files changed, 110 insertions(+), 48 deletions(-) create mode 100644 export-config-list-sample.yml create mode 100644 import-config-list-sample.yml diff --git a/export-config-list-sample.yml b/export-config-list-sample.yml new file mode 100644 index 000000000..8149eba5e --- /dev/null +++ b/export-config-list-sample.yml @@ -0,0 +1,6 @@ +commands: + - command: 'config:export:single' + options: + config-names: + - core.extension + - system.site \ No newline at end of file diff --git a/import-config-list-sample.yml b/import-config-list-sample.yml new file mode 100644 index 000000000..28d554443 --- /dev/null +++ b/import-config-list-sample.yml @@ -0,0 +1,6 @@ +commands: + - command: 'config:import:single' + options: + config-names: + - system.site + - core.extension \ No newline at end of file diff --git a/src/Command/Config/ExportSingleCommand.php b/src/Command/Config/ExportSingleCommand.php index d8f318f2f..fe877a420 100644 --- a/src/Command/Config/ExportSingleCommand.php +++ b/src/Command/Config/ExportSingleCommand.php @@ -61,9 +61,15 @@ protected function configure() ->setDescription($this->trans('commands.config.export.single.description')) ->addArgument( 'config-name', - InputArgument::REQUIRED, + InputArgument::OPTIONAL, $this->trans('commands.config.export.single.arguments.config-name') ) + ->addOption( + 'config-names', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.config.export.single.arguments.config-names') + ) ->addOption( 'directory', '', @@ -229,28 +235,32 @@ protected function execute(InputInterface $input, OutputInterface $output) $directory = $input->getOption('directory'); $module = $input->getOption('module'); - $configName = $input->getArgument('config-name'); + $configNames = $input->getOption('config-names'); + $configNameArg = $input->getArgument('config-name'); $optionalConfig = $input->getOption('optional-config'); $removeUuid = $input->getOption('remove-uuid'); $removeHash = $input->getOption('remove-config-hash'); - $config = $this->getConfiguration($configName, $removeUuid, $removeHash); - - if ($config) { - if (!$directory) { - $directory = config_get_config_directory(CONFIG_SYNC_DIRECTORY); - } - - $this->configExport[$configName] = array('data' => $config, 'optional' => $optionalConfig); + if (empty($configNames) && isset($configNameArg)) { + $configNames = array($configNameArg); + } - if ($input->getOption('include-dependencies')) { - // Include config dependencies in export files - if ($dependencies = $this->fetchDependencies($config, 'config')) { - $this->resolveDependencies($dependencies, $optionalConfig); + foreach ($configNames as $configName) { + $config = $this->getConfiguration($configName, $removeUuid, $removeHash); + $config = $this->getConfiguration($configName, false); + + if ($config) { + $this->configExport[$configName] = array('data' => $config, 'optional' => $optionalConfig); + + if ($input->getOption('include-dependencies')) { + // Include config dependencies in export files + if ($dependencies = $this->fetchDependencies($config, 'config')) { + $this->resolveDependencies($dependencies, $optionalConfig); + } } + } else { + $io->error($this->trans('commands.config.export.single.messages.config-not-found')); } - } else { - $io->error($this->trans('commands.config.export.single.messages.config-not-found')); } if (!$module) { diff --git a/src/Command/Config/ImportSingleCommand.php b/src/Command/Config/ImportSingleCommand.php index 3b080c3b2..3d4e0cc2b 100644 --- a/src/Command/Config/ImportSingleCommand.php +++ b/src/Command/Config/ImportSingleCommand.php @@ -6,19 +6,20 @@ */ namespace Drupal\Console\Command\Config; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Yaml\Parser; -use Symfony\Component\Console\Command\Command; -use Drupal\Core\Config\CachedStorage; -use Drupal\Core\Config\ConfigManager; +use Drupal\config\StorageReplaceDataWrapper; use Drupal\Console\Command\Shared\CommandTrait; use Drupal\Console\Style\DrupalStyle; +use Drupal\Core\Config\CachedStorage; use Drupal\Core\Config\ConfigImporter; use Drupal\Core\Config\ConfigImporterException; +use Drupal\Core\Config\ConfigManager; use Drupal\Core\Config\StorageComparer; -use Drupal\config\StorageReplaceDataWrapper; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Yaml\Parser; class ImportSingleCommand extends Command { @@ -53,12 +54,22 @@ protected function configure() ->setName('config:import:single') ->setDescription($this->trans('commands.config.import.single.description')) ->addArgument( - 'name', InputArgument::REQUIRED, - $this->trans('commands.config.import.single.arguments.name') + 'name', InputArgument::OPTIONAL, + $this->trans('commands.config.import.single.arguments.name') ) ->addArgument( - 'file', InputArgument::REQUIRED, - $this->trans('commands.config.import.single.arguments.file') + 'file', InputArgument::OPTIONAL, + $this->trans('commands.config.import.single.arguments.file') + ) + ->addOption( + 'config-names', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.config.import.single.arguments.config-names') + ) + ->addOption( + 'directory', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.config.import.arguments.directory') ); } @@ -69,39 +80,66 @@ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); - $configName = $input->getArgument('name'); + $configNames = $input->getOption('config-names'); + $directory = $input->getOption('directory'); + + $configNameArg = $input->getArgument('name'); $fileName = $input->getArgument('file'); - $ymlFile = new Parser(); + $singleMode = FALSE; + if (empty($configNames) && isset($configNameArg)) { + $singleMode = TRUE; + $configNames = array($configNameArg); + } - if (!empty($fileName) && file_exists($fileName)) { - $value = $ymlFile->parse(file_get_contents($fileName)); - } else { - $value = $ymlFile->parse(stream_get_contents(fopen("php://stdin", "r"))); + if (!isset($fileName) && !$directory) { + $directory = config_get_config_directory(CONFIG_SYNC_DIRECTORY); } + $ymlFile = new Parser(); + try { + $source_storage = new StorageReplaceDataWrapper( + $this->configStorage + ); - if (empty($value)) { - $io->error($this->trans('commands.config.import.single.messages.empty-value')); + foreach ($configNames as $configName) { + // Allow for accidental .yml extension. + if (substr($configName, -4) === '.yml') { + $configName = substr($configName, 0, -4); + } - return; - } + if ($singleMode === FALSE) { + $fileName = $directory.DIRECTORY_SEPARATOR.$configName.'.yml'; + } + + $value = null; + if (!empty($fileName) && file_exists($fileName)) { + $value = $ymlFile->parse(file_get_contents($fileName)); + } + + if (empty($value)) { + $io->error($this->trans('commands.config.import.single.messages.empty-value')); + + return; + } + + $source_storage->replaceData($configName, $value); + } - try { - $source_storage = new StorageReplaceDataWrapper($this->configStorage); - $source_storage->replaceData($configName, $value); $storage_comparer = new StorageComparer( - $source_storage, - $this->configStorage, - $this->configManager + $source_storage, + $this->configStorage, + $this->configManager ); if ($this->configImport($io, $storage_comparer)) { $io->success( - sprintf( - $this->trans('commands.config.import.single.messages.success'), - $configName - ) + sprintf( + $this->trans( + 'commands.config.import.single.messages.success' + ), + implode(", ", $configNames) + ) ); } } catch (\Exception $e) { @@ -138,6 +176,8 @@ private function configImport($io, StorageComparer $storage_comparer) $config_importer->doSyncStep($step, $context); } while ($context['finished'] < 1); } + + return TRUE; } } catch (ConfigImporterException $e) { $message = 'The import failed due for the following reasons:' . "\n"; From d5da57dc3d65a75488826881b602b40f7e060419 Mon Sep 17 00:00:00 2001 From: Miguel Date: Sat, 17 Dec 2016 17:35:05 -0600 Subject: [PATCH 086/321] Add new commands to process features. (#3021) --- config/services/drupal-console/feature.yml | 9 + src/Command/Features/DebugCommand.php | 77 +++++++ src/Command/Features/ImportCommand.php | 88 ++++++++ src/Command/Shared/FeatureTrait.php | 241 +++++++++++++++++++++ 4 files changed, 415 insertions(+) create mode 100644 config/services/drupal-console/feature.yml create mode 100644 src/Command/Features/DebugCommand.php create mode 100644 src/Command/Features/ImportCommand.php create mode 100644 src/Command/Shared/FeatureTrait.php diff --git a/config/services/drupal-console/feature.yml b/config/services/drupal-console/feature.yml new file mode 100644 index 000000000..9351c3b5c --- /dev/null +++ b/config/services/drupal-console/feature.yml @@ -0,0 +1,9 @@ +services: + feature_debug: + class: Drupal\Console\Command\Features\DebugCommand + tags: + - { name: drupal.command } + feature_import: + class: Drupal\Console\Command\Features\ImportCommand + tags: + - { name: drupal.command } diff --git a/src/Command/Features/DebugCommand.php b/src/Command/Features/DebugCommand.php new file mode 100644 index 000000000..ee2dd49f8 --- /dev/null +++ b/src/Command/Features/DebugCommand.php @@ -0,0 +1,77 @@ +setName('features:debug') + ->setDescription($this->trans('commands.features.debug.description')) + ->addArgument( + 'bundle', + InputArgument::OPTIONAL, + $this->trans('commands.features.debug.arguments.bundle') + ); + + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + $bundle= $input->getArgument('bundle'); + + $tableHeader = [ + $this->trans('commands.features.debug.messages.bundle'), + $this->trans('commands.features.debug.messages.name'), + $this->trans('commands.features.debug.messages.machine_name'), + $this->trans('commands.features.debug.messages.status'), + $this->trans('commands.features.debug.messages.state'), + ]; + + $tableRows = []; + + $features = $this->getFeatureList($bundle); + + foreach ($features as $feature) { + $tableRows[] = [$feature['bundle_name'],$feature['name'], $feature['machine_name'], $feature['status'],$feature['state']]; + } + + $io->table($tableHeader, $tableRows, 'compact'); + } + + + } diff --git a/src/Command/Features/ImportCommand.php b/src/Command/Features/ImportCommand.php new file mode 100644 index 000000000..9bf508ece --- /dev/null +++ b/src/Command/Features/ImportCommand.php @@ -0,0 +1,88 @@ +setName('features:import') + ->setDescription($this->trans('commands.features.import.description')) + ->addOption( + 'bundle', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.features.import.options.packages') + ) + ->addArgument('packages',InputArgument::IS_ARRAY,$this->trans('commands.features.import.arguments.packages')); + + + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $packages = $input->getArgument('packages'); + $bundle = $input->getOption('bundle'); + + if ($bundle) { + $packages = $this->getPackagesByBundle($bundle); + } + + $this->getAssigner($bundle); + $this->importFeature($io,$packages); + + } + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $packages = $input->getArgument('packages'); + $bundle = $input->getOption('bundle'); + + if (!$packages && !$bundle) { + // @see Drupal\Console\Command\Shared\FeatureTrait::packageQuestion + $bundle = $this->packageQuestion($io); + $input->setArgument('packages', $bundle); + } + } + + } diff --git a/src/Command/Shared/FeatureTrait.php b/src/Command/Shared/FeatureTrait.php new file mode 100644 index 000000000..8f7f27002 --- /dev/null +++ b/src/Command/Shared/FeatureTrait.php @@ -0,0 +1,241 @@ +getPackagesByBundle($bundle); + + if (empty($packages)) { + throw new \Exception('No packages available'); + } + + $package = $io->choiceNoList( + $this->trans('commands.features.import.questions.packages'), + $packages + ); + + return $package; + + } + + + /** + * @param bool $bundle_name + * + * @return \Drupal\features\FeaturesAssignerInterface + */ + protected function getAssigner($bundle_name) { + /** @var \Drupal\features\FeaturesAssignerInterface $assigner */ + $assigner = \Drupal::service('features_assigner'); + if (!empty($bundle_name)) { + $bundle = $assigner->applyBundle($bundle_name); + + if ($bundle->getMachineName() != $bundle_name) { + + } + } + // return configuration for default bundle + else { + $assigner->assignConfigPackages(); + } + return $assigner; + } + + + + /** + * Get a list of features. + * + * @param bundle + * + * @return features + */ + protected function getFeatureList($io,$bundle) { + + $features = []; + $manager = $this->getFeatureManager(); + $modules = $this->getPackagesByBundle($bundle); + + foreach ($modules as $module_name) { + $feature = $manager->loadPackage($module_name,TRUE); + $overrides = $manager->detectOverrides($feature); + + $state = $feature->getState(); + + if (!empty($overrides) && ($feature->getStatus() != FeaturesManagerInterface::STATUS_NO_EXPORT)) { + $state = FeaturesManagerInterface::STATE_OVERRIDDEN; + } + + if ($feature->getStatus() != FeaturesManagerInterface::STATUS_NO_EXPORT) { + + $features[$feature->getMachineName()] = array( + 'name' => $feature->getName(), + 'machine_name' => $feature->getMachineName(), + 'bundle_name' => $feature->getBundle(), + 'status' => $manager->statusLabel($feature->getStatus()), + 'state' => ($state != FeaturesManagerInterface::STATE_DEFAULT) + ? $manager->stateLabel($state) + : '', + ); + } + + } + + return $features; + + } + + + protected function importFeature($io,$packages) { + + $manager = $this->getFeatureManager(); + + /** @var \Drupal\config_update\ConfigRevertInterface $config_revert */ + $config_revert = \Drupal::service('features.config_update'); + + $config = $manager->getConfigCollection(); + $modules = (is_array($packages)) ? $packages : array($packages); + $overridden = [] ; + foreach ($modules as $module_name) { + + $package = $manager->loadPackage($module_name,TRUE); + + if (empty($package)) { + $io->warning( + sprintf( + $this->trans('commands.features.import.messages.not-available'), + $module_name + ) + ); + continue; + } + + if ($package->getStatus() != FeaturesManagerInterface::STATUS_INSTALLED) { + $io->warning( + sprintf( + $this->trans('commands.features.import.messages.uninstall'), + $module_name + ) + ); + continue; + } + + $overrides = $manager->detectOverrides($package); + $missing = $manager->reorderMissing($manager->detectMissing($package)); + + if (!empty($overrides) || !empty($missing) && ($package->getStatus() == FeaturesManagerInterface::STATUS_INSTALLED)) { + $overridden[] = array_merge($missing,$overrides); + } + } + + // Process only missing or overriden features + $components = $overridden; + + if (empty($components)){ + $io->warning( + sprintf( + $this->trans('commands.features.import.messages.nothing'), + $components + ) + ); + + return ; + } + else { + + $this->import($io,$components); + } + } + + public function import($io,$components) { + $manager = $this->getFeatureManager(); + /** @var \Drupal\config_update\ConfigRevertInterface $config_revert */ + $config_revert = \Drupal::service('features.config_update'); + + $config = $manager->getConfigCollection(); + + foreach ($components as $component) { + foreach ($component as $feature) { + + if (!isset($config[$feature])) { + + //Import missing component. + $item = $manager->getConfigType($feature); + $type = ConfigurationItem::fromConfigStringToConfigType($item['type']); + $config_revert->import($type, $item['name_short']); + $io->info( + sprintf( + $this->trans('commands.features.import.messages.importing'), + $feature + ) + ); + + } + + else { + + // Revert existing component. + $item = $config[$feature]; + $type = ConfigurationItem::fromConfigStringToConfigType($item->getType()); + $config_revert->revert($type, $item->getShortName()); + $io->info( + sprintf( + $this->trans('commands.features.import.messages.reverting'), + $feature + ) + ); + } + } + } + + } + + + public function getPackagesByBundle($bundle) { + + $packages = []; + $manager = $this->getFeatureManager(); + $assigner = $this->getAssigner($bundle); + $current_bundle = $assigner->getBundle(); + + // List all packages availables + if ($current_bundle->getMachineName() == 'default') { + $current_bundle = NULL; + + } + + $packages = array_keys($manager->getFeaturesModules($current_bundle)); + + return $packages; + + } + + public function getFeatureManager(){ + return \Drupal::service('features.manager'); + } + +} From 370a57dffceafed8989a38b67d9b207533a4d568 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sat, 17 Dec 2016 18:46:09 -0800 Subject: [PATCH 087/321] Udpate site commands (#3023) * [site:new] Remove command. * [site:mode] Disable command. --- config/services/drupal-console/site.yml | 10 +- src/Command/Site/NewCommand.php | 221 ------------------------ 2 files changed, 3 insertions(+), 228 deletions(-) delete mode 100644 src/Command/Site/NewCommand.php diff --git a/config/services/drupal-console/site.yml b/config/services/drupal-console/site.yml index 9479b5dce..fa790d922 100644 --- a/config/services/drupal-console/site.yml +++ b/config/services/drupal-console/site.yml @@ -9,13 +9,9 @@ services: arguments: ['@state', '@console.chain_queue'] tags: - { name: drupal.command } - console.site_mode: - class: Drupal\Console\Command\Site\ModeCommand - arguments: ['@config.factory', '@console.configuration_manager', '@app.root', '@console.chain_queue'] - tags: - - { name: drupal.command } -# console.site_new: -# class: Drupal\Console\Command\Site\NewCommand +# console.site_mode: +# class: Drupal\Console\Command\Site\ModeCommand +# arguments: ['@config.factory', '@console.configuration_manager', '@app.root', '@console.chain_queue'] # tags: # - { name: drupal.command } console.site_statistics: diff --git a/src/Command/Site/NewCommand.php b/src/Command/Site/NewCommand.php deleted file mode 100644 index 388bdcaad..000000000 --- a/src/Command/Site/NewCommand.php +++ /dev/null @@ -1,221 +0,0 @@ -setName('site:new') - ->setDescription($this->trans('commands.site.new.description')) - ->addArgument( - 'directory', - InputArgument::REQUIRED, - $this->trans('commands.site.new.arguments.directory') - ) - ->addArgument( - 'version', - InputArgument::OPTIONAL, - $this->trans('commands.site.new.arguments.version') - ) - ->addOption( - 'latest', - '', - InputOption::VALUE_NONE, - $this->trans('commands.site.new.options.latest') - ) - ->addOption( - 'composer', - '', - InputOption::VALUE_NONE, - $this->trans('commands.site.new.options.composer') - ) - ->addOption( - 'unstable', - '', - InputOption::VALUE_NONE, - $this->trans('commands.site.new.options.unstable') - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $directory = $input->getArgument('directory'); - $version = $input->getArgument('version'); - $latest = $input->getOption('latest'); - $composer = $input->getOption('composer'); - - if (!$directory) { - $io->error( - $this->trans('commands.site.new.messages.missing-directory') - ); - - return 1; - } - - if ($composer) { - if (!$version) { - $version = '8.x-dev'; - } - - $io->newLine(); - $io->comment( - sprintf( - $this->trans('commands.site.new.messages.executing'), - 'drupal', - $version - ) - ); - - $command = sprintf( - 'composer create-project %s:%s %s --no-interaction', - 'drupal-composer/drupal-project', - $version, - $directory - ); - - $io->commentBlock($command); - - $shellProcess = $this->get('shell_process'); - if ($shellProcess->exec($command)) { - $io->success( - sprintf( - $this->trans('commands.site.new.messages.composer'), - $version, - $directory - ) - ); - - return 0; - } else { - return 1; - } - } - - if (!$version && $latest) { - $version = current( - $this->getApplication()->getDrupalApi()->getProjectReleases('drupal', 1, true) - ); - } - - if (!$version) { - $io->error('Missing version'); - - return 1; - } - - $projectPath = $this->downloadProject($io, 'drupal', $version, 'core'); - $downloadPath = sprintf('%sdrupal-%s', $projectPath, $version); - - if ($this->isAbsolutePath($directory)) { - $copyPath = $directory; - } else { - $copyPath = sprintf('%s%s', $projectPath, $directory); - } - - try { - $fileSystem = new Filesystem(); - $fileSystem->rename($downloadPath, $copyPath); - } catch (IOExceptionInterface $e) { - $io->commentBlock( - sprintf( - $this->trans('commands.site.new.messages.downloaded'), - $version, - $downloadPath - ) - ); - - $io->error( - sprintf( - $this->trans('commands.site.new.messages.error-copying'), - $e->getPath() - ) - ); - - return 1; - } - - $io->success( - sprintf( - $this->trans('commands.site.new.messages.downloaded'), - $version, - $copyPath - ) - ); - - return 0; - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $directory = $input->getArgument('directory'); - $version = $input->getArgument('version'); - $latest = $input->getOption('latest'); - $unstable = $input->getOption('unstable'); - $composer = $input->getOption('composer'); - - if (!$directory) { - $directory = $io->ask( - $this->trans('commands.site.new.questions.directory') - ); - $input->setArgument('directory', $directory); - } - - if ($composer) { - $input->setArgument('version', '8.x-dev'); - - return 0; - } - - if (!$version && $latest) { - $version = current( - $this->getApplication()->getDrupalApi()->getProjectReleases('drupal', 1, true) - ); - } - - if (!$version) { - $version = $this->releasesQuestion($io, 'drupal', false, !$unstable); - } - - $input->setArgument('version', $version); - - return 0; - } - - protected function isAbsolutePath($path) - { - return $path[0] === DIRECTORY_SEPARATOR || preg_match('~\A[A-Z]:(?![^/\\\\])~i', $path) > 0; - } -} From 0f388ef1b48ca941452ac73668cf41926371f444 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sat, 17 Dec 2016 19:07:33 -0800 Subject: [PATCH 088/321] [console] Apply PSR-2 code style. (#3024) --- src/Annotations/DrupalCommand.php | 1 - .../DrupalCommandAnnotationReader.php | 6 +- src/Application.php | 3 +- src/Bootstrap/Drupal.php | 19 +- src/Command/Config/DebugCommand.php | 8 +- src/Command/Config/DeleteCommand.php | 14 +- src/Command/Config/DiffCommand.php | 8 +- src/Command/Config/EditCommand.php | 20 +- src/Command/Config/ExportCommand.php | 14 +- .../Config/ExportContentTypeCommand.php | 18 +- src/Command/Config/ExportSingleCommand.php | 134 +++---- src/Command/Config/ExportViewCommand.php | 17 +- src/Command/Config/ImportCommand.php | 8 +- src/Command/Config/ImportSingleCommand.php | 44 ++- src/Command/Config/OverrideCommand.php | 8 +- .../Config/PrintConfigValidationTrait.php | 30 +- src/Command/Config/SettingsDebugCommand.php | 10 +- src/Command/Config/ValidateCommand.php | 75 ++-- src/Command/Config/ValidateDebugCommand.php | 146 +++---- src/Command/Cron/ExecuteCommand.php | 2 +- src/Command/Database/ClientCommand.php | 18 +- src/Command/Database/DatabaseLogBase.php | 357 +++++++++--------- src/Command/Database/DropCommand.php | 3 +- src/Command/Database/DumpCommand.php | 33 +- src/Command/Database/LogClearCommand.php | 5 +- src/Command/Database/LogDebugCommand.php | 234 ++++++------ src/Command/Database/LogPollCommand.php | 119 +++--- src/Command/Database/QueryCommand.php | 92 ++--- src/Command/Database/RestoreCommand.php | 3 +- src/Command/Database/TableDebugCommand.php | 2 +- .../Develop/TranslationCleanupCommand.php | 35 +- .../Develop/TranslationPendingCommand.php | 13 +- .../Develop/TranslationStatsCommand.php | 26 +- .../Develop/TranslationSyncCommand.php | 11 +- src/Command/Entity/DebugCommand.php | 8 +- src/Command/Entity/DeleteCommand.php | 4 +- src/Command/Features/DebugCommand.php | 101 +++-- src/Command/Features/ImportCommand.php | 96 +++-- .../AuthenticationProviderCommand.php | 8 +- src/Command/Generate/BreakPointCommand.php | 6 +- src/Command/Generate/CommandCommand.php | 3 +- src/Command/Generate/ControllerCommand.php | 16 +- src/Command/Generate/EntityBundleCommand.php | 8 +- src/Command/Generate/FormAlterCommand.php | 17 +- src/Command/Generate/FormCommand.php | 12 +- src/Command/Generate/HelpCommand.php | 9 +- src/Command/Generate/ModuleCommand.php | 26 +- src/Command/Generate/ModuleFileCommand.php | 9 +- .../Generate/PluginCKEditorButtonCommand.php | 8 +- .../Generate/PluginConditionCommand.php | 19 +- src/Command/Generate/PluginFieldCommand.php | 4 +- .../Generate/PluginFieldFormatterCommand.php | 20 +- .../Generate/PluginFieldTypeCommand.php | 8 +- .../Generate/PluginFieldWidgetCommand.php | 16 +- .../Generate/PluginImageEffectCommand.php | 8 +- .../Generate/PluginImageFormatterCommand.php | 20 +- src/Command/Generate/PluginMailCommand.php | 12 +- .../Generate/PluginRestResourceCommand.php | 8 +- .../Generate/PluginRulesActionCommand.php | 16 +- .../Generate/PluginSkeletonCommand.php | 12 +- .../Generate/PluginTypeAnnotationCommand.php | 9 +- .../Generate/PluginTypeYamlCommand.php | 8 +- .../Generate/PluginViewsFieldCommand.php | 8 +- src/Command/Generate/PostUpdateCommand.php | 12 +- src/Command/Generate/ProfileCommand.php | 13 +- .../Generate/RouteSubscriberCommand.php | 9 +- src/Command/Generate/ServiceCommand.php | 16 +- src/Command/Generate/ThemeCommand.php | 12 +- src/Command/Generate/TwigExtensionCommand.php | 8 +- src/Command/Generate/UpdateCommand.php | 8 +- src/Command/Libraries/DebugCommand.php | 16 +- src/Command/Locale/LanguageDeleteCommand.php | 6 +- src/Command/Migrate/ExecuteCommand.php | 3 +- src/Command/Module/DebugCommand.php | 2 +- src/Command/Module/DownloadCommand.php | 45 ++- src/Command/Module/InstallCommand.php | 36 +- .../Module/InstallDependencyCommand.php | 12 +- src/Command/Module/UninstallCommand.php | 16 +- src/Command/Module/UpdateCommand.php | 4 +- src/Command/Multisite/DebugCommand.php | 3 +- src/Command/Multisite/NewCommand.php | 3 +- src/Command/Node/AccessRebuildCommand.php | 3 +- src/Command/PermissionDebugCommand.php | 46 +-- src/Command/Queue/DebugCommand.php | 3 +- src/Command/Queue/RunCommand.php | 4 +- src/Command/Rest/DisableCommand.php | 4 +- src/Command/Rest/EnableCommand.php | 20 +- src/Command/Shared/ExportTrait.php | 2 +- src/Command/Shared/FeatureTrait.php | 350 ++++++++--------- src/Command/Shared/MigrationTrait.php | 8 +- src/Command/Site/InstallCommand.php | 10 +- src/Command/Site/MaintenanceCommand.php | 4 +- src/Command/Site/ModeCommand.php | 15 +- src/Command/Site/StatisticsCommand.php | 8 +- src/Command/Site/StatusCommand.php | 5 +- src/Command/Taxonomy/DeleteTermCommand.php | 7 +- src/Command/Test/DebugCommand.php | 2 +- src/Command/Test/RunCommand.php | 6 +- src/Command/Theme/DebugCommand.php | 2 +- src/Command/Theme/DownloadCommand.php | 4 +- src/Command/Theme/InstallCommand.php | 4 +- src/Command/Theme/UninstallCommand.php | 4 +- src/Command/Update/EntitiesCommand.php | 2 +- src/Command/Update/ExecuteCommand.php | 8 +- src/Command/User/CreateCommand.php | 8 +- src/Command/User/DebugCommand.php | 4 +- src/Command/User/DeleteCommand.php | 4 +- .../User/LoginCleanAttemptsCommand.php | 3 +- src/Command/User/LoginUrlCommand.php | 5 +- src/Command/User/PasswordHashCommand.php | 3 +- src/Command/User/RoleCommand.php | 3 +- src/Command/Views/DebugCommand.php | 3 +- src/Command/Views/DisableCommand.php | 2 +- src/Command/Views/EnableCommand.php | 2 +- src/Command/Yaml/DiffCommand.php | 7 +- src/Command/Yaml/GetValueCommand.php | 5 +- src/Command/Yaml/MergeCommand.php | 5 +- src/Command/Yaml/SplitCommand.php | 5 +- src/Command/Yaml/UnsetKeyCommand.php | 151 ++++---- src/Command/Yaml/UpdateKeyCommand.php | 5 +- src/Command/Yaml/UpdateValueCommand.php | 5 +- src/Extension/Manager.php | 4 +- .../AuthenticationProviderGenerator.php | 5 +- src/Generator/BreakPointGenerator.php | 5 +- src/Generator/CommandGenerator.php | 4 +- src/Generator/ControllerGenerator.php | 5 +- src/Generator/EntityBundleGenerator.php | 5 +- src/Generator/EntityConfigGenerator.php | 7 +- src/Generator/EntityContentGenerator.php | 75 ++-- src/Generator/EventSubscriberGenerator.php | 4 +- src/Generator/FormAlterGenerator.php | 5 +- src/Generator/FormGenerator.php | 6 +- src/Generator/HelpGenerator.php | 6 +- src/Generator/ModuleGenerator.php | 76 ++-- src/Generator/PluginBlockGenerator.php | 54 ++- .../PluginCKEditorButtonGenerator.php | 6 +- src/Generator/PluginConditionGenerator.php | 5 +- src/Generator/PluginRulesActionGenerator.php | 1 - src/Generator/PluginViewsFieldGenerator.php | 4 +- src/Generator/PostUpdateGenerator.php | 4 +- src/Generator/RouteSubscriberGenerator.php | 4 +- src/Generator/ServiceGenerator.php | 4 +- src/Generator/ThemeGenerator.php | 5 +- src/Generator/TwigExtensionGenerator.php | 4 +- src/Generator/UpdateGenerator.php | 4 +- src/Utils/AnnotationValidator.php | 23 +- src/Utils/DrupalApi.php | 5 +- src/Utils/Site.php | 4 +- 148 files changed, 1780 insertions(+), 1554 deletions(-) diff --git a/src/Annotations/DrupalCommand.php b/src/Annotations/DrupalCommand.php index 8be4fd025..5163c53c3 100644 --- a/src/Annotations/DrupalCommand.php +++ b/src/Annotations/DrupalCommand.php @@ -29,5 +29,4 @@ class DrupalCommand * @var array */ public $dependencies; - } diff --git a/src/Annotations/DrupalCommandAnnotationReader.php b/src/Annotations/DrupalCommandAnnotationReader.php index c2e13eb13..b432bdb0b 100644 --- a/src/Annotations/DrupalCommandAnnotationReader.php +++ b/src/Annotations/DrupalCommandAnnotationReader.php @@ -8,8 +8,8 @@ * Class DrupalCommandReader * @package Drupal\Console\Annotations */ -class DrupalCommandAnnotationReader { - +class DrupalCommandAnnotationReader +{ /** * @param $class * @return array @@ -22,7 +22,7 @@ public function readAnnotation($class) new \ReflectionClass($class), 'Drupal\\Console\\Annotations\\DrupalCommand' ); - if($drupalCommandAnnotation) { + if ($drupalCommandAnnotation) { $annotation['extension'] = $drupalCommandAnnotation->extension?:''; $annotation['extensionType'] = $drupalCommandAnnotation->extensionType?:''; $annotation['dependencies'] = $drupalCommandAnnotation->dependencies?:[]; diff --git a/src/Application.php b/src/Application.php index b3d9aa963..7d6eba6f2 100644 --- a/src/Application.php +++ b/src/Application.php @@ -344,7 +344,8 @@ private function commandData($commandName) return $data; } - public function setContainer($container) { + public function setContainer($container) + { $this->container = $container; $this->registerGenerators(); $this->registerCommands(); diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index a43604245..eeb0c2276 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -42,18 +42,17 @@ public function boot() $argvInputReader = new ArgvInputReader(); if ($argvInputReader->get('uri')) { - $uri = $argvInputReader->get('uri'); - if (substr($uri, -1) != '/') { - $uri .= '/'; - } - $uri .= 'index.php'; - $request = Request::create($uri, 'GET', array() , array(), array(), array('SCRIPT_NAME' => $this->appRoot . '/index.php')); - } - else { - $request = Request::createFromGlobals(); + $uri = $argvInputReader->get('uri'); + if (substr($uri, -1) != '/') { + $uri .= '/'; + } + $uri .= 'index.php'; + $request = Request::create($uri, 'GET', array(), array(), array(), array('SCRIPT_NAME' => $this->appRoot . '/index.php')); + } else { + $request = Request::createFromGlobals(); } - $drupalKernel = DrupalKernel::createFromRequest ( + $drupalKernel = DrupalKernel::createFromRequest( $request, $this->autoload, 'prod', diff --git a/src/Command/Config/DebugCommand.php b/src/Command/Config/DebugCommand.php index df057cf84..5faf3dcb4 100644 --- a/src/Command/Config/DebugCommand.php +++ b/src/Command/Config/DebugCommand.php @@ -21,10 +21,14 @@ class DebugCommand extends Command { use CommandTrait; - /** @var ConfigFactory */ + /** + * @var ConfigFactory + */ protected $configFactory; - /** @var CachedStorage */ + /** + * @var CachedStorage + */ protected $configStorage; /** diff --git a/src/Command/Config/DeleteCommand.php b/src/Command/Config/DeleteCommand.php index bc4c5b602..5aa6f3676 100644 --- a/src/Command/Config/DeleteCommand.php +++ b/src/Command/Config/DeleteCommand.php @@ -23,13 +23,19 @@ class DeleteCommand extends Command protected $allConfig = []; - /** @var ConfigFactory */ + /** + * @var ConfigFactory + */ protected $configFactory; - /** @var CachedStorage */ + /** + * @var CachedStorage + */ protected $configStorage; - /** @var FileStorage */ + /** + * @var FileStorage + */ protected $configStorageSync; /** @@ -39,7 +45,7 @@ class DeleteCommand extends Command * @param FileStorage $configStorageSync */ public function __construct( - ConfigFactory $configFactory , + ConfigFactory $configFactory, CachedStorage $configStorage, FileStorage $configStorageSync ) { diff --git a/src/Command/Config/DiffCommand.php b/src/Command/Config/DiffCommand.php index 117154b1b..86417ab71 100644 --- a/src/Command/Config/DiffCommand.php +++ b/src/Command/Config/DiffCommand.php @@ -22,10 +22,14 @@ class DiffCommand extends Command { use CommandTrait; - /** @var CachedStorage */ + /** + * @var CachedStorage + */ protected $configStorage; - /** @var ConfigManager */ + /** + * @var ConfigManager + */ protected $configManager; /** diff --git a/src/Command/Config/EditCommand.php b/src/Command/Config/EditCommand.php index 1ccb592e7..cfad573d7 100644 --- a/src/Command/Config/EditCommand.php +++ b/src/Command/Config/EditCommand.php @@ -26,23 +26,29 @@ class EditCommand extends Command { use CommandTrait; - /** @var ConfigFactory */ + /** + * @var ConfigFactory + */ protected $configFactory; - /** @var CachedStorage */ + /** + * @var CachedStorage + */ protected $configStorage; - /** @var ConfigurationManager */ + /** + * @var ConfigurationManager + */ protected $configurationManager; /** * EditCommand constructor. - * @param ConfigFactory $configFactory - * @param CachedStorage $configStorage - * @param ConfigurationManager $configurationManager + * @param ConfigFactory $configFactory + * @param CachedStorage $configStorage + * @param ConfigurationManager $configurationManager */ public function __construct( - ConfigFactory $configFactory , + ConfigFactory $configFactory, CachedStorage $configStorage, ConfigurationManager $configurationManager ) { diff --git a/src/Command/Config/ExportCommand.php b/src/Command/Config/ExportCommand.php index e7dea0366..9f7b9aec3 100644 --- a/src/Command/Config/ExportCommand.php +++ b/src/Command/Config/ExportCommand.php @@ -18,19 +18,21 @@ use Drupal\Console\Style\DrupalStyle; use Drupal\Core\Config\ConfigManager; - class ExportCommand extends Command { use CommandTrait; - /** @var ConfigManager */ + /** + * @var ConfigManager + */ protected $configManager; /** * ExportCommand constructor. * @param ConfigManager $configManager */ - public function __construct(ConfigManager $configManager ) { + public function __construct(ConfigManager $configManager) + { $this->configManager = $configManager; parent::__construct(); } @@ -142,9 +144,9 @@ protected function execute(InputInterface $input, OutputInterface $output) } $io->info( - sprintf( - $this->trans('commands.config.export.messages.directory'), - $directory + sprintf( + $this->trans('commands.config.export.messages.directory'), + $directory ) ); } diff --git a/src/Command/Config/ExportContentTypeCommand.php b/src/Command/Config/ExportContentTypeCommand.php index b8d938e9d..cb94f7cfc 100644 --- a/src/Command/Config/ExportContentTypeCommand.php +++ b/src/Command/Config/ExportContentTypeCommand.php @@ -26,13 +26,19 @@ class ExportContentTypeCommand extends Command use ModuleTrait; use ExportTrait; - /** @var EntityTypeManager */ + /** + * @var EntityTypeManagerInterface + */ protected $entityTypeManager; - /** @var CachedStorage */ + /** + * @var CachedStorage + */ protected $configStorage; - /** @var Manager */ + /** + * @var Manager + */ protected $extensionManager; protected $configExport; @@ -40,8 +46,8 @@ class ExportContentTypeCommand extends Command /** * ExportContentTypeCommand constructor. * @param EntityTypeManagerInterface $entityTypeManager - * @param CachedStorage $configStorage - * @param Manager $extensionManager + * @param CachedStorage $configStorage + * @param Manager $extensionManager */ public function __construct( EntityTypeManagerInterface $entityTypeManager, @@ -199,4 +205,4 @@ protected function getViewDisplays($contentType, $optional = false) } } } -} \ No newline at end of file +} diff --git a/src/Command/Config/ExportSingleCommand.php b/src/Command/Config/ExportSingleCommand.php index fe877a420..4a63b1d7f 100644 --- a/src/Command/Config/ExportSingleCommand.php +++ b/src/Command/Config/ExportSingleCommand.php @@ -29,10 +29,14 @@ class ExportSingleCommand extends Command */ protected $definitions; - /** @var EntityTypeManagerInterface */ + /** + * @var EntityTypeManagerInterface + */ protected $entityTypeManager; - /** @var CachedStorage */ + /** + * @var CachedStorage + */ protected $configStorage; protected $configExport; @@ -40,7 +44,7 @@ class ExportSingleCommand extends Command /** * ExportSingleCommand constructor. * @param EntityTypeManagerInterface $entityTypeManager - * @param CachedStorage $configStorage + * @param CachedStorage $configStorage */ public function __construct( EntityTypeManagerInterface $entityTypeManager, @@ -57,50 +61,50 @@ public function __construct( protected function configure() { $this - ->setName('config:export:single') - ->setDescription($this->trans('commands.config.export.single.description')) - ->addArgument( - 'config-name', - InputArgument::OPTIONAL, - $this->trans('commands.config.export.single.arguments.config-name') - ) - ->addOption( - 'config-names', - null, - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.config.export.single.arguments.config-names') - ) - ->addOption( - 'directory', - '', - InputOption::VALUE_OPTIONAL, - $this->trans('commands.config.export.arguments.directory') - ) - ->addOption( - 'include-dependencies', - '', - InputOption::VALUE_NONE, - $this->trans('commands.config.export.single.options.include-dependencies') - )->addOption( - 'module', '', - InputOption::VALUE_OPTIONAL, - $this->trans('commands.common.options.module') - )->addOption( - 'optional-config', - '', - InputOption::VALUE_OPTIONAL, - $this->trans('commands.config.export.single.options.optional-config') - )->addOption( - 'remove-uuid', - '', - InputOption::VALUE_NONE, - $this->trans('commands.config.export.single.options.remove-uuid') - )->addOption( - 'remove-config-hash', - '', - InputOption::VALUE_NONE, - $this->trans('commands.config.export.single.options.remove-config-hash') - ); + ->setName('config:export:single') + ->setDescription($this->trans('commands.config.export.single.description')) + ->addArgument( + 'config-name', + InputArgument::OPTIONAL, + $this->trans('commands.config.export.single.arguments.config-name') + ) + ->addOption( + 'config-names', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.config.export.single.arguments.config-names') + ) + ->addOption( + 'directory', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.config.export.arguments.directory') + ) + ->addOption( + 'include-dependencies', + '', + InputOption::VALUE_NONE, + $this->trans('commands.config.export.single.options.include-dependencies') + )->addOption( + 'module', '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.common.options.module') + )->addOption( + 'optional-config', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.config.export.single.options.optional-config') + )->addOption( + 'remove-uuid', + '', + InputOption::VALUE_NONE, + $this->trans('commands.config.export.single.options.remove-uuid') + )->addOption( + 'remove-config-hash', + '', + InputOption::VALUE_NONE, + $this->trans('commands.config.export.single.options.remove-config-hash') + ); } /* @@ -114,9 +118,9 @@ protected function getConfigTypes() } } $entity_types = array_map( - function ($definition) { - return $definition->getLabel(); - }, $this->definitions + function ($definition) { + return $definition->getLabel(); + }, $this->definitions ); uasort($entity_types, 'strnatcasecmp'); @@ -146,9 +150,9 @@ protected function getConfigNames($config_type) else { // Gather the config entity prefixes. $config_prefixes = array_map( - function ($definition) { - return $definition->getConfigPrefix() . '.'; - }, $this->definitions + function ($definition) { + return $definition->getConfigPrefix() . '.'; + }, $this->definitions ); // Find all config, and then filter our anything matching a config prefix. @@ -178,15 +182,15 @@ protected function interact(InputInterface $input, OutputInterface $output) $config_name = $input->getArgument('config-name'); if (!$config_name) { $config_type = $io->choiceNoList( - $this->trans('commands.config.export.single.questions.config-type'), - array_keys($config_types), - $this->trans('commands.config.export.single.options.simple-configuration') + $this->trans('commands.config.export.single.questions.config-type'), + array_keys($config_types), + $this->trans('commands.config.export.single.options.simple-configuration') ); $config_names = $this->getConfigNames($config_type); $config_name = $io->choiceNoList( - $this->trans('commands.config.export.single.questions.config-name'), - array_keys($config_names) + $this->trans('commands.config.export.single.questions.config-name'), + array_keys($config_names) ); if ($config_type !== 'system.simple') { @@ -203,23 +207,23 @@ protected function interact(InputInterface $input, OutputInterface $output) $optionalConfig = $input->getOption('optional-config'); if (!$optionalConfig) { $optionalConfig = $io->confirm( - $this->trans('commands.config.export.single.questions.optional-config'), - true + $this->trans('commands.config.export.single.questions.optional-config'), + true ); $input->setOption('optional-config', $optionalConfig); } } if (!$input->getOption('remove-uuid')) { $removeUuid = $io->confirm( - $this->trans('commands.config.export.single.questions.remove-uuid'), - true + $this->trans('commands.config.export.single.questions.remove-uuid'), + true ); $input->setOption('remove-uuid', $removeUuid); } if (!$input->getOption('remove-config-hash')) { $removeHash = $io->confirm( - $this->trans('commands.config.export.single.questions.remove-config-hash'), - true + $this->trans('commands.config.export.single.questions.remove-config-hash'), + true ); $input->setOption('remove-config-hash', $removeHash); } @@ -249,7 +253,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $config = $this->getConfiguration($configName, $removeUuid, $removeHash); $config = $this->getConfiguration($configName, false); - if ($config) { + if ($config) { $this->configExport[$configName] = array('data' => $config, 'optional' => $optionalConfig); if ($input->getOption('include-dependencies')) { diff --git a/src/Command/Config/ExportViewCommand.php b/src/Command/Config/ExportViewCommand.php index 1f15a87ca..c524f1c3e 100644 --- a/src/Command/Config/ExportViewCommand.php +++ b/src/Command/Config/ExportViewCommand.php @@ -29,20 +29,26 @@ class ExportViewCommand extends Command protected $configExport; - /** @var EntityTypeManagerInterface */ + /** + * @var EntityTypeManagerInterface + */ protected $entityTypeManager; - /** @var CachedStorage */ + /** + * @var CachedStorage + */ protected $configStorage; - /** @var Manager */ + /** + * @var Manager + */ protected $extensionManager; /** * ExportViewCommand constructor. * @param EntityTypeManagerInterface $entityTypeManager - * @param CachedStorage $configStorage - * @param Manager $extensionManager + * @param CachedStorage $configStorage + * @param Manager $extensionManager */ public function __construct( EntityTypeManagerInterface $entityTypeManager, @@ -103,7 +109,6 @@ protected function interact(InputInterface $input, OutputInterface $output) // view-id argument $viewId = $input->getArgument('view-id'); if (!$viewId) { - $views = $this->entityTypeManager->getStorage('view')->loadMultiple(); $viewList = []; diff --git a/src/Command/Config/ImportCommand.php b/src/Command/Config/ImportCommand.php index 5ee0a2d57..403e3cb24 100644 --- a/src/Command/Config/ImportCommand.php +++ b/src/Command/Config/ImportCommand.php @@ -26,10 +26,14 @@ class ImportCommand extends Command { use CommandTrait; - /** @var CachedStorage */ + /** + * @var CachedStorage + */ protected $configStorage; - /** @var ConfigManager */ + /** + * @var ConfigManager + */ protected $configManager; /** diff --git a/src/Command/Config/ImportSingleCommand.php b/src/Command/Config/ImportSingleCommand.php index 3d4e0cc2b..3b0f7e8b4 100644 --- a/src/Command/Config/ImportSingleCommand.php +++ b/src/Command/Config/ImportSingleCommand.php @@ -25,10 +25,14 @@ class ImportSingleCommand extends Command { use CommandTrait; - /** @var CachedStorage */ + /** + * @var CachedStorage + */ protected $configStorage; - /** @var ConfigManager */ + /** + * @var ConfigManager + */ protected $configManager; /** @@ -54,12 +58,12 @@ protected function configure() ->setName('config:import:single') ->setDescription($this->trans('commands.config.import.single.description')) ->addArgument( - 'name', InputArgument::OPTIONAL, - $this->trans('commands.config.import.single.arguments.name') + 'name', InputArgument::OPTIONAL, + $this->trans('commands.config.import.single.arguments.name') ) ->addArgument( - 'file', InputArgument::OPTIONAL, - $this->trans('commands.config.import.single.arguments.file') + 'file', InputArgument::OPTIONAL, + $this->trans('commands.config.import.single.arguments.file') ) ->addOption( 'config-names', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, @@ -86,9 +90,9 @@ protected function execute(InputInterface $input, OutputInterface $output) $configNameArg = $input->getArgument('name'); $fileName = $input->getArgument('file'); - $singleMode = FALSE; + $singleMode = false; if (empty($configNames) && isset($configNameArg)) { - $singleMode = TRUE; + $singleMode = true; $configNames = array($configNameArg); } @@ -99,7 +103,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $ymlFile = new Parser(); try { $source_storage = new StorageReplaceDataWrapper( - $this->configStorage + $this->configStorage ); foreach ($configNames as $configName) { @@ -108,7 +112,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $configName = substr($configName, 0, -4); } - if ($singleMode === FALSE) { + if ($singleMode === false) { $fileName = $directory.DIRECTORY_SEPARATOR.$configName.'.yml'; } @@ -127,19 +131,19 @@ protected function execute(InputInterface $input, OutputInterface $output) } $storage_comparer = new StorageComparer( - $source_storage, - $this->configStorage, - $this->configManager + $source_storage, + $this->configStorage, + $this->configManager ); if ($this->configImport($io, $storage_comparer)) { $io->success( - sprintf( - $this->trans( - 'commands.config.import.single.messages.success' - ), - implode(", ", $configNames) - ) + sprintf( + $this->trans( + 'commands.config.import.single.messages.success' + ), + implode(", ", $configNames) + ) ); } } catch (\Exception $e) { @@ -177,7 +181,7 @@ private function configImport($io, StorageComparer $storage_comparer) } while ($context['finished'] < 1); } - return TRUE; + return true; } } catch (ConfigImporterException $e) { $message = 'The import failed due for the following reasons:' . "\n"; diff --git a/src/Command/Config/OverrideCommand.php b/src/Command/Config/OverrideCommand.php index dd6c40c24..3d0991841 100644 --- a/src/Command/Config/OverrideCommand.php +++ b/src/Command/Config/OverrideCommand.php @@ -20,10 +20,14 @@ class OverrideCommand extends Command { use CommandTrait; - /** @var CachedStorage */ + /** + * @var CachedStorage + */ protected $configStorage; - /** @var ConfigFactory */ + /** + * @var ConfigFactory + */ protected $configFactory; /** diff --git a/src/Command/Config/PrintConfigValidationTrait.php b/src/Command/Config/PrintConfigValidationTrait.php index a0fcf2009..6dcbe6624 100644 --- a/src/Command/Config/PrintConfigValidationTrait.php +++ b/src/Command/Config/PrintConfigValidationTrait.php @@ -9,20 +9,18 @@ use Drupal\Console\Style\DrupalStyle; - -trait PrintConfigValidationTrait { - - protected function printResults($valid, DrupalStyle $io){ - - if($valid === TRUE){ - $io->info($this->trans('commands.config.validate.messages.success')); - return 0; +trait PrintConfigValidationTrait +{ + protected function printResults($valid, DrupalStyle $io) + { + if ($valid === true) { + $io->info($this->trans('commands.config.validate.messages.success')); + return 0; + } + + foreach ($valid as $key => $error) { + $io->warning($key . ': ' . $error); + } + return 1; } - - foreach ($valid as $key => $error) { - $io->warning($key . ': ' . $error); - } - return 1; - } - -} \ No newline at end of file +} diff --git a/src/Command/Config/SettingsDebugCommand.php b/src/Command/Config/SettingsDebugCommand.php index 33de258ef..80bad753e 100644 --- a/src/Command/Config/SettingsDebugCommand.php +++ b/src/Command/Config/SettingsDebugCommand.php @@ -23,15 +23,19 @@ class SettingsDebugCommand extends Command { use CommandTrait; - /** @var Settings */ + /** + * @var Settings + */ protected $settings; /** * SettingsDebugCommand constructor. * @param Settings $settings */ - public function __construct(Settings $settings) { - $this->settings = $settings;; + public function __construct(Settings $settings) + { + $this->settings = $settings; + ; parent::__construct(); } /** diff --git a/src/Command/Config/ValidateCommand.php b/src/Command/Config/ValidateCommand.php index e8427a5bd..5bf4b2e4c 100644 --- a/src/Command/Config/ValidateCommand.php +++ b/src/Command/Config/ValidateCommand.php @@ -13,7 +13,6 @@ use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Style\DrupalStyle; use Drupal\Core\Config\TypedConfigManagerInterface; -use Drupal\Core\Config\ConfigFactoryInterface; use Symfony\Component\Console\Input\InputArgument; use Drupal\Core\Config\Schema\SchemaCheckTrait; @@ -22,53 +21,53 @@ * * @package Drupal\Console\Command\Config */ -class ValidateCommand extends Command { - - use ContainerAwareCommandTrait; - use SchemaCheckTrait; - use PrintConfigValidationTrait; - - public function __construct($name) { - - parent::__construct($name); - - } +class ValidateCommand extends Command +{ + use ContainerAwareCommandTrait; + use SchemaCheckTrait; + use PrintConfigValidationTrait; + + public function __construct($name) + { + parent::__construct($name); + } - /** + /** * {@inheritdoc} */ - protected function configure() { - - $this - ->setName('config:validate') - ->setDescription($this->trans('commands.config.default.description')) - ->addArgument('config.name',InputArgument::REQUIRED); - - } + protected function configure() + { + $this + ->setName('config:validate') + ->setDescription($this->trans('commands.config.default.description')) + ->addArgument('config.name', InputArgument::REQUIRED); + } - /** + /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) { + protected function execute(InputInterface $input, OutputInterface $output) + { - /** @var TypedConfigManagerInterface $typedConfigManager */ - $typedConfigManager = $this->get('config.typed'); + /** + * @var TypedConfigManagerInterface $typedConfigManager +*/ + $typedConfigManager = $this->get('config.typed'); - $io = new DrupalStyle($input, $output); + $io = new DrupalStyle($input, $output); - //Test the config name and see if a schema exists, if not it will fail - $name = $input->getArgument('config.name'); - if(!$typedConfigManager->hasConfigSchema($name)){ - $io->warning($this->trans('commands.config.default.messages.noconf')); - return 1; - } + //Test the config name and see if a schema exists, if not it will fail + $name = $input->getArgument('config.name'); + if (!$typedConfigManager->hasConfigSchema($name)) { + $io->warning($this->trans('commands.config.default.messages.noconf')); + return 1; + } - //Get the config data from the factory - $configFactory = $this->get('config.factory'); - $config_data = $configFactory->get($name)->get(); + //Get the config data from the factory + $configFactory = $this->get('config.factory'); + $config_data = $configFactory->get($name)->get(); - return $this->printResults($this->checkConfigSchema($typedConfigManager, $name, $config_data), $io); - - } + return $this->printResults($this->checkConfigSchema($typedConfigManager, $name, $config_data), $io); + } } diff --git a/src/Command/Config/ValidateDebugCommand.php b/src/Command/Config/ValidateDebugCommand.php index efcf95be0..1768be324 100644 --- a/src/Command/Config/ValidateDebugCommand.php +++ b/src/Command/Config/ValidateDebugCommand.php @@ -23,83 +23,87 @@ * *@package Drupal\Console\Command\Config */ -class ValidateDebugCommand extends Command { - - use ContainerAwareCommandTrait; - use SchemaCheckTrait; - use PrintConfigValidationTrait; +class ValidateDebugCommand extends Command +{ + use ContainerAwareCommandTrait; + use SchemaCheckTrait; + use PrintConfigValidationTrait; + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('config:validate:debug') + ->setDescription($this->trans('commands.config.validate.debug.description')) + ->addArgument('config.filepath', InputArgument::REQUIRED) + ->addArgument('config.schema.filepath', InputArgument::REQUIRED) + ->addOption('schema-name', 'sch', InputOption::VALUE_REQUIRED); + } - /** - * {@inheritdoc} - */ - protected function configure() { - $this - ->setName('config:validate:debug') - ->setDescription($this->trans('commands.config.validate.debug.description')) - ->addArgument('config.filepath', InputArgument::REQUIRED) - ->addArgument('config.schema.filepath', InputArgument::REQUIRED) - ->addOption('schema-name', 'sch', InputOption::VALUE_REQUIRED); - } - - /** + /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) { - - /** @var TypedConfigManagerInterface $typedConfigManager */ - $typedConfigManager = $this->get('config.typed'); - - $io = new DrupalStyle($input, $output); - - //Validate config file path - $configFilePath = $input->getArgument('config.filepath'); - if (!file_exists($configFilePath)) { - $io->info($this->trans('commands.config.validate.debug.messages.noConfFile')); - return 1; - } - - //Validate schema path - $configSchemaFilePath = $input->getArgument('config.schema.filepath'); - if (!file_exists($configSchemaFilePath)) { - $io->info($this->trans('commands.config.validate.debug.messages.noConfSchema')); - return 1; - } - - $config = Yaml::decode(file_get_contents($configFilePath)); - $schema = Yaml::decode(file_get_contents($configSchemaFilePath)); - - //Get the schema name and check it exists in the schema array - $schemaName = $this->getSchemaName($input,$configFilePath); - if(!array_key_exists($schemaName,$schema)){ - $io->warning($this->trans('commands.config.validate.debug.messages.noSchemaName') . $schemaName ); - return 1; + protected function execute(InputInterface $input, OutputInterface $output) + { + + /** + * @var TypedConfigManagerInterface $typedConfigManager + */ + $typedConfigManager = $this->get('config.typed'); + + $io = new DrupalStyle($input, $output); + + //Validate config file path + $configFilePath = $input->getArgument('config.filepath'); + if (!file_exists($configFilePath)) { + $io->info($this->trans('commands.config.validate.debug.messages.noConfFile')); + return 1; + } + + //Validate schema path + $configSchemaFilePath = $input->getArgument('config.schema.filepath'); + if (!file_exists($configSchemaFilePath)) { + $io->info($this->trans('commands.config.validate.debug.messages.noConfSchema')); + return 1; + } + + $config = Yaml::decode(file_get_contents($configFilePath)); + $schema = Yaml::decode(file_get_contents($configSchemaFilePath)); + + //Get the schema name and check it exists in the schema array + $schemaName = $this->getSchemaName($input, $configFilePath); + if (!array_key_exists($schemaName, $schema)) { + $io->warning($this->trans('commands.config.validate.debug.messages.noSchemaName') . $schemaName); + return 1; + } + + return $this->printResults($this->manualCheckConfigSchema($typedConfigManager, $config, $schema[$schemaName]), $io); } - return $this->printResults($this->manualCheckConfigSchema($typedConfigManager,$config,$schema[$schemaName]), $io); - - } - - private function getSchemaName(InputInterface $input, $configFilePath) - { - $schemaName = $input->getOption('schema-name'); - if( $schemaName === null){ - $schema_name = end(explode('/',$configFilePath)); - $schemaName = substr($schema_name, 0, -4); + private function getSchemaName(InputInterface $input, $configFilePath) + { + $schemaName = $input->getOption('schema-name'); + if ($schemaName === null) { + $schema_name = end(explode('/', $configFilePath)); + $schemaName = substr($schema_name, 0, -4); + } + return $schemaName; } - return $schemaName; - } - private function manualCheckConfigSchema(TypedConfigManagerInterface $typed_config, $config_data, $config_schema) { - - $data_definition = $typed_config->buildDataDefinition($config_schema, $config_data); - $this->schema = $typed_config->create($data_definition, $config_data); - $errors = array(); - foreach ($config_data as $key => $value) { - $errors = array_merge($errors, $this->checkValue($key, $value)); - } - if (empty($errors)) { - return TRUE; + private function manualCheckConfigSchema(TypedConfigManagerInterface $typed_config, $config_data, $config_schema) + { + $data_definition = $typed_config->buildDataDefinition($config_schema, $config_data); + $this->schema = $typed_config->create($data_definition, $config_data); + $errors = array(); + foreach ($config_data as $key => $value) { + $errors = array_merge($errors, $this->checkValue($key, $value)); + } + if (empty($errors)) { + return true; + } + + return $errors; } - return $errors; - } } diff --git a/src/Command/Cron/ExecuteCommand.php b/src/Command/Cron/ExecuteCommand.php index d676d4904..f0cd6849b 100644 --- a/src/Command/Cron/ExecuteCommand.php +++ b/src/Command/Cron/ExecuteCommand.php @@ -46,7 +46,7 @@ class ExecuteCommand extends Command * DebugCommand constructor. * @param ModuleHandlerInterface $moduleHandler * @param LockBackendInterface $lock - * @param StateInterface $state + * @param StateInterface $state * @param ChainQueue $chainQueue */ public function __construct( diff --git a/src/Command/Database/ClientCommand.php b/src/Command/Database/ClientCommand.php index 0f9b13b9d..d6a4a494f 100644 --- a/src/Command/Database/ClientCommand.php +++ b/src/Command/Database/ClientCommand.php @@ -50,15 +50,15 @@ protected function execute(InputInterface $input, OutputInterface $output) $databaseConnection = $this->resolveConnection($io, $database); - $connection = sprintf( - '%s -A --database=%s --user=%s --password=%s --host=%s --port=%s', - $databaseConnection['driver'], - $databaseConnection['database'], - $databaseConnection['username'], - $databaseConnection['password'], - $databaseConnection['host'], - $databaseConnection['port'] - ); + $connection = sprintf( + '%s -A --database=%s --user=%s --password=%s --host=%s --port=%s', + $databaseConnection['driver'], + $databaseConnection['database'], + $databaseConnection['username'], + $databaseConnection['password'], + $databaseConnection['host'], + $databaseConnection['port'] + ); if ($learning) { $io->commentBlock( diff --git a/src/Command/Database/DatabaseLogBase.php b/src/Command/Database/DatabaseLogBase.php index 87bacc5b6..fea09034f 100644 --- a/src/Command/Database/DatabaseLogBase.php +++ b/src/Command/Database/DatabaseLogBase.php @@ -24,62 +24,61 @@ use Symfony\Component\Console\Input\InputInterface; use Drupal\Console\Style\DrupalStyle; - /** * Class DatabaseLogBase * * @package Drupal\Console\Command\Database */ -abstract class DatabaseLogBase extends Command { - - use CommandTrait; +abstract class DatabaseLogBase extends Command +{ + use CommandTrait; - /** + /** * @var Connection */ - protected $database; + protected $database; - /** + /** * @var DateFormatterInterface */ - protected $dateFormatter; + protected $dateFormatter; - /** + /** * @var EntityTypeManagerInterface */ - protected $entityTypeManager; + protected $entityTypeManager; - /** + /** * @var TranslationInterface */ - protected $stringTranslation; + protected $stringTranslation; - /** + /** * @var UserStorageInterface */ - protected $userStorage; + protected $userStorage; - /** + /** * @var TranslatableMarkup[] */ - protected $severityList; + protected $severityList; - /** + /** * @var null|string */ - protected $eventType; + protected $eventType; - /** + /** * @var null|string */ - protected $eventSeverity; + protected $eventSeverity; - /** + /** * @var null|string */ - protected $userId; + protected $userId; - /** + /** * LogDebugCommand constructor. * * @param Connection $database @@ -87,154 +86,161 @@ abstract class DatabaseLogBase extends Command { * @param EntityTypeManagerInterface $entityTypeManager * @param \Drupal\Core\StringTranslation\TranslationInterface $stringTranslation */ - public function __construct( - Connection $database, - DateFormatterInterface $dateFormatter, - EntityTypeManagerInterface $entityTypeManager, - TranslationInterface $stringTranslation - ) { - $this->database = $database; - $this->dateFormatter = $dateFormatter; - $this->entityTypeManager = $entityTypeManager; - $this->stringTranslation = $stringTranslation; - $this->userStorage = $this->entityTypeManager->getStorage('user'); - $this->severityList = RfcLogLevel::getLevels(); - parent::__construct(); - } - - /** + public function __construct( + Connection $database, + DateFormatterInterface $dateFormatter, + EntityTypeManagerInterface $entityTypeManager, + TranslationInterface $stringTranslation + ) { + $this->database = $database; + $this->dateFormatter = $dateFormatter; + $this->entityTypeManager = $entityTypeManager; + $this->stringTranslation = $stringTranslation; + $this->userStorage = $this->entityTypeManager->getStorage('user'); + $this->severityList = RfcLogLevel::getLevels(); + parent::__construct(); + } + + /** * */ - protected function addDefaultLoggingOptions() { - - $this - ->addOption( - 'type', - '', - InputOption::VALUE_OPTIONAL, - $this->trans('commands.database.log.common.options.type') - ) - ->addOption( - 'severity', - '', - InputOption::VALUE_OPTIONAL, - $this->trans('commands.database.log.common.options.severity') - ) - ->addOption( - 'user-id', - '', - InputOption::VALUE_OPTIONAL, - $this->trans('commands.database.log.common.options.user-id') - ); - - } - - /** + protected function addDefaultLoggingOptions() + { + $this + ->addOption( + 'type', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.database.log.common.options.type') + ) + ->addOption( + 'severity', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.database.log.common.options.severity') + ) + ->addOption( + 'user-id', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.database.log.common.options.user-id') + ); + } + + /** * @param \Symfony\Component\Console\Input\InputInterface $input */ - protected function getDefaultOptions(InputInterface $input) { - - $this->eventType = $input->getOption('type'); - $this->eventSeverity = $input->getOption('severity'); - $this->userId = $input->getOption('user-id'); - - } + protected function getDefaultOptions(InputInterface $input) + { + $this->eventType = $input->getOption('type'); + $this->eventSeverity = $input->getOption('severity'); + $this->userId = $input->getOption('user-id'); + } - /** + /** * @param \Drupal\Console\Style\DrupalStyle $io * @param null $offset * @param int $range * @return bool|\Drupal\Core\Database\Query\SelectInterface */ - protected function makeQuery(DrupalStyle $io, $offset = NULL, $range = 1000) { - - $query = $this->database->select('watchdog', 'w'); - $query->fields( - 'w', - [ - 'wid', - 'uid', - 'severity', - 'type', - 'timestamp', - 'message', - 'variables', - ] - ); - - if ($this->eventType) { - $query->condition('type', $this->eventType); - } - - if ($this->eventSeverity) { - if (!in_array($this->eventSeverity, $this->severityList)) { - $io->error( - sprintf( - $this->trans('database.log.common.messages.invalid-severity'), - $this->eventSeverity - ) + protected function makeQuery(DrupalStyle $io, $offset = null, $range = 1000) + { + $query = $this->database->select('watchdog', 'w'); + $query->fields( + 'w', + [ + 'wid', + 'uid', + 'severity', + 'type', + 'timestamp', + 'message', + 'variables', + ] ); - return FALSE; - } - $query->condition('severity', - array_search($this->eventSeverity, - $this->severityList)); - } - - if ($this->userId) { - $query->condition('uid', $this->userId); - } - - $query->orderBy('wid', 'ASC'); - if ($offset) { - $query->range($offset, $range); + if ($this->eventType) { + $query->condition('type', $this->eventType); + } + + if ($this->eventSeverity) { + if (!in_array($this->eventSeverity, $this->severityList)) { + $io->error( + sprintf( + $this->trans('database.log.common.messages.invalid-severity'), + $this->eventSeverity + ) + ); + return false; + } + $query->condition( + 'severity', + array_search( + $this->eventSeverity, + $this->severityList + ) + ); + } + + if ($this->userId) { + $query->condition('uid', $this->userId); + } + + $query->orderBy('wid', 'ASC'); + + if ($offset) { + $query->range($offset, $range); + } + + return $query; } - return $query; - - } - - /** + /** * Generic logging table header * * @return array */ - protected function createTableHeader() { - return [ - $this->trans('commands.database.log.common.messages.event-id'), - $this->trans('commands.database.log.common.messages.type'), - $this->trans('commands.database.log.common.messages.date'), - $this->trans('commands.database.log.common.messages.message'), - $this->trans('commands.database.log.common.messages.user'), - $this->trans('commands.database.log.common.messages.severity'), - ]; - } - - - /** + protected function createTableHeader() + { + return [ + $this->trans('commands.database.log.common.messages.event-id'), + $this->trans('commands.database.log.common.messages.type'), + $this->trans('commands.database.log.common.messages.date'), + $this->trans('commands.database.log.common.messages.message'), + $this->trans('commands.database.log.common.messages.user'), + $this->trans('commands.database.log.common.messages.severity'), + ]; + } + + + /** * @param \stdClass $dblog * @return array */ - protected function createTableRow(\stdClass $dblog) { - - /** @var User $user */ - $user = $this->userStorage->load($dblog->uid); - - return [ - $dblog->wid, - $dblog->type, - $this->dateFormatter->format($dblog->timestamp, 'short'), - Unicode::truncate(Html::decodeEntities(strip_tags($this->formatMessage($dblog))), - 500, - TRUE, - TRUE), - $user->getUsername() . ' (' . $user->id() . ')', - $this->severityList[$dblog->severity]->render(), - ]; - } - - /** + protected function createTableRow(\stdClass $dblog) + { + + /** + * @var User $user +*/ + $user = $this->userStorage->load($dblog->uid); + + return [ + $dblog->wid, + $dblog->type, + $this->dateFormatter->format($dblog->timestamp, 'short'), + Unicode::truncate( + Html::decodeEntities(strip_tags($this->formatMessage($dblog))), + 500, + true, + true + ), + $user->getUsername() . ' (' . $user->id() . ')', + $this->severityList[$dblog->severity]->render(), + ]; + } + + /** * Formats a database log message. * * @param $event @@ -245,32 +251,35 @@ protected function createTableRow(\stdClass $dblog) { * The formatted log message or FALSE if the message or variables properties * are not set. */ - protected function formatMessage(\stdClass $event) { - $message = FALSE; - - // Check for required properties. - if (isset($event->message, $event->variables)) { - // Messages without variables or user specified text. - if ($event->variables === 'N;') { - return $event->message; - } - - return $this->stringTranslation->translate( - $event->message, - unserialize($event->variables) - ); + protected function formatMessage(\stdClass $event) + { + $message = false; + + // Check for required properties. + if (isset($event->message, $event->variables)) { + // Messages without variables or user specified text. + if ($event->variables === 'N;') { + return $event->message; + } + + return $this->stringTranslation->translate( + $event->message, + unserialize($event->variables) + ); + } + + return $message; } - return $message; - } - - /** + /** * @param $dblog * @return array */ - protected function formatSingle($dblog) { - return array_combine($this->createTableHeader(), - $this->createTableRow($dblog)); - } - -} \ No newline at end of file + protected function formatSingle($dblog) + { + return array_combine( + $this->createTableHeader(), + $this->createTableRow($dblog) + ); + } +} diff --git a/src/Command/Database/DropCommand.php b/src/Command/Database/DropCommand.php index 66857dbc6..b5da63f21 100644 --- a/src/Command/Database/DropCommand.php +++ b/src/Command/Database/DropCommand.php @@ -34,7 +34,8 @@ class DropCommand extends Command * DropCommand constructor. * @param Connection $database */ - public function __construct(Connection $database) { + public function __construct(Connection $database) + { $this->database = $database; parent::__construct(); } diff --git a/src/Command/Database/DumpCommand.php b/src/Command/Database/DumpCommand.php index 349b44acd..5802eb5fa 100644 --- a/src/Command/Database/DumpCommand.php +++ b/src/Command/Database/DumpCommand.php @@ -125,22 +125,23 @@ protected function execute(InputInterface $input, OutputInterface $output) } if ($this->shellProcess->exec($command, $this->appRoot)) { - $resultFile = $file; - if ($gz) { - if(substr($file, -3) != '.gz') { - $resultFile = $file . ".gz"; - } - file_put_contents( - $resultFile, - gzencode( - file_get_contents( - $file) - ) - ); - if($resultFile != $file) { - unlink($file); - } - } + $resultFile = $file; + if ($gz) { + if (substr($file, -3) != '.gz') { + $resultFile = $file . ".gz"; + } + file_put_contents( + $resultFile, + gzencode( + file_get_contents( + $file + ) + ) + ); + if ($resultFile != $file) { + unlink($file); + } + } $io->success( sprintf( diff --git a/src/Command/Database/LogClearCommand.php b/src/Command/Database/LogClearCommand.php index 0aef41e82..58e7cae88 100644 --- a/src/Command/Database/LogClearCommand.php +++ b/src/Command/Database/LogClearCommand.php @@ -30,7 +30,8 @@ class LogClearCommand extends Command * LogClearCommand constructor. * @param Connection $database */ - public function __construct(Connection $database) { + public function __construct(Connection $database) + { $this->database = $database; parent::__construct(); } @@ -120,7 +121,7 @@ private function clearEvent(DrupalStyle $io, $eventId) } /** - * @param DrupalStyle $io + * @param DrupalStyle $io * @param $eventType * @param $eventSeverity * @param $userId diff --git a/src/Command/Database/LogDebugCommand.php b/src/Command/Database/LogDebugCommand.php index a643eb7d4..57ef7fe5b 100644 --- a/src/Command/Database/LogDebugCommand.php +++ b/src/Command/Database/LogDebugCommand.php @@ -19,156 +19,154 @@ * * @package Drupal\Console\Command\Database */ -class LogDebugCommand extends DatabaseLogBase { - - /** +class LogDebugCommand extends DatabaseLogBase +{ + /** * @var */ - protected $eventId; + protected $eventId; - /** + /** * @var */ - protected $asc; - /** + protected $asc; + /** * @var */ - protected $limit; - /** + protected $limit; + /** * @var */ - protected $offset; + protected $offset; - /** + /** * Print in yml style if true * * @var bool */ - protected $ymlStyle; + protected $ymlStyle; - /** + /** * {@inheritdoc} */ - protected function configure() { - $this - ->setName('database:log:debug') - ->setDescription($this->trans('commands.database.log.debug.description')); - - $this->addDefaultLoggingOptions(); - - $this - ->addArgument( - 'event-id', - InputArgument::OPTIONAL, - $this->trans('commands.database.log.debug.arguments.event-id') - ) - ->addOption( - 'asc', - FALSE, - InputOption::VALUE_NONE, - $this->trans('commands.database.log.debug.options.asc') - ) - ->addOption( - 'limit', - NULL, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.database.log.debug.options.limit') - ) - ->addOption( - 'offset', - NULL, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.database.log.debug.options.offset'), - 0 - ) - ->addOption( - 'yml', - NULL, - InputOption::VALUE_NONE, - $this->trans('commands.database.log.debug.options.yml'), - NULL - ); - } - - /** + protected function configure() + { + $this + ->setName('database:log:debug') + ->setDescription($this->trans('commands.database.log.debug.description')); + + $this->addDefaultLoggingOptions(); + + $this + ->addArgument( + 'event-id', + InputArgument::OPTIONAL, + $this->trans('commands.database.log.debug.arguments.event-id') + ) + ->addOption( + 'asc', + false, + InputOption::VALUE_NONE, + $this->trans('commands.database.log.debug.options.asc') + ) + ->addOption( + 'limit', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.database.log.debug.options.limit') + ) + ->addOption( + 'offset', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.database.log.debug.options.offset'), + 0 + ) + ->addOption( + 'yml', + null, + InputOption::VALUE_NONE, + $this->trans('commands.database.log.debug.options.yml'), + null + ); + } + + /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) { - - $io = new DrupalStyle($input, $output); - - $this->getDefaultOptions($input); - $this->eventId = $input->getArgument('event-id'); - $this->asc = $input->getOption('asc'); - $this->limit = $input->getOption('limit'); - $this->offset = $input->getOption('offset'); - $this->ymlStyle = $input->getOption('yml'); - - - if ($this->eventId) { - return $this->getEventDetails($io); - } else { - return $this->getAllEvents($io); + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $this->getDefaultOptions($input); + $this->eventId = $input->getArgument('event-id'); + $this->asc = $input->getOption('asc'); + $this->limit = $input->getOption('limit'); + $this->offset = $input->getOption('offset'); + $this->ymlStyle = $input->getOption('yml'); + + + if ($this->eventId) { + return $this->getEventDetails($io); + } else { + return $this->getAllEvents($io); + } } - } - /** + /** * @param $io * @param $eventId * @return bool */ - private function getEventDetails(DrupalStyle $io) { - - $dblog = $this->database - ->query( - 'SELECT w.*, u.uid FROM {watchdog} w LEFT JOIN {users} u ON u.uid = w.uid WHERE w.wid = :id', - [':id' => $this->eventId] - ) - ->fetchObject(); - - if (!$dblog) { - $io->error( - sprintf( - $this->trans('commands.database.log.debug.messages.not-found'), - $this->eventId - ) - ); - return 1; + private function getEventDetails(DrupalStyle $io) + { + $dblog = $this->database + ->query( + 'SELECT w.*, u.uid FROM {watchdog} w LEFT JOIN {users} u ON u.uid = w.uid WHERE w.wid = :id', + [':id' => $this->eventId] + ) + ->fetchObject(); + + if (!$dblog) { + $io->error( + sprintf( + $this->trans('commands.database.log.debug.messages.not-found'), + $this->eventId + ) + ); + return 1; + } + + if ($this->ymlStyle) { + $io->writeln(Yaml::encode($this->formatSingle($dblog))); + } else { + $io->table( + $this->createTableHeader(), + [$this->createTableRow($dblog)] + ); + } } - if ($this->ymlStyle) { - $io->writeln(Yaml::encode($this->formatSingle($dblog))); - } else { - $io->table( - $this->createTableHeader(), - [$this->createTableRow($dblog)] - ); - } - - - } - - /** + /** * @param \Drupal\Console\Style\DrupalStyle $io * @return bool */ - private function getAllEvents(DrupalStyle $io) { + private function getAllEvents(DrupalStyle $io) + { + $query = $this->makeQuery($io); - $query = $this->makeQuery($io); + $result = $query->execute(); - $result = $query->execute(); + $tableRows = []; + foreach ($result as $dblog) { + $tableRows[] = $this->createTableRow($dblog); + } - $tableRows = []; - foreach ($result as $dblog) { - $tableRows[] = $this->createTableRow($dblog); - } - - $io->table( - $this->createTableHeader(), - $tableRows - ); - - return TRUE; - } + $io->table( + $this->createTableHeader(), + $tableRows + ); + return true; + } } diff --git a/src/Command/Database/LogPollCommand.php b/src/Command/Database/LogPollCommand.php index 8e80e020e..6ffd16bce 100644 --- a/src/Command/Database/LogPollCommand.php +++ b/src/Command/Database/LogPollCommand.php @@ -2,94 +2,87 @@ namespace Drupal\Console\Command\Database; - use Drupal\Console\Style\DrupalStyle; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; - /** * Class LogPollCommand * * @package Drupal\Console\Command\Database */ -class LogPollCommand extends DatabaseLogBase { - - /** +class LogPollCommand extends DatabaseLogBase +{ + /** * @var */ - protected $duration; + protected $duration; - /** + /** * */ - protected function configure() { - $this - ->setName('database:log:poll') - ->setDescription($this->trans('commands.database.log.poll.description')); - - $this->addDefaultLoggingOptions(); - - $this->addArgument( - 'duration', - InputArgument::OPTIONAL, - $this->trans('commands.database.log.poll.arguments.duration'), - '10' - ); - - } + protected function configure() + { + $this + ->setName('database:log:poll') + ->setDescription($this->trans('commands.database.log.poll.description')); + + $this->addDefaultLoggingOptions(); + + $this->addArgument( + 'duration', + InputArgument::OPTIONAL, + $this->trans('commands.database.log.poll.arguments.duration'), + '10' + ); + } - /** + /** * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output */ - protected function execute(InputInterface $input, OutputInterface $output) { - - $io = new DrupalStyle($input, $output); - - $io->note($this->trans('commands.database.log.poll.messages.warning')); + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); - $this->getDefaultOptions($input); - $this->duration = $input->getArgument('duration'); + $io->note($this->trans('commands.database.log.poll.messages.warning')); - $this->pollForEvents($io); + $this->getDefaultOptions($input); + $this->duration = $input->getArgument('duration'); - } + $this->pollForEvents($io); + } - /** + /** * @param \Drupal\Console\Style\DrupalStyle $io */ - protected function pollForEvents(DrupalStyle $io) { - - $query = $this->makeQuery($io)->countQuery(); - $results = $query->execute()->fetchAssoc(); - $count = $results['expression'] - 1;//minus 1 so the newest message always prints - - $tableHeader = $this->createTableHeader(); - - //Poll, force no wait on first loop - $lastExec = time() - $this->duration; - while (1) { - - if (time() > $lastExec + $this->duration) { - //Print out any new db logs - $query = $this->makeQuery($io, $count); - $results = $query->execute()->fetchAll(); - $count += count($results); - $tableRows = []; - foreach ($results as $r) { - $tableRows[] = $this->createTableRow($r); + protected function pollForEvents(DrupalStyle $io) + { + $query = $this->makeQuery($io)->countQuery(); + $results = $query->execute()->fetchAssoc(); + $count = $results['expression'] - 1;//minus 1 so the newest message always prints + + $tableHeader = $this->createTableHeader(); + + //Poll, force no wait on first loop + $lastExec = time() - $this->duration; + while (1) { + if (time() > $lastExec + $this->duration) { + //Print out any new db logs + $query = $this->makeQuery($io, $count); + $results = $query->execute()->fetchAll(); + $count += count($results); + $tableRows = []; + foreach ($results as $r) { + $tableRows[] = $this->createTableRow($r); + } + if (!empty($tableRows)) { + $io->table($tableHeader, $tableRows); + } + //update the last exec time + $lastExec = time(); + } } - if (!empty($tableRows)) { - $io->table($tableHeader, $tableRows); - } - //update the last exec time - $lastExec = time(); - } } - - } - - } diff --git a/src/Command/Database/QueryCommand.php b/src/Command/Database/QueryCommand.php index e32809675..6774e06ef 100644 --- a/src/Command/Database/QueryCommand.php +++ b/src/Command/Database/QueryCommand.php @@ -6,8 +6,8 @@ * * * @TODO: - * - mysql -H option for html - * - mysql -X option for xml + * - mysql -H option for html + * - mysql -X option for xml */ namespace Drupal\Console\Command\Database; @@ -70,49 +70,51 @@ protected function execute(InputInterface $input, OutputInterface $output) $databaseConnection = $this->resolveConnection($io, $database); - $connection = sprintf( - '%s -A --database=%s --user=%s --password=%s --host=%s --port=%s', - $databaseConnection['driver'], - $databaseConnection['database'], - $databaseConnection['username'], - $databaseConnection['password'], - $databaseConnection['host'], - $databaseConnection['port'] - ); - - $args = explode(' ', $connection); - $args[] = sprintf('--execute=%s', $query); - - $opts = ["quick", "debug", "html", "xml", "raw", "vertical", "batch"]; - array_walk($opts, function($opt) use ($input, &$args) { - if ($input->getOption($opt)) { - switch ($opt) { - case "quick": - $args[] = "--quick"; - break; - case "debug": - $args[] = "-T"; - break; - case "html": - $args[] = "-H"; - break; - case "xml": - $args[] = "-X"; - break; - case "raw": - $args[] = "--raw"; - break; - case "vertical": - $args[] = "-E"; - break; - case "batch": - $args[] = "--batch"; - break; - } - } - }); - - if ($learning) { + $connection = sprintf( + '%s -A --database=%s --user=%s --password=%s --host=%s --port=%s', + $databaseConnection['driver'], + $databaseConnection['database'], + $databaseConnection['username'], + $databaseConnection['password'], + $databaseConnection['host'], + $databaseConnection['port'] + ); + + $args = explode(' ', $connection); + $args[] = sprintf('--execute=%s', $query); + + $opts = ["quick", "debug", "html", "xml", "raw", "vertical", "batch"]; + array_walk( + $opts, function ($opt) use ($input, &$args) { + if ($input->getOption($opt)) { + switch ($opt) { + case "quick": + $args[] = "--quick"; + break; + case "debug": + $args[] = "-T"; + break; + case "html": + $args[] = "-H"; + break; + case "xml": + $args[] = "-X"; + break; + case "raw": + $args[] = "--raw"; + break; + case "vertical": + $args[] = "-E"; + break; + case "batch": + $args[] = "--batch"; + break; + } + } + } + ); + + if ($learning) { $io->commentBlock( implode(" ", $args) ); diff --git a/src/Command/Database/RestoreCommand.php b/src/Command/Database/RestoreCommand.php index a62f8ec77..3dc9d702a 100644 --- a/src/Command/Database/RestoreCommand.php +++ b/src/Command/Database/RestoreCommand.php @@ -31,7 +31,8 @@ class RestoreCommand extends Command * RestoreCommand constructor. * @param string $appRoot */ - public function __construct($appRoot) { + public function __construct($appRoot) + { $this->appRoot = $appRoot; parent::__construct(); } diff --git a/src/Command/Database/TableDebugCommand.php b/src/Command/Database/TableDebugCommand.php index 440357026..d8d80251a 100644 --- a/src/Command/Database/TableDebugCommand.php +++ b/src/Command/Database/TableDebugCommand.php @@ -39,7 +39,7 @@ class TableDebugCommand extends Command /** * TableDebugCommand constructor. - * @param R $redBean + * @param R $redBean * @param Connection $database */ public function __construct( diff --git a/src/Command/Develop/TranslationCleanupCommand.php b/src/Command/Develop/TranslationCleanupCommand.php index 938af4bf2..5fb3bac5f 100644 --- a/src/Command/Develop/TranslationCleanupCommand.php +++ b/src/Command/Develop/TranslationCleanupCommand.php @@ -25,7 +25,7 @@ class TranslationCleanupCommand extends Command /** * @var string */ - protected $consoleRoot; + protected $consoleRoot; /** * @var ConfigurationManager @@ -37,7 +37,6 @@ class TranslationCleanupCommand extends Command * * @param $consoleRoot * @param configurationManager $configurationManager - * */ public function __construct( $consoleRoot, @@ -103,21 +102,21 @@ protected function cleanupTranslations($io, $language = null, $languages) $finder = new Finder(); foreach ($languages as $langCode => $languageName) { - if (file_exists($this->consoleRoot . sprintf( DRUPAL_CONSOLE_LANGUAGE, $langCode ))) { - foreach ($finder->files()->name('*.yml')->in($this->consoleRoot . sprintf( DRUPAL_CONSOLE_LANGUAGE, $langCode )) as $file) { - $filename = $file->getBasename('.yml'); - if (!file_exists($this->consoleRoot . sprintf( DRUPAL_CONSOLE_LANGUAGE, 'en') . $filename . '.yml')) { - $io->info( - sprintf( - $this->trans('commands.translation.cleanup.messages.file-deleted'), - $filename, - $languageName - ) - ); - unlink($this->consoleRoot . sprintf( DRUPAL_CONSOLE_LANGUAGE, $langCode ). '/' . $filename . '.yml'); - } - } - } - } + if (file_exists($this->consoleRoot . sprintf(DRUPAL_CONSOLE_LANGUAGE, $langCode))) { + foreach ($finder->files()->name('*.yml')->in($this->consoleRoot . sprintf(DRUPAL_CONSOLE_LANGUAGE, $langCode)) as $file) { + $filename = $file->getBasename('.yml'); + if (!file_exists($this->consoleRoot . sprintf(DRUPAL_CONSOLE_LANGUAGE, 'en') . $filename . '.yml')) { + $io->info( + sprintf( + $this->trans('commands.translation.cleanup.messages.file-deleted'), + $filename, + $languageName + ) + ); + unlink($this->consoleRoot . sprintf(DRUPAL_CONSOLE_LANGUAGE, $langCode). '/' . $filename . '.yml'); + } + } + } + } } } diff --git a/src/Command/Develop/TranslationPendingCommand.php b/src/Command/Develop/TranslationPendingCommand.php index 559c7f079..0718b4fb5 100644 --- a/src/Command/Develop/TranslationPendingCommand.php +++ b/src/Command/Develop/TranslationPendingCommand.php @@ -29,7 +29,7 @@ class TranslationPendingCommand extends Command /** * @var string */ - protected $consoleRoot; + protected $consoleRoot; /** * @var ConfigurationManager @@ -47,8 +47,7 @@ class TranslationPendingCommand extends Command * * @param $consoleRoot * @param $configurationManager - * @param NestedArray $nestedArray - * + * @param NestedArray $nestedArray */ public function __construct( $consoleRoot, @@ -166,10 +165,10 @@ protected function determinePendingTranslation($io, $language = null, $languages foreach ($languages as $langCode => $languageName) { $languageDir = $this->consoleRoot . - sprintf( - DRUPAL_CONSOLE_LANGUAGE, - $langCode - ); + sprintf( + DRUPAL_CONSOLE_LANGUAGE, + $langCode + ); if (isset($language) && $langCode != $language) { continue; } diff --git a/src/Command/Develop/TranslationStatsCommand.php b/src/Command/Develop/TranslationStatsCommand.php index b26ed6f4c..e94a8a28c 100644 --- a/src/Command/Develop/TranslationStatsCommand.php +++ b/src/Command/Develop/TranslationStatsCommand.php @@ -30,7 +30,7 @@ class TranslationStatsCommand extends Command /** * @var string */ - protected $consoleRoot; + protected $consoleRoot; /** * @var ConfigurationManager @@ -52,8 +52,8 @@ class TranslationStatsCommand extends Command * * @param $appRoot * @param ConfigurationManager $configurationManager - * @param TwigRenderer $renderer - * @param NestedArray $nestedArray + * @param TwigRenderer $renderer + * @param NestedArray $nestedArray */ public function __construct( $consoleRoot, @@ -140,10 +140,10 @@ protected function execute(InputInterface $input, OutputInterface $output) $io->writeln( $this->renderFile( - 'core/translation/stats.md.twig', - null, - $arguments - ) + 'core/translation/stats.md.twig', + null, + $arguments + ) ); } } @@ -175,12 +175,12 @@ protected function calculateStats($io, $language = null, $languages) foreach ($languages as $langCode => $languageName) { $languageDir = $this->consoleRoot . - sprintf( - DRUPAL_CONSOLE_LANGUAGE, - $langCode - ); - //don't show that language if that repo isn't present - if (!file_exists($languageDir)) { + sprintf( + DRUPAL_CONSOLE_LANGUAGE, + $langCode + ); + //don't show that language if that repo isn't present + if (!file_exists($languageDir)) { continue; } if (isset($language) && $langCode != $language) { diff --git a/src/Command/Develop/TranslationSyncCommand.php b/src/Command/Develop/TranslationSyncCommand.php index 1a87e6cdd..e96a76135 100644 --- a/src/Command/Develop/TranslationSyncCommand.php +++ b/src/Command/Develop/TranslationSyncCommand.php @@ -26,7 +26,7 @@ class TranslationSyncCommand extends Command /** * @var string */ - protected $consoleRoot; + protected $consoleRoot; /** * @var ConfigurationManager @@ -38,7 +38,6 @@ class TranslationSyncCommand extends Command * * @param $consoleRoot * @param configurationManager $configurationManager - * */ public function __construct( $consoleRoot, @@ -135,10 +134,10 @@ protected function syncTranslations($io, $language = null, $languages, $file) foreach ($languages as $langCode => $languageName) { $languageDir = $this->consoleRoot . - sprintf( - DRUPAL_CONSOLE_LANGUAGE, - $langCode - ); + sprintf( + DRUPAL_CONSOLE_LANGUAGE, + $langCode + ); if (isset($language) && $langCode != $language) { continue; } diff --git a/src/Command/Entity/DebugCommand.php b/src/Command/Entity/DebugCommand.php index d837049b1..905aabfb4 100644 --- a/src/Command/Entity/DebugCommand.php +++ b/src/Command/Entity/DebugCommand.php @@ -31,8 +31,8 @@ class DebugCommand extends Command /** * DeleteCommand constructor. - * @param EntityTypeRepository $entityTypeRepository - * @param EntityTypeManagerInterface $entityTypeManager + * @param EntityTypeRepository $entityTypeRepository + * @param EntityTypeManagerInterface $entityTypeManager */ public function __construct( EntityTypeRepository $entityTypeRepository, @@ -80,9 +80,9 @@ protected function execute(InputInterface $input, OutputInterface $output) $entityTypes = array_keys($entityTypesLabels); } - foreach($entityTypes as $entityTypeId){ + foreach ($entityTypes as $entityTypeId) { $entities = array_keys($entityTypesLabels[$entityTypeId]); - foreach($entities as $entity) { + foreach ($entities as $entity) { $tableRows[$entity] = [ $entity, $entityTypeId diff --git a/src/Command/Entity/DeleteCommand.php b/src/Command/Entity/DeleteCommand.php index 0bf875695..3933a103e 100644 --- a/src/Command/Entity/DeleteCommand.php +++ b/src/Command/Entity/DeleteCommand.php @@ -31,8 +31,8 @@ class DeleteCommand extends Command /** * DeleteCommand constructor. - * @param EntityTypeRepository $entityTypeRepository - * @param EntityTypeManagerInterface $entityTypeManager + * @param EntityTypeRepository $entityTypeRepository + * @param EntityTypeManagerInterface $entityTypeManager */ public function __construct( EntityTypeRepository $entityTypeRepository, diff --git a/src/Command/Features/DebugCommand.php b/src/Command/Features/DebugCommand.php index ee2dd49f8..617746a3e 100644 --- a/src/Command/Features/DebugCommand.php +++ b/src/Command/Features/DebugCommand.php @@ -1,77 +1,66 @@ setName('features:debug') - ->setDescription($this->trans('commands.features.debug.description')) - ->addArgument( - 'bundle', - InputArgument::OPTIONAL, - $this->trans('commands.features.debug.arguments.bundle') - ); - + $this + ->setName('features:debug') + ->setDescription($this->trans('commands.features.debug.description')) + ->addArgument( + 'bundle', + InputArgument::OPTIONAL, + $this->trans('commands.features.debug.arguments.bundle') + ); } protected function execute(InputInterface $input, OutputInterface $output) { - $io = new DrupalStyle($input, $output); - $bundle= $input->getArgument('bundle'); + $io = new DrupalStyle($input, $output); + $bundle= $input->getArgument('bundle'); - $tableHeader = [ - $this->trans('commands.features.debug.messages.bundle'), - $this->trans('commands.features.debug.messages.name'), - $this->trans('commands.features.debug.messages.machine_name'), - $this->trans('commands.features.debug.messages.status'), - $this->trans('commands.features.debug.messages.state'), - ]; + $tableHeader = [ + $this->trans('commands.features.debug.messages.bundle'), + $this->trans('commands.features.debug.messages.name'), + $this->trans('commands.features.debug.messages.machine_name'), + $this->trans('commands.features.debug.messages.status'), + $this->trans('commands.features.debug.messages.state'), + ]; - $tableRows = []; + $tableRows = []; - $features = $this->getFeatureList($bundle); + $features = $this->getFeatureList($io, $bundle); - foreach ($features as $feature) { - $tableRows[] = [$feature['bundle_name'],$feature['name'], $feature['machine_name'], $feature['status'],$feature['state']]; - } + foreach ($features as $feature) { + $tableRows[] = [$feature['bundle_name'],$feature['name'], $feature['machine_name'], $feature['status'],$feature['state']]; + } - $io->table($tableHeader, $tableRows, 'compact'); + $io->table($tableHeader, $tableRows, 'compact'); } - - - } +} diff --git a/src/Command/Features/ImportCommand.php b/src/Command/Features/ImportCommand.php index 9bf508ece..9823ac774 100644 --- a/src/Command/Features/ImportCommand.php +++ b/src/Command/Features/ImportCommand.php @@ -1,73 +1,68 @@ setName('features:import') - ->setDescription($this->trans('commands.features.import.description')) - ->addOption( - 'bundle', - '', - InputOption::VALUE_OPTIONAL, - $this->trans('commands.features.import.options.packages') - ) - ->addArgument('packages',InputArgument::IS_ARRAY,$this->trans('commands.features.import.arguments.packages')); - - + $this + ->setName('features:import') + ->setDescription($this->trans('commands.features.import.description')) + ->addOption( + 'bundle', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.features.import.options.packages') + ) + ->addArgument('packages', InputArgument::IS_ARRAY, $this->trans('commands.features.import.arguments.packages')); } protected function execute(InputInterface $input, OutputInterface $output) { - $io = new DrupalStyle($input, $output); + $io = new DrupalStyle($input, $output); - $packages = $input->getArgument('packages'); - $bundle = $input->getOption('bundle'); - - if ($bundle) { - $packages = $this->getPackagesByBundle($bundle); - } + $packages = $input->getArgument('packages'); + $bundle = $input->getOption('bundle'); - $this->getAssigner($bundle); - $this->importFeature($io,$packages); + if ($bundle) { + $packages = $this->getPackagesByBundle($bundle); + } + $this->getAssigner($bundle); + $this->importFeature($io, $packages); } + /** * {@inheritdoc} */ @@ -83,6 +78,5 @@ protected function interact(InputInterface $input, OutputInterface $output) $bundle = $this->packageQuestion($io); $input->setArgument('packages', $bundle); } - } - - } + } +} diff --git a/src/Command/Generate/AuthenticationProviderCommand.php b/src/Command/Generate/AuthenticationProviderCommand.php index 5888eadd2..f1ab59005 100644 --- a/src/Command/Generate/AuthenticationProviderCommand.php +++ b/src/Command/Generate/AuthenticationProviderCommand.php @@ -29,10 +29,14 @@ class AuthenticationProviderCommand extends Command use ConfirmationTrait; use CommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var AuthenticationProviderGenerator */ + /** + * @var AuthenticationProviderGenerator +*/ protected $generator; /** diff --git a/src/Command/Generate/BreakPointCommand.php b/src/Command/Generate/BreakPointCommand.php index 3720c0b4b..12785c393 100644 --- a/src/Command/Generate/BreakPointCommand.php +++ b/src/Command/Generate/BreakPointCommand.php @@ -52,7 +52,9 @@ class BreakPointCommand extends Command protected $themeHandler; - /** @var Validator */ + /** + * @var Validator +*/ protected $validator; /** @@ -74,7 +76,7 @@ public function __construct( ThemeHandler $themeHandler, Validator $validator, StringConverter $stringConverter - ) { + ) { $this->generator = $generator; $this->appRoot = $appRoot; $this->themeHandler = $themeHandler; diff --git a/src/Command/Generate/CommandCommand.php b/src/Command/Generate/CommandCommand.php index 860bb7f90..8efb20733 100644 --- a/src/Command/Generate/CommandCommand.php +++ b/src/Command/Generate/CommandCommand.php @@ -106,8 +106,7 @@ protected function configure() '', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.common.options.services') - ) - ; + ); } /** diff --git a/src/Command/Generate/ControllerCommand.php b/src/Command/Generate/ControllerCommand.php index b3d4aafb2..53c6ba201 100644 --- a/src/Command/Generate/ControllerCommand.php +++ b/src/Command/Generate/ControllerCommand.php @@ -32,10 +32,14 @@ class ControllerCommand extends Command use InputTrait; use ContainerAwareCommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var ControllerGenerator */ + /** + * @var ControllerGenerator +*/ protected $generator; /** @@ -43,10 +47,14 @@ class ControllerCommand extends Command */ protected $stringConverter; - /** @var Validator */ + /** + * @var Validator +*/ protected $validator; - /** @var RouteProviderInterface */ + /** + * @var RouteProviderInterface +*/ protected $routeProvider; /** diff --git a/src/Command/Generate/EntityBundleCommand.php b/src/Command/Generate/EntityBundleCommand.php index 6f04b979c..a39f5a4be 100644 --- a/src/Command/Generate/EntityBundleCommand.php +++ b/src/Command/Generate/EntityBundleCommand.php @@ -34,10 +34,14 @@ class EntityBundleCommand extends Command */ protected $validator; - /** @var EntityBundleGenerator */ + /** + * @var EntityBundleGenerator +*/ protected $generator; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** diff --git a/src/Command/Generate/FormAlterCommand.php b/src/Command/Generate/FormAlterCommand.php index 9699e2108..ea248c863 100644 --- a/src/Command/Generate/FormAlterCommand.php +++ b/src/Command/Generate/FormAlterCommand.php @@ -37,10 +37,14 @@ class FormAlterCommand extends Command use ConfirmationTrait; use CommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var FormAlterGenerator */ + /** + * @var FormAlterGenerator +*/ protected $generator; /** @@ -58,10 +62,14 @@ class FormAlterCommand extends Command */ protected $elementInfoManager; - /** @var Validator */ + /** + * @var Validator +*/ protected $validator; - /** @var RouteProviderInterface */ + /** + * @var RouteProviderInterface +*/ protected $routeProvider; /** @@ -309,5 +317,4 @@ public function getWebprofilerForms() } return $forms; } - } diff --git a/src/Command/Generate/FormCommand.php b/src/Command/Generate/FormCommand.php index ae570471b..a464211ca 100644 --- a/src/Command/Generate/FormCommand.php +++ b/src/Command/Generate/FormCommand.php @@ -35,13 +35,19 @@ abstract class FormCommand extends Command private $formType; private $commandName; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var FormGenerator */ + /** + * @var FormGenerator +*/ protected $generator; - /** @var ChainQueue */ + /** + * @var ChainQueue +*/ protected $chainQueue; /** diff --git a/src/Command/Generate/HelpCommand.php b/src/Command/Generate/HelpCommand.php index ad3616164..c71e21b3e 100644 --- a/src/Command/Generate/HelpCommand.php +++ b/src/Command/Generate/HelpCommand.php @@ -20,14 +20,15 @@ use Drupal\Console\Utils\Site; use Drupal\Console\Utils\ChainQueue; - class HelpCommand extends Command { use CommandTrait; use ModuleTrait; use ConfirmationTrait; - /** @var HelpGenerator */ + /** + * @var HelpGenerator +*/ protected $generator; /** @@ -35,7 +36,9 @@ class HelpCommand extends Command */ protected $site; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** diff --git a/src/Command/Generate/ModuleCommand.php b/src/Command/Generate/ModuleCommand.php index 826e1986c..76605644a 100644 --- a/src/Command/Generate/ModuleCommand.php +++ b/src/Command/Generate/ModuleCommand.php @@ -28,10 +28,14 @@ class ModuleCommand extends Command use ConfirmationTrait; use CommandTrait; - /** @var ModuleGenerator */ + /** + * @var ModuleGenerator +*/ protected $generator; - /** @var Validator */ + /** + * @var Validator +*/ protected $validator; /** @@ -74,7 +78,7 @@ class ModuleCommand extends Command * @param DrupalApi $drupalApi * @param Client $httpClient * @param Site $site - * @param $twigtemplate + * @param $twigtemplate */ public function __construct( ModuleGenerator $generator, @@ -167,16 +171,16 @@ protected function configure() $this->trans('commands.generate.module.options.dependencies') ) ->addOption( - 'test', - '', - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.module.options.test') + 'test', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.module.options.test') ) ->addOption( - 'twigtemplate', - '', - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.module.options.twigtemplate') + 'twigtemplate', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.module.options.twigtemplate') ); } diff --git a/src/Command/Generate/ModuleFileCommand.php b/src/Command/Generate/ModuleFileCommand.php index dc089a8f2..a0457281d 100644 --- a/src/Command/Generate/ModuleFileCommand.php +++ b/src/Command/Generate/ModuleFileCommand.php @@ -18,7 +18,6 @@ use Drupal\Console\Extension\Manager; use Drupal\Console\Style\DrupalStyle; - /** * Class ModuleFileCommand * @package Drupal\Console\Command\Generate @@ -29,10 +28,14 @@ class ModuleFileCommand extends Command use ConfirmationTrait; use ModuleTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var ModuleFileGenerator */ + /** + * @var ModuleFileGenerator +*/ protected $generator; diff --git a/src/Command/Generate/PluginCKEditorButtonCommand.php b/src/Command/Generate/PluginCKEditorButtonCommand.php index b26f39aa3..cbae078de 100644 --- a/src/Command/Generate/PluginCKEditorButtonCommand.php +++ b/src/Command/Generate/PluginCKEditorButtonCommand.php @@ -33,10 +33,14 @@ class PluginCKEditorButtonCommand extends Command protected $chainQueue; - /** @var PluginCKEditorButtonGenerator */ + /** + * @var PluginCKEditorButtonGenerator +*/ protected $generator; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** diff --git a/src/Command/Generate/PluginConditionCommand.php b/src/Command/Generate/PluginConditionCommand.php index f31e2e677..3aacc0922 100644 --- a/src/Command/Generate/PluginConditionCommand.php +++ b/src/Command/Generate/PluginConditionCommand.php @@ -21,7 +21,6 @@ use Drupal\Console\Utils\ChainQueue; use Drupal\Console\Utils\StringConverter; - /** * Class PluginConditionCommand * @package Drupal\Console\Command\Generate @@ -32,10 +31,14 @@ class PluginConditionCommand extends Command use ModuleTrait; use ConfirmationTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var PluginConditionGenerator */ + /** + * @var PluginConditionGenerator +*/ protected $generator; /** @@ -51,11 +54,11 @@ class PluginConditionCommand extends Command /** * PluginConditionCommand constructor. - * @param Manager $extensionManager - * @param PluginConditionGenerator $generator - * @param ChainQueue $chainQueue - * @param EntityTypeRepository $entitytyperepository - * @param StringConverter $stringConverter + * @param Manager $extensionManager + * @param PluginConditionGenerator $generator + * @param ChainQueue $chainQueue + * @param EntityTypeRepository $entitytyperepository + * @param StringConverter $stringConverter */ public function __construct( Manager $extensionManager, diff --git a/src/Command/Generate/PluginFieldCommand.php b/src/Command/Generate/PluginFieldCommand.php index 468bc39b1..e49ef37fd 100644 --- a/src/Command/Generate/PluginFieldCommand.php +++ b/src/Command/Generate/PluginFieldCommand.php @@ -25,7 +25,9 @@ class PluginFieldCommand extends Command use ConfirmationTrait; use CommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** diff --git a/src/Command/Generate/PluginFieldFormatterCommand.php b/src/Command/Generate/PluginFieldFormatterCommand.php index 3af94bee8..0e4d45485 100644 --- a/src/Command/Generate/PluginFieldFormatterCommand.php +++ b/src/Command/Generate/PluginFieldFormatterCommand.php @@ -31,10 +31,14 @@ class PluginFieldFormatterCommand extends Command use ConfirmationTrait; use CommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var PluginFieldFormatterGenerator */ + /** + * @var PluginFieldFormatterGenerator +*/ protected $generator; /** @@ -42,7 +46,9 @@ class PluginFieldFormatterCommand extends Command */ protected $stringConverter; - /** @var FieldTypePluginManager */ + /** + * @var FieldTypePluginManager +*/ protected $fieldTypePluginManager; /** @@ -53,11 +59,11 @@ class PluginFieldFormatterCommand extends Command /** * PluginImageFormatterCommand constructor. - * @param Manager $extensionManager + * @param Manager $extensionManager * @param PluginFieldFormatterGenerator $generator - * @param StringConverter $stringConverter - * @param FieldTypePluginManager $fieldTypePluginManager - * @param ChainQueue $chainQueue + * @param StringConverter $stringConverter + * @param FieldTypePluginManager $fieldTypePluginManager + * @param ChainQueue $chainQueue */ public function __construct( Manager $extensionManager, diff --git a/src/Command/Generate/PluginFieldTypeCommand.php b/src/Command/Generate/PluginFieldTypeCommand.php index fb41ca55a..c9e99d15d 100644 --- a/src/Command/Generate/PluginFieldTypeCommand.php +++ b/src/Command/Generate/PluginFieldTypeCommand.php @@ -31,10 +31,14 @@ class PluginFieldTypeCommand extends Command use ConfirmationTrait; use CommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var PluginFieldTypeGenerator */ + /** + * @var PluginFieldTypeGenerator +*/ protected $generator; /** diff --git a/src/Command/Generate/PluginFieldWidgetCommand.php b/src/Command/Generate/PluginFieldWidgetCommand.php index f43cda77f..fcdc4a20d 100644 --- a/src/Command/Generate/PluginFieldWidgetCommand.php +++ b/src/Command/Generate/PluginFieldWidgetCommand.php @@ -31,10 +31,14 @@ class PluginFieldWidgetCommand extends Command use ConfirmationTrait; use CommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var PluginFieldWidgetGenerator */ + /** + * @var PluginFieldWidgetGenerator +*/ protected $generator; /** @@ -42,10 +46,14 @@ class PluginFieldWidgetCommand extends Command */ protected $stringConverter; - /** @var Validator */ + /** + * @var Validator +*/ protected $validator; - /** @var FieldTypePluginManager */ + /** + * @var FieldTypePluginManager +*/ protected $fieldTypePluginManager; /** diff --git a/src/Command/Generate/PluginImageEffectCommand.php b/src/Command/Generate/PluginImageEffectCommand.php index 6d4309dcd..c2fed7e30 100644 --- a/src/Command/Generate/PluginImageEffectCommand.php +++ b/src/Command/Generate/PluginImageEffectCommand.php @@ -30,10 +30,14 @@ class PluginImageEffectCommand extends Command use ConfirmationTrait; use CommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var PluginImageEffectGenerator */ + /** + * @var PluginImageEffectGenerator +*/ protected $generator; /** diff --git a/src/Command/Generate/PluginImageFormatterCommand.php b/src/Command/Generate/PluginImageFormatterCommand.php index 1d56abbc5..8a30100d1 100644 --- a/src/Command/Generate/PluginImageFormatterCommand.php +++ b/src/Command/Generate/PluginImageFormatterCommand.php @@ -27,10 +27,14 @@ class PluginImageFormatterCommand extends Command use ConfirmationTrait; use CommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var PluginImageFormatterGenerator */ + /** + * @var PluginImageFormatterGenerator +*/ protected $generator; /** @@ -38,7 +42,9 @@ class PluginImageFormatterCommand extends Command */ protected $stringConverter; - /** @var Validator */ + /** + * @var Validator +*/ protected $validator; /** @@ -49,11 +55,11 @@ class PluginImageFormatterCommand extends Command /** * PluginImageFormatterCommand constructor. - * @param Manager $extensionManager + * @param Manager $extensionManager * @param PluginImageFormatterGenerator $generator - * @param StringConverter $stringConverter - * @param Validator $validator - * @param ChainQueue $chainQueue + * @param StringConverter $stringConverter + * @param Validator $validator + * @param ChainQueue $chainQueue */ public function __construct( Manager $extensionManager, diff --git a/src/Command/Generate/PluginMailCommand.php b/src/Command/Generate/PluginMailCommand.php index 0eb67aa8d..254b50894 100644 --- a/src/Command/Generate/PluginMailCommand.php +++ b/src/Command/Generate/PluginMailCommand.php @@ -35,10 +35,14 @@ class PluginMailCommand extends Command use ConfirmationTrait; use ContainerAwareCommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var PluginMailGenerator */ + /** + * @var PluginMailGenerator +*/ protected $generator; /** @@ -46,7 +50,9 @@ class PluginMailCommand extends Command */ protected $stringConverter; - /** @var Validator */ + /** + * @var Validator +*/ protected $validator; /** diff --git a/src/Command/Generate/PluginRestResourceCommand.php b/src/Command/Generate/PluginRestResourceCommand.php index 83327c3fa..bee7d0205 100644 --- a/src/Command/Generate/PluginRestResourceCommand.php +++ b/src/Command/Generate/PluginRestResourceCommand.php @@ -34,10 +34,14 @@ class PluginRestResourceCommand extends Command use ConfirmationTrait; use CommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var PluginRestResourceGenerator */ + /** + * @var PluginRestResourceGenerator +*/ protected $generator; /** diff --git a/src/Command/Generate/PluginRulesActionCommand.php b/src/Command/Generate/PluginRulesActionCommand.php index c7ceb0ecc..76f596795 100644 --- a/src/Command/Generate/PluginRulesActionCommand.php +++ b/src/Command/Generate/PluginRulesActionCommand.php @@ -34,10 +34,14 @@ class PluginRulesActionCommand extends Command use ConfirmationTrait; use CommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var PluginRulesActionGenerator */ + /** + * @var PluginRulesActionGenerator +*/ protected $generator; /** @@ -53,10 +57,10 @@ class PluginRulesActionCommand extends Command /** * PluginRulesActionCommand constructor. - * @param Manager $extensionManager - * @param PluginRulesActionGenerator $generator - * @param StringConverter $stringConverter - * @param ChainQueue $chainQueue + * @param Manager $extensionManager + * @param PluginRulesActionGenerator $generator + * @param StringConverter $stringConverter + * @param ChainQueue $chainQueue */ public function __construct( Manager $extensionManager, diff --git a/src/Command/Generate/PluginSkeletonCommand.php b/src/Command/Generate/PluginSkeletonCommand.php index b8a49a8b1..56367ffe7 100644 --- a/src/Command/Generate/PluginSkeletonCommand.php +++ b/src/Command/Generate/PluginSkeletonCommand.php @@ -33,10 +33,14 @@ class PluginSkeletonCommand extends Command use ServicesTrait; use ContainerAwareCommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var PluginSkeletonGenerator */ + /** + * @var PluginSkeletonGenerator +*/ protected $generator; /** @@ -44,7 +48,9 @@ class PluginSkeletonCommand extends Command */ protected $stringConverter; - /** @var Validator */ + /** + * @var Validator +*/ protected $validator; /** diff --git a/src/Command/Generate/PluginTypeAnnotationCommand.php b/src/Command/Generate/PluginTypeAnnotationCommand.php index 1dabc927f..a84d5a5b7 100644 --- a/src/Command/Generate/PluginTypeAnnotationCommand.php +++ b/src/Command/Generate/PluginTypeAnnotationCommand.php @@ -21,7 +21,6 @@ use Drupal\Console\Extension\Manager; use Drupal\Console\Utils\StringConverter; - /** * Class PluginTypeAnnotationCommand * @package Drupal\Console\Command\Generate @@ -34,10 +33,14 @@ class PluginTypeAnnotationCommand extends Command use ConfirmationTrait; use CommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var PluginTypeAnnotationGenerator */ + /** + * @var PluginTypeAnnotationGenerator +*/ protected $generator; /** diff --git a/src/Command/Generate/PluginTypeYamlCommand.php b/src/Command/Generate/PluginTypeYamlCommand.php index 0f366c314..686c91a53 100644 --- a/src/Command/Generate/PluginTypeYamlCommand.php +++ b/src/Command/Generate/PluginTypeYamlCommand.php @@ -34,10 +34,14 @@ class PluginTypeYamlCommand extends Command use ConfirmationTrait; use CommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var PluginTypeYamlGenerator */ + /** + * @var PluginTypeYamlGenerator +*/ protected $generator; /** diff --git a/src/Command/Generate/PluginViewsFieldCommand.php b/src/Command/Generate/PluginViewsFieldCommand.php index d973725ee..44e879581 100644 --- a/src/Command/Generate/PluginViewsFieldCommand.php +++ b/src/Command/Generate/PluginViewsFieldCommand.php @@ -32,10 +32,14 @@ class PluginViewsFieldCommand extends Command use CommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var PluginViewsFieldGenerator */ + /** + * @var PluginViewsFieldGenerator +*/ protected $generator; /** diff --git a/src/Command/Generate/PostUpdateCommand.php b/src/Command/Generate/PostUpdateCommand.php index 853a61f73..ec5f582e0 100644 --- a/src/Command/Generate/PostUpdateCommand.php +++ b/src/Command/Generate/PostUpdateCommand.php @@ -31,10 +31,14 @@ class PostUpdateCommand extends Command use ConfirmationTrait; use CommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var PostUpdateGenerator */ + /** + * @var PostUpdateGenerator +*/ protected $generator; /** @@ -42,7 +46,9 @@ class PostUpdateCommand extends Command */ protected $site; - /** @var Validator */ + /** + * @var Validator +*/ protected $validator; /** diff --git a/src/Command/Generate/ProfileCommand.php b/src/Command/Generate/ProfileCommand.php index 4df53d6b9..0abd64674 100644 --- a/src/Command/Generate/ProfileCommand.php +++ b/src/Command/Generate/ProfileCommand.php @@ -21,7 +21,6 @@ use Drupal\Console\Utils\Site; use GuzzleHttp\Client; - /** * Class ProfileCommand * @package Drupal\Console\Command\Generate @@ -32,10 +31,14 @@ class ProfileCommand extends Command use ConfirmationTrait; use CommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var ProfileGenerator */ + /** + * @var ProfileGenerator +*/ protected $generator; /** @@ -43,7 +46,9 @@ class ProfileCommand extends Command */ protected $stringConverter; - /** @var Validator */ + /** + * @var Validator +*/ protected $validator; /** diff --git a/src/Command/Generate/RouteSubscriberCommand.php b/src/Command/Generate/RouteSubscriberCommand.php index d3cabdcd3..f58a7c780 100644 --- a/src/Command/Generate/RouteSubscriberCommand.php +++ b/src/Command/Generate/RouteSubscriberCommand.php @@ -19,7 +19,6 @@ use Drupal\Console\Utils\ChainQueue; use Drupal\Console\Command\Shared\CommandTrait; - /** * Class RouteSubscriberCommand * @package Drupal\Console\Command\Generate @@ -30,10 +29,14 @@ class RouteSubscriberCommand extends Command use ConfirmationTrait; use CommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var RouteSubscriberGenerator */ + /** + * @var RouteSubscriberGenerator +*/ protected $generator; /** diff --git a/src/Command/Generate/ServiceCommand.php b/src/Command/Generate/ServiceCommand.php index 0c331dfdb..b31c7e2bb 100644 --- a/src/Command/Generate/ServiceCommand.php +++ b/src/Command/Generate/ServiceCommand.php @@ -32,10 +32,14 @@ class ServiceCommand extends Command use ConfirmationTrait; use ContainerAwareCommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var ServiceGenerator */ + /** + * @var ServiceGenerator +*/ protected $generator; /** @@ -50,10 +54,10 @@ class ServiceCommand extends Command /** * ServiceCommand constructor. - * @param Manager $extensionManager - * @param ServiceGenerator $generator - * @param StringConverter $stringConverter - * @param ChainQueue $chainQueue + * @param Manager $extensionManager + * @param ServiceGenerator $generator + * @param StringConverter $stringConverter + * @param ChainQueue $chainQueue */ public function __construct( Manager $extensionManager, diff --git a/src/Command/Generate/ThemeCommand.php b/src/Command/Generate/ThemeCommand.php index c77cb1677..b05b55c08 100644 --- a/src/Command/Generate/ThemeCommand.php +++ b/src/Command/Generate/ThemeCommand.php @@ -34,13 +34,19 @@ class ThemeCommand extends Command use ThemeBreakpointTrait; use CommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var ThemeGenerator */ + /** + * @var ThemeGenerator +*/ protected $generator; - /** @var Validator */ + /** + * @var Validator +*/ protected $validator; /** diff --git a/src/Command/Generate/TwigExtensionCommand.php b/src/Command/Generate/TwigExtensionCommand.php index b2e397d87..ed9529247 100644 --- a/src/Command/Generate/TwigExtensionCommand.php +++ b/src/Command/Generate/TwigExtensionCommand.php @@ -32,10 +32,14 @@ class TwigExtensionCommand extends Command use ConfirmationTrait; use ContainerAwareCommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var TwigExtensionGenerator */ + /** + * @var TwigExtensionGenerator +*/ protected $generator; /** diff --git a/src/Command/Generate/UpdateCommand.php b/src/Command/Generate/UpdateCommand.php index 0302b89ac..c65f89050 100644 --- a/src/Command/Generate/UpdateCommand.php +++ b/src/Command/Generate/UpdateCommand.php @@ -30,10 +30,14 @@ class UpdateCommand extends Command use ConfirmationTrait; use CommandTrait; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var UpdateGenerator */ + /** + * @var UpdateGenerator +*/ protected $generator; /** diff --git a/src/Command/Libraries/DebugCommand.php b/src/Command/Libraries/DebugCommand.php index 5b734e27a..8989b799c 100644 --- a/src/Command/Libraries/DebugCommand.php +++ b/src/Command/Libraries/DebugCommand.php @@ -22,16 +22,24 @@ class DebugCommand extends Command { use CommandTrait; - /** @var ModuleHandlerInterface */ + /** + * @var ModuleHandlerInterface +*/ protected $moduleHandler; - /** @var ThemeHandlerInterface; */ + /** + * @var ThemeHandlerInterface; +*/ protected $themeHandler; - /** @var LibraryDiscoveryInterface */ + /** + * @var LibraryDiscoveryInterface +*/ protected $libraryDiscovery; - /** @var string */ + /** + * @var string +*/ protected $appRoot; /** diff --git a/src/Command/Locale/LanguageDeleteCommand.php b/src/Command/Locale/LanguageDeleteCommand.php index 91a988a11..9cf290c4b 100644 --- a/src/Command/Locale/LanguageDeleteCommand.php +++ b/src/Command/Locale/LanguageDeleteCommand.php @@ -47,9 +47,9 @@ class LanguageDeleteCommand extends Command /** * LoginUrlCommand constructor. - * @param Site $site - * @param EntityTypeManagerInterface $entityTypeManager - * @param ModuleHandlerInterface $moduleHandler + * @param Site $site + * @param EntityTypeManagerInterface $entityTypeManager + * @param ModuleHandlerInterface $moduleHandler */ public function __construct( Site $site, diff --git a/src/Command/Migrate/ExecuteCommand.php b/src/Command/Migrate/ExecuteCommand.php index 4d327220c..b68586a08 100644 --- a/src/Command/Migrate/ExecuteCommand.php +++ b/src/Command/Migrate/ExecuteCommand.php @@ -119,7 +119,8 @@ protected function configure() '', InputOption::VALUE_OPTIONAL, $this->trans('commands.migrate.execute.options.source-base_path') - );; + ); + ; } /** diff --git a/src/Command/Module/DebugCommand.php b/src/Command/Module/DebugCommand.php index 6bed2f05c..59372172c 100644 --- a/src/Command/Module/DebugCommand.php +++ b/src/Command/Module/DebugCommand.php @@ -42,7 +42,7 @@ class DebugCommand extends Command /** * ChainDebugCommand constructor. * @param ConfigurationManager $configurationManager - * @param Site $site + * @param Site $site */ public function __construct( ConfigurationManager $configurationManager, diff --git a/src/Command/Module/DownloadCommand.php b/src/Command/Module/DownloadCommand.php index f214a0219..450db99fe 100644 --- a/src/Command/Module/DownloadCommand.php +++ b/src/Command/Module/DownloadCommand.php @@ -28,10 +28,14 @@ class DownloadCommand extends Command use CommandTrait; use ProjectDownloadTrait; - /** @var DrupalApi */ + /** + * @var DrupalApi +*/ protected $drupalApi; - /** @var Client */ + /** + * @var Client +*/ protected $httpClient; /** @@ -39,16 +43,24 @@ class DownloadCommand extends Command */ protected $appRoot; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; - /** @var Validator */ + /** + * @var Validator +*/ protected $validator; - /** @var ConfigurationManager */ + /** + * @var ConfigurationManager +*/ protected $configurationManager; - /** @var ShellProcess */ + /** + * @var ShellProcess +*/ protected $shellProcess; /** @@ -58,14 +70,14 @@ class DownloadCommand extends Command /** * DownloadCommand constructor. - * @param DrupalApi $drupalApi - * @param Client $httpClient + * @param DrupalApi $drupalApi + * @param Client $httpClient * @param $appRoot - * @param Manager $extensionManager - * @param Validator $validator - * @param Site $site + * @param Manager $extensionManager + * @param Validator $validator + * @param Site $site * @param ConfigurationManager $configurationManager - * @param ShellProcess $shellProcess + * @param ShellProcess $shellProcess * @param $root */ public function __construct( @@ -186,10 +198,11 @@ protected function execute(InputInterface $input, OutputInterface $output) } else { $version = $io->choice( sprintf( - $this->trans( - 'commands.site.new.questions.composer-release'), - $module - ), + $this->trans( + 'commands.site.new.questions.composer-release' + ), + $module + ), $versions ); } diff --git a/src/Command/Module/InstallCommand.php b/src/Command/Module/InstallCommand.php index b625221a5..039c3ecb6 100644 --- a/src/Command/Module/InstallCommand.php +++ b/src/Command/Module/InstallCommand.php @@ -40,16 +40,24 @@ class InstallCommand extends Command */ protected $site; - /** @var Validator */ + /** + * @var Validator +*/ protected $validator; - /** @var ModuleInstaller */ + /** + * @var ModuleInstaller +*/ protected $moduleInstaller; - /** @var DrupalApi */ + /** + * @var DrupalApi +*/ protected $drupalApi; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** @@ -64,13 +72,13 @@ class InstallCommand extends Command /** * InstallCommand constructor. - * @param Site $site - * @param Validator $validator + * @param Site $site + * @param Validator $validator * @param ModuleInstaller $moduleInstaller - * @param DrupalApi $drupalApi - * @param Manager $extensionManager + * @param DrupalApi $drupalApi + * @param Manager $extensionManager * @param $appRoot - * @param ChainQueue $chainQueue + * @param ChainQueue $chainQueue */ public function __construct( Site $site, @@ -157,12 +165,12 @@ protected function execute(InputInterface $input, OutputInterface $output) $processBuilder = new ProcessBuilder([]); $processBuilder->setWorkingDirectory($this->appRoot); - $processBuilder->setArguments(explode(" ", $command)); - $process = $processBuilder->getProcess(); - $process->setTty('true'); - $process->run(); + $processBuilder->setArguments(explode(" ", $command)); + $process = $processBuilder->getProcess(); + $process->setTty('true'); + $process->run(); - if ($process->isSuccessful()) { + if ($process->isSuccessful()) { $io->info( sprintf( 'Module %s was downloaded with Composer.', diff --git a/src/Command/Module/InstallDependencyCommand.php b/src/Command/Module/InstallDependencyCommand.php index e5e38fb7d..4bc60f4b0 100644 --- a/src/Command/Module/InstallDependencyCommand.php +++ b/src/Command/Module/InstallDependencyCommand.php @@ -36,10 +36,14 @@ class InstallDependencyCommand extends Command */ protected $site; - /** @var Validator */ + /** + * @var Validator +*/ protected $validator; - /** @var ModuleInstaller */ + /** + * @var ModuleInstaller +*/ protected $moduleInstaller; /** @@ -49,8 +53,8 @@ class InstallDependencyCommand extends Command /** * InstallCommand constructor. - * @param Site $site - * @param Validator $validator + * @param Site $site + * @param Validator $validator * @param ChainQueue $chainQueue */ public function __construct( diff --git a/src/Command/Module/UninstallCommand.php b/src/Command/Module/UninstallCommand.php index 030043ec8..ac42d2cfa 100755 --- a/src/Command/Module/UninstallCommand.php +++ b/src/Command/Module/UninstallCommand.php @@ -31,7 +31,9 @@ class UninstallCommand extends Command */ protected $site; - /** @var ModuleInstaller */ + /** + * @var ModuleInstaller +*/ protected $moduleInstaller; /** @@ -39,15 +41,17 @@ class UninstallCommand extends Command */ protected $chainQueue; - /** @var ConfigFactory */ + /** + * @var ConfigFactory +*/ protected $configFactory; /** * InstallCommand constructor. - * @param Site $site - * @param Validator $validator - * @param ChainQueue $chainQueue + * @param Site $site + * @param Validator $validator + * @param ChainQueue $chainQueue * @param ConfigFactory $configFactory */ public function __construct( @@ -55,7 +59,6 @@ public function __construct( ModuleInstaller $moduleInstaller, ChainQueue $chainQueue, ConfigFactory $configFactory - ) { $this->site = $site; $this->moduleInstaller = $moduleInstaller; @@ -199,7 +202,6 @@ protected function execute(InputInterface $input, OutputInterface $output) false ) ); - } catch (\Exception $e) { $io->error($e->getMessage()); diff --git a/src/Command/Module/UpdateCommand.php b/src/Command/Module/UpdateCommand.php index e3f034dc1..586e1ea7d 100644 --- a/src/Command/Module/UpdateCommand.php +++ b/src/Command/Module/UpdateCommand.php @@ -23,7 +23,9 @@ class UpdateCommand extends Command use ProjectDownloadTrait; - /** @var ShellProcess */ + /** + * @var ShellProcess +*/ protected $shellProcess; /** diff --git a/src/Command/Multisite/DebugCommand.php b/src/Command/Multisite/DebugCommand.php index a096b7c4d..aafac4269 100644 --- a/src/Command/Multisite/DebugCommand.php +++ b/src/Command/Multisite/DebugCommand.php @@ -27,7 +27,8 @@ class DebugCommand extends Command * DebugCommand constructor. * @param $appRoot */ - public function __construct($appRoot) { + public function __construct($appRoot) + { $this->appRoot = $appRoot; parent::__construct(); } diff --git a/src/Command/Multisite/NewCommand.php b/src/Command/Multisite/NewCommand.php index 1147f400c..374bd61e1 100644 --- a/src/Command/Multisite/NewCommand.php +++ b/src/Command/Multisite/NewCommand.php @@ -31,7 +31,8 @@ class NewCommand extends Command * DebugCommand constructor. * @param $appRoot */ - public function __construct($appRoot) { + public function __construct($appRoot) + { $this->appRoot = $appRoot; parent::__construct(); } diff --git a/src/Command/Node/AccessRebuildCommand.php b/src/Command/Node/AccessRebuildCommand.php index 3b71eef82..8d8e6c130 100644 --- a/src/Command/Node/AccessRebuildCommand.php +++ b/src/Command/Node/AccessRebuildCommand.php @@ -32,7 +32,8 @@ class AccessRebuildCommand extends Command * AccessRebuildCommand constructor. * @param StateInterface $state */ - public function __construct(StateInterface $state) { + public function __construct(StateInterface $state) + { $this->state = $state; parent::__construct(); } diff --git a/src/Command/PermissionDebugCommand.php b/src/Command/PermissionDebugCommand.php index 4ab2f3216..6afa4c8b0 100644 --- a/src/Command/PermissionDebugCommand.php +++ b/src/Command/PermissionDebugCommand.php @@ -65,32 +65,31 @@ protected function execute(InputInterface $input, OutputInterface $output) $io->table($tableHeader, array_values($tableRows)); return true; - } - else { + } else { $tableHeader = [ $this->trans('commands.permission.debug.table-headers.permission-name'), $this->trans('commands.permission.debug.table-headers.permission-label') ]; $tableRows = []; - $permissions = \Drupal::service('user.permissions')->getPermissions(); - $roles = user_roles(); - if (empty($roles[$role])) { - $message = sprintf($this->trans('commands.permission.debug.messages.role-error'), $role); - $io->error($message); - return true; - } - $user_permission = $roles[$role]->getPermissions(); - foreach ($permissions as $permission_name => $permission) { - if (in_array($permission_name, $user_permission)) { - $tableRows[$permission_name] = [ + $permissions = \Drupal::service('user.permissions')->getPermissions(); + $roles = user_roles(); + if (empty($roles[$role])) { + $message = sprintf($this->trans('commands.permission.debug.messages.role-error'), $role); + $io->error($message); + return true; + } + $user_permission = $roles[$role]->getPermissions(); + foreach ($permissions as $permission_name => $permission) { + if (in_array($permission_name, $user_permission)) { + $tableRows[$permission_name] = [ $permission_name, strip_tags($permission['title']->__toString()) - ]; - } - } - ksort($tableRows); - $io->table($tableHeader, array_values($tableRows)); - return true; + ]; + } + } + ksort($tableRows); + $io->table($tableHeader, array_values($tableRows)); + return true; } } @@ -103,13 +102,14 @@ protected function execute(InputInterface $input, OutputInterface $output) * @return array * User roles filtered by permission else empty array. */ - public function getRolesAssignedByPermission($permission_name) { + public function getRolesAssignedByPermission($permission_name) + { $roles = user_roles(); $roles_found = []; foreach ($roles as $role) { - if ($role->hasPermission($permission_name)) { - $roles_found[] = $role->getOriginalId(); - } + if ($role->hasPermission($permission_name)) { + $roles_found[] = $role->getOriginalId(); + } } return $roles_found; } diff --git a/src/Command/Queue/DebugCommand.php b/src/Command/Queue/DebugCommand.php index e30269254..fd2d050c2 100644 --- a/src/Command/Queue/DebugCommand.php +++ b/src/Command/Queue/DebugCommand.php @@ -31,7 +31,8 @@ class DebugCommand extends Command * DebugCommand constructor. * @param QueueWorkerManagerInterface $queueWorker */ - public function __construct( QueueWorkerManagerInterface $queueWorker) { + public function __construct(QueueWorkerManagerInterface $queueWorker) + { $this->queueWorker = $queueWorker; parent::__construct(); } diff --git a/src/Command/Queue/RunCommand.php b/src/Command/Queue/RunCommand.php index cc0052e8c..3185e4a70 100644 --- a/src/Command/Queue/RunCommand.php +++ b/src/Command/Queue/RunCommand.php @@ -37,8 +37,8 @@ class RunCommand extends Command /** * DebugCommand constructor. - * @param QueueWorkerManagerInterface $queueWorker - * @param QueueFactory $queue + * @param QueueWorkerManagerInterface $queueWorker + * @param QueueFactory $queue */ public function __construct( QueueWorkerManagerInterface $queueWorker, diff --git a/src/Command/Rest/DisableCommand.php b/src/Command/Rest/DisableCommand.php index d437491f5..bca821d26 100644 --- a/src/Command/Rest/DisableCommand.php +++ b/src/Command/Rest/DisableCommand.php @@ -125,8 +125,8 @@ protected function execute(InputInterface $input, OutputInterface $output) * @return string * The resource key in the form. */ - protected function getResourceKey($resource_id) { + protected function getResourceKey($resource_id) + { return str_replace(':', '.', $resource_id); } - } diff --git a/src/Command/Rest/EnableCommand.php b/src/Command/Rest/EnableCommand.php index 91ecad1fb..814a075c8 100644 --- a/src/Command/Rest/EnableCommand.php +++ b/src/Command/Rest/EnableCommand.php @@ -63,10 +63,10 @@ class EnableCommand extends Command /** * EnableCommand constructor. - * @param ResourcePluginManager $pluginManagerRest - * @param AuthenticationCollector $authenticationCollector - * @param ConfigFactory $configFactory - * @param array $formats + * @param ResourcePluginManager $pluginManagerRest + * @param AuthenticationCollector $authenticationCollector + * @param ConfigFactory $configFactory + * @param array $formats * The available serialization formats. * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The entity manager. @@ -162,11 +162,13 @@ protected function execute(InputInterface $input, OutputInterface $output) $format_resource_id = str_replace(':', '.', $resource_id); $config = $this->entityManager->getStorage('rest_resource_config')->load($format_resource_id); if (!$config) { - $config = $this->entityManager->getStorage('rest_resource_config')->create([ - 'id' => $format_resource_id, - 'granularity' => RestResourceConfigInterface::METHOD_GRANULARITY, - 'configuration' => [] - ]); + $config = $this->entityManager->getStorage('rest_resource_config')->create( + [ + 'id' => $format_resource_id, + 'granularity' => RestResourceConfigInterface::METHOD_GRANULARITY, + 'configuration' => [] + ] + ); } $configuration = $config->get('configuration') ?: []; $configuration[$method] = [ diff --git a/src/Command/Shared/ExportTrait.php b/src/Command/Shared/ExportTrait.php index 2a3f0aea5..508f8a203 100644 --- a/src/Command/Shared/ExportTrait.php +++ b/src/Command/Shared/ExportTrait.php @@ -32,7 +32,7 @@ protected function getConfiguration($configName, $uuid = false, $hash = false) // Exclude default_config_hash inside _core is site-specific. if ($hash) { - unset($config['_core']['default_config_hash']); + unset($config['_core']['default_config_hash']); } return $config; diff --git a/src/Command/Shared/FeatureTrait.php b/src/Command/Shared/FeatureTrait.php index 8f7f27002..04cdadf90 100644 --- a/src/Command/Shared/FeatureTrait.php +++ b/src/Command/Shared/FeatureTrait.php @@ -7,7 +7,6 @@ namespace Drupal\Console\Command\Shared; - use Drupal\Console\Style\DrupalStyle; use Symfony\Component\Console\Input\ArgvInput; use Drupal\features\FeaturesManagerInterface; @@ -22,220 +21,199 @@ */ trait FeatureTrait { + public function packageQuestion(DrupalStyle $io) + { + $packages = $this->getPackagesByBundle($bundle); + if (empty($packages)) { + throw new \Exception('No packages available'); + } - public function packageQuestion(DrupalStyle $io) - { - - $packages = $this->getPackagesByBundle($bundle); + $package = $io->choiceNoList( + $this->trans('commands.features.import.questions.packages'), + $packages + ); - if (empty($packages)) { - throw new \Exception('No packages available'); + return $package; } - $package = $io->choiceNoList( - $this->trans('commands.features.import.questions.packages'), - $packages - ); - - return $package; - - } - - /** + /** * @param bool $bundle_name * * @return \Drupal\features\FeaturesAssignerInterface */ - protected function getAssigner($bundle_name) { - /** @var \Drupal\features\FeaturesAssignerInterface $assigner */ - $assigner = \Drupal::service('features_assigner'); - if (!empty($bundle_name)) { - $bundle = $assigner->applyBundle($bundle_name); - - if ($bundle->getMachineName() != $bundle_name) { - - } - } - // return configuration for default bundle - else { - $assigner->assignConfigPackages(); + protected function getAssigner($bundle_name) + { + /** + * @var \Drupal\features\FeaturesAssignerInterface $assigner + */ + $assigner = \Drupal::service('features_assigner'); + if (!empty($bundle_name)) { + $bundle = $assigner->applyBundle($bundle_name); + + if ($bundle->getMachineName() != $bundle_name) { + } + } + // return configuration for default bundle + else { + $assigner->assignConfigPackages(); + } + return $assigner; } - return $assigner; - } - + /** + * Get a list of features. + * + * @param bundle + * + * @return features + */ + protected function getFeatureList($bundle) + { + $features = []; + $manager = $this->getFeatureManager(); + $modules = $this->getPackagesByBundle($bundle); + + foreach ($modules as $module_name) { + $feature = $manager->loadPackage($module_name, true); + $overrides = $manager->detectOverrides($feature); + + $state = $feature->getState(); + + if (!empty($overrides) && ($feature->getStatus() != FeaturesManagerInterface::STATUS_NO_EXPORT)) { + $state = FeaturesManagerInterface::STATE_OVERRIDDEN; + } + + if ($feature->getStatus() != FeaturesManagerInterface::STATUS_NO_EXPORT) { + $features[$feature->getMachineName()] = array( + 'name' => $feature->getName(), + 'machine_name' => $feature->getMachineName(), + 'bundle_name' => $feature->getBundle(), + 'status' => $manager->statusLabel($feature->getStatus()), + 'state' => ($state != FeaturesManagerInterface::STATE_DEFAULT) ? $manager->stateLabel($state) : '', + ); + } + } - /** - * Get a list of features. - * - * @param bundle - * - * @return features - */ - protected function getFeatureList($io,$bundle) { - - $features = []; - $manager = $this->getFeatureManager(); - $modules = $this->getPackagesByBundle($bundle); - - foreach ($modules as $module_name) { - $feature = $manager->loadPackage($module_name,TRUE); - $overrides = $manager->detectOverrides($feature); - - $state = $feature->getState(); - - if (!empty($overrides) && ($feature->getStatus() != FeaturesManagerInterface::STATUS_NO_EXPORT)) { - $state = FeaturesManagerInterface::STATE_OVERRIDDEN; - } - - if ($feature->getStatus() != FeaturesManagerInterface::STATUS_NO_EXPORT) { - - $features[$feature->getMachineName()] = array( - 'name' => $feature->getName(), - 'machine_name' => $feature->getMachineName(), - 'bundle_name' => $feature->getBundle(), - 'status' => $manager->statusLabel($feature->getStatus()), - 'state' => ($state != FeaturesManagerInterface::STATE_DEFAULT) - ? $manager->stateLabel($state) - : '', - ); - } - + return $features; } - return $features; - - } - - protected function importFeature($io,$packages) { - - $manager = $this->getFeatureManager(); - - /** @var \Drupal\config_update\ConfigRevertInterface $config_revert */ - $config_revert = \Drupal::service('features.config_update'); - - $config = $manager->getConfigCollection(); - $modules = (is_array($packages)) ? $packages : array($packages); - $overridden = [] ; - foreach ($modules as $module_name) { - - $package = $manager->loadPackage($module_name,TRUE); - - if (empty($package)) { - $io->warning( - sprintf( - $this->trans('commands.features.import.messages.not-available'), - $module_name - ) - ); - continue; - } - - if ($package->getStatus() != FeaturesManagerInterface::STATUS_INSTALLED) { - $io->warning( - sprintf( - $this->trans('commands.features.import.messages.uninstall'), - $module_name - ) - ); - continue; - } - - $overrides = $manager->detectOverrides($package); - $missing = $manager->reorderMissing($manager->detectMissing($package)); - - if (!empty($overrides) || !empty($missing) && ($package->getStatus() == FeaturesManagerInterface::STATUS_INSTALLED)) { - $overridden[] = array_merge($missing,$overrides); - } - } + protected function importFeature($io, $packages) + { + $manager = $this->getFeatureManager(); + + $modules = (is_array($packages)) ? $packages : array($packages); + $overridden = [] ; + foreach ($modules as $module_name) { + $package = $manager->loadPackage($module_name, true); + + if (empty($package)) { + $io->warning( + sprintf( + $this->trans('commands.features.import.messages.not-available'), + $module_name + ) + ); + continue; + } + + if ($package->getStatus() != FeaturesManagerInterface::STATUS_INSTALLED) { + $io->warning( + sprintf( + $this->trans('commands.features.import.messages.uninstall'), + $module_name + ) + ); + continue; + } + + $overrides = $manager->detectOverrides($package); + $missing = $manager->reorderMissing($manager->detectMissing($package)); + + if (!empty($overrides) || !empty($missing) && ($package->getStatus() == FeaturesManagerInterface::STATUS_INSTALLED)) { + $overridden[] = array_merge($missing, $overrides); + } + } - // Process only missing or overriden features - $components = $overridden; + // Process only missing or overriden features + $components = $overridden; - if (empty($components)){ - $io->warning( - sprintf( - $this->trans('commands.features.import.messages.nothing'), - $components - ) - ); + if (empty($components)) { + $io->warning( + sprintf( + $this->trans('commands.features.import.messages.nothing'), + $components + ) + ); - return ; + return ; + } else { + $this->import($io, $components); + } } - else { - $this->import($io,$components); + public function import($io, $components) + { + $manager = $this->getFeatureManager(); + /** + * @var \Drupal\config_update\ConfigRevertInterface $config_revert + */ + $config_revert = \Drupal::service('features.config_update'); + + $config = $manager->getConfigCollection(); + + foreach ($components as $component) { + foreach ($component as $feature) { + if (!isset($config[$feature])) { + + //Import missing component. + $item = $manager->getConfigType($feature); + $type = ConfigurationItem::fromConfigStringToConfigType($item['type']); + $config_revert->import($type, $item['name_short']); + $io->info( + sprintf( + $this->trans('commands.features.import.messages.importing'), + $feature + ) + ); + } else { + + // Revert existing component. + $item = $config[$feature]; + $type = ConfigurationItem::fromConfigStringToConfigType($item->getType()); + $config_revert->revert($type, $item->getShortName()); + $io->info( + sprintf( + $this->trans('commands.features.import.messages.reverting'), + $feature + ) + ); + } + } + } } - } - - public function import($io,$components) { - $manager = $this->getFeatureManager(); - /** @var \Drupal\config_update\ConfigRevertInterface $config_revert */ - $config_revert = \Drupal::service('features.config_update'); - $config = $manager->getConfigCollection(); - foreach ($components as $component) { - foreach ($component as $feature) { - - if (!isset($config[$feature])) { - - //Import missing component. - $item = $manager->getConfigType($feature); - $type = ConfigurationItem::fromConfigStringToConfigType($item['type']); - $config_revert->import($type, $item['name_short']); - $io->info( - sprintf( - $this->trans('commands.features.import.messages.importing'), - $feature - ) - ); + public function getPackagesByBundle($bundle) + { + $manager = $this->getFeatureManager(); + $assigner = $this->getAssigner($bundle); + $current_bundle = $assigner->getBundle(); + // List all packages availables + if ($current_bundle->getMachineName() == 'default') { + $current_bundle = null; } - else { + $packages = array_keys($manager->getFeaturesModules($current_bundle)); - // Revert existing component. - $item = $config[$feature]; - $type = ConfigurationItem::fromConfigStringToConfigType($item->getType()); - $config_revert->revert($type, $item->getShortName()); - $io->info( - sprintf( - $this->trans('commands.features.import.messages.reverting'), - $feature - ) - ); - } - } + return $packages; } - } - - - public function getPackagesByBundle($bundle) { - - $packages = []; - $manager = $this->getFeatureManager(); - $assigner = $this->getAssigner($bundle); - $current_bundle = $assigner->getBundle(); - - // List all packages availables - if ($current_bundle->getMachineName() == 'default') { - $current_bundle = NULL; - + public function getFeatureManager() + { + return \Drupal::service('features.manager'); } - - $packages = array_keys($manager->getFeaturesModules($current_bundle)); - - return $packages; - - } - - public function getFeatureManager(){ - return \Drupal::service('features.manager'); - } - } diff --git a/src/Command/Shared/MigrationTrait.php b/src/Command/Shared/MigrationTrait.php index 82077c27d..94f5499c8 100644 --- a/src/Command/Shared/MigrationTrait.php +++ b/src/Command/Shared/MigrationTrait.php @@ -29,9 +29,11 @@ trait MigrationTrait protected function getMigrations($version_tag = false, $flatList = false, $configuration = []) { //Get migration definitions by tag - $migrations = array_filter($this->pluginManagerMigration->getDefinitions(), function($migration) use ($version_tag) { - return !empty($migration['migration_tags']) && in_array($version_tag, $migration['migration_tags']); - }); + $migrations = array_filter( + $this->pluginManagerMigration->getDefinitions(), function ($migration) use ($version_tag) { + return !empty($migration['migration_tags']) && in_array($version_tag, $migration['migration_tags']); + } + ); // Create an array to configure all migration plugins with same configuration $keys = array_keys($migrations); diff --git a/src/Command/Site/InstallCommand.php b/src/Command/Site/InstallCommand.php index 5907664bd..94423b957 100644 --- a/src/Command/Site/InstallCommand.php +++ b/src/Command/Site/InstallCommand.php @@ -26,7 +26,6 @@ use Drupal\Console\Utils\Site; use DrupalFinder\DrupalFinder; - class InstallCommand extends Command { use ContainerAwareCommandTrait; @@ -374,8 +373,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $io = new DrupalStyle($input, $output); $uri = parse_url($input->getParameterOption(['--uri', '-l']) ?: 'default', PHP_URL_HOST); - if($this->site->multisiteMode($uri)) { - if(!$this->site->validMultisite($uri)) { + if ($this->site->multisiteMode($uri)) { + if (!$this->site->validMultisite($uri)) { $io->error( sprintf($this->trans('commands.site.install.messages.invalid-multisite'), $uri, $uri) ); @@ -433,7 +432,6 @@ protected function execute(InputInterface $input, OutputInterface $output) } try { - $drupalFinder = new DrupalFinder(); $drupalFinder->locateRoot(getcwd()); $composerRoot = $drupalFinder->getComposerRoot(); @@ -445,7 +443,6 @@ protected function execute(InputInterface $input, OutputInterface $output) $drupal = new Drupal($autoload, $composerRoot, $drupalRoot); $container = $drupal->boot(); $this->getApplication()->setContainer($container); - } catch (Exception $e) { $io->error($e->getMessage()); return; @@ -495,8 +492,7 @@ protected function runInstaller( InputInterface $input, $database, $uri - ) - { + ) { $this->site->loadLegacyFile('/core/includes/install.core.inc'); $driver = (string)$database['driver']; diff --git a/src/Command/Site/MaintenanceCommand.php b/src/Command/Site/MaintenanceCommand.php index dfc49617a..e562a0df9 100644 --- a/src/Command/Site/MaintenanceCommand.php +++ b/src/Command/Site/MaintenanceCommand.php @@ -34,8 +34,8 @@ class MaintenanceCommand extends Command /** * DebugCommand constructor. - * @param StateInterface $state - * @param ChainQueue $chainQueue + * @param StateInterface $state + * @param ChainQueue $chainQueue */ public function __construct( StateInterface $state, diff --git a/src/Command/Site/ModeCommand.php b/src/Command/Site/ModeCommand.php index f39b6dd78..b70e42442 100644 --- a/src/Command/Site/ModeCommand.php +++ b/src/Command/Site/ModeCommand.php @@ -21,7 +21,6 @@ use Drupal\Core\Config\ConfigFactory; use Drupal\Console\Utils\ChainQueue; - class ModeCommand extends Command { use ContainerAwareCommandTrait; @@ -222,9 +221,7 @@ protected function overrideConfigurations($configurations, $io) // include settings.local.php in settings.php // -- check first line if it is already this - if ( - $this->maginot->getFirstLine($this->settings_file) - != $line_include_settings + if ($this->maginot->getFirstLine($this->settings_file)!= $line_include_settings ) { chmod($this->settings_file, (int)0775); $this->maginot->setFirstLine( @@ -244,10 +241,7 @@ protected function overrideConfigurations($configurations, $io) if (!$this->local) { // comment local.settings.php in settings.php - if ( - $this->maginot->getFirstLine($this->settings_file) - == - $line_include_settings + if ($this->maginot->getFirstLine($this->settings_file)==$line_include_settings ) { $this->maginot->deleteFirstLine( $this->settings_file @@ -263,7 +257,7 @@ protected function overrideConfigurations($configurations, $io) } catch (IOExceptionInterface $e) { echo $e->getMessage(); } - }else{ + } else { // comment cache bins in local.settings.php, // we still use local.settings.php for testing PROD @@ -282,10 +276,7 @@ protected function overrideConfigurations($configurations, $io) } /** - * * would be better if this were replaced by $config->save? - * - * */ //@TODO: 0444 should be a better permission for settings.php chmod($this->settings_file, (int)0644); diff --git a/src/Command/Site/StatisticsCommand.php b/src/Command/Site/StatisticsCommand.php index 6fe46d027..be80636f1 100644 --- a/src/Command/Site/StatisticsCommand.php +++ b/src/Command/Site/StatisticsCommand.php @@ -47,10 +47,10 @@ class StatisticsCommand extends Command /** * StatisticsCommand constructor. - * @param DrupalApi $drupalApi - * @param QueryFactory $entityQuery; - * @param Manager $extensionManager - * @param ModuleHandlerInterface $moduleHandler + * @param DrupalApi $drupalApi + * @param QueryFactory $entityQuery; + * @param Manager $extensionManager + * @param ModuleHandlerInterface $moduleHandler */ public function __construct( DrupalApi $drupalApi, diff --git a/src/Command/Site/StatusCommand.php b/src/Command/Site/StatusCommand.php index a764625c0..453a3d1cf 100644 --- a/src/Command/Site/StatusCommand.php +++ b/src/Command/Site/StatusCommand.php @@ -72,8 +72,8 @@ class StatusCommand extends Command /** * DebugCommand constructor. - * @param SystemManager $systemManager - * @param Settings $settings + * @param SystemManager $systemManager + * @param Settings $settings * @param ConfigFactory $configFactory * @param ThemeHandler $themeHandler * @param $appRoot @@ -213,7 +213,6 @@ protected function getThemeData() protected function getDirectoryData() { - $systemTheme = $this->configFactory->get('system.theme'); $themeDefaultDirectory = ''; diff --git a/src/Command/Taxonomy/DeleteTermCommand.php b/src/Command/Taxonomy/DeleteTermCommand.php index 5dfdb8fad..bb3f996b4 100644 --- a/src/Command/Taxonomy/DeleteTermCommand.php +++ b/src/Command/Taxonomy/DeleteTermCommand.php @@ -32,7 +32,8 @@ class DeleteTermCommand extends Command * InfoCommand constructor. * @param EntityTypeManagerInterface $entityTypeManager */ - public function __construct(EntityTypeManagerInterface $entityTypeManager) { + public function __construct(EntityTypeManagerInterface $entityTypeManager) + { $this->entityTypeManager = $entityTypeManager; parent::__construct(); } @@ -70,8 +71,8 @@ private function deleteExistingTerms($vid = null, DrupalStyle $io) { //Load the vid $termStorage = $this->entityTypeManager->getStorage('taxonomy_term'); - $vocabularies = $this->entityTypeManager->getStorage('taxonomy_vocabulary') - ->loadMultiple(); + $vocabularies = $this->entityTypeManager->getStorage('taxonomy_vocabulary') + ->loadMultiple(); if ($vid !== 'all') { $vid = [$vid]; diff --git a/src/Command/Test/DebugCommand.php b/src/Command/Test/DebugCommand.php index 24470bab0..32fef1cd6 100644 --- a/src/Command/Test/DebugCommand.php +++ b/src/Command/Test/DebugCommand.php @@ -35,7 +35,7 @@ class DebugCommand extends Command /** * DebugCommand constructor. - * @param TestDiscovery $test_discovery + * @param TestDiscovery $test_discovery */ public function __construct( TestDiscovery $test_discovery diff --git a/src/Command/Test/RunCommand.php b/src/Command/Test/RunCommand.php index ba882d005..2b945057b 100644 --- a/src/Command/Test/RunCommand.php +++ b/src/Command/Test/RunCommand.php @@ -56,9 +56,9 @@ class RunCommand extends Command /** * RunCommand constructor. - * @param Site $site - * @param TestDiscovery $test_discovery - * @param ModuleHandlerInterface $moduleHandler + * @param Site $site + * @param TestDiscovery $test_discovery + * @param ModuleHandlerInterface $moduleHandler */ public function __construct( $appRoot, diff --git a/src/Command/Theme/DebugCommand.php b/src/Command/Theme/DebugCommand.php index 695956909..c0fd81674 100644 --- a/src/Command/Theme/DebugCommand.php +++ b/src/Command/Theme/DebugCommand.php @@ -33,7 +33,7 @@ class DebugCommand extends Command /** * DebugCommand constructor. * @param ConfigFactory $configFactory - * @param ThemeHandler $themeHandler + * @param ThemeHandler $themeHandler */ public function __construct( ConfigFactory $configFactory, diff --git a/src/Command/Theme/DownloadCommand.php b/src/Command/Theme/DownloadCommand.php index c111e6d5e..c3e3919b1 100644 --- a/src/Command/Theme/DownloadCommand.php +++ b/src/Command/Theme/DownloadCommand.php @@ -42,8 +42,8 @@ class DownloadCommand extends Command /** * DownloadCommand constructor. - * @param DrupalApi $drupalApi - * @param Client $httpClient + * @param DrupalApi $drupalApi + * @param Client $httpClient * @param $appRoot */ public function __construct( diff --git a/src/Command/Theme/InstallCommand.php b/src/Command/Theme/InstallCommand.php index 893cf0b04..f6ba43e6d 100644 --- a/src/Command/Theme/InstallCommand.php +++ b/src/Command/Theme/InstallCommand.php @@ -41,8 +41,8 @@ class InstallCommand extends Command /** * DebugCommand constructor. * @param ConfigFactory $configFactory - * @param ThemeHandler $themeHandler - * @param ChainQueue $chainQueue + * @param ThemeHandler $themeHandler + * @param ChainQueue $chainQueue */ public function __construct( ConfigFactory $configFactory, diff --git a/src/Command/Theme/UninstallCommand.php b/src/Command/Theme/UninstallCommand.php index 8d11fffa2..a22e3d7c4 100644 --- a/src/Command/Theme/UninstallCommand.php +++ b/src/Command/Theme/UninstallCommand.php @@ -40,8 +40,8 @@ class UninstallCommand extends Command /** * DebugCommand constructor. * @param ConfigFactory $configFactory - * @param ThemeHandler $themeHandler - * @param ChainQueue $chainQueue + * @param ThemeHandler $themeHandler + * @param ChainQueue $chainQueue */ public function __construct( ConfigFactory $configFactory, diff --git a/src/Command/Update/EntitiesCommand.php b/src/Command/Update/EntitiesCommand.php index 43ea2aed0..521bb6e0f 100644 --- a/src/Command/Update/EntitiesCommand.php +++ b/src/Command/Update/EntitiesCommand.php @@ -44,7 +44,7 @@ class EntitiesCommand extends Command /** * EntitiesCommand constructor. - * @param StateInterface $state + * @param StateInterface $state * @param EntityDefinitionUpdateManager $entityDefinitionUpdateManager * @param ChainQueue $chainQueue */ diff --git a/src/Command/Update/ExecuteCommand.php b/src/Command/Update/ExecuteCommand.php index ccfba07ec..d84d78b4a 100644 --- a/src/Command/Update/ExecuteCommand.php +++ b/src/Command/Update/ExecuteCommand.php @@ -45,7 +45,9 @@ class ExecuteCommand extends Command protected $postUpdateRegistry; - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** @@ -66,10 +68,10 @@ class ExecuteCommand extends Command /** * EntitiesCommand constructor. * @param Site $site - * @param StateInterface $state + * @param StateInterface $state * @param ModuleHandler $moduleHandler * @param UpdateRegistry $postUpdateRegistry - * @param Manager $extensionManager + * @param Manager $extensionManager * @param ChainQueue $chainQueue */ public function __construct( diff --git a/src/Command/User/CreateCommand.php b/src/Command/User/CreateCommand.php index c19639729..797b370d9 100644 --- a/src/Command/User/CreateCommand.php +++ b/src/Command/User/CreateCommand.php @@ -48,10 +48,10 @@ class CreateCommand extends Command /** * CreateCommand constructor. - * @param Connection $database - * @param EntityTypeManagerInterface $entityTypeManager - * @param DateFormatterInterface $dateFormatter - * @param DrupalApi $drupalApi + * @param Connection $database + * @param EntityTypeManagerInterface $entityTypeManager + * @param DateFormatterInterface $dateFormatter + * @param DrupalApi $drupalApi */ public function __construct( Connection $database, diff --git a/src/Command/User/DebugCommand.php b/src/Command/User/DebugCommand.php index 450224bc0..b03222e3c 100644 --- a/src/Command/User/DebugCommand.php +++ b/src/Command/User/DebugCommand.php @@ -43,8 +43,8 @@ class DebugCommand extends Command /** * DebugCommand constructor. * @param EntityTypeManagerInterface $entityTypeManager - * @param QueryFactory $entityQuery - * @param DrupalApi $drupalApi + * @param QueryFactory $entityQuery + * @param DrupalApi $drupalApi */ public function __construct( EntityTypeManagerInterface $entityTypeManager, diff --git a/src/Command/User/DeleteCommand.php b/src/Command/User/DeleteCommand.php index d01d327d4..4c0611ce4 100644 --- a/src/Command/User/DeleteCommand.php +++ b/src/Command/User/DeleteCommand.php @@ -43,8 +43,8 @@ class DeleteCommand extends Command /** * DeleteCommand constructor. * @param EntityTypeManagerInterface $entityTypeManager - * @param QueryFactory $entityQuery - * @param DrupalApi $drupalApi + * @param QueryFactory $entityQuery + * @param DrupalApi $drupalApi */ public function __construct( EntityTypeManagerInterface $entityTypeManager, diff --git a/src/Command/User/LoginCleanAttemptsCommand.php b/src/Command/User/LoginCleanAttemptsCommand.php index 93ca05fc5..6ca7e66ea 100644 --- a/src/Command/User/LoginCleanAttemptsCommand.php +++ b/src/Command/User/LoginCleanAttemptsCommand.php @@ -31,7 +31,8 @@ class LoginCleanAttemptsCommand extends Command * LoginCleanAttemptsCommand constructor. * @param Connection $database */ - public function __construct(Connection $database) { + public function __construct(Connection $database) + { $this->database = $database; parent::__construct(); } diff --git a/src/Command/User/LoginUrlCommand.php b/src/Command/User/LoginUrlCommand.php index ac2550f23..3edfb1850 100644 --- a/src/Command/User/LoginUrlCommand.php +++ b/src/Command/User/LoginUrlCommand.php @@ -31,9 +31,10 @@ class LoginUrlCommand extends Command /** * LoginUrlCommand constructor. - * @param EntityTypeManagerInterface $entityTypeManager + * @param EntityTypeManagerInterface $entityTypeManager */ - public function __construct(EntityTypeManagerInterface $entityTypeManager) { + public function __construct(EntityTypeManagerInterface $entityTypeManager) + { $this->entityTypeManager = $entityTypeManager; parent::__construct(); } diff --git a/src/Command/User/PasswordHashCommand.php b/src/Command/User/PasswordHashCommand.php index 795c9e410..c31044cee 100644 --- a/src/Command/User/PasswordHashCommand.php +++ b/src/Command/User/PasswordHashCommand.php @@ -30,7 +30,8 @@ class PasswordHashCommand extends Command * PasswordHashCommand constructor. * @param PasswordInterface $password */ - public function __construct(PasswordInterface $password) { + public function __construct(PasswordInterface $password) + { $this->password = $password; parent::__construct(); } diff --git a/src/Command/User/RoleCommand.php b/src/Command/User/RoleCommand.php index a4f7c0b23..9d9f75231 100644 --- a/src/Command/User/RoleCommand.php +++ b/src/Command/User/RoleCommand.php @@ -32,7 +32,8 @@ class RoleCommand extends Command * RoleCommand constructor. * @param DrupalApi $drupalApi */ - public function __construct(DrupalApi $drupalApi) { + public function __construct(DrupalApi $drupalApi) + { $this->drupalApi = $drupalApi; parent::__construct(); } diff --git a/src/Command/Views/DebugCommand.php b/src/Command/Views/DebugCommand.php index 8e60acc24..1b261337f 100644 --- a/src/Command/Views/DebugCommand.php +++ b/src/Command/Views/DebugCommand.php @@ -34,7 +34,8 @@ class DebugCommand extends Command * DebugCommand constructor. * @param EntityTypeManagerInterface $entityTypeManager */ - public function __construct(EntityTypeManagerInterface $entityTypeManager) { + public function __construct(EntityTypeManagerInterface $entityTypeManager) + { $this->entityTypeManager = $entityTypeManager; parent::__construct(); } diff --git a/src/Command/Views/DisableCommand.php b/src/Command/Views/DisableCommand.php index 6f83f4d4d..7d849aa4d 100644 --- a/src/Command/Views/DisableCommand.php +++ b/src/Command/Views/DisableCommand.php @@ -37,7 +37,7 @@ class DisableCommand extends Command /** * DisableCommand constructor. * @param EntityTypeManagerInterface $entityTypeManager - * @param QueryFactory $entityQuery + * @param QueryFactory $entityQuery */ public function __construct( EntityTypeManagerInterface $entityTypeManager, diff --git a/src/Command/Views/EnableCommand.php b/src/Command/Views/EnableCommand.php index b0133c31b..5c76d096d 100644 --- a/src/Command/Views/EnableCommand.php +++ b/src/Command/Views/EnableCommand.php @@ -38,7 +38,7 @@ class EnableCommand extends Command /** * EnableCommand constructor. * @param EntityTypeManagerInterface $entityTypeManager - * @param QueryFactory $entityQuery + * @param QueryFactory $entityQuery */ public function __construct( EntityTypeManagerInterface $entityTypeManager, diff --git a/src/Command/Yaml/DiffCommand.php b/src/Command/Yaml/DiffCommand.php index 41f043b54..dc21cb4d6 100644 --- a/src/Command/Yaml/DiffCommand.php +++ b/src/Command/Yaml/DiffCommand.php @@ -28,9 +28,10 @@ class DiffCommand extends Command /** * RebuildCommand constructor. - * @param NestedArray $nestedArray + * @param NestedArray $nestedArray */ - public function __construct(NestedArray $nestedArray) { + public function __construct(NestedArray $nestedArray) + { $this->nestedArray = $nestedArray; parent::__construct(); } @@ -127,7 +128,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } $statistics = ['total' => 0, 'equal'=> 0 , 'diff' => 0]; -/* print_r($yamlLeftParsed); + /* print_r($yamlLeftParsed); print_r($yamlRightParsed);*/ $diff = $this->nestedArray->arrayDiff($yamlLeftParsed, $yamlRightParsed, $negate, $statistics); print_r($diff); diff --git a/src/Command/Yaml/GetValueCommand.php b/src/Command/Yaml/GetValueCommand.php index 2ecb8b3df..ee5df1f53 100644 --- a/src/Command/Yaml/GetValueCommand.php +++ b/src/Command/Yaml/GetValueCommand.php @@ -27,9 +27,10 @@ class GetValueCommand extends Command /** * RebuildCommand constructor. - * @param NestedArray $nestedArray + * @param NestedArray $nestedArray */ - public function __construct(NestedArray $nestedArray) { + public function __construct(NestedArray $nestedArray) + { $this->nestedArray = $nestedArray; parent::__construct(); } diff --git a/src/Command/Yaml/MergeCommand.php b/src/Command/Yaml/MergeCommand.php index fa5a50ee6..df80b4e7f 100644 --- a/src/Command/Yaml/MergeCommand.php +++ b/src/Command/Yaml/MergeCommand.php @@ -159,10 +159,9 @@ protected function interact(InputInterface $input, OutputInterface $output) while (true) { // Set the string key based on among files provided - if(count($yaml_files) >= 2) { + if (count($yaml_files) >= 2) { $questionStringKey = 'commands.yaml.merge.questions.other-file'; - } - else { + } else { $questionStringKey = 'commands.yaml.merge.questions.file'; } diff --git a/src/Command/Yaml/SplitCommand.php b/src/Command/Yaml/SplitCommand.php index 56392892c..313cfc97f 100644 --- a/src/Command/Yaml/SplitCommand.php +++ b/src/Command/Yaml/SplitCommand.php @@ -29,9 +29,10 @@ class SplitCommand extends Command /** * RebuildCommand constructor. - * @param NestedArray $nestedArray + * @param NestedArray $nestedArray */ - public function __construct(NestedArray $nestedArray) { + public function __construct(NestedArray $nestedArray) + { $this->nestedArray = $nestedArray; parent::__construct(); } diff --git a/src/Command/Yaml/UnsetKeyCommand.php b/src/Command/Yaml/UnsetKeyCommand.php index d744e6bbe..add8e252c 100644 --- a/src/Command/Yaml/UnsetKeyCommand.php +++ b/src/Command/Yaml/UnsetKeyCommand.php @@ -19,90 +19,91 @@ class UnsetKeyCommand extends Command { - use CommandTrait; + use CommandTrait; - /** + /** * @var NestedArray */ - protected $nestedArray; + protected $nestedArray; - /** + /** * RebuildCommand constructor. - * @param NestedArray $nestedArray + * @param NestedArray $nestedArray */ - public function __construct(NestedArray $nestedArray) { - $this->nestedArray = $nestedArray; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('yaml:unset:key') - ->setDescription($this->trans('commands.yaml.unset.key.description')) - ->addArgument( - 'yaml-file', - InputArgument::REQUIRED, - $this->trans('commands.yaml.unset.value.arguments.yaml-file') - ) - ->addArgument( - 'yaml-key', - InputArgument::REQUIRED, - $this->trans('commands.yaml.unset.value.arguments.yaml-key') - ); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $yaml = new Parser(); - $dumper = new Dumper(); - - $yaml_file = $input->getArgument('yaml-file'); - $yaml_key = $input->getArgument('yaml-key'); - - try { - $yaml_parsed = $yaml->parse(file_get_contents($yaml_file)); - } catch (\Exception $e) { - $io->error($this->trans('commands.yaml.merge.messages.error-parsing').': '.$e->getMessage()); - - return; + public function __construct(NestedArray $nestedArray) + { + $this->nestedArray = $nestedArray; + parent::__construct(); } - if (empty($yaml_parsed)) { - $io->info( - sprintf( - $this->trans('commands.yaml.merge.messages.wrong-parse'), - $yaml_file - ) - ); + protected function configure() + { + $this + ->setName('yaml:unset:key') + ->setDescription($this->trans('commands.yaml.unset.key.description')) + ->addArgument( + 'yaml-file', + InputArgument::REQUIRED, + $this->trans('commands.yaml.unset.value.arguments.yaml-file') + ) + ->addArgument( + 'yaml-key', + InputArgument::REQUIRED, + $this->trans('commands.yaml.unset.value.arguments.yaml-key') + ); } - $parents = explode(".", $yaml_key); - $this->nestedArray->unsetValue($yaml_parsed, $parents); - - try { - $yaml = $dumper->dump($yaml_parsed, 10); - } catch (\Exception $e) { - $io->error($this->trans('commands.yaml.merge.messages.error-generating').': '.$e->getMessage()); - - return; - } - - try { - file_put_contents($yaml_file, $yaml); - } catch (\Exception $e) { - $io->error($this->trans('commands.yaml.merge.messages.error-writing').': '.$e->getMessage()); - - return; + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $yaml = new Parser(); + $dumper = new Dumper(); + + $yaml_file = $input->getArgument('yaml-file'); + $yaml_key = $input->getArgument('yaml-key'); + + try { + $yaml_parsed = $yaml->parse(file_get_contents($yaml_file)); + } catch (\Exception $e) { + $io->error($this->trans('commands.yaml.merge.messages.error-parsing').': '.$e->getMessage()); + + return; + } + + if (empty($yaml_parsed)) { + $io->info( + sprintf( + $this->trans('commands.yaml.merge.messages.wrong-parse'), + $yaml_file + ) + ); + } + + $parents = explode(".", $yaml_key); + $this->nestedArray->unsetValue($yaml_parsed, $parents); + + try { + $yaml = $dumper->dump($yaml_parsed, 10); + } catch (\Exception $e) { + $io->error($this->trans('commands.yaml.merge.messages.error-generating').': '.$e->getMessage()); + + return; + } + + try { + file_put_contents($yaml_file, $yaml); + } catch (\Exception $e) { + $io->error($this->trans('commands.yaml.merge.messages.error-writing').': '.$e->getMessage()); + + return; + } + + $io->info( + sprintf( + $this->trans('commands.yaml.unset.value.messages.unset'), + $yaml_file + ) + ); } - - $io->info( - sprintf( - $this->trans('commands.yaml.unset.value.messages.unset'), - $yaml_file - ) - ); - } } diff --git a/src/Command/Yaml/UpdateKeyCommand.php b/src/Command/Yaml/UpdateKeyCommand.php index f194837fe..be9a7d27f 100644 --- a/src/Command/Yaml/UpdateKeyCommand.php +++ b/src/Command/Yaml/UpdateKeyCommand.php @@ -28,9 +28,10 @@ class UpdateKeyCommand extends Command /** * RebuildCommand constructor. - * @param NestedArray $nestedArray + * @param NestedArray $nestedArray */ - public function __construct(NestedArray $nestedArray) { + public function __construct(NestedArray $nestedArray) + { $this->nestedArray = $nestedArray; parent::__construct(); } diff --git a/src/Command/Yaml/UpdateValueCommand.php b/src/Command/Yaml/UpdateValueCommand.php index 76dc11148..a78823143 100644 --- a/src/Command/Yaml/UpdateValueCommand.php +++ b/src/Command/Yaml/UpdateValueCommand.php @@ -28,9 +28,10 @@ class UpdateValueCommand extends Command /** * RebuildCommand constructor. - * @param NestedArray $nestedArray + * @param NestedArray $nestedArray */ - public function __construct(NestedArray $nestedArray) { + public function __construct(NestedArray $nestedArray) + { $this->nestedArray = $nestedArray; parent::__construct(); } diff --git a/src/Extension/Manager.php b/src/Extension/Manager.php index cecafc673..e9113d291 100644 --- a/src/Extension/Manager.php +++ b/src/Extension/Manager.php @@ -284,11 +284,11 @@ private function createExtension($extension) } /** - * @param string $testType + * @param string $testType * @param $fullPath * @return string */ - public function getTestPath( $testType, $fullPath = false) + public function getTestPath($testType, $fullPath = false) { return $this->getPath($fullPath) . '/Tests/' . $testType; } diff --git a/src/Generator/AuthenticationProviderGenerator.php b/src/Generator/AuthenticationProviderGenerator.php index ca7157e1c..bc7b6788b 100644 --- a/src/Generator/AuthenticationProviderGenerator.php +++ b/src/Generator/AuthenticationProviderGenerator.php @@ -11,8 +11,9 @@ class AuthenticationProviderGenerator extends Generator { - - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** diff --git a/src/Generator/BreakPointGenerator.php b/src/Generator/BreakPointGenerator.php index 693bf4949..e036a54b0 100644 --- a/src/Generator/BreakPointGenerator.php +++ b/src/Generator/BreakPointGenerator.php @@ -15,8 +15,9 @@ */ class BreakPointGenerator extends Generator { - - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** diff --git a/src/Generator/CommandGenerator.php b/src/Generator/CommandGenerator.php index 4a175665a..b882b1776 100644 --- a/src/Generator/CommandGenerator.php +++ b/src/Generator/CommandGenerator.php @@ -18,7 +18,6 @@ */ class CommandGenerator extends Generator { - /** * @var Manager */ @@ -31,7 +30,7 @@ class CommandGenerator extends Generator /** * CommandGenerator constructor. - * @param Manager $extensionManager + * @param Manager $extensionManager * @param TranslatorManager $translatorManager */ public function __construct( @@ -86,6 +85,5 @@ public function generate($module, $name, $class, $containerAware, $services) 'module/src/Command/console/translations/en/command.yml.twig', $this->extensionManager->getModule($module)->getPath().'/console/translations/en/'.$command_key.'.yml' ); - } } diff --git a/src/Generator/ControllerGenerator.php b/src/Generator/ControllerGenerator.php index 9ebb2c476..21733e8b0 100644 --- a/src/Generator/ControllerGenerator.php +++ b/src/Generator/ControllerGenerator.php @@ -11,8 +11,9 @@ class ControllerGenerator extends Generator { - - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** diff --git a/src/Generator/EntityBundleGenerator.php b/src/Generator/EntityBundleGenerator.php index 2056fc222..67a671e5e 100644 --- a/src/Generator/EntityBundleGenerator.php +++ b/src/Generator/EntityBundleGenerator.php @@ -11,8 +11,9 @@ class EntityBundleGenerator extends Generator { - - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** diff --git a/src/Generator/EntityConfigGenerator.php b/src/Generator/EntityConfigGenerator.php index d415d3a6b..e7fec2bb2 100644 --- a/src/Generator/EntityConfigGenerator.php +++ b/src/Generator/EntityConfigGenerator.php @@ -6,13 +6,14 @@ */ namespace Drupal\Console\Generator; + use Drupal\Console\Extension\Manager; class EntityConfigGenerator extends Generator { - - - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** diff --git a/src/Generator/EntityContentGenerator.php b/src/Generator/EntityContentGenerator.php index 61bc9de0b..b4a076c6c 100644 --- a/src/Generator/EntityContentGenerator.php +++ b/src/Generator/EntityContentGenerator.php @@ -14,8 +14,9 @@ class EntityContentGenerator extends Generator { - - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** @@ -23,15 +24,17 @@ class EntityContentGenerator extends Generator */ protected $site; - /** @var TwigRenderer*/ + /** + * @var TwigRenderer +*/ protected $twigrenderer; protected $io; /** * EntityContentGenerator constructor. - * @param Manager $extensionManager - * @param Site $site + * @param Manager $extensionManager + * @param Site $site * @param TwigRenderer $twigrenderer */ public function __construct( @@ -60,7 +63,7 @@ public function setIo($io) * @param string $base_path Base path * @param string $is_translatable Translation configuration * @param string $bundle_entity_type (Config) entity type acting as bundle - * @param bool $revisionable Revision configuration + * @param bool $revisionable Revision configuration */ public function generate($module, $entity_name, $entity_class, $label, $base_path, $is_translatable, $bundle_entity_type = null, $revisionable = false) { @@ -178,36 +181,36 @@ public function generate($module, $entity_name, $entity_class, $label, $base_pat ); if ($revisionable) { - $this->renderFile( - 'module/src/Entity/Form/entity-content-revision-delete.php.twig', - $this->extensionManager->getModule($module)->getFormPath() .'/'.$entity_class.'RevisionDeleteForm.php', - $parameters - ); - $this->renderFile( - 'module/src/Entity/Form/entity-content-revision-revert-translation.php.twig', - $this->extensionManager->getModule($module)->getFormPath() .'/'.$entity_class.'RevisionRevertTranslationForm.php', - $parameters - ); - $this->renderFile( - 'module/src/Entity/Form/entity-content-revision-revert.php.twig', - $this->extensionManager->getModule($module)->getFormPath().'/'.$entity_class.'RevisionRevertForm.php', - $parameters - ); - $this->renderFile( - 'module/src/entity-storage.php.twig', - $this->extensionManager->getModule($module)->getSourcePath() .'/'.$entity_class.'Storage.php', - $parameters - ); - $this->renderFile( - 'module/src/interface-entity-storage.php.twig', - $this->extensionManager->getModule($module)->getSourcePath() .'/'.$entity_class.'StorageInterface.php', - $parameters - ); - $this->renderFile( - 'module/src/Controller/entity-controller.php.twig', - $this->extensionManager->getModule($module)->getControllerPath() .'/'.$entity_class.'Controller.php', - $parameters - ); + $this->renderFile( + 'module/src/Entity/Form/entity-content-revision-delete.php.twig', + $this->extensionManager->getModule($module)->getFormPath() .'/'.$entity_class.'RevisionDeleteForm.php', + $parameters + ); + $this->renderFile( + 'module/src/Entity/Form/entity-content-revision-revert-translation.php.twig', + $this->extensionManager->getModule($module)->getFormPath() .'/'.$entity_class.'RevisionRevertTranslationForm.php', + $parameters + ); + $this->renderFile( + 'module/src/Entity/Form/entity-content-revision-revert.php.twig', + $this->extensionManager->getModule($module)->getFormPath().'/'.$entity_class.'RevisionRevertForm.php', + $parameters + ); + $this->renderFile( + 'module/src/entity-storage.php.twig', + $this->extensionManager->getModule($module)->getSourcePath() .'/'.$entity_class.'Storage.php', + $parameters + ); + $this->renderFile( + 'module/src/interface-entity-storage.php.twig', + $this->extensionManager->getModule($module)->getSourcePath() .'/'.$entity_class.'StorageInterface.php', + $parameters + ); + $this->renderFile( + 'module/src/Controller/entity-controller.php.twig', + $this->extensionManager->getModule($module)->getControllerPath() .'/'.$entity_class.'Controller.php', + $parameters + ); } if ($bundle_entity_type) { diff --git a/src/Generator/EventSubscriberGenerator.php b/src/Generator/EventSubscriberGenerator.php index 5adb9f618..bc7473ca7 100644 --- a/src/Generator/EventSubscriberGenerator.php +++ b/src/Generator/EventSubscriberGenerator.php @@ -11,7 +11,9 @@ class EventSubscriberGenerator extends Generator { - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** diff --git a/src/Generator/FormAlterGenerator.php b/src/Generator/FormAlterGenerator.php index 32ff7fd2f..6c8fe59dd 100644 --- a/src/Generator/FormAlterGenerator.php +++ b/src/Generator/FormAlterGenerator.php @@ -11,8 +11,9 @@ class FormAlterGenerator extends Generator { - - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** diff --git a/src/Generator/FormGenerator.php b/src/Generator/FormGenerator.php index 3d6077f8e..c7b68b7e1 100644 --- a/src/Generator/FormGenerator.php +++ b/src/Generator/FormGenerator.php @@ -12,7 +12,9 @@ class FormGenerator extends Generator { - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** @@ -22,7 +24,7 @@ class FormGenerator extends Generator /** * AuthenticationProviderGenerator constructor. - * @param Manager $extensionManager + * @param Manager $extensionManager * @param StringConverter $stringConverter */ public function __construct( diff --git a/src/Generator/HelpGenerator.php b/src/Generator/HelpGenerator.php index 1bf429d27..185d4250b 100644 --- a/src/Generator/HelpGenerator.php +++ b/src/Generator/HelpGenerator.php @@ -11,9 +11,9 @@ class HelpGenerator extends Generator { - - - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** diff --git a/src/Generator/ModuleGenerator.php b/src/Generator/ModuleGenerator.php index 705453c9e..90abda5a7 100644 --- a/src/Generator/ModuleGenerator.php +++ b/src/Generator/ModuleGenerator.php @@ -123,44 +123,44 @@ public function generate( } if ($twigtemplate) { $this->renderFile( - 'module/module-twig-template-append.twig', - $dir .'/' . $machineName . '.module', - $parameters, - FILE_APPEND + 'module/module-twig-template-append.twig', + $dir .'/' . $machineName . '.module', + $parameters, + FILE_APPEND ); - $dir .= '/templates/'; - if (file_exists($dir)) { - if (!is_dir($dir)) { - throw new \RuntimeException( - sprintf( - 'Unable to generate the templates directory as the target directory "%s" exists but is a file.', - realpath($dir) - ) - ); - } - $files = scandir($dir); - if ($files != array('.', '..')) { - throw new \RuntimeException( - sprintf( - 'Unable to generate the templates directory as the target directory "%s" is not empty.', - realpath($dir) - ) - ); - } - if (!is_writable($dir)) { - throw new \RuntimeException( - sprintf( - 'Unable to generate the templates directory as the target directory "%s" is not writable.', - realpath($dir) - ) - ); - } - } - $this->renderFile( - 'module/twig-template-file.twig', - $dir . $machineName . '.html.twig', - $parameters - ); - } + $dir .= '/templates/'; + if (file_exists($dir)) { + if (!is_dir($dir)) { + throw new \RuntimeException( + sprintf( + 'Unable to generate the templates directory as the target directory "%s" exists but is a file.', + realpath($dir) + ) + ); + } + $files = scandir($dir); + if ($files != array('.', '..')) { + throw new \RuntimeException( + sprintf( + 'Unable to generate the templates directory as the target directory "%s" is not empty.', + realpath($dir) + ) + ); + } + if (!is_writable($dir)) { + throw new \RuntimeException( + sprintf( + 'Unable to generate the templates directory as the target directory "%s" is not writable.', + realpath($dir) + ) + ); + } + } + $this->renderFile( + 'module/twig-template-file.twig', + $dir . $machineName . '.html.twig', + $parameters + ); + } } } diff --git a/src/Generator/PluginBlockGenerator.php b/src/Generator/PluginBlockGenerator.php index ed92d2e11..03d512c98 100644 --- a/src/Generator/PluginBlockGenerator.php +++ b/src/Generator/PluginBlockGenerator.php @@ -40,37 +40,33 @@ public function generate($module, $class_name, $label, $plugin_id, $services, $i // Consider the type when determining a default value. Figure out what // the code looks like for the default value tht we need to generate. foreach ($inputs as &$input) { - $default_code = '$this->t(\'\')'; - if ($input['default_value'] == '') { - switch ($input['type']) { - case 'checkbox': - case 'number': - case 'weight': - case 'radio': - $default_code = 0; - break; + $default_code = '$this->t(\'\')'; + if ($input['default_value'] == '') { + switch ($input['type']) { + case 'checkbox': + case 'number': + case 'weight': + case 'radio': + $default_code = 0; + break; - case 'radios': - case 'checkboxes': - $default_code = 'array()'; - break; + case 'radios': + case 'checkboxes': + $default_code = 'array()'; + break; + } + } elseif (substr($input['default_value'], 0, 1) == '$') { + // If they want to put in code, let them, they're programmers. + $default_code = $input['default_value']; + } elseif (is_numeric($input['default_value'])) { + $default_code = $input['default_value']; + } elseif (preg_match('/^(true|false)$/i', $input['default_value'])) { + // Coding Standards + $default_code = strtoupper($input['default_value']); + } else { + $default_code = '$this->t(\'' . $input['default_value'] . '\')'; } - } - elseif (substr($input['default_value'], 0, 1) == '$') { - // If they want to put in code, let them, they're programmers. - $default_code = $input['default_value']; - } - elseif (is_numeric($input['default_value'])) { - $default_code = $input['default_value']; - } - elseif (preg_match('/^(true|false)$/i', $input['default_value'])) { - // Coding Standards - $default_code = strtoupper($input['default_value']); - } - else { - $default_code = '$this->t(\'' . $input['default_value'] . '\')'; - } - $input['default_code'] = $default_code; + $input['default_code'] = $default_code; } $parameters = [ diff --git a/src/Generator/PluginCKEditorButtonGenerator.php b/src/Generator/PluginCKEditorButtonGenerator.php index ab2b2604e..d809e7b9d 100644 --- a/src/Generator/PluginCKEditorButtonGenerator.php +++ b/src/Generator/PluginCKEditorButtonGenerator.php @@ -11,9 +11,9 @@ class PluginCKEditorButtonGenerator extends Generator { - - - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; diff --git a/src/Generator/PluginConditionGenerator.php b/src/Generator/PluginConditionGenerator.php index 858b3d802..60fe6cf01 100644 --- a/src/Generator/PluginConditionGenerator.php +++ b/src/Generator/PluginConditionGenerator.php @@ -15,8 +15,9 @@ */ class PluginConditionGenerator extends Generator { - - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; diff --git a/src/Generator/PluginRulesActionGenerator.php b/src/Generator/PluginRulesActionGenerator.php index 10455c2e3..1b27f3860 100644 --- a/src/Generator/PluginRulesActionGenerator.php +++ b/src/Generator/PluginRulesActionGenerator.php @@ -11,7 +11,6 @@ class PluginRulesActionGenerator extends Generator { - /** * PluginRulesActionGenerator constructor. * @param Manager $extensionManager diff --git a/src/Generator/PluginViewsFieldGenerator.php b/src/Generator/PluginViewsFieldGenerator.php index 924cb1513..3e8c7cbc2 100644 --- a/src/Generator/PluginViewsFieldGenerator.php +++ b/src/Generator/PluginViewsFieldGenerator.php @@ -11,7 +11,9 @@ class PluginViewsFieldGenerator extends Generator { - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** diff --git a/src/Generator/PostUpdateGenerator.php b/src/Generator/PostUpdateGenerator.php index 0f3c31acd..e9205514f 100644 --- a/src/Generator/PostUpdateGenerator.php +++ b/src/Generator/PostUpdateGenerator.php @@ -11,7 +11,9 @@ class PostUpdateGenerator extends Generator { - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** diff --git a/src/Generator/RouteSubscriberGenerator.php b/src/Generator/RouteSubscriberGenerator.php index d7ced3cd7..9e451439a 100644 --- a/src/Generator/RouteSubscriberGenerator.php +++ b/src/Generator/RouteSubscriberGenerator.php @@ -11,7 +11,9 @@ class RouteSubscriberGenerator extends Generator { - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** diff --git a/src/Generator/ServiceGenerator.php b/src/Generator/ServiceGenerator.php index bad04e973..2ab2fe4be 100644 --- a/src/Generator/ServiceGenerator.php +++ b/src/Generator/ServiceGenerator.php @@ -11,7 +11,9 @@ class ServiceGenerator extends Generator { - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** diff --git a/src/Generator/ThemeGenerator.php b/src/Generator/ThemeGenerator.php index 8b1633b6a..6b686a336 100644 --- a/src/Generator/ThemeGenerator.php +++ b/src/Generator/ThemeGenerator.php @@ -14,8 +14,9 @@ */ class ThemeGenerator extends Generator { - - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** diff --git a/src/Generator/TwigExtensionGenerator.php b/src/Generator/TwigExtensionGenerator.php index de5b95400..76c474a2f 100644 --- a/src/Generator/TwigExtensionGenerator.php +++ b/src/Generator/TwigExtensionGenerator.php @@ -15,7 +15,9 @@ */ class TwigExtensionGenerator extends Generator { - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** diff --git a/src/Generator/UpdateGenerator.php b/src/Generator/UpdateGenerator.php index 23de36b1a..fe8243f6d 100644 --- a/src/Generator/UpdateGenerator.php +++ b/src/Generator/UpdateGenerator.php @@ -11,7 +11,9 @@ class UpdateGenerator extends Generator { - /** @var Manager */ + /** + * @var Manager +*/ protected $extensionManager; /** diff --git a/src/Utils/AnnotationValidator.php b/src/Utils/AnnotationValidator.php index 4154fc148..43afe07bb 100644 --- a/src/Utils/AnnotationValidator.php +++ b/src/Utils/AnnotationValidator.php @@ -9,8 +9,8 @@ * Class AnnotationValidator * @package Drupal\Console\Utils */ -class AnnotationValidator { - +class AnnotationValidator +{ /** * @var DrupalCommandAnnotationReader */ @@ -41,7 +41,8 @@ public function __construct( * @param $class * @return bool */ - public function isValidCommand($class) { + public function isValidCommand($class) + { $annotation = $this->annotationCommandReader->readAnnotation($class); if (!$annotation) { return true; @@ -66,25 +67,26 @@ public function isValidCommand($class) { * @param $extension * @return bool */ - protected function isExtensionInstalled($extension){ + protected function isExtensionInstalled($extension) + { if (!$this->extensions) { - $modules = $this->extensionManager->discoverModules() + $modules = $this->extensionManager->discoverModules() ->showCore() ->showNoCore() ->showInstalled() - ->getList(TRUE); + ->getList(true); $themes = $this->extensionManager->discoverThemes() ->showCore() ->showNoCore() ->showInstalled() - ->getList(TRUE); + ->getList(true); $profiles = $this->extensionManager->discoverProfiles() ->showCore() ->showNoCore() ->showInstalled() - ->getList(TRUE); + ->getList(true); $this->extensions = array_merge( $modules, @@ -100,7 +102,8 @@ protected function isExtensionInstalled($extension){ * @param $annotation * @return array */ - protected function extractDependencies($annotation) { + protected function extractDependencies($annotation) + { $dependencies = []; if (array_key_exists('extension', $annotation)) { $dependencies[] = $annotation['extension']; @@ -111,4 +114,4 @@ protected function extractDependencies($annotation) { return $dependencies; } -} \ No newline at end of file +} diff --git a/src/Utils/DrupalApi.php b/src/Utils/DrupalApi.php index b0e660a33..06d580fef 100644 --- a/src/Utils/DrupalApi.php +++ b/src/Utils/DrupalApi.php @@ -314,14 +314,15 @@ private function getComposerReleases($url, $limit = 10, $unstable = false) * * Rebuilds all caches even when Drupal itself does not work. * - * @param \Composer\Autoload\ClassLoader $class_loader + * @param \Composer\Autoload\ClassLoader $class_loader * The class loader. * @param \Symfony\Component\HttpFoundation\Request $request * The current request. * * @see rebuild.php */ - public function drupal_rebuild($class_loader, \Symfony\Component\HttpFoundation\Request $request) { + public function drupal_rebuild($class_loader, \Symfony\Component\HttpFoundation\Request $request) + { // Remove Drupal's error and exception handlers; they rely on a working // service container and other subsystems and will only cause a fatal error // that hides the actual error. diff --git a/src/Utils/Site.php b/src/Utils/Site.php index c561f4cb7..aafe8cbfa 100644 --- a/src/Utils/Site.php +++ b/src/Utils/Site.php @@ -141,7 +141,7 @@ public function getAutoload() */ public function multisiteMode($uri) { - if($uri != 'default') { + if ($uri != 'default') { return true; } @@ -164,7 +164,7 @@ public function validMultisite($uri) return false; } - if(isset($sites[$uri]) && is_dir($this->appRoot . "/sites/" . $sites[$uri])) { + if (isset($sites[$uri]) && is_dir($this->appRoot . "/sites/" . $sites[$uri])) { return true; } From 38e26f8b2043aecb7fff1c022ca553338efda35c Mon Sep 17 00:00:00 2001 From: Perttu Ehn Date: Mon, 19 Dec 2016 18:25:37 +0200 Subject: [PATCH 089/321] [site:install] Allow empty db password (#3027) --- src/Command/Site/InstallCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Command/Site/InstallCommand.php b/src/Command/Site/InstallCommand.php index 94423b957..a32144063 100644 --- a/src/Command/Site/InstallCommand.php +++ b/src/Command/Site/InstallCommand.php @@ -391,7 +391,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $dbHost = $input->getOption('db-host')?:'127.0.0.1'; $dbName = $input->getOption('db-name')?:'drupal_'.time(); $dbUser = $input->getOption('db-user')?:'root'; - $dbPass = $input->getOption('db-pass')?:'root'; + $dbPass = $input->getOption('db-pass'); $dbPrefix = $input->getOption('db-prefix'); $dbPort = $input->getOption('db-port')?:'3306'; $force = $input->getOption('force'); From ee702af379b906c5598a4065355d5bfdf27347d5 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 19 Dec 2016 09:47:35 -0800 Subject: [PATCH 090/321] [config:*:single] Fix config single options (#3028) * [console] Show error on command registration error. * [config:export:single] Multiple fixes and improvements * [config:import:single] Multiple fixes and improvements --- src/Application.php | 3 +- src/Command/Config/ExportSingleCommand.php | 120 +++++++++++---------- src/Command/Config/ImportSingleCommand.php | 107 +++++++++--------- 3 files changed, 116 insertions(+), 114 deletions(-) diff --git a/src/Application.php b/src/Application.php index 7d6eba6f2..89188594b 100644 --- a/src/Application.php +++ b/src/Application.php @@ -148,6 +148,8 @@ private function registerCommands() try { $command = $this->container->get($name); } catch (\Exception $e) { + echo $name . ' - ' . $e->getMessage() . PHP_EOL; + continue; } @@ -189,7 +191,6 @@ public function getData() 'help', 'init', 'list', - // 'self-update', 'server' ]; $languages = $this->container->get('console.configuration_manager') diff --git a/src/Command/Config/ExportSingleCommand.php b/src/Command/Config/ExportSingleCommand.php index 4a63b1d7f..ee628f1d5 100644 --- a/src/Command/Config/ExportSingleCommand.php +++ b/src/Command/Config/ExportSingleCommand.php @@ -63,37 +63,31 @@ protected function configure() $this ->setName('config:export:single') ->setDescription($this->trans('commands.config.export.single.description')) - ->addArgument( - 'config-name', - InputArgument::OPTIONAL, - $this->trans('commands.config.export.single.arguments.config-name') - ) ->addOption( - 'config-names', - null, + 'name', + '', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.config.export.single.arguments.config-names') - ) - ->addOption( + $this->trans('commands.config.export.single.options.name') + )->addOption( 'directory', '', InputOption::VALUE_OPTIONAL, $this->trans('commands.config.export.arguments.directory') - ) - ->addOption( + )->addOption( + 'module', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.common.options.module') + )->addOption( 'include-dependencies', '', InputOption::VALUE_NONE, $this->trans('commands.config.export.single.options.include-dependencies') )->addOption( - 'module', '', - InputOption::VALUE_OPTIONAL, - $this->trans('commands.common.options.module') - )->addOption( - 'optional-config', + 'optional', '', - InputOption::VALUE_OPTIONAL, - $this->trans('commands.config.export.single.options.optional-config') + InputOption::VALUE_NONE, + $this->trans('commands.config.export.single.options.optional') )->addOption( 'remove-uuid', '', @@ -136,7 +130,7 @@ function ($definition) { */ protected function getConfigNames($config_type) { - + $names = []; // For a given entity type, load all entities. if ($config_type && $config_type !== 'system.simple') { $entity_storage = $this->entityTypeManager->getStorage($config_type); @@ -179,40 +173,39 @@ protected function interact(InputInterface $input, OutputInterface $output) $config_types = $this->getConfigTypes(); - $config_name = $input->getArgument('config-name'); - if (!$config_name) { - $config_type = $io->choiceNoList( + $name = $input->getOption('name'); + if (!$name) { + $type = $io->choiceNoList( $this->trans('commands.config.export.single.questions.config-type'), array_keys($config_types), - $this->trans('commands.config.export.single.options.simple-configuration') + 'system.simple' ); - $config_names = $this->getConfigNames($config_type); + $names = $this->getConfigNames($type); - $config_name = $io->choiceNoList( - $this->trans('commands.config.export.single.questions.config-name'), - array_keys($config_names) + $name = $io->choiceNoList( + $this->trans('commands.config.export.single.questions.name'), + array_keys($names) ); - if ($config_type !== 'system.simple') { - $definition = $this->entityTypeManager->getDefinition($config_type); - $config_name = $definition->getConfigPrefix() . '.' . $config_name; + if ($type !== 'system.simple') { + $definition = $this->entityTypeManager->getDefinition($type); + $name = $definition->getConfigPrefix() . '.' . $name; } - - $input->setArgument('config-name', $config_name); + $input->setOption('name', $name); } $module = $input->getOption('module'); - if ($module) { - $optionalConfig = $input->getOption('optional-config'); + $optionalConfig = $input->getOption('optional'); if (!$optionalConfig) { $optionalConfig = $io->confirm( - $this->trans('commands.config.export.single.questions.optional-config'), + $this->trans('commands.config.export.single.questions.optional'), true ); - $input->setOption('optional-config', $optionalConfig); + $input->setOption('optional', $optionalConfig); } } + if (!$input->getOption('remove-uuid')) { $removeUuid = $io->confirm( $this->trans('commands.config.export.single.questions.remove-uuid'), @@ -239,27 +232,28 @@ protected function execute(InputInterface $input, OutputInterface $output) $directory = $input->getOption('directory'); $module = $input->getOption('module'); - $configNames = $input->getOption('config-names'); - $configNameArg = $input->getArgument('config-name'); - $optionalConfig = $input->getOption('optional-config'); + $ame = $input->getOption('name'); + $optional = $input->getOption('optional'); $removeUuid = $input->getOption('remove-uuid'); $removeHash = $input->getOption('remove-config-hash'); - - if (empty($configNames) && isset($configNameArg)) { - $configNames = array($configNameArg); - } - foreach ($configNames as $configName) { - $config = $this->getConfiguration($configName, $removeUuid, $removeHash); - $config = $this->getConfiguration($configName, false); + foreach ($ame as $nameItem) { + $config = $this->getConfiguration( + $nameItem, + $removeUuid, + $removeHash + ); if ($config) { - $this->configExport[$configName] = array('data' => $config, 'optional' => $optionalConfig); + $this->configExport[$nameItem] = [ + 'data' => $config, + 'optional' => $optional + ]; if ($input->getOption('include-dependencies')) { // Include config dependencies in export files if ($dependencies = $this->fetchDependencies($config, 'config')) { - $this->resolveDependencies($dependencies, $optionalConfig); + $this->resolveDependencies($dependencies, $optional); } } } else { @@ -267,14 +261,28 @@ protected function execute(InputInterface $input, OutputInterface $output) } } - if (!$module) { - if (!$directory) { - $directory = config_get_config_directory(CONFIG_SYNC_DIRECTORY); - } + if ($module) { + $this->exportConfigToModule( + $module, + $io, + $this->trans( + 'commands.config.export.single.messages.config_exported' + ) + ); + + return 0; + } - $this->exportConfig($directory, $io, $this->trans('commands.config.export.single.messages.config_exported')); - } else { - $this->exportConfigToModule($module, $io, $this->trans('commands.config.export.single.messages.config_exported')); + if (!$directory) { + $directory = config_get_config_directory(CONFIG_SYNC_DIRECTORY); } + + $this->exportConfig( + $directory, + $io, + $this->trans('commands.config.export.single.messages.config_exported') + ); + + return 0; } } diff --git a/src/Command/Config/ImportSingleCommand.php b/src/Command/Config/ImportSingleCommand.php index 3b0f7e8b4..752f9ef8c 100644 --- a/src/Command/Config/ImportSingleCommand.php +++ b/src/Command/Config/ImportSingleCommand.php @@ -57,19 +57,17 @@ protected function configure() $this ->setName('config:import:single') ->setDescription($this->trans('commands.config.import.single.description')) - ->addArgument( - 'name', InputArgument::OPTIONAL, - $this->trans('commands.config.import.single.arguments.name') - ) - ->addArgument( - 'file', InputArgument::OPTIONAL, - $this->trans('commands.config.import.single.arguments.file') - ) - ->addOption( - 'config-names', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.config.import.single.arguments.config-names') - ) ->addOption( + 'name', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.config.import.single.options.name') + )->addOption( + 'file', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.config.import.single.options.file') + )->addOption( 'directory', '', InputOption::VALUE_OPTIONAL, @@ -84,19 +82,11 @@ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); - $configNames = $input->getOption('config-names'); + $name = $input->getOption('name'); $directory = $input->getOption('directory'); + $file = $input->getOption('file'); - $configNameArg = $input->getArgument('name'); - $fileName = $input->getArgument('file'); - - $singleMode = false; - if (empty($configNames) && isset($configNameArg)) { - $singleMode = true; - $configNames = array($configNameArg); - } - - if (!isset($fileName) && !$directory) { + if (!$file && !$directory) { $directory = config_get_config_directory(CONFIG_SYNC_DIRECTORY); } @@ -106,43 +96,36 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->configStorage ); - foreach ($configNames as $configName) { + foreach ($name as $nameItem) { // Allow for accidental .yml extension. - if (substr($configName, -4) === '.yml') { - $configName = substr($configName, 0, -4); - } - - if ($singleMode === false) { - $fileName = $directory.DIRECTORY_SEPARATOR.$configName.'.yml'; - } - - $value = null; - if (!empty($fileName) && file_exists($fileName)) { - $value = $ymlFile->parse(file_get_contents($fileName)); + if (substr($nameItem, -4) === '.yml') { + $nameItem = substr($nameItem, 0, -4); } - if (empty($value)) { - $io->error($this->trans('commands.config.import.single.messages.empty-value')); - - return; + $configFile = $directory.DIRECTORY_SEPARATOR.$nameItem.'.yml'; + if (file_exists($configFile)) { + $value = $ymlFile->parse(file_get_contents($configFile)); + $source_storage->replaceData($nameItem, $value); + continue; } - $source_storage->replaceData($configName, $value); + $io->error($this->trans('commands.config.import.single.messages.empty-value')); + return 1; } - $storage_comparer = new StorageComparer( + $storageComparer = new StorageComparer( $source_storage, $this->configStorage, $this->configManager ); - if ($this->configImport($io, $storage_comparer)) { + if ($this->configImport($io, $storageComparer)) { $io->success( sprintf( $this->trans( 'commands.config.import.single.messages.success' ), - implode(", ", $configNames) + implode(", ", $name) ) ); } @@ -153,10 +136,10 @@ protected function execute(InputInterface $input, OutputInterface $output) } } - private function configImport($io, StorageComparer $storage_comparer) + private function configImport($io, StorageComparer $storageComparer) { - $config_importer = new ConfigImporter( - $storage_comparer, + $configImporter = new ConfigImporter( + $storageComparer, \Drupal::service('event_dispatcher'), \Drupal::service('config.manager'), \Drupal::lock(), @@ -167,17 +150,17 @@ private function configImport($io, StorageComparer $storage_comparer) \Drupal::service('string_translation') ); - if ($config_importer->alreadyImporting()) { + if ($configImporter->alreadyImporting()) { $io->success($this->trans('commands.config.import.messages.already-imported')); } else { try { - if ($config_importer->validate()) { - $sync_steps = $config_importer->initialize(); + if ($configImporter->validate()) { + $sync_steps = $configImporter->initialize(); foreach ($sync_steps as $step) { $context = array(); do { - $config_importer->doSyncStep($step, $context); + $configImporter->doSyncStep($step, $context); } while ($context['finished'] < 1); } @@ -185,7 +168,7 @@ private function configImport($io, StorageComparer $storage_comparer) } } catch (ConfigImporterException $e) { $message = 'The import failed due for the following reasons:' . "\n"; - $message .= implode("\n", $config_importer->getErrors()); + $message .= implode("\n", $configImporter->getErrors()); $io->error( sprintf( $this->trans('commands.site.import.local.messages.error-writing'), @@ -209,20 +192,30 @@ private function configImport($io, StorageComparer $storage_comparer) protected function interact(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); - $name = $input->getArgument('name'); + $name = $input->getOption('name'); + $file = $input->getOption('file'); + $directory = $input->getOption('directory'); + if (!$name) { $name = $io->ask( $this->trans('commands.config.import.single.questions.name') ); - $input->setArgument('name', $name); + $input->setOption('name', $name); } - $file = $input->getArgument('file'); - if (!$file) { - $file = $io->ask( + if (!$directory && !$file) { + $file = $io->askEmpty( $this->trans('commands.config.import.single.questions.file') ); - $input->setArgument('file', $file); + $input->setOption('file', $file); + } + + + if (!$file && !$directory) { + $directory = $io->askEmpty( + $this->trans('commands.config.import.single.questions.directory') + ); + $input->setOption('directory', $directory); } } } From b4483c9eead49800a3111415d58cd789fe4eecca Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Tue, 20 Dec 2016 18:18:20 +0100 Subject: [PATCH 091/321] Remove duplicate declaration of Views base table. (#3025) --- .../src/Entity/entity-content-views-data.php.twig | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/templates/module/src/Entity/entity-content-views-data.php.twig b/templates/module/src/Entity/entity-content-views-data.php.twig index ffaed8650..c8ee2645b 100644 --- a/templates/module/src/Entity/entity-content-views-data.php.twig +++ b/templates/module/src/Entity/entity-content-views-data.php.twig @@ -10,14 +10,13 @@ namespace Drupal\{{ module }}\Entity; {% block use_class %} use Drupal\views\EntityViewsData; -use Drupal\views\EntityViewsDataInterface; {% endblock %} {% block class_declaration %} /** * Provides Views data for {{ label }} entities. */ -class {{ entity_class }}ViewsData extends EntityViewsData implements EntityViewsDataInterface {% endblock %} +class {{ entity_class }}ViewsData extends EntityViewsData {% endblock %} {% block class_methods %} /** * {@inheritdoc} @@ -25,11 +24,8 @@ class {{ entity_class }}ViewsData extends EntityViewsData implements EntityViews public function getViewsData() { $data = parent::getViewsData(); - $data['{{ entity_name }}']['table']['base'] = array( - 'field' => 'id', - 'title' => $this->t('{{ label }}'), - 'help' => $this->t('The {{ label }} ID.'), - ); + // Additional information for Views integration, such as table joins, can be + // put here. return $data; } From e4160798dc73edf402889c729b47181c083dbad5 Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Tue, 20 Dec 2016 18:29:37 +0100 Subject: [PATCH 092/321] Remove two unused use statements from the template to generate entity.page.inc. (#3026) --- templates/module/entity-content-page.php.twig | 2 -- 1 file changed, 2 deletions(-) diff --git a/templates/module/entity-content-page.php.twig b/templates/module/entity-content-page.php.twig index 4279ebe0d..4b855e446 100644 --- a/templates/module/entity-content-page.php.twig +++ b/templates/module/entity-content-page.php.twig @@ -9,8 +9,6 @@ {% block use_class %} use Drupal\Core\Render\Element; -use Drupal\Core\Link; -use Drupal\Core\Url; {% endblock %} {% block file_methods %} From bbcb43e0757cf1e4beeb41e7729313435095a520 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Tue, 20 Dec 2016 11:40:03 -0800 Subject: [PATCH 093/321] [multisite:new] Force sites.php file create/update. (#3031) --- src/Command/Multisite/NewCommand.php | 132 +++++++++++++-------------- 1 file changed, 65 insertions(+), 67 deletions(-) diff --git a/src/Command/Multisite/NewCommand.php b/src/Command/Multisite/NewCommand.php index 374bd61e1..6d0c18b57 100644 --- a/src/Command/Multisite/NewCommand.php +++ b/src/Command/Multisite/NewCommand.php @@ -10,6 +10,7 @@ use Drupal\Console\Command\Shared\CommandTrait; use Drupal\Console\Style\DrupalStyle; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -18,7 +19,7 @@ use Symfony\Component\Filesystem\Exception\FileNotFoundException; /** - * Class MultisiteNewCommand + * Class NewCommand * @package Drupal\Console\Command\Multisite */ class NewCommand extends Command @@ -38,14 +39,14 @@ public function __construct($appRoot) } /** - * @var \Symfony\Component\Filesystem\Filesystem; + * @var Filesystem; */ protected $fs; /** * @var string */ - protected $subdir = ''; + protected $directory = ''; /** * {@inheritdoc} @@ -56,21 +57,20 @@ public function configure() ->setDescription($this->trans('commands.multisite.new.description')) ->setHelp($this->trans('commands.multisite.new.help')) ->addArgument( - 'sites-subdir', - InputOption::VALUE_REQUIRED, - $this->trans('commands.multisite.new.arguments.sites-subdir') + 'directory', + InputArgument::REQUIRED, + $this->trans('commands.multisite.new.arguments.directory') ) - ->addOption( - 'site-uri', - '', - InputOption::VALUE_OPTIONAL, - $this->trans('commands.multisite.new.options.site-uri') + ->addArgument( + 'uri', + InputArgument::REQUIRED, + $this->trans('commands.multisite.new.arguments.uri') ) ->addOption( - 'copy-install', + 'copy-default', '', InputOption::VALUE_NONE, - $this->trans('commands.multisite.new.options.copy-install') + $this->trans('commands.multisite.new.options.copy-default') ); } @@ -79,21 +79,21 @@ public function configure() */ protected function execute(InputInterface $input, OutputInterface $output) { - $output = new DrupalStyle($input, $output); - $this->subdir = $input->getArgument('sites-subdir'); + $io = new DrupalStyle($input, $output); + $this->fs = new Filesystem(); + $this->directory = $input->getArgument('directory'); + + if (!$this->directory) { + $io->error($this->trans('commands.multisite.new.errors.subdir-empty')); - if (empty($this->subdir)) { - $output->error($this->trans('commands.multisite.new.errors.subdir-empty')); return 1; } - $this->fs = new Filesystem(); - - if ($this->fs->exists($this->appRoot . '/sites/' . $this->subdir)) { - $output->error( + if ($this->fs->exists($this->appRoot . '/sites/' . $this->directory)) { + $io->error( sprintf( $this->trans('commands.multisite.new.errors.subdir-exists'), - $this->subdir + $this->directory ) ); @@ -101,36 +101,34 @@ protected function execute(InputInterface $input, OutputInterface $output) } if (!$this->fs->exists($this->appRoot . '/sites/default')) { - $output->error($this->trans('commands.multisite.new.errors.default-missing')); + $io->error($this->trans('commands.multisite.new.errors.default-missing')); + return 1; } try { - $this->fs->mkdir($this->appRoot . '/sites/' . $this->subdir, 0755); + $this->fs->mkdir($this->appRoot . '/sites/' . $this->directory, 0755); } catch (IOExceptionInterface $e) { - $output->error( + $io->error( sprintf( $this->trans('commands.multisite.new.errors.mkdir-fail'), - $this->subdir + $this->directory ) ); + return 1; } - if ($uri = $input->getOption('site-uri')) { - try { - $this->addToSitesFile($output, $uri); - } catch (\Exception $e) { - $output->error($e->getMessage()); - return 1; - } - } + $uri = $input->getArgument('uri'); + try { + $this->addToSitesFile($io, $uri); + } catch (\Exception $e) { + $io->error($e->getMessage()); - if ($input->getOption('copy-install')) { - $this->copyExistingInstall($output); + return 1; } - $this->createFreshSite($output); + $this->createFreshSite($io); return 0; } @@ -159,7 +157,7 @@ protected function addToSitesFile(DrupalStyle $output, $uri) throw new FileNotFoundException($this->trans('commands.multisite.new.errors.sites-missing')); } - $sites_file_contents .= "\n\$sites['$uri'] = '$this->subdir';"; + $sites_file_contents .= "\n\$sites['$uri'] = '$this->directory';"; try { $this->fs->dumpFile($this->appRoot . '/sites/sites.php', $sites_file_contents); @@ -172,12 +170,12 @@ protected function addToSitesFile(DrupalStyle $output, $uri) /** * Copies detected default install alters settings.php to fit the new directory. * - * @param DrupalStyle $output + * @param DrupalStyle $io */ - protected function copyExistingInstall(DrupalStyle $output) + protected function copyExistingInstall(DrupalStyle $io) { if (!$this->fs->exists($this->appRoot . '/sites/default/settings.php')) { - $output->error( + $io->error( sprintf( $this->trans('commands.multisite.new.errors.file-missing'), 'sites/default/settings.php' @@ -190,46 +188,46 @@ protected function copyExistingInstall(DrupalStyle $output) try { $this->fs->mirror( $this->appRoot . '/sites/default/files', - $this->appRoot . '/sites/' . $this->subdir . '/files' + $this->appRoot . '/sites/' . $this->directory . '/files' ); } catch (IOExceptionInterface $e) { - $output->error( + $io->error( sprintf( $this->trans('commands.multisite.new.errors.copy-fail'), 'sites/default/files', - 'sites/' . $this->subdir . '/files' + 'sites/' . $this->directory . '/files' ) ); return; } } else { - $output->warning($this->trans('commands.multisite.new.warnings.missing-files')); + $io->warning($this->trans('commands.multisite.new.warnings.missing-files')); } $settings = file_get_contents($this->appRoot . '/sites/default/settings.php'); - $settings = str_replace('sites/default', 'sites/' . $this->subdir, $settings); + $settings = str_replace('sites/default', 'sites/' . $this->directory, $settings); try { $this->fs->dumpFile( - $this->appRoot . '/sites/' . $this->subdir . '/settings.php', + $this->appRoot . '/sites/' . $this->directory . '/settings.php', $settings ); } catch (IOExceptionInterface $e) { - $output->error( + $io->error( sprintf( $this->trans('commands.multisite.new.errors.write-fail'), - 'sites/' . $this->subdir . '/settings.php' + 'sites/' . $this->directory . '/settings.php' ) ); return; } - $this->chmodSettings($output); + $this->chmodSettings($io); - $output->success( + $io->success( sprintf( - $this->trans('commands.multisite.new.messages.copy-install'), - $this->subdir + $this->trans('commands.multisite.new.messages.copy-default'), + $this->directory ) ); } @@ -237,28 +235,28 @@ protected function copyExistingInstall(DrupalStyle $output) /** * Creates site folder with clean settings.php file. * - * @param DrupalStyle $output + * @param DrupalStyle $io */ - protected function createFreshSite(DrupalStyle $output) + protected function createFreshSite(DrupalStyle $io) { if ($this->fs->exists($this->appRoot . '/sites/default/default.settings.php')) { try { $this->fs->copy( $this->appRoot . '/sites/default/default.settings.php', - $this->appRoot . '/sites/' . $this->subdir . '/settings.php' + $this->appRoot . '/sites/' . $this->directory . '/settings.php' ); } catch (IOExceptionInterface $e) { - $output->error( + $io->error( sprintf( $this->trans('commands.multisite.new.errors.copy-fail'), $this->appRoot . '/sites/default/default.settings.php', - $this->appRoot . '/sites/' . $this->subdir . '/settings.php' + $this->appRoot . '/sites/' . $this->directory . '/settings.php' ) ); return; } } else { - $output->error( + $io->error( sprintf( $this->trans('commands.multisite.new.errors.file-missing'), 'sites/default/default.settings.php' @@ -267,12 +265,12 @@ protected function createFreshSite(DrupalStyle $output) return; } - $this->chmodSettings($output); + $this->chmodSettings($io); - $output->success( + $io->success( sprintf( $this->trans('commands.multisite.new.messages.fresh-site'), - $this->subdir + $this->directory ) ); } @@ -284,17 +282,17 @@ protected function createFreshSite(DrupalStyle $output) * anyone. Also, Drupal likes being able to write to it during, for example, * a fresh install. * - * @param DrupalStyle $output + * @param DrupalStyle $io */ - protected function chmodSettings(DrupalStyle $output) + protected function chmodSettings(DrupalStyle $io) { try { - $this->fs->chmod($this->appRoot . '/sites/' . $this->subdir . '/settings.php', 0640); + $this->fs->chmod($this->appRoot . '/sites/' . $this->directory . '/settings.php', 0640); } catch (IOExceptionInterface $e) { - $output->error( + $io->error( sprintf( $this->trans('commands.multisite.new.errors.chmod-fail'), - $this->appRoot . '/sites/' . $this->subdir . '/settings.php' + $this->appRoot . '/sites/' . $this->directory . '/settings.php' ) ); } From b3d2c88fccffa156f70481fe2b0b8f055fa70712 Mon Sep 17 00:00:00 2001 From: Nick Wilde Date: Tue, 20 Dec 2016 13:28:43 -0800 Subject: [PATCH 094/321] Nick wilde1990 generator white space fixes (#3032) * Update FormAlterGenerator.php * Update AuthenticationProviderGenerator.php * Update BreakPointGenerator.php * Update EntityBundleGenerator.php * Update EntityConfigGenerator.php * Update ControllerGenerator.php * Update EntityContentGenerator.php * Update EventSubscriberGenerator.php * Update FormGenerator.php * Update PluginConditionGenerator.php * Update PluginCKEditorButtonGenerator.php * Update HelpGenerator.php * Update PluginViewsFieldGenerator.php * Update UpdateGenerator.php * Update TwigExtensionGenerator.php * Update ThemeGenerator.php * Update ServiceGenerator.php * Update RouteSubscriberGenerator.php * Update PostUpdateGenerator.php --- src/Generator/AuthenticationProviderGenerator.php | 4 ++-- src/Generator/BreakPointGenerator.php | 4 ++-- src/Generator/ControllerGenerator.php | 4 ++-- src/Generator/EntityBundleGenerator.php | 4 ++-- src/Generator/EntityConfigGenerator.php | 4 ++-- src/Generator/EntityContentGenerator.php | 4 ++-- src/Generator/EventSubscriberGenerator.php | 4 ++-- src/Generator/FormAlterGenerator.php | 4 ++-- src/Generator/FormGenerator.php | 4 ++-- src/Generator/HelpGenerator.php | 4 ++-- src/Generator/PluginCKEditorButtonGenerator.php | 4 ++-- src/Generator/PluginConditionGenerator.php | 5 ++--- src/Generator/PluginViewsFieldGenerator.php | 4 ++-- src/Generator/PostUpdateGenerator.php | 4 ++-- src/Generator/RouteSubscriberGenerator.php | 4 ++-- src/Generator/ServiceGenerator.php | 4 ++-- src/Generator/ThemeGenerator.php | 4 ++-- src/Generator/TwigExtensionGenerator.php | 4 ++-- src/Generator/UpdateGenerator.php | 4 ++-- 19 files changed, 38 insertions(+), 39 deletions(-) diff --git a/src/Generator/AuthenticationProviderGenerator.php b/src/Generator/AuthenticationProviderGenerator.php index bc7b6788b..dd5598f82 100644 --- a/src/Generator/AuthenticationProviderGenerator.php +++ b/src/Generator/AuthenticationProviderGenerator.php @@ -12,8 +12,8 @@ class AuthenticationProviderGenerator extends Generator { /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** diff --git a/src/Generator/BreakPointGenerator.php b/src/Generator/BreakPointGenerator.php index e036a54b0..7b7432f29 100644 --- a/src/Generator/BreakPointGenerator.php +++ b/src/Generator/BreakPointGenerator.php @@ -16,8 +16,8 @@ class BreakPointGenerator extends Generator { /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** diff --git a/src/Generator/ControllerGenerator.php b/src/Generator/ControllerGenerator.php index 21733e8b0..1f046bda9 100644 --- a/src/Generator/ControllerGenerator.php +++ b/src/Generator/ControllerGenerator.php @@ -12,8 +12,8 @@ class ControllerGenerator extends Generator { /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** diff --git a/src/Generator/EntityBundleGenerator.php b/src/Generator/EntityBundleGenerator.php index 67a671e5e..176d911eb 100644 --- a/src/Generator/EntityBundleGenerator.php +++ b/src/Generator/EntityBundleGenerator.php @@ -12,8 +12,8 @@ class EntityBundleGenerator extends Generator { /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** diff --git a/src/Generator/EntityConfigGenerator.php b/src/Generator/EntityConfigGenerator.php index e7fec2bb2..7ed90b7fc 100644 --- a/src/Generator/EntityConfigGenerator.php +++ b/src/Generator/EntityConfigGenerator.php @@ -12,8 +12,8 @@ class EntityConfigGenerator extends Generator { /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** diff --git a/src/Generator/EntityContentGenerator.php b/src/Generator/EntityContentGenerator.php index b4a076c6c..d6b0abaa3 100644 --- a/src/Generator/EntityContentGenerator.php +++ b/src/Generator/EntityContentGenerator.php @@ -15,8 +15,8 @@ class EntityContentGenerator extends Generator { /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** diff --git a/src/Generator/EventSubscriberGenerator.php b/src/Generator/EventSubscriberGenerator.php index bc7473ca7..5356efd6a 100644 --- a/src/Generator/EventSubscriberGenerator.php +++ b/src/Generator/EventSubscriberGenerator.php @@ -12,8 +12,8 @@ class EventSubscriberGenerator extends Generator { /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** diff --git a/src/Generator/FormAlterGenerator.php b/src/Generator/FormAlterGenerator.php index 6c8fe59dd..49ac143f5 100644 --- a/src/Generator/FormAlterGenerator.php +++ b/src/Generator/FormAlterGenerator.php @@ -12,8 +12,8 @@ class FormAlterGenerator extends Generator { /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** diff --git a/src/Generator/FormGenerator.php b/src/Generator/FormGenerator.php index c7b68b7e1..e1c73d7af 100644 --- a/src/Generator/FormGenerator.php +++ b/src/Generator/FormGenerator.php @@ -13,8 +13,8 @@ class FormGenerator extends Generator { /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** diff --git a/src/Generator/HelpGenerator.php b/src/Generator/HelpGenerator.php index 185d4250b..15634165f 100644 --- a/src/Generator/HelpGenerator.php +++ b/src/Generator/HelpGenerator.php @@ -12,8 +12,8 @@ class HelpGenerator extends Generator { /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** diff --git a/src/Generator/PluginCKEditorButtonGenerator.php b/src/Generator/PluginCKEditorButtonGenerator.php index d809e7b9d..c510cea6f 100644 --- a/src/Generator/PluginCKEditorButtonGenerator.php +++ b/src/Generator/PluginCKEditorButtonGenerator.php @@ -12,8 +12,8 @@ class PluginCKEditorButtonGenerator extends Generator { /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; diff --git a/src/Generator/PluginConditionGenerator.php b/src/Generator/PluginConditionGenerator.php index 60fe6cf01..5655c0975 100644 --- a/src/Generator/PluginConditionGenerator.php +++ b/src/Generator/PluginConditionGenerator.php @@ -16,11 +16,10 @@ class PluginConditionGenerator extends Generator { /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; - /** * PluginConditionGenerator constructor. * @param Manager $extensionManager diff --git a/src/Generator/PluginViewsFieldGenerator.php b/src/Generator/PluginViewsFieldGenerator.php index 3e8c7cbc2..65d1871f3 100644 --- a/src/Generator/PluginViewsFieldGenerator.php +++ b/src/Generator/PluginViewsFieldGenerator.php @@ -12,8 +12,8 @@ class PluginViewsFieldGenerator extends Generator { /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** diff --git a/src/Generator/PostUpdateGenerator.php b/src/Generator/PostUpdateGenerator.php index e9205514f..ecf8333dd 100644 --- a/src/Generator/PostUpdateGenerator.php +++ b/src/Generator/PostUpdateGenerator.php @@ -12,8 +12,8 @@ class PostUpdateGenerator extends Generator { /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** diff --git a/src/Generator/RouteSubscriberGenerator.php b/src/Generator/RouteSubscriberGenerator.php index 9e451439a..e80c89236 100644 --- a/src/Generator/RouteSubscriberGenerator.php +++ b/src/Generator/RouteSubscriberGenerator.php @@ -12,8 +12,8 @@ class RouteSubscriberGenerator extends Generator { /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** diff --git a/src/Generator/ServiceGenerator.php b/src/Generator/ServiceGenerator.php index 2ab2fe4be..20c65945f 100644 --- a/src/Generator/ServiceGenerator.php +++ b/src/Generator/ServiceGenerator.php @@ -12,8 +12,8 @@ class ServiceGenerator extends Generator { /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** diff --git a/src/Generator/ThemeGenerator.php b/src/Generator/ThemeGenerator.php index 6b686a336..d9cf133fd 100644 --- a/src/Generator/ThemeGenerator.php +++ b/src/Generator/ThemeGenerator.php @@ -15,8 +15,8 @@ class ThemeGenerator extends Generator { /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** diff --git a/src/Generator/TwigExtensionGenerator.php b/src/Generator/TwigExtensionGenerator.php index 76c474a2f..aec492bb4 100644 --- a/src/Generator/TwigExtensionGenerator.php +++ b/src/Generator/TwigExtensionGenerator.php @@ -16,8 +16,8 @@ class TwigExtensionGenerator extends Generator { /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** diff --git a/src/Generator/UpdateGenerator.php b/src/Generator/UpdateGenerator.php index fe8243f6d..f170c1728 100644 --- a/src/Generator/UpdateGenerator.php +++ b/src/Generator/UpdateGenerator.php @@ -12,8 +12,8 @@ class UpdateGenerator extends Generator { /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** From 7d27a5a45c2e6e8bd40869053fdd1ccc62272625 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Tue, 20 Dec 2016 14:29:06 -0800 Subject: [PATCH 095/321] [config:export:single] Update translation key. (#3033) --- src/Command/Config/ExportSingleCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Command/Config/ExportSingleCommand.php b/src/Command/Config/ExportSingleCommand.php index ee628f1d5..cbfe66372 100644 --- a/src/Command/Config/ExportSingleCommand.php +++ b/src/Command/Config/ExportSingleCommand.php @@ -266,7 +266,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $module, $io, $this->trans( - 'commands.config.export.single.messages.config_exported' + 'commands.config.export.single.messages.config-exported' ) ); @@ -280,7 +280,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->exportConfig( $directory, $io, - $this->trans('commands.config.export.single.messages.config_exported') + $this->trans('commands.config.export.single.messages.config-exported') ); return 0; From e724d9df0ba6486071cdbc7826841379d1e7bd4f Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Tue, 20 Dec 2016 15:58:11 -0800 Subject: [PATCH 096/321] Remove translation directory (#3034) * [config:export:single] Update translation key. * Remove translations directory. --- config/translations/en/yaml.unset.yml | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 config/translations/en/yaml.unset.yml diff --git a/config/translations/en/yaml.unset.yml b/config/translations/en/yaml.unset.yml deleted file mode 100644 index 5d8418197..000000000 --- a/config/translations/en/yaml.unset.yml +++ /dev/null @@ -1,7 +0,0 @@ -key: - description: 'Unset a YAML key in a YAML file.' - arguments: - yaml-file: 'Path of YAML file to update' - yaml-key: 'YAML key to be unset' - messages: - unset: 'YAML file "%s" was unset successfully.' From 1fbe7801b80267b8ed3bc88318467e00cdafbcde Mon Sep 17 00:00:00 2001 From: GDrupal Date: Wed, 21 Dec 2016 11:57:34 -0300 Subject: [PATCH 097/321] Console issue 2996 replace deprecated revision author (#3030) * Extend from RevisionLogInterface. Replace several deprecated *RevisionAuthor* functions. * Replace several deprecated *RevisionAuthor* functions. * Add missing dependency. --- .../module/src/Controller/entity-controller.php.twig | 2 +- templates/module/src/Entity/Form/entity-content.php.twig | 2 +- templates/module/src/Entity/entity-content.php.twig | 8 ++++---- .../module/src/Entity/interface-entity-content.php.twig | 7 ++++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/templates/module/src/Controller/entity-controller.php.twig b/templates/module/src/Controller/entity-controller.php.twig index f1e4a49f5..3c2fcd829 100644 --- a/templates/module/src/Controller/entity-controller.php.twig +++ b/templates/module/src/Controller/entity-controller.php.twig @@ -93,7 +93,7 @@ class {{ entity_class }}Controller extends ControllerBase implements ContainerIn if ($revision->hasTranslation($langcode) && $revision->getTranslation($langcode)->isRevisionTranslationAffected()) { $username = [ '#theme' => 'username', - '#account' => $revision->getRevisionAuthor(), + '#account' => $revision->getRevisionUser(), ]; // Use revision link to link to revisions that are not active. diff --git a/templates/module/src/Entity/Form/entity-content.php.twig b/templates/module/src/Entity/Form/entity-content.php.twig index 1cc9a7cf2..e703e5f17 100644 --- a/templates/module/src/Entity/Form/entity-content.php.twig +++ b/templates/module/src/Entity/Form/entity-content.php.twig @@ -57,7 +57,7 @@ class {{ entity_class }}Form extends ContentEntityForm {% endblock %} // If a new revision is created, save the current user as revision author. $entity->setRevisionCreationTime(REQUEST_TIME); - $entity->setRevisionAuthorId(\Drupal::currentUser()->id()); + $entity->setRevisionUserId(\Drupal::currentUser()->id()); } else { $entity->setNewRevision(FALSE); diff --git a/templates/module/src/Entity/entity-content.php.twig b/templates/module/src/Entity/entity-content.php.twig index 862e01a20..ae3f34240 100644 --- a/templates/module/src/Entity/entity-content.php.twig +++ b/templates/module/src/Entity/entity-content.php.twig @@ -146,8 +146,8 @@ class {{ entity_class }} extends {% if revisionable %}RevisionableContentEntityB // If no revision author has been set explicitly, make the {{ entity_name }} owner the // revision author. - if (!$this->getRevisionAuthor()) { - $this->setRevisionAuthorId($this->getOwnerId()); + if (!$this->getRevisionUser()) { + $this->setRevisionUserId($this->getOwnerId()); } } {% endif %} @@ -255,14 +255,14 @@ class {{ entity_class }} extends {% if revisionable %}RevisionableContentEntityB /** * {@inheritdoc} */ - public function getRevisionAuthor() { + public function getRevisionUser() { return $this->get('revision_uid')->entity; } /** * {@inheritdoc} */ - public function setRevisionAuthorId($uid) { + public function setRevisionUserId($uid) { $this->set('revision_uid', $uid); return $this; } diff --git a/templates/module/src/Entity/interface-entity-content.php.twig b/templates/module/src/Entity/interface-entity-content.php.twig index 7831466e3..9f7d3dad9 100644 --- a/templates/module/src/Entity/interface-entity-content.php.twig +++ b/templates/module/src/Entity/interface-entity-content.php.twig @@ -10,6 +10,7 @@ namespace Drupal\{{module}}\Entity; {% block use_class %} {% if revisionable %} +use Drupal\Core\Entity\RevisionLogInterface; use Drupal\Core\Entity\RevisionableInterface; use Drupal\Component\Utility\Xss; use Drupal\Core\Url; @@ -26,7 +27,7 @@ use Drupal\user\EntityOwnerInterface; * * @ingroup {{module}} */ -interface {{ entity_class }}Interface extends {% if revisionable %}RevisionableInterface{% else %} ContentEntityInterface{% endif %}, EntityChangedInterface, EntityOwnerInterface {% endblock %} +interface {{ entity_class }}Interface extends {% if revisionable %}RevisionableInterface, RevisionLogInterface{% else %} ContentEntityInterface{% endif %}, EntityChangedInterface, EntityOwnerInterface {% endblock %} {% block class_methods %} // Add get/set methods for your configuration properties here. @@ -125,7 +126,7 @@ interface {{ entity_class }}Interface extends {% if revisionable %}RevisionableI * @return \Drupal\user\UserInterface * The user entity for the revision author. */ - public function getRevisionAuthor(); + public function getRevisionUser(); /** * Sets the {{ label }} revision author. @@ -136,6 +137,6 @@ interface {{ entity_class }}Interface extends {% if revisionable %}RevisionableI * @return \Drupal\{{ module }}\Entity\{{ entity_class }}Interface * The called {{ label }} entity. */ - public function setRevisionAuthorId($uid); + public function setRevisionUserId($uid); {% endif %} {% endblock %} From f31a2526ba1c1ac28ddf9ed7cef29764e2ca4609 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Thu, 22 Dec 2016 03:27:03 +0100 Subject: [PATCH 098/321] [generate:profile] fix passing profile or machine name on the command line (#3036) When passing profile or machine-name on the command line like that: drupal generate:profile --profile=PROFILE --machine-name=MACHINE_NAME drupal console gives an error: Error: Call to undefined method Drupal\Console\Command\Generate\ProfileCommand::validateModuleName() in Drupal\Console\Command\Generate\ProfileCommand->interact() (line 234 of .../vendor/drupal/console/src/Command/Generate/ProfileCommand.php). After fixing this another similar error shows up: Error: Call to undefined method Drupal\Console\Command\Generate\ProfileCommand::validateModule() in Drupal\Console\Command\Generate\ProfileCommand->interact() (line 253 of .../vendor/drupal/console/src/Command/Generate/ProfileCommand.php). Fix both so that the command line from above works again. Closes #3035 --- src/Command/Generate/ProfileCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Command/Generate/ProfileCommand.php b/src/Command/Generate/ProfileCommand.php index 0abd64674..db2580a44 100644 --- a/src/Command/Generate/ProfileCommand.php +++ b/src/Command/Generate/ProfileCommand.php @@ -231,7 +231,7 @@ protected function interact(InputInterface $input, OutputInterface $output) try { // A profile is technically also a module, so we can use the same // validator to check the name. - $profile = $input->getOption('profile') ? $this->validateModuleName($input->getOption('profile')) : null; + $profile = $input->getOption('profile') ? $validators->validateModuleName($input->getOption('profile')) : null; } catch (\Exception $error) { $io->error($error->getMessage()); @@ -250,7 +250,7 @@ function ($profile) use ($validators) { } try { - $machine_name = $input->getOption('machine-name') ? $this->validateModule($input->getOption('machine-name')) : null; + $machine_name = $input->getOption('machine-name') ? $validators->validateModuleName($input->getOption('machine-name')) : null; } catch (\Exception $error) { $io->error($error->getMessage()); From ebcd2a140836ec5fb6d57116275c4a32d298281b Mon Sep 17 00:00:00 2001 From: Nick Wilde Date: Thu, 22 Dec 2016 08:11:06 -0800 Subject: [PATCH 099/321] Use question strings generate:plugin:block (#3039) There are question strings defined but they aren't used, unlike in other plugin generation commands. --- src/Command/Generate/PluginBlockCommand.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Command/Generate/PluginBlockCommand.php b/src/Command/Generate/PluginBlockCommand.php index 3a4cf9021..5f8aa71ab 100644 --- a/src/Command/Generate/PluginBlockCommand.php +++ b/src/Command/Generate/PluginBlockCommand.php @@ -234,7 +234,7 @@ protected function interact(InputInterface $input, OutputInterface $output) $class = $input->getOption('class'); if (!$class) { $class = $io->ask( - $this->trans('commands.generate.plugin.block.options.class'), + $this->trans('commands.generate.plugin.block.questions.class'), 'DefaultBlock', function ($class) { return $this->validator->validateClassName($class); @@ -247,7 +247,7 @@ function ($class) { $label = $input->getOption('label'); if (!$label) { $label = $io->ask( - $this->trans('commands.generate.plugin.block.options.label'), + $this->trans('commands.generate.plugin.block.questions.label'), $this->stringConverter->camelCaseToHuman($class) ); $input->setOption('label', $label); @@ -257,7 +257,7 @@ function ($class) { $pluginId = $input->getOption('plugin-id'); if (!$pluginId) { $pluginId = $io->ask( - $this->trans('commands.generate.plugin.block.options.plugin-id'), + $this->trans('commands.generate.plugin.block.questions.plugin-id'), $this->stringConverter->camelCaseToUnderscore($class) ); $input->setOption('plugin-id', $pluginId); @@ -267,7 +267,7 @@ function ($class) { $themeRegion = $input->getOption('theme-region'); if (!$themeRegion) { $themeRegion = $io->choiceNoList( - $this->trans('commands.generate.plugin.block.options.theme-region'), + $this->trans('commands.generate.plugin.block.questions.theme-region'), array_values($themeRegions), null, true From da0e61df3451d465334ee0f6750d557f37073165 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 22 Dec 2016 15:48:04 -0800 Subject: [PATCH 100/321] [console] Tag 1.0.0-rc12 release. (#3040) --- composer.json | 2 +- composer.lock | 202 ++++++++++++++++++++++---------------------- src/Application.php | 2 +- 3 files changed, 104 insertions(+), 102 deletions(-) diff --git a/composer.json b/composer.json index 68da77952..da5e09128 100644 --- a/composer.json +++ b/composer.json @@ -37,9 +37,9 @@ }, "require": { "php": "^5.5.9 || ^7.0", + "drupal/console-core" : "1.0.0-rc12", "alchemy/zippy": "0.3.5", "composer/installers": "~1.0", - "drupal/console-core" : "~1.0", "symfony/css-selector": ">=2.7 <3.2", "symfony/dom-crawler": ">=2.7 <3.2", "symfony/http-foundation": ">=2.7 <3.2", diff --git a/composer.lock b/composer.lock index 4525b68c8..02f9aecd4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "abc4204e3a3d233d485f486e24f25a8a", - "content-hash": "d87c94c69b0633a18e20de8337c4595d", + "content-hash": "ae85b832e356668e1095cf4fbe43156f", "packages": [ { "name": "alchemy/zippy", @@ -67,7 +66,7 @@ "tar", "zip" ], - "time": "2016-02-15 22:46:40" + "time": "2016-02-15T22:46:40+00:00" }, { "name": "composer/installers", @@ -174,7 +173,7 @@ "zend", "zikula" ], - "time": "2016-08-13 20:53:52" + "time": "2016-08-13T20:53:52+00:00" }, { "name": "dflydev/dot-access-configuration", @@ -288,7 +287,7 @@ "dot", "notation" ], - "time": "2015-08-13 03:51:18" + "time": "2015-08-13T03:51:18+00:00" }, { "name": "dflydev/placeholder-resolver", @@ -340,7 +339,7 @@ "placeholder", "resolver" ], - "time": "2012-10-28 21:08:28" + "time": "2012-10-28T21:08:28+00:00" }, { "name": "doctrine/annotations", @@ -408,7 +407,7 @@ "docblock", "parser" ], - "time": "2015-08-31 12:32:49" + "time": "2015-08-31T12:32:49+00:00" }, { "name": "doctrine/collections", @@ -474,7 +473,7 @@ "collections", "iterator" ], - "time": "2015-04-14 22:21:58" + "time": "2015-04-14T22:21:58+00:00" }, { "name": "doctrine/lexer", @@ -528,25 +527,25 @@ "lexer", "parser" ], - "time": "2014-09-09 13:34:57" + "time": "2014-09-09T13:34:57+00:00" }, { "name": "drupal/console-core", - "version": "1.0.0-rc11", + "version": "1.0.0-rc12", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "b0b73776d6495d253ed1dfdda67a6e05bb5895f6" + "reference": "59e2f5069db3eec1260eecd7e7b4e7167c36cc91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/b0b73776d6495d253ed1dfdda67a6e05bb5895f6", - "reference": "b0b73776d6495d253ed1dfdda67a6e05bb5895f6", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/59e2f5069db3eec1260eecd7e7b4e7167c36cc91", + "reference": "59e2f5069db3eec1260eecd7e7b4e7167c36cc91", "shasum": "" }, "require": { - "dflydev/dot-access-configuration": "dev-master#9dc52aeeab5ae99afcbb0d67bb5c1af8c87d03dc", - "drupal/console-en": "~1.0", + "dflydev/dot-access-configuration": "dev-master", + "drupal/console-en": "1.0.0-rc12", "php": "^5.5.9 || ^7.0", "stecman/symfony-console-completion": "~0.7", "symfony/config": ">=2.7 <3.2", @@ -609,20 +608,20 @@ "drupal", "symfony" ], - "time": "2016-12-12 21:43:08" + "time": "2016-12-22T23:33:09+00:00" }, { "name": "drupal/console-en", - "version": "1.0.0-rc11", + "version": "1.0.0-rc12", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", - "reference": "694f46c5dfa69efc3f8a0bdc6eab4d63c306b1b6" + "reference": "810cc4d3e45d47ff444be57c8d25f50ebfcfae28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/694f46c5dfa69efc3f8a0bdc6eab4d63c306b1b6", - "reference": "694f46c5dfa69efc3f8a0bdc6eab4d63c306b1b6", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/810cc4d3e45d47ff444be57c8d25f50ebfcfae28", + "reference": "810cc4d3e45d47ff444be57c8d25f50ebfcfae28", "shasum": "" }, "type": "drupal-console-language", @@ -663,7 +662,7 @@ "drupal", "symfony" ], - "time": "2016-12-12 17:16:39" + "time": "2016-12-22T23:08:32+00:00" }, { "name": "gabordemooij/redbean", @@ -704,7 +703,7 @@ "keywords": [ "orm" ], - "time": "2016-10-03 21:25:17" + "time": "2016-10-03T21:25:17+00:00" }, { "name": "guzzlehttp/guzzle", @@ -766,32 +765,32 @@ "rest", "web service" ], - "time": "2016-10-08 15:01:37" + "time": "2016-10-08T15:01:37+00:00" }, { "name": "guzzlehttp/promises", - "version": "1.3.0", + "version": "v1.3.1", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "2693c101803ca78b27972d84081d027fca790a1e" + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/2693c101803ca78b27972d84081d027fca790a1e", - "reference": "2693c101803ca78b27972d84081d027fca790a1e", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", "shasum": "" }, "require": { "php": ">=5.5.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "^4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -817,7 +816,7 @@ "keywords": [ "promise" ], - "time": "2016-11-18 17:47:58" + "time": "2016-12-20T10:07:11+00:00" }, { "name": "guzzlehttp/psr7", @@ -875,7 +874,7 @@ "stream", "uri" ], - "time": "2016-06-24 23:00:38" + "time": "2016-06-24T23:00:38+00:00" }, { "name": "psr/cache", @@ -921,7 +920,7 @@ "psr", "psr-6" ], - "time": "2016-08-06 20:24:11" + "time": "2016-08-06T20:24:11+00:00" }, { "name": "psr/http-message", @@ -971,7 +970,7 @@ "request", "response" ], - "time": "2016-08-06 14:39:51" + "time": "2016-08-06T14:39:51+00:00" }, { "name": "psr/log", @@ -1018,7 +1017,7 @@ "psr", "psr-3" ], - "time": "2016-10-10 12:19:37" + "time": "2016-10-10T12:19:37+00:00" }, { "name": "stecman/symfony-console-completion", @@ -1063,11 +1062,11 @@ } ], "description": "Automatic BASH completion for Symfony Console Component based applications.", - "time": "2016-02-24 05:08:54" + "time": "2016-02-24T05:08:54+00:00" }, { "name": "symfony/cache", - "version": "v3.1.7", + "version": "v3.1.8", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", @@ -1129,26 +1128,29 @@ "caching", "psr6" ], - "time": "2016-11-09 14:09:05" + "time": "2016-11-09T14:09:05+00:00" }, { "name": "symfony/config", - "version": "v3.1.7", + "version": "v3.1.8", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "ab4fa32ffe6e625f9b7444e5e8d4702a0bc3ad7a" + "reference": "b0fe918a721df5194ec5785fabb771302f2ca474" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/ab4fa32ffe6e625f9b7444e5e8d4702a0bc3ad7a", - "reference": "ab4fa32ffe6e625f9b7444e5e8d4702a0bc3ad7a", + "url": "https://api.github.com/repos/symfony/config/zipball/b0fe918a721df5194ec5785fabb771302f2ca474", + "reference": "b0fe918a721df5194ec5785fabb771302f2ca474", "shasum": "" }, "require": { "php": ">=5.5.9", "symfony/filesystem": "~2.8|~3.0" }, + "require-dev": { + "symfony/yaml": "~2.7|~3.0" + }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" }, @@ -1182,20 +1184,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2016-11-03 08:04:31" + "time": "2016-12-10T08:22:22+00:00" }, { "name": "symfony/console", - "version": "v3.1.7", + "version": "v3.1.8", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "5be36e1f3ac7ecbe7e34fb641480ad8497b83aa6" + "reference": "221a60fb2f369a065eea1ed96b61183219fdfa6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/5be36e1f3ac7ecbe7e34fb641480ad8497b83aa6", - "reference": "5be36e1f3ac7ecbe7e34fb641480ad8497b83aa6", + "url": "https://api.github.com/repos/symfony/console/zipball/221a60fb2f369a065eea1ed96b61183219fdfa6e", + "reference": "221a60fb2f369a065eea1ed96b61183219fdfa6e", "shasum": "" }, "require": { @@ -1243,11 +1245,11 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-11-16 22:17:09" + "time": "2016-12-08T14:58:14+00:00" }, { "name": "symfony/css-selector", - "version": "v3.1.7", + "version": "v3.1.8", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", @@ -1296,11 +1298,11 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2016-11-03 08:04:31" + "time": "2016-11-03T08:04:31+00:00" }, { "name": "symfony/debug", - "version": "v3.1.7", + "version": "v3.1.8", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", @@ -1353,20 +1355,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2016-11-15 12:55:20" + "time": "2016-11-15T12:55:20+00:00" }, { "name": "symfony/dependency-injection", - "version": "v3.1.7", + "version": "v3.1.8", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "87598e21bb9020bd9ccd6df6936b9c369c72775d" + "reference": "bd2a915cd29ccfc93c2835765a8b06dd1cc83aa9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/87598e21bb9020bd9ccd6df6936b9c369c72775d", - "reference": "87598e21bb9020bd9ccd6df6936b9c369c72775d", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/bd2a915cd29ccfc93c2835765a8b06dd1cc83aa9", + "reference": "bd2a915cd29ccfc93c2835765a8b06dd1cc83aa9", "shasum": "" }, "require": { @@ -1413,20 +1415,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2016-11-18 21:15:08" + "time": "2016-12-08T14:58:14+00:00" }, { "name": "symfony/dom-crawler", - "version": "v3.1.7", + "version": "v3.1.8", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "1eb3b4d216e8db117218dd2bb7d23dfe67bdf518" + "reference": "51e979357eba65b1e6aac7cba75cf5aa6379b8f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/1eb3b4d216e8db117218dd2bb7d23dfe67bdf518", - "reference": "1eb3b4d216e8db117218dd2bb7d23dfe67bdf518", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/51e979357eba65b1e6aac7cba75cf5aa6379b8f3", + "reference": "51e979357eba65b1e6aac7cba75cf5aa6379b8f3", "shasum": "" }, "require": { @@ -1469,11 +1471,11 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2016-11-14 16:20:02" + "time": "2016-12-10T14:24:45+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v3.1.7", + "version": "v3.1.8", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -1529,11 +1531,11 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2016-10-13 06:28:43" + "time": "2016-10-13T06:28:43+00:00" }, { "name": "symfony/expression-language", - "version": "v3.1.7", + "version": "v3.1.8", "source": { "type": "git", "url": "https://github.com/symfony/expression-language.git", @@ -1578,20 +1580,20 @@ ], "description": "Symfony ExpressionLanguage Component", "homepage": "https://symfony.com", - "time": "2016-11-03 08:04:31" + "time": "2016-11-03T08:04:31+00:00" }, { "name": "symfony/filesystem", - "version": "v3.1.7", + "version": "v3.1.8", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "0565b61bf098cb4dc09f4f103f033138ae4f42c6" + "reference": "509b2bc3636f11be17f5d8b5f083803c3257dc65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/0565b61bf098cb4dc09f4f103f033138ae4f42c6", - "reference": "0565b61bf098cb4dc09f4f103f033138ae4f42c6", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/509b2bc3636f11be17f5d8b5f083803c3257dc65", + "reference": "509b2bc3636f11be17f5d8b5f083803c3257dc65", "shasum": "" }, "require": { @@ -1627,20 +1629,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2016-10-18 04:30:12" + "time": "2016-11-24T00:33:22+00:00" }, { "name": "symfony/finder", - "version": "v3.1.7", + "version": "v3.1.8", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "9925935bf7144f9e4d2b976905881b4face036fb" + "reference": "74dcd370c8d057882575e535616fde935e411b19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/9925935bf7144f9e4d2b976905881b4face036fb", - "reference": "9925935bf7144f9e4d2b976905881b4face036fb", + "url": "https://api.github.com/repos/symfony/finder/zipball/74dcd370c8d057882575e535616fde935e411b19", + "reference": "74dcd370c8d057882575e535616fde935e411b19", "shasum": "" }, "require": { @@ -1676,20 +1678,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2016-11-03 08:04:31" + "time": "2016-12-13T09:38:21+00:00" }, { "name": "symfony/http-foundation", - "version": "v3.1.7", + "version": "v3.1.8", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "5a4c8099a1547fe451256e056180ad4624177017" + "reference": "88a1d3cee2dbd06f7103ff63938743b903b65a92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/5a4c8099a1547fe451256e056180ad4624177017", - "reference": "5a4c8099a1547fe451256e056180ad4624177017", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/88a1d3cee2dbd06f7103ff63938743b903b65a92", + "reference": "88a1d3cee2dbd06f7103ff63938743b903b65a92", "shasum": "" }, "require": { @@ -1729,7 +1731,7 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2016-11-16 22:17:09" + "time": "2016-11-27T04:21:07+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -1788,20 +1790,20 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2016-11-14T01:06:16+00:00" }, { "name": "symfony/process", - "version": "v3.1.7", + "version": "v3.1.8", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "66de154ae86b1a07001da9fbffd620206e4faf94" + "reference": "d23427a7f97a373129f61bc3b876fe4c66e2b3c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/66de154ae86b1a07001da9fbffd620206e4faf94", - "reference": "66de154ae86b1a07001da9fbffd620206e4faf94", + "url": "https://api.github.com/repos/symfony/process/zipball/d23427a7f97a373129f61bc3b876fe4c66e2b3c7", + "reference": "d23427a7f97a373129f61bc3b876fe4c66e2b3c7", "shasum": "" }, "require": { @@ -1837,11 +1839,11 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2016-09-29 14:13:09" + "time": "2016-11-24T01:08:05+00:00" }, { "name": "symfony/translation", - "version": "v3.1.7", + "version": "v3.1.8", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", @@ -1901,20 +1903,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2016-11-18 21:15:08" + "time": "2016-11-18T21:15:08+00:00" }, { "name": "symfony/yaml", - "version": "v3.1.7", + "version": "v3.1.8", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "9da375317228e54f4ea1b013b30fa47417e84943" + "reference": "da61ca54e755bda2108f97ce67c37f0713df15b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/9da375317228e54f4ea1b013b30fa47417e84943", - "reference": "9da375317228e54f4ea1b013b30fa47417e84943", + "url": "https://api.github.com/repos/symfony/yaml/zipball/da61ca54e755bda2108f97ce67c37f0713df15b2", + "reference": "da61ca54e755bda2108f97ce67c37f0713df15b2", "shasum": "" }, "require": { @@ -1950,20 +1952,20 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-11-18 21:05:29" + "time": "2016-12-03T10:04:08+00:00" }, { "name": "twig/twig", - "version": "v1.28.2", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "b22ce0eb070e41f7cba65d78fe216de29726459c" + "reference": "74f723e542368ca2080b252740be5f1113ebb898" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/b22ce0eb070e41f7cba65d78fe216de29726459c", - "reference": "b22ce0eb070e41f7cba65d78fe216de29726459c", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/74f723e542368ca2080b252740be5f1113ebb898", + "reference": "74f723e542368ca2080b252740be5f1113ebb898", "shasum": "" }, "require": { @@ -1976,7 +1978,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.28-dev" + "dev-master": "1.29-dev" } }, "autoload": { @@ -2011,7 +2013,7 @@ "keywords": [ "templating" ], - "time": "2016-11-23 18:41:40" + "time": "2016-12-13T17:28:18+00:00" }, { "name": "webflo/drupal-finder", @@ -2048,7 +2050,7 @@ } ], "description": "Helper class to locate a Drupal installation from a given path.", - "time": "2016-11-28 18:50:45" + "time": "2016-11-28T18:50:45+00:00" } ], "packages-dev": [], diff --git a/src/Application.php b/src/Application.php index 89188594b..1daa081f8 100644 --- a/src/Application.php +++ b/src/Application.php @@ -23,7 +23,7 @@ class Application extends ConsoleApplication /** * @var string */ - const VERSION = '1.0.0-rc11'; + const VERSION = '1.0.0-rc12'; public function __construct(ContainerInterface $container) { From 24f519b734d41f63b024991a20ed8ed65ef4c003 Mon Sep 17 00:00:00 2001 From: Christoph Burschka Date: Tue, 27 Dec 2016 02:46:49 +0100 Subject: [PATCH 101/321] Fix constructor args in two commands (#3041) (#3044) - config:validate overrides the parent constructor's optional name argument with a constructor that requires it. - generate:module requires an argument that is not defined in the corresponding services file, and should be optional. --- src/Command/Config/ValidateCommand.php | 6 ------ src/Command/Generate/ModuleCommand.php | 4 ++-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Command/Config/ValidateCommand.php b/src/Command/Config/ValidateCommand.php index 5bf4b2e4c..8e2e82e38 100644 --- a/src/Command/Config/ValidateCommand.php +++ b/src/Command/Config/ValidateCommand.php @@ -27,12 +27,6 @@ class ValidateCommand extends Command use SchemaCheckTrait; use PrintConfigValidationTrait; - public function __construct($name) - { - parent::__construct($name); - } - - /** * {@inheritdoc} */ diff --git a/src/Command/Generate/ModuleCommand.php b/src/Command/Generate/ModuleCommand.php index 76605644a..202cc82d9 100644 --- a/src/Command/Generate/ModuleCommand.php +++ b/src/Command/Generate/ModuleCommand.php @@ -78,7 +78,7 @@ class ModuleCommand extends Command * @param DrupalApi $drupalApi * @param Client $httpClient * @param Site $site - * @param $twigtemplate + * @param $twigtemplate */ public function __construct( ModuleGenerator $generator, @@ -88,7 +88,7 @@ public function __construct( DrupalApi $drupalApi, Client $httpClient, Site $site, - $twigtemplate + $twigtemplate = NULL ) { $this->generator = $generator; $this->validator = $validator; From 2daeb3f2b7fd3bc3b507edccfe71498fc07f026f Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 26 Dec 2016 17:47:23 -0800 Subject: [PATCH 102/321] [multisite:debug] Fix site path. (#3046) --- export-config-list-sample.yml | 6 ------ import-config-list-sample.yml | 6 ------ phpqa.yml | 2 +- src/Command/Multisite/DebugCommand.php | 2 +- 4 files changed, 2 insertions(+), 14 deletions(-) delete mode 100644 export-config-list-sample.yml delete mode 100644 import-config-list-sample.yml diff --git a/export-config-list-sample.yml b/export-config-list-sample.yml deleted file mode 100644 index 8149eba5e..000000000 --- a/export-config-list-sample.yml +++ /dev/null @@ -1,6 +0,0 @@ -commands: - - command: 'config:export:single' - options: - config-names: - - core.extension - - system.site \ No newline at end of file diff --git a/import-config-list-sample.yml b/import-config-list-sample.yml deleted file mode 100644 index 28d554443..000000000 --- a/import-config-list-sample.yml +++ /dev/null @@ -1,6 +0,0 @@ -commands: - - command: 'config:import:single' - options: - config-names: - - system.site - - core.extension \ No newline at end of file diff --git a/phpqa.yml b/phpqa.yml index c05323fc4..30c73aab2 100644 --- a/phpqa.yml +++ b/phpqa.yml @@ -36,7 +36,7 @@ application: arguments: - '-n' phpcs: - enabled: true + enabled: false exception: false options: standard: PSR2 diff --git a/src/Command/Multisite/DebugCommand.php b/src/Command/Multisite/DebugCommand.php index aafac4269..a1036d805 100644 --- a/src/Command/Multisite/DebugCommand.php +++ b/src/Command/Multisite/DebugCommand.php @@ -84,7 +84,7 @@ protected function execute(InputInterface $input, OutputInterface $output) foreach ($sites as $site => $directory) { $tableRows[] = [ $site, - $this->appRoot . '/' . $directory + $this->appRoot . '/sites/' . $directory ]; } From a76d51c3bb6b30e4f783338b619dfa035cd95347 Mon Sep 17 00:00:00 2001 From: Nick Wilde Date: Mon, 26 Dec 2016 17:49:53 -0800 Subject: [PATCH 103/321] database:add command (#3037) * database:add command * Switch order of default and custom Much more frequent to want $databases['custom']['default'] than the other way around - for exampale with the migrate drush commands. --- config/services/drupal-console/database.yml | 5 + config/services/drupal-console/generator.yml | 5 + src/Command/Database/AddCommand.php | 172 +++++++++++++++++++ src/Generator/DatabaseSettingsGenerator.php | 49 ++++++ templates/database/add.php.twig | 10 ++ 5 files changed, 241 insertions(+) create mode 100644 src/Command/Database/AddCommand.php create mode 100644 src/Generator/DatabaseSettingsGenerator.php create mode 100644 templates/database/add.php.twig diff --git a/config/services/drupal-console/database.yml b/config/services/drupal-console/database.yml index 348f5d394..65327cec7 100644 --- a/config/services/drupal-console/database.yml +++ b/config/services/drupal-console/database.yml @@ -1,4 +1,9 @@ services: + console.database_add: + class: Drupal\Console\Command\Database\AddCommand + arguments: ['@console.database_settings_generator'] + tags: + - { name: drupal.command } console.database_client: class: Drupal\Console\Command\Database\ClientCommand tags: diff --git a/config/services/drupal-console/generator.yml b/config/services/drupal-console/generator.yml index bcd4fdc5a..877cfd78b 100644 --- a/config/services/drupal-console/generator.yml +++ b/config/services/drupal-console/generator.yml @@ -166,6 +166,11 @@ services: arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + console.database_settings_generator: + class: Drupal\Console\Generator\DatabaseSettingsGenerator + arguments: ['@kernel'] + tags: + - { name: drupal.generator } console.entitycontent_generator: class: Drupal\Console\Generator\EntityContentGenerator arguments: ['@console.extension_manager', '@console.site', '@console.renderer'] diff --git a/src/Command/Database/AddCommand.php b/src/Command/Database/AddCommand.php new file mode 100644 index 000000000..19412cce1 --- /dev/null +++ b/src/Command/Database/AddCommand.php @@ -0,0 +1,172 @@ +generator = $generator; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('database:add') + ->setDescription($this->trans('commands.database.add.description')) + ->addOption( + 'database', + '', + InputOption::VALUE_REQUIRED, + $this->trans('commands.database.add.options.database') + ) + ->addOption( + 'username', + '', + InputOption::VALUE_REQUIRED, + $this->trans('commands.database.add.options.username') + ) + ->addOption( + 'password', + '', + InputOption::VALUE_REQUIRED, + $this->trans('commands.database.add.options.password') + ) + ->addOption( + 'prefix', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.database.add.options.prefix') + ) + ->addOption( + 'host', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.database.add.options.host') + ) + ->addOption( + 'port', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.database.add.options.port') + ) + ->addOption( + 'driver', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.database.add.options.driver') + ) + ->setHelp($this->trans('commands.database.add.help')); + } + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + $result = $this + ->generator + ->generate($input->getOptions()); + if (!$result) { + $io->error($this->trans('commands.database.add.error')); + } + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $database = $input->getOption('database'); + if (!$database) { + $database = $io->ask( + $this->trans('commands.database.add.questions.database'), + 'migrate_db' + ); + } + $input->setOption('database', $database); + $username = $input->getOption('username'); + if (!$username) { + $username = $io->ask( + $this->trans('commands.database.add.questions.username'), + '' + ); + } + $input->setOption('username', $username); + $password = $input->getOption('password'); + if (!$password) { + $password = $io->ask( + $this->trans('commands.database.add.questions.password'), + '' + ); + } + $input->setOption('password', $password); + $prefix = $input->getOption('prefix'); + if (!$prefix) { + $prefix = $io->ask( + $this->trans('commands.database.add.questions.prefix'), + FALSE + ); + } + $input->setOption('prefix', $prefix); + $host = $input->getOption('host'); + if (!$host) { + $host = $io->ask( + $this->trans('commands.database.add.questions.host'), + 'localhost' + ); + } + $input->setOption('host', $host); + $port = $input->getOption('port'); + if (!$port) { + $port = $io->ask( + $this->trans('commands.database.add.questions.port'), + 3306 + ); + } + $input->setOption('port', $port); + $driver = $input->getOption('driver'); + if (!$driver) { + $driver = $io->ask( + $this->trans('commands.database.add.questions.driver'), + 'mysql' + ); + } + $input->setOption('driver', $driver); + } +} \ No newline at end of file diff --git a/src/Generator/DatabaseSettingsGenerator.php b/src/Generator/DatabaseSettingsGenerator.php new file mode 100644 index 000000000..617f842e4 --- /dev/null +++ b/src/Generator/DatabaseSettingsGenerator.php @@ -0,0 +1,49 @@ +kernel = $kernel; + } + + + /** + * Generator Plugin Block. + * + * @param $parameters + */ + public function generate($parameters) + { + $settingsFile = $this->kernel->getSitePath().'/settings.php'; + if (!is_writable($settingsFile)) { + return false; + } + return $this->renderFile( + 'database/add.php.twig', + $settingsFile, + $parameters, + FILE_APPEND + ); + } +} \ No newline at end of file diff --git a/templates/database/add.php.twig b/templates/database/add.php.twig new file mode 100644 index 000000000..c279c9fbd --- /dev/null +++ b/templates/database/add.php.twig @@ -0,0 +1,10 @@ + +$databases['{{ database }}']['default'] = [ + 'database' => '{{ database }}', + 'username' => '{{ username }}', + 'password' => '{{ password }}', + 'host' => '{{ host }}', + 'port' => '{{ port }}', + 'driver' => '{{ driver }}', + 'prefix' => '{{ prefix }}', +]; From 22527f1edcd3b4e3934304e4c22102e85dea77a2 Mon Sep 17 00:00:00 2001 From: Nick Wilde Date: Mon, 26 Dec 2016 17:50:47 -0800 Subject: [PATCH 104/321] generate:plugin:migrate:source (#3038) * generate:plugin:migrate:source * Fix: mostly minor formatting/standards stuff. little touchups to generate standards compliant code Remove extra ] in genereated code autosuggest for class names is now --- config/services/drupal-console/generate.yml | 5 + config/services/drupal-console/generator.yml | 5 + .../Generate/PluginMigrateSourceCommand.php | 266 ++++++++++++++++++ .../PluginMigrateSourceGenerator.php | 59 ++++ .../src/Plugin/migrate/source/source.php.twig | 55 ++++ 5 files changed, 390 insertions(+) create mode 100644 src/Command/Generate/PluginMigrateSourceCommand.php create mode 100644 src/Generator/PluginMigrateSourceGenerator.php create mode 100644 templates/module/src/Plugin/migrate/source/source.php.twig diff --git a/config/services/drupal-console/generate.yml b/config/services/drupal-console/generate.yml index b16112a07..41a8cfdf2 100644 --- a/config/services/drupal-console/generate.yml +++ b/config/services/drupal-console/generate.yml @@ -99,6 +99,11 @@ services: arguments: ['@console.extension_manager', '@console.plugin_mail_generator','@console.string_converter', '@console.validator', '@console.chain_queue'] tags: - { name: drupal.command } + console.generate_plugin_migrate_source: + class: Drupal\Console\Command\Generate\PluginMigrateSourceCommand + arguments: ['@config.factory', '@console.chain_queue', '@console.plugin_migrate_source_generator', '@entity_type.manager', '@console.extension_manager', '@console.validator', '@console.string_converter', '@plugin.manager.element_info'] + tags: + - { name: drupal.command } console.generate_plugin_rest_resource: class: Drupal\Console\Command\Generate\PluginRestResourceCommand arguments: ['@console.extension_manager', '@console.plugin_rest_resource_generator','@console.string_converter', '@console.chain_queue'] diff --git a/config/services/drupal-console/generator.yml b/config/services/drupal-console/generator.yml index 877cfd78b..2b7ea49bb 100644 --- a/config/services/drupal-console/generator.yml +++ b/config/services/drupal-console/generator.yml @@ -96,6 +96,11 @@ services: arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + console.plugin_migrate_source_generator: + class: Drupal\Console\Generator\PluginMigrateSourceGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } console.plugin_rest_resource_generator: class: Drupal\Console\Generator\PluginRestResourceGenerator arguments: ['@console.extension_manager'] diff --git a/src/Command/Generate/PluginMigrateSourceCommand.php b/src/Command/Generate/PluginMigrateSourceCommand.php new file mode 100644 index 000000000..287a1ef86 --- /dev/null +++ b/src/Command/Generate/PluginMigrateSourceCommand.php @@ -0,0 +1,266 @@ +configFactory = $configFactory; + $this->chainQueue = $chainQueue; + $this->generator = $generator; + $this->entityTypeManager = $entityTypeManager; + $this->extensionManager = $extensionManager; + $this->validator = $validator; + $this->stringConverter = $stringConverter; + $this->elementInfoManager = $elementInfoManager; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:plugin:migrate:source') + ->setDescription($this->trans('commands.generate.plugin.migrate.source.description')) + ->setHelp($this->trans('commands.generate.plugin.migrate.source.help')) + ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'class', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.migrate.source.options.class') + ) + ->addOption( + 'plugin-id', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.migrate.source.options.plugin-id') + ) + ->addOption( + 'table', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.migrate.source.options.table') + ) + ->addOption( + 'alias', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.migrate.source.options.alias') + ) + ->addOption( + 'group-by', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.migrate.source.options.group-by') + ) + ->addOption( + 'fields', + '', + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.generate.plugin.migrate.source.options.fields') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $class_name = $input->getOption('class'); + $plugin_id = $input->getOption('plugin-id'); + $table = $input->getOption('table'); + $alias = $input->getOption('alias'); + $group_by = $input->getOption('group-by'); + $fields = $input->getOption('fields'); + + $this->generator + ->generate( + $module, + $class_name, + $plugin_id, + $table, + $alias, + $group_by, + $fields + ); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + $class = $input->getOption('class'); + if (!$class) { + $class = $io->ask( + $this->trans('commands.generate.plugin.migrate.source.questions.class'), + ucfirst($this->stringConverter->underscoreToCamelCase($module)), + function ($class) { + return $this->validator->validateClassName($class); + } + ); + $input->setOption('class', $class); + } + + $pluginId = $input->getOption('plugin-id'); + if (!$pluginId) { + $pluginId = $io->ask( + $this->trans('commands.generate.plugin.migrate.source.questions.plugin-id'), + $this->stringConverter->camelCaseToUnderscore($class) + ); + $input->setOption('plugin-id', $pluginId); + } + + $table = $input->getOption('table'); + if (!$table) { + $table = $io->ask( + $this->trans('commands.generate.plugin.migrate.source.questions.table'), + '' + ); + $input->setOption('table', $table); + } + + $alias = $input->getOption('alias'); + if (!$alias) { + $alias = $io->ask( + $this->trans('commands.generate.plugin.migrate.source.questions.alias'), + substr($table, 0, 1) + ); + $input->setOption('alias', $alias); + } + + $groupBy = $input->getOption('group-by'); + if ($groupBy == '') { + $groupBy = $io->ask( + $this->trans('commands.generate.plugin.migrate.source.questions.group-by'), + false + ); + $input->setOption('group-by', $groupBy); + } + + $fields = $input->getOption('fields'); + if (!$fields) { + $fields = []; + while(true) { + $id = $io->ask( + $this->trans('commands.generate.plugin.migrate.source.questions.fields.id'), + false + ); + if (!$id) { + break; + } + $description = $io->ask( + $this->trans('commands.generate.plugin.migrate.source.questions.fields.description'), + $id + ); + $fields[] = [ + 'id' => $id, + 'description' => $description, + ]; + } + $input->setOption('fields', $fields); + } + } +} diff --git a/src/Generator/PluginMigrateSourceGenerator.php b/src/Generator/PluginMigrateSourceGenerator.php new file mode 100644 index 000000000..163d4861c --- /dev/null +++ b/src/Generator/PluginMigrateSourceGenerator.php @@ -0,0 +1,59 @@ +extensionManager = $extensionManager; + } + + /** + * Generate Migrate Source plugin code. + * + * @param $module + * @param $class_name + * @param $plugin_id + * @param $table + * @param $alias + * @param $group_by + * @param fields + */ + public function generate($module, $class_name, $plugin_id, $table, $alias, $group_by, $fields) + { + + $parameters = [ + 'module' => $module, + 'class_name' => $class_name, + 'plugin_id' => $plugin_id, + 'table' => $table, + 'alias' => $alias, + 'group_by' => $group_by, + 'fields' => $fields, + ]; + + $this->renderFile( + 'module/src/Plugin/migrate/source/source.php.twig', + $this->extensionManager->getPluginPath($module, 'migrate').'/source/'.$class_name.'.php', + $parameters + ); + } +} diff --git a/templates/module/src/Plugin/migrate/source/source.php.twig b/templates/module/src/Plugin/migrate/source/source.php.twig new file mode 100644 index 000000000..1f8ee6e23 --- /dev/null +++ b/templates/module/src/Plugin/migrate/source/source.php.twig @@ -0,0 +1,55 @@ +{% extends "base/class.php.twig" %} + +{% block file_path %} +\Drupal\{{module}}\Plugin\migrate\source\{{class_name}}. +{% endblock %} + +{% block namespace_class %} +namespace Drupal\{{module}}\Plugin\migrate\source; +{% endblock %} + +{% block use_class %} +use Drupal\migrate\Plugin\migrate\source\SqlBase; +{% endblock %} + +{% block class_declaration %} +/** + * Provides a '{{class_name}}' migrate source. + * + * @MigrateSource( + * id = "{{plugin_id}}" + * ) + */ +class {{class_name}} extends SqlBase {% endblock %} +{% block class_methods %} + /** + * {@inheritdoc} + */ + public function query() { + + return $this->select('{{table}}', '{{alias}}') + ->fields('{{alias}}'){% if group_by %} + ->groupBy('{{alias}}.{{group_by}}') + {% endif %}; + } + + /** + * {@inheritdoc} + */ + public function fields() { + $fields = [ + {% for field in fields %} + '{{field.id}}' => $this->t('{{field.description}}'), + {% endfor %} +]; + return $fields; + } + + /** + * {@inheritdoc} + */ + public function getIds() { + return [ + ]; + } +{% endblock %} From 44e2cd183e430922d1260b7c2226f2f5101a5ef4 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 28 Dec 2016 09:16:25 -0800 Subject: [PATCH 105/321] Update core namespace (#3051) * [console] Update console-core namespace. * [console] Update composer dev-master. * [console] Update ChainQueue namespaces. * [console] Update ShellProcess namespace. * [console] Update NestedArray namespace. * [console] Update InputTrait namespace. --- bin/drupal.php | 2 +- composer.json | 2 +- composer.lock | 42 ++++++++++--------- src/Application.php | 5 ++- src/Bootstrap/AddServicesCompilerPass.php | 2 +- src/Bootstrap/Drupal.php | 5 ++- src/Command/Breakpoints/DebugCommand.php | 4 +- src/Command/Cache/ContextDebugCommand.php | 4 +- src/Command/Cache/RebuildCommand.php | 4 +- src/Command/Config/DebugCommand.php | 4 +- src/Command/Config/DeleteCommand.php | 4 +- src/Command/Config/DiffCommand.php | 4 +- src/Command/Config/EditCommand.php | 6 +-- src/Command/Config/ExportCommand.php | 4 +- .../Config/ExportContentTypeCommand.php | 4 +- src/Command/Config/ExportSingleCommand.php | 4 +- src/Command/Config/ExportViewCommand.php | 4 +- src/Command/Config/ImportCommand.php | 4 +- src/Command/Config/ImportSingleCommand.php | 4 +- src/Command/Config/OverrideCommand.php | 4 +- .../Config/PrintConfigValidationTrait.php | 2 +- src/Command/Config/SettingsDebugCommand.php | 4 +- src/Command/Config/ValidateCommand.php | 8 ++-- src/Command/Config/ValidateDebugCommand.php | 4 +- src/Command/ContainerDebugCommand.php | 4 +- src/Command/Create/CommentsCommand.php | 4 +- src/Command/Create/NodesCommand.php | 4 +- src/Command/Create/TermsCommand.php | 4 +- src/Command/Create/UsersCommand.php | 4 +- src/Command/Create/VocabulariesCommand.php | 4 +- src/Command/Cron/DebugCommand.php | 4 +- src/Command/Cron/ExecuteCommand.php | 6 +-- src/Command/Cron/ReleaseCommand.php | 6 +-- src/Command/Database/AddCommand.php | 4 +- src/Command/Database/ClientCommand.php | 4 +- src/Command/Database/ConnectCommand.php | 4 +- src/Command/Database/DatabaseLogBase.php | 6 +-- src/Command/Database/DropCommand.php | 4 +- src/Command/Database/DumpCommand.php | 6 +-- src/Command/Database/LogClearCommand.php | 4 +- src/Command/Database/LogDebugCommand.php | 4 +- src/Command/Database/LogPollCommand.php | 4 +- src/Command/Database/QueryCommand.php | 4 +- src/Command/Database/RestoreCommand.php | 4 +- src/Command/Database/TableDebugCommand.php | 4 +- src/Command/DevelDumperCommand.php | 4 +- src/Command/Develop/ExampleCommand.php | 4 +- .../Develop/ExampleContainerAwareCommand.php | 4 +- .../Develop/GenerateDocCheatsheetCommand.php | 4 +- .../Develop/GenerateDocDashCommand.php | 8 ++-- .../Develop/GenerateDocDataCommand.php | 4 +- .../Develop/GenerateDocGitbookCommand.php | 6 +-- .../Develop/TranslationCleanupCommand.php | 6 +-- .../Develop/TranslationPendingCommand.php | 8 ++-- .../Develop/TranslationStatsCommand.php | 10 ++--- .../Develop/TranslationSyncCommand.php | 6 +-- src/Command/Entity/DebugCommand.php | 4 +- src/Command/Entity/DeleteCommand.php | 4 +- src/Command/EventDebugCommand.php | 4 +- src/Command/Features/DebugCommand.php | 4 +- src/Command/Features/ImportCommand.php | 4 +- src/Command/Field/InfoCommand.php | 4 +- .../AuthenticationProviderCommand.php | 6 +-- src/Command/Generate/BreakPointCommand.php | 6 +-- src/Command/Generate/CommandCommand.php | 6 +-- .../Generate/ConfigFormBaseCommand.php | 4 +- src/Command/Generate/ControllerCommand.php | 12 +++--- src/Command/Generate/EntityBundleCommand.php | 4 +- src/Command/Generate/EntityCommand.php | 4 +- src/Command/Generate/EntityConfigCommand.php | 2 +- src/Command/Generate/EntityContentCommand.php | 6 +-- .../Generate/EventSubscriberCommand.php | 8 ++-- src/Command/Generate/FormAlterCommand.php | 8 ++-- src/Command/Generate/FormCommand.php | 8 ++-- src/Command/Generate/HelpCommand.php | 6 +-- src/Command/Generate/ModuleCommand.php | 6 +-- src/Command/Generate/ModuleFileCommand.php | 4 +- src/Command/Generate/PermissionCommand.php | 6 +-- src/Command/Generate/PluginBlockCommand.php | 8 ++-- .../Generate/PluginCKEditorButtonCommand.php | 8 ++-- .../Generate/PluginConditionCommand.php | 8 ++-- src/Command/Generate/PluginFieldCommand.php | 8 ++-- .../Generate/PluginFieldFormatterCommand.php | 8 ++-- .../Generate/PluginFieldTypeCommand.php | 8 ++-- .../Generate/PluginFieldWidgetCommand.php | 8 ++-- .../Generate/PluginImageEffectCommand.php | 8 ++-- .../Generate/PluginImageFormatterCommand.php | 8 ++-- src/Command/Generate/PluginMailCommand.php | 8 ++-- .../Generate/PluginMigrateSourceCommand.php | 8 ++-- .../Generate/PluginRestResourceCommand.php | 8 ++-- .../Generate/PluginRulesActionCommand.php | 8 ++-- .../Generate/PluginSkeletonCommand.php | 8 ++-- .../Generate/PluginTypeAnnotationCommand.php | 6 +-- .../Generate/PluginTypeYamlCommand.php | 8 ++-- .../Generate/PluginViewsFieldCommand.php | 8 ++-- src/Command/Generate/PostUpdateCommand.php | 6 +-- src/Command/Generate/ProfileCommand.php | 6 +-- .../Generate/RouteSubscriberCommand.php | 6 +-- src/Command/Generate/ServiceCommand.php | 8 ++-- src/Command/Generate/ThemeCommand.php | 6 +-- src/Command/Generate/TwigExtensionCommand.php | 8 ++-- src/Command/Generate/UpdateCommand.php | 6 +-- src/Command/Image/StylesDebugCommand.php | 6 +-- src/Command/Image/StylesFlushCommand.php | 4 +- src/Command/Libraries/DebugCommand.php | 4 +- src/Command/Locale/LanguageAddCommand.php | 4 +- src/Command/Locale/LanguageDeleteCommand.php | 4 +- .../Locale/TranslationStatusCommand.php | 4 +- src/Command/Migrate/DebugCommand.php | 4 +- src/Command/Migrate/ExecuteCommand.php | 4 +- src/Command/Migrate/SetupCommand.php | 4 +- src/Command/Module/DebugCommand.php | 6 +-- src/Command/Module/DownloadCommand.php | 8 ++-- src/Command/Module/InstallCommand.php | 6 +-- .../Module/InstallDependencyCommand.php | 6 +-- src/Command/Module/PathCommand.php | 4 +- src/Command/Module/UninstallCommand.php | 6 +-- src/Command/Module/UpdateCommand.php | 6 +-- src/Command/Multisite/DebugCommand.php | 4 +- src/Command/Multisite/NewCommand.php | 4 +- src/Command/Node/AccessRebuildCommand.php | 4 +- src/Command/PermissionDebugCommand.php | 4 +- src/Command/PluginDebugCommand.php | 4 +- src/Command/Queue/DebugCommand.php | 4 +- src/Command/Queue/RunCommand.php | 4 +- src/Command/Rest/DebugCommand.php | 4 +- src/Command/Rest/DisableCommand.php | 4 +- src/Command/Rest/EnableCommand.php | 4 +- src/Command/Router/DebugCommand.php | 4 +- src/Command/Router/RebuildCommand.php | 4 +- src/Command/ServerCommand.php | 4 +- src/Command/Shared/ConfirmationTrait.php | 2 +- src/Command/Shared/ConnectTrait.php | 2 +- src/Command/Shared/DatabaseTrait.php | 2 +- src/Command/Shared/EventsTrait.php | 2 +- src/Command/Shared/ExportTrait.php | 2 +- src/Command/Shared/FeatureTrait.php | 2 +- src/Command/Shared/FormTrait.php | 2 +- src/Command/Shared/MenuTrait.php | 4 +- src/Command/Shared/MigrationTrait.php | 4 +- src/Command/Shared/ModuleTrait.php | 4 +- src/Command/Shared/PermissionTrait.php | 2 +- src/Command/Shared/ProjectDownloadTrait.php | 6 +-- src/Command/Shared/ServicesTrait.php | 2 +- src/Command/Shared/ThemeBreakpointTrait.php | 2 +- src/Command/Shared/ThemeRegionTrait.php | 2 +- src/Command/Shared/TranslationTrait.php | 2 +- src/Command/Site/ImportLocalCommand.php | 6 +-- src/Command/Site/InstallCommand.php | 6 +-- src/Command/Site/MaintenanceCommand.php | 6 +-- src/Command/Site/ModeCommand.php | 8 ++-- src/Command/Site/StatisticsCommand.php | 4 +- src/Command/Site/StatusCommand.php | 4 +- src/Command/State/DebugCommand.php | 4 +- src/Command/State/DeleteCommand.php | 4 +- src/Command/State/OverrideCommand.php | 4 +- src/Command/Taxonomy/DeleteTermCommand.php | 4 +- src/Command/Test/DebugCommand.php | 4 +- src/Command/Test/RunCommand.php | 4 +- src/Command/Theme/DebugCommand.php | 4 +- src/Command/Theme/DownloadCommand.php | 4 +- src/Command/Theme/InstallCommand.php | 6 +-- src/Command/Theme/PathCommand.php | 4 +- src/Command/Theme/UninstallCommand.php | 6 +-- src/Command/Update/DebugCommand.php | 10 ++--- src/Command/Update/EntitiesCommand.php | 6 +-- src/Command/Update/ExecuteCommand.php | 12 +++--- src/Command/User/CreateCommand.php | 6 +-- src/Command/User/DebugCommand.php | 4 +- src/Command/User/DeleteCommand.php | 4 +- .../User/LoginCleanAttemptsCommand.php | 4 +- src/Command/User/LoginUrlCommand.php | 4 +- src/Command/User/PasswordHashCommand.php | 4 +- src/Command/User/PasswordResetCommand.php | 6 +-- src/Command/User/RoleCommand.php | 4 +- src/Command/Views/DebugCommand.php | 8 ++-- src/Command/Views/DisableCommand.php | 4 +- src/Command/Views/EnableCommand.php | 4 +- src/Command/Views/PluginsDebugCommand.php | 6 +-- src/Command/Yaml/DiffCommand.php | 6 +-- src/Command/Yaml/GetValueCommand.php | 6 +-- src/Command/Yaml/MergeCommand.php | 4 +- src/Command/Yaml/SplitCommand.php | 6 +-- src/Command/Yaml/UnsetKeyCommand.php | 6 +-- src/Command/Yaml/UpdateKeyCommand.php | 6 +-- src/Command/Yaml/UpdateValueCommand.php | 6 +-- .../AuthenticationProviderGenerator.php | 1 + src/Generator/BreakPointGenerator.php | 1 + src/Generator/CommandGenerator.php | 5 +-- src/Generator/ControllerGenerator.php | 1 + src/Generator/DatabaseSettingsGenerator.php | 1 + src/Generator/EntityBundleGenerator.php | 1 + src/Generator/EntityConfigGenerator.php | 1 + src/Generator/EntityContentGenerator.php | 4 +- src/Generator/EventSubscriberGenerator.php | 1 + src/Generator/FormAlterGenerator.php | 1 + src/Generator/FormGenerator.php | 3 +- src/Generator/GeneratorInterface.php | 8 ---- src/Generator/HelpGenerator.php | 1 + src/Generator/ModuleFileGenerator.php | 2 + src/Generator/ModuleGenerator.php | 2 + src/Generator/PermissionGenerator.php | 1 + src/Generator/PluginBlockGenerator.php | 1 + .../PluginCKEditorButtonGenerator.php | 3 +- src/Generator/PluginConditionGenerator.php | 1 + .../PluginFieldFormatterGenerator.php | 1 + src/Generator/PluginFieldTypeGenerator.php | 2 +- src/Generator/PluginFieldWidgetGenerator.php | 1 + src/Generator/PluginImageEffectGenerator.php | 1 + .../PluginImageFormatterGenerator.php | 1 + src/Generator/PluginMailGenerator.php | 1 + .../PluginMigrateSourceGenerator.php | 1 + src/Generator/PluginRestResourceGenerator.php | 6 +++ src/Generator/PluginRulesActionGenerator.php | 7 ++++ src/Generator/PluginSkeletonGenerator.php | 10 ++++- .../PluginTypeAnnotationGenerator.php | 7 ++++ src/Generator/PluginTypeYamlGenerator.php | 7 ++++ src/Generator/PluginViewsFieldGenerator.php | 1 + src/Generator/PostUpdateGenerator.php | 1 + src/Generator/ProfileGenerator.php | 2 + src/Generator/RouteSubscriberGenerator.php | 1 + src/Generator/ServiceGenerator.php | 1 + src/Generator/ThemeGenerator.php | 1 + src/Generator/TwigExtensionGenerator.php | 1 + src/Generator/UpdateGenerator.php | 1 + src/Utils/Validator.php | 2 +- 226 files changed, 564 insertions(+), 503 deletions(-) delete mode 100644 src/Generator/GeneratorInterface.php diff --git a/bin/drupal.php b/bin/drupal.php index 2a2389662..b54abd93c 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -1,7 +1,7 @@ =2.7 <3.2", diff --git a/composer.lock b/composer.lock index 02f9aecd4..b70a1c57c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "ae85b832e356668e1095cf4fbe43156f", + "content-hash": "4fa5e5170d08130d0acc773f3c1a8e44", "packages": [ { "name": "alchemy/zippy", @@ -531,21 +531,21 @@ }, { "name": "drupal/console-core", - "version": "1.0.0-rc12", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "59e2f5069db3eec1260eecd7e7b4e7167c36cc91" + "reference": "db06bb9fbe7851417a7abbbae5afe5a973de1a06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/59e2f5069db3eec1260eecd7e7b4e7167c36cc91", - "reference": "59e2f5069db3eec1260eecd7e7b4e7167c36cc91", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/db06bb9fbe7851417a7abbbae5afe5a973de1a06", + "reference": "db06bb9fbe7851417a7abbbae5afe5a973de1a06", "shasum": "" }, "require": { "dflydev/dot-access-configuration": "dev-master", - "drupal/console-en": "1.0.0-rc12", + "drupal/console-en": "self.version", "php": "^5.5.9 || ^7.0", "stecman/symfony-console-completion": "~0.7", "symfony/config": ">=2.7 <3.2", @@ -568,7 +568,7 @@ "src/functions.php" ], "psr-4": { - "Drupal\\Console\\": "src" + "Drupal\\Console\\Core\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -608,20 +608,20 @@ "drupal", "symfony" ], - "time": "2016-12-22T23:33:09+00:00" + "time": "2016-12-28 08:22:19" }, { "name": "drupal/console-en", - "version": "1.0.0-rc12", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", - "reference": "810cc4d3e45d47ff444be57c8d25f50ebfcfae28" + "reference": "815bd92f8984bb3a8ad8fceabdba60b1a50fe345" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/810cc4d3e45d47ff444be57c8d25f50ebfcfae28", - "reference": "810cc4d3e45d47ff444be57c8d25f50ebfcfae28", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/815bd92f8984bb3a8ad8fceabdba60b1a50fe345", + "reference": "815bd92f8984bb3a8ad8fceabdba60b1a50fe345", "shasum": "" }, "type": "drupal-console-language", @@ -662,7 +662,7 @@ "drupal", "symfony" ], - "time": "2016-12-22T23:08:32+00:00" + "time": "2016-12-27 01:51:22" }, { "name": "gabordemooij/redbean", @@ -1956,16 +1956,16 @@ }, { "name": "twig/twig", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "74f723e542368ca2080b252740be5f1113ebb898" + "reference": "c6ff71094fde15d12398eaba029434b013dc5e59" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/74f723e542368ca2080b252740be5f1113ebb898", - "reference": "74f723e542368ca2080b252740be5f1113ebb898", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/c6ff71094fde15d12398eaba029434b013dc5e59", + "reference": "c6ff71094fde15d12398eaba029434b013dc5e59", "shasum": "" }, "require": { @@ -1978,7 +1978,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.29-dev" + "dev-master": "1.30-dev" } }, "autoload": { @@ -2013,7 +2013,7 @@ "keywords": [ "templating" ], - "time": "2016-12-13T17:28:18+00:00" + "time": "2016-12-23T11:06:22+00:00" }, { "name": "webflo/drupal-finder", @@ -2056,7 +2056,9 @@ "packages-dev": [], "aliases": [], "minimum-stability": "dev", - "stability-flags": [], + "stability-flags": { + "drupal/console-core": 20 + }, "prefer-stable": true, "prefer-lowest": false, "platform": { diff --git a/src/Application.php b/src/Application.php index 1daa081f8..94ceb25b9 100644 --- a/src/Application.php +++ b/src/Application.php @@ -7,13 +7,14 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Console\Utils\AnnotationValidator; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Application as BaseApplication; /** * Class Application * @package Drupal\Console */ -class Application extends ConsoleApplication +class Application extends BaseApplication { /** * @var string diff --git a/src/Bootstrap/AddServicesCompilerPass.php b/src/Bootstrap/AddServicesCompilerPass.php index e0708bdfa..f7763b1b7 100644 --- a/src/Bootstrap/AddServicesCompilerPass.php +++ b/src/Bootstrap/AddServicesCompilerPass.php @@ -2,12 +2,12 @@ namespace Drupal\Console\Bootstrap; -use Drupal\Console\Extension\Manager; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\Finder\Finder; +use Drupal\Console\Extension\Manager; /** * FindCommandsCompilerPass diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index eeb0c2276..80ed8fd99 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -4,7 +4,8 @@ use Doctrine\Common\Annotations\AnnotationRegistry; use Symfony\Component\HttpFoundation\Request; -use Drupal\Console\Utils\ArgvInputReader; +use Drupal\Console\Core\Utils\ArgvInputReader; +use Drupal\Console\Core\Bootstrap\DrupalConsoleCore; class Drupal { @@ -28,6 +29,7 @@ public function __construct($autoload, $root, $appRoot) public function boot() { if (!class_exists('Drupal\Core\DrupalKernel')) { + echo 'Class Drupal\Core\DrupalKernel do not exists.' . PHP_EOL; $drupal = new DrupalConsoleCore($this->root, $this->appRoot); return $drupal->boot(); } @@ -97,6 +99,7 @@ public function boot() return $container; } catch (\Exception $e) { + echo $e->getMessage() . PHP_EOL; $drupal = new DrupalConsoleCore($this->root, $this->appRoot); $container = $drupal->boot(); $container->set('class_loader', $this->autoload); diff --git a/src/Command/Breakpoints/DebugCommand.php b/src/Command/Breakpoints/DebugCommand.php index 714dfd2c4..fae24f0aa 100644 --- a/src/Command/Breakpoints/DebugCommand.php +++ b/src/Command/Breakpoints/DebugCommand.php @@ -13,9 +13,9 @@ use Symfony\Component\Console\Command\Command; use Drupal\breakpoint\BreakpointManagerInterface; use Symfony\Component\Yaml\Yaml; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Annotations\DrupalCommand; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; /** * @DrupalCommand( diff --git a/src/Command/Cache/ContextDebugCommand.php b/src/Command/Cache/ContextDebugCommand.php index 0c9e219fa..b14f849f0 100644 --- a/src/Command/Cache/ContextDebugCommand.php +++ b/src/Command/Cache/ContextDebugCommand.php @@ -10,8 +10,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class ContextDebugCommand. diff --git a/src/Command/Cache/RebuildCommand.php b/src/Command/Cache/RebuildCommand.php index 6f955d258..0144f8157 100644 --- a/src/Command/Cache/RebuildCommand.php +++ b/src/Command/Cache/RebuildCommand.php @@ -12,10 +12,10 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Utils\DrupalApi; use Drupal\Console\Utils\Site; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class RebuildCommand diff --git a/src/Command/Config/DebugCommand.php b/src/Command/Config/DebugCommand.php index 5faf3dcb4..321707193 100644 --- a/src/Command/Config/DebugCommand.php +++ b/src/Command/Config/DebugCommand.php @@ -14,8 +14,8 @@ use Drupal\Core\Config\CachedStorage; use Drupal\Core\Config\ConfigFactory; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; class DebugCommand extends Command { diff --git a/src/Command/Config/DeleteCommand.php b/src/Command/Config/DeleteCommand.php index 5aa6f3676..14525d012 100644 --- a/src/Command/Config/DeleteCommand.php +++ b/src/Command/Config/DeleteCommand.php @@ -14,8 +14,8 @@ use Symfony\Component\Console\Command\Command; use Drupal\Core\Config\CachedStorage; use Drupal\Core\Config\ConfigFactory; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; class DeleteCommand extends Command { diff --git a/src/Command/Config/DiffCommand.php b/src/Command/Config/DiffCommand.php index 86417ab71..63802ccb5 100644 --- a/src/Command/Config/DiffCommand.php +++ b/src/Command/Config/DiffCommand.php @@ -15,8 +15,8 @@ use Symfony\Component\Console\Command\Command; use Drupal\Core\Config\CachedStorage; use Drupal\Core\Config\ConfigManager; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; class DiffCommand extends Command { diff --git a/src/Command/Config/EditCommand.php b/src/Command/Config/EditCommand.php index cfad573d7..973b2d31c 100644 --- a/src/Command/Config/EditCommand.php +++ b/src/Command/Config/EditCommand.php @@ -18,9 +18,9 @@ use Drupal\Core\Config\CachedStorage; use Drupal\Core\Config\ConfigFactory; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Utils\ConfigurationManager; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Utils\ConfigurationManager; class EditCommand extends Command { diff --git a/src/Command/Config/ExportCommand.php b/src/Command/Config/ExportCommand.php index 9f7b9aec3..1cdfc4bb7 100644 --- a/src/Command/Config/ExportCommand.php +++ b/src/Command/Config/ExportCommand.php @@ -14,8 +14,8 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Symfony\Component\Filesystem\Filesystem; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Core\Config\ConfigManager; class ExportCommand extends Command diff --git a/src/Command/Config/ExportContentTypeCommand.php b/src/Command/Config/ExportContentTypeCommand.php index cb94f7cfc..6a0a5ff83 100644 --- a/src/Command/Config/ExportContentTypeCommand.php +++ b/src/Command/Config/ExportContentTypeCommand.php @@ -15,8 +15,8 @@ use Symfony\Component\Console\Command\Command; use Drupal\Core\Config\CachedStorage; use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Command\Shared\ExportTrait; use Drupal\Console\Extension\Manager; diff --git a/src/Command/Config/ExportSingleCommand.php b/src/Command/Config/ExportSingleCommand.php index cbfe66372..449b17ccc 100644 --- a/src/Command/Config/ExportSingleCommand.php +++ b/src/Command/Config/ExportSingleCommand.php @@ -15,8 +15,8 @@ use Symfony\Component\Console\Command\Command; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Config\CachedStorage; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Command\Shared\ExportTrait; class ExportSingleCommand extends Command diff --git a/src/Command/Config/ExportViewCommand.php b/src/Command/Config/ExportViewCommand.php index c524f1c3e..1f7cf3a23 100644 --- a/src/Command/Config/ExportViewCommand.php +++ b/src/Command/Config/ExportViewCommand.php @@ -12,11 +12,11 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Config\CachedStorage; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Command\Shared\ExportTrait; use Drupal\Console\Extension\Manager; diff --git a/src/Command/Config/ImportCommand.php b/src/Command/Config/ImportCommand.php index 403e3cb24..25b83a8b6 100644 --- a/src/Command/Config/ImportCommand.php +++ b/src/Command/Config/ImportCommand.php @@ -15,8 +15,8 @@ use Symfony\Component\Console\Command\Command; use Drupal\Core\Config\CachedStorage; use Drupal\Core\Config\ConfigManager; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Core\Config\ConfigImporterException; use Drupal\Core\Config\ConfigImporter; use Drupal\Core\Config\FileStorage; diff --git a/src/Command/Config/ImportSingleCommand.php b/src/Command/Config/ImportSingleCommand.php index 752f9ef8c..06a8a5611 100644 --- a/src/Command/Config/ImportSingleCommand.php +++ b/src/Command/Config/ImportSingleCommand.php @@ -7,8 +7,8 @@ namespace Drupal\Console\Command\Config; use Drupal\config\StorageReplaceDataWrapper; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Core\Config\CachedStorage; use Drupal\Core\Config\ConfigImporter; use Drupal\Core\Config\ConfigImporterException; diff --git a/src/Command/Config/OverrideCommand.php b/src/Command/Config/OverrideCommand.php index 3d0991841..3ff545aa6 100644 --- a/src/Command/Config/OverrideCommand.php +++ b/src/Command/Config/OverrideCommand.php @@ -13,8 +13,8 @@ use Symfony\Component\Console\Command\Command; use Drupal\Core\Config\CachedStorage; use Drupal\Core\Config\ConfigFactory; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; class OverrideCommand extends Command { diff --git a/src/Command/Config/PrintConfigValidationTrait.php b/src/Command/Config/PrintConfigValidationTrait.php index 6dcbe6624..16a54f92f 100644 --- a/src/Command/Config/PrintConfigValidationTrait.php +++ b/src/Command/Config/PrintConfigValidationTrait.php @@ -7,7 +7,7 @@ namespace Drupal\Console\Command\Config; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; trait PrintConfigValidationTrait { diff --git a/src/Command/Config/SettingsDebugCommand.php b/src/Command/Config/SettingsDebugCommand.php index 80bad753e..032a8d144 100644 --- a/src/Command/Config/SettingsDebugCommand.php +++ b/src/Command/Config/SettingsDebugCommand.php @@ -10,9 +10,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Drupal\Component\Serialization\Yaml; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Site\Settings; /** diff --git a/src/Command/Config/ValidateCommand.php b/src/Command/Config/ValidateCommand.php index 8e2e82e38..186a394c1 100644 --- a/src/Command/Config/ValidateCommand.php +++ b/src/Command/Config/ValidateCommand.php @@ -10,8 +10,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Core\Config\TypedConfigManagerInterface; use Symfony\Component\Console\Input\InputArgument; use Drupal\Core\Config\Schema\SchemaCheckTrait; @@ -45,8 +45,8 @@ protected function execute(InputInterface $input, OutputInterface $output) { /** - * @var TypedConfigManagerInterface $typedConfigManager -*/ + * @var TypedConfigManagerInterface $typedConfigManager + */ $typedConfigManager = $this->get('config.typed'); $io = new DrupalStyle($input, $output); diff --git a/src/Command/Config/ValidateDebugCommand.php b/src/Command/Config/ValidateDebugCommand.php index 1768be324..fc8e17107 100644 --- a/src/Command/Config/ValidateDebugCommand.php +++ b/src/Command/Config/ValidateDebugCommand.php @@ -12,8 +12,8 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Symfony\Component\Console\Input\InputArgument; use Drupal\Core\Config\TypedConfigManagerInterface; use Drupal\Core\Serialization\Yaml; diff --git a/src/Command/ContainerDebugCommand.php b/src/Command/ContainerDebugCommand.php index 9e49af0b4..8d9a8be7b 100644 --- a/src/Command/ContainerDebugCommand.php +++ b/src/Command/ContainerDebugCommand.php @@ -12,9 +12,9 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; -use Drupal\Console\Style\DrupalStyle; use Symfony\Component\Yaml\Yaml; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class ContainerDebugCommand diff --git a/src/Command/Create/CommentsCommand.php b/src/Command/Create/CommentsCommand.php index 9d3e6e2d6..4267e78b4 100644 --- a/src/Command/Create/CommentsCommand.php +++ b/src/Command/Create/CommentsCommand.php @@ -10,10 +10,10 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Command\Shared\CreateTrait; use Drupal\Console\Utils\Create\CommentData; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class CommentsCommand diff --git a/src/Command/Create/NodesCommand.php b/src/Command/Create/NodesCommand.php index 7467a91fb..23244baad 100644 --- a/src/Command/Create/NodesCommand.php +++ b/src/Command/Create/NodesCommand.php @@ -12,11 +12,11 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Command\Shared\CreateTrait; use Drupal\Console\Utils\Create\NodeData; use Drupal\Console\Utils\DrupalApi; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class NodesCommand diff --git a/src/Command/Create/TermsCommand.php b/src/Command/Create/TermsCommand.php index ef1139c62..0e2b95c86 100644 --- a/src/Command/Create/TermsCommand.php +++ b/src/Command/Create/TermsCommand.php @@ -12,10 +12,10 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Utils\Create\TermData; use Drupal\Console\Utils\DrupalApi; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class TermsCommand diff --git a/src/Command/Create/UsersCommand.php b/src/Command/Create/UsersCommand.php index 5cb98ac30..33ecc6593 100644 --- a/src/Command/Create/UsersCommand.php +++ b/src/Command/Create/UsersCommand.php @@ -12,11 +12,11 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Command\Shared\CreateTrait; use Drupal\Console\Utils\Create\UserData; use Drupal\Console\Utils\DrupalApi; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class UsersCommand diff --git a/src/Command/Create/VocabulariesCommand.php b/src/Command/Create/VocabulariesCommand.php index 5b1edba7b..bff958c12 100644 --- a/src/Command/Create/VocabulariesCommand.php +++ b/src/Command/Create/VocabulariesCommand.php @@ -7,13 +7,13 @@ namespace Drupal\Console\Command\Create; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Drupal\Console\Utils\Create\VocabularyData; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class VocabulariesCommand diff --git a/src/Command/Cron/DebugCommand.php b/src/Command/Cron/DebugCommand.php index 6a6c48aae..43ef9d5a4 100644 --- a/src/Command/Cron/DebugCommand.php +++ b/src/Command/Cron/DebugCommand.php @@ -11,8 +11,8 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; class DebugCommand extends Command { diff --git a/src/Command/Cron/ExecuteCommand.php b/src/Command/Cron/ExecuteCommand.php index f0cd6849b..203919da6 100644 --- a/src/Command/Cron/ExecuteCommand.php +++ b/src/Command/Cron/ExecuteCommand.php @@ -14,9 +14,9 @@ use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Lock\LockBackendInterface; use Drupal\Core\State\StateInterface; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Utils\ChainQueue; class ExecuteCommand extends Command { diff --git a/src/Command/Cron/ReleaseCommand.php b/src/Command/Cron/ReleaseCommand.php index 1debe4da0..57f51a727 100644 --- a/src/Command/Cron/ReleaseCommand.php +++ b/src/Command/Cron/ReleaseCommand.php @@ -12,9 +12,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Drupal\Core\Lock\LockBackendInterface; -use Drupal\Console\Utils\ChainQueue; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Utils\ChainQueue; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; class ReleaseCommand extends Command { diff --git a/src/Command/Database/AddCommand.php b/src/Command/Database/AddCommand.php index 19412cce1..928383f4e 100644 --- a/src/Command/Database/AddCommand.php +++ b/src/Command/Database/AddCommand.php @@ -13,9 +13,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Drupal\Console\Generator\DatabaseSettingsGenerator; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Command\Shared\ConnectTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; class AddCommand extends Command { diff --git a/src/Command/Database/ClientCommand.php b/src/Command/Database/ClientCommand.php index d6a4a494f..93b2d6574 100644 --- a/src/Command/Database/ClientCommand.php +++ b/src/Command/Database/ClientCommand.php @@ -12,9 +12,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Process\ProcessBuilder; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Command\Shared\ConnectTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; class ClientCommand extends Command { diff --git a/src/Command/Database/ConnectCommand.php b/src/Command/Database/ConnectCommand.php index 9db250b42..1908cb0e0 100644 --- a/src/Command/Database/ConnectCommand.php +++ b/src/Command/Database/ConnectCommand.php @@ -11,9 +11,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Command\Shared\ConnectTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; class ConnectCommand extends Command { diff --git a/src/Command/Database/DatabaseLogBase.php b/src/Command/Database/DatabaseLogBase.php index fea09034f..2d1073633 100644 --- a/src/Command/Database/DatabaseLogBase.php +++ b/src/Command/Database/DatabaseLogBase.php @@ -8,7 +8,7 @@ namespace Drupal\Console\Command\Database; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Database\Connection; use Drupal\Core\Datetime\DateFormatterInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; @@ -22,7 +22,7 @@ use Drupal\Component\Utility\Html; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class DatabaseLogBase @@ -138,7 +138,7 @@ protected function getDefaultOptions(InputInterface $input) } /** - * @param \Drupal\Console\Style\DrupalStyle $io + * @param \Drupal\Console\Core\Style\DrupalStyle $io * @param null $offset * @param int $range * @return bool|\Drupal\Core\Database\Query\SelectInterface diff --git a/src/Command/Database/DropCommand.php b/src/Command/Database/DropCommand.php index b5da63f21..266370374 100644 --- a/src/Command/Database/DropCommand.php +++ b/src/Command/Database/DropCommand.php @@ -12,9 +12,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Drupal\Core\Database\Connection; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Command\Shared\ConnectTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class DropCommand diff --git a/src/Command/Database/DumpCommand.php b/src/Command/Database/DumpCommand.php index 5802eb5fa..34f2c938c 100644 --- a/src/Command/Database/DumpCommand.php +++ b/src/Command/Database/DumpCommand.php @@ -12,10 +12,10 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Command\Shared\ConnectTrait; -use Drupal\Console\Utils\ShellProcess; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Utils\ShellProcess; +use Drupal\Console\Core\Style\DrupalStyle; class DumpCommand extends Command { diff --git a/src/Command/Database/LogClearCommand.php b/src/Command/Database/LogClearCommand.php index 58e7cae88..3da85b8b9 100644 --- a/src/Command/Database/LogClearCommand.php +++ b/src/Command/Database/LogClearCommand.php @@ -13,9 +13,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Drupal\Core\Database\Connection; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Logger\RfcLogLevel; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; class LogClearCommand extends Command { diff --git a/src/Command/Database/LogDebugCommand.php b/src/Command/Database/LogDebugCommand.php index 57ef7fe5b..b74cc9c5d 100644 --- a/src/Command/Database/LogDebugCommand.php +++ b/src/Command/Database/LogDebugCommand.php @@ -12,7 +12,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Drupal\Component\Serialization\Yaml; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class LogDebugCommand @@ -148,7 +148,7 @@ private function getEventDetails(DrupalStyle $io) } /** - * @param \Drupal\Console\Style\DrupalStyle $io + * @param \Drupal\Console\Core\Style\DrupalStyle $io * @return bool */ private function getAllEvents(DrupalStyle $io) diff --git a/src/Command/Database/LogPollCommand.php b/src/Command/Database/LogPollCommand.php index 6ffd16bce..438ab8c81 100644 --- a/src/Command/Database/LogPollCommand.php +++ b/src/Command/Database/LogPollCommand.php @@ -2,7 +2,7 @@ namespace Drupal\Console\Command\Database; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -55,7 +55,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } /** - * @param \Drupal\Console\Style\DrupalStyle $io + * @param \Drupal\Console\Core\Style\DrupalStyle $io */ protected function pollForEvents(DrupalStyle $io) { diff --git a/src/Command/Database/QueryCommand.php b/src/Command/Database/QueryCommand.php index 6774e06ef..6e412b788 100644 --- a/src/Command/Database/QueryCommand.php +++ b/src/Command/Database/QueryCommand.php @@ -18,9 +18,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Process\ProcessBuilder; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Command\Shared\ConnectTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; class QueryCommand extends Command { diff --git a/src/Command/Database/RestoreCommand.php b/src/Command/Database/RestoreCommand.php index 3dc9d702a..8294b6227 100644 --- a/src/Command/Database/RestoreCommand.php +++ b/src/Command/Database/RestoreCommand.php @@ -13,9 +13,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Process\ProcessBuilder; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Command\Shared\ConnectTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; class RestoreCommand extends Command { diff --git a/src/Command/Database/TableDebugCommand.php b/src/Command/Database/TableDebugCommand.php index d8d80251a..ee3490a07 100644 --- a/src/Command/Database/TableDebugCommand.php +++ b/src/Command/Database/TableDebugCommand.php @@ -14,8 +14,8 @@ use Symfony\Component\Console\Command\Command; use RedBeanPHP\R; use Drupal\Core\Database\Connection; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Command\Shared\ConnectTrait; /** diff --git a/src/Command/DevelDumperCommand.php b/src/Command/DevelDumperCommand.php index 33d8ee4d8..4748f4ea9 100644 --- a/src/Command/DevelDumperCommand.php +++ b/src/Command/DevelDumperCommand.php @@ -8,8 +8,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\devel\DevelDumperPluginManager; use Drupal\devel\DevelDumperManager; diff --git a/src/Command/Develop/ExampleCommand.php b/src/Command/Develop/ExampleCommand.php index 17ca3bc4c..c3fe7c61a 100644 --- a/src/Command/Develop/ExampleCommand.php +++ b/src/Command/Develop/ExampleCommand.php @@ -10,8 +10,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class ExampleCommand diff --git a/src/Command/Develop/ExampleContainerAwareCommand.php b/src/Command/Develop/ExampleContainerAwareCommand.php index 641ece2bd..085430b88 100644 --- a/src/Command/Develop/ExampleContainerAwareCommand.php +++ b/src/Command/Develop/ExampleContainerAwareCommand.php @@ -10,8 +10,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class ExampleContainerAwareCommand diff --git a/src/Command/Develop/GenerateDocCheatsheetCommand.php b/src/Command/Develop/GenerateDocCheatsheetCommand.php index a29b840f5..a607ff424 100644 --- a/src/Command/Develop/GenerateDocCheatsheetCommand.php +++ b/src/Command/Develop/GenerateDocCheatsheetCommand.php @@ -13,9 +13,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Knp\Snappy\Pdf; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; class GenerateDocCheatsheetCommand extends Command { diff --git a/src/Command/Develop/GenerateDocDashCommand.php b/src/Command/Develop/GenerateDocDashCommand.php index 07328a3d0..5850eee3a 100644 --- a/src/Command/Develop/GenerateDocDashCommand.php +++ b/src/Command/Develop/GenerateDocDashCommand.php @@ -13,10 +13,10 @@ use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Utils\TwigRenderer; -use Drupal\Console\Utils\ConfigurationManager; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Utils\TwigRenderer; +use Drupal\Console\Core\Utils\ConfigurationManager; class GenerateDocDashCommand extends Command { diff --git a/src/Command/Develop/GenerateDocDataCommand.php b/src/Command/Develop/GenerateDocDataCommand.php index f6ec7303c..587280525 100644 --- a/src/Command/Develop/GenerateDocDataCommand.php +++ b/src/Command/Develop/GenerateDocDataCommand.php @@ -11,8 +11,8 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; class GenerateDocDataCommand extends Command { diff --git a/src/Command/Develop/GenerateDocGitbookCommand.php b/src/Command/Develop/GenerateDocGitbookCommand.php index 04b515160..328c244d1 100644 --- a/src/Command/Develop/GenerateDocGitbookCommand.php +++ b/src/Command/Develop/GenerateDocGitbookCommand.php @@ -11,9 +11,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Utils\TwigRenderer; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Utils\TwigRenderer; class GenerateDocGitbookCommand extends Command { diff --git a/src/Command/Develop/TranslationCleanupCommand.php b/src/Command/Develop/TranslationCleanupCommand.php index 5fb3bac5f..27e10c44c 100644 --- a/src/Command/Develop/TranslationCleanupCommand.php +++ b/src/Command/Develop/TranslationCleanupCommand.php @@ -14,9 +14,9 @@ use Symfony\Component\Finder\Finder; use Symfony\Component\Yaml\Parser; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Utils\ConfigurationManager; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Utils\ConfigurationManager; class TranslationCleanupCommand extends Command { diff --git a/src/Command/Develop/TranslationPendingCommand.php b/src/Command/Develop/TranslationPendingCommand.php index 0718b4fb5..12f483e40 100644 --- a/src/Command/Develop/TranslationPendingCommand.php +++ b/src/Command/Develop/TranslationPendingCommand.php @@ -16,10 +16,10 @@ use Symfony\Component\Finder\Finder; use Symfony\Component\Yaml\Parser; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Utils\ConfigurationManager; -use Drupal\Console\Utils\NestedArray; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Utils\ConfigurationManager; +use Drupal\Console\Core\Utils\NestedArray; class TranslationPendingCommand extends Command { diff --git a/src/Command/Develop/TranslationStatsCommand.php b/src/Command/Develop/TranslationStatsCommand.php index e94a8a28c..c37abe670 100644 --- a/src/Command/Develop/TranslationStatsCommand.php +++ b/src/Command/Develop/TranslationStatsCommand.php @@ -16,11 +16,11 @@ use Symfony\Component\Yaml\Parser; use Symfony\Component\Yaml\Exception\ParseException; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Utils\ConfigurationManager; -use Drupal\Console\Utils\TwigRenderer; -use Drupal\Console\Utils\NestedArray; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Utils\ConfigurationManager; +use Drupal\Console\Core\Utils\TwigRenderer; +use Drupal\Console\Core\Utils\NestedArray; class TranslationStatsCommand extends Command { diff --git a/src/Command/Develop/TranslationSyncCommand.php b/src/Command/Develop/TranslationSyncCommand.php index e96a76135..c5a8c8ada 100644 --- a/src/Command/Develop/TranslationSyncCommand.php +++ b/src/Command/Develop/TranslationSyncCommand.php @@ -15,9 +15,9 @@ use Symfony\Component\Yaml\Dumper; use Symfony\Component\Yaml\Parser; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Utils\ConfigurationManager; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Utils\ConfigurationManager; class TranslationSyncCommand extends Command { diff --git a/src/Command/Entity/DebugCommand.php b/src/Command/Entity/DebugCommand.php index 905aabfb4..e43d4eb49 100644 --- a/src/Command/Entity/DebugCommand.php +++ b/src/Command/Entity/DebugCommand.php @@ -12,8 +12,8 @@ use Symfony\Component\Console\Command\Command; use Drupal\Core\Entity\EntityTypeRepository; use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; class DebugCommand extends Command { diff --git a/src/Command/Entity/DeleteCommand.php b/src/Command/Entity/DeleteCommand.php index 3933a103e..c2cbfa8c8 100644 --- a/src/Command/Entity/DeleteCommand.php +++ b/src/Command/Entity/DeleteCommand.php @@ -12,8 +12,8 @@ use Symfony\Component\Console\Command\Command; use Drupal\Core\Entity\EntityTypeRepository; use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; class DeleteCommand extends Command { diff --git a/src/Command/EventDebugCommand.php b/src/Command/EventDebugCommand.php index 2b5edadc7..60198a166 100644 --- a/src/Command/EventDebugCommand.php +++ b/src/Command/EventDebugCommand.php @@ -11,8 +11,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class EventDebugCommand diff --git a/src/Command/Features/DebugCommand.php b/src/Command/Features/DebugCommand.php index 617746a3e..5c7b5f1c3 100644 --- a/src/Command/Features/DebugCommand.php +++ b/src/Command/Features/DebugCommand.php @@ -11,8 +11,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Drupal\Console\Command\Shared\FeatureTrait; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Annotations\DrupalCommand; use Symfony\Component\Console\Command\Command; diff --git a/src/Command/Features/ImportCommand.php b/src/Command/Features/ImportCommand.php index 9823ac774..5263d227d 100644 --- a/src/Command/Features/ImportCommand.php +++ b/src/Command/Features/ImportCommand.php @@ -12,8 +12,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Drupal\Console\Command\Shared\FeatureTrait; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Annotations\DrupalCommand; use Symfony\Component\Console\Command\Command; diff --git a/src/Command/Field/InfoCommand.php b/src/Command/Field/InfoCommand.php index 904769dda..656834d9e 100644 --- a/src/Command/Field/InfoCommand.php +++ b/src/Command/Field/InfoCommand.php @@ -14,8 +14,8 @@ use Drupal\Core\Entity\EntityFieldManagerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\field\FieldConfigInterface; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class InfoCommand. diff --git a/src/Command/Generate/AuthenticationProviderCommand.php b/src/Command/Generate/AuthenticationProviderCommand.php index f1ab59005..faaf36d13 100644 --- a/src/Command/Generate/AuthenticationProviderCommand.php +++ b/src/Command/Generate/AuthenticationProviderCommand.php @@ -16,9 +16,9 @@ use Symfony\Component\Console\Command\Command; use Drupal\Console\Generator\AuthenticationProviderGenerator; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Utils\StringConverter; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Extension\Manager; class AuthenticationProviderCommand extends Command diff --git a/src/Command/Generate/BreakPointCommand.php b/src/Command/Generate/BreakPointCommand.php index 12785c393..e34ab6c85 100644 --- a/src/Command/Generate/BreakPointCommand.php +++ b/src/Command/Generate/BreakPointCommand.php @@ -15,10 +15,10 @@ use Drupal\Console\Command\Shared\ThemeRegionTrait; use Drupal\Console\Command\Shared\ThemeBreakpointTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\Validator; -use Drupal\Console\Utils\StringConverter; +use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Generator\BreakPointGenerator; /** diff --git a/src/Command/Generate/CommandCommand.php b/src/Command/Generate/CommandCommand.php index 8efb20733..00826aeac 100644 --- a/src/Command/Generate/CommandCommand.php +++ b/src/Command/Generate/CommandCommand.php @@ -12,13 +12,13 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Generator\CommandGenerator; -use Drupal\Console\Utils\StringConverter; +use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Extension\Manager; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\Validator; class CommandCommand extends Command diff --git a/src/Command/Generate/ConfigFormBaseCommand.php b/src/Command/Generate/ConfigFormBaseCommand.php index c7b26e5ae..be31efc32 100644 --- a/src/Command/Generate/ConfigFormBaseCommand.php +++ b/src/Command/Generate/ConfigFormBaseCommand.php @@ -8,9 +8,9 @@ namespace Drupal\Console\Command\Generate; use Drupal\Console\Generator\FormGenerator; -use Drupal\Console\Utils\StringConverter; +use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Extension\Manager; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Core\Routing\RouteProviderInterface; use Drupal\Core\Render\ElementInfoManager; diff --git a/src/Command/Generate/ControllerCommand.php b/src/Command/Generate/ControllerCommand.php index 53c6ba201..ba5a8e04a 100644 --- a/src/Command/Generate/ControllerCommand.php +++ b/src/Command/Generate/ControllerCommand.php @@ -7,7 +7,6 @@ namespace Drupal\Console\Command\Generate; -use Drupal\Console\Command\Shared\InputTrait; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -16,13 +15,14 @@ use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Generator\ControllerGenerator; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Utils\StringConverter; +use Drupal\Core\Routing\RouteProviderInterface; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Utils\StringConverter; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Utils\ChainQueue; +use Drupal\Console\Core\Command\Shared\InputTrait; use Drupal\Console\Extension\Manager; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Utils\Validator; -use Drupal\Core\Routing\RouteProviderInterface; -use Drupal\Console\Utils\ChainQueue; class ControllerCommand extends Command { diff --git a/src/Command/Generate/EntityBundleCommand.php b/src/Command/Generate/EntityBundleCommand.php index a39f5a4be..a12020316 100644 --- a/src/Command/Generate/EntityBundleCommand.php +++ b/src/Command/Generate/EntityBundleCommand.php @@ -14,10 +14,10 @@ use Drupal\Console\Command\Shared\ConfirmationTrait; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ServicesTrait; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Generator\ContentTypeGenerator; use Drupal\Console\Generator\EntityBundleGenerator; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; use Drupal\Console\Utils\Validator; diff --git a/src/Command/Generate/EntityCommand.php b/src/Command/Generate/EntityCommand.php index fe214a543..d5869edc7 100644 --- a/src/Command/Generate/EntityCommand.php +++ b/src/Command/Generate/EntityCommand.php @@ -12,8 +12,8 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Drupal\Console\Command\Shared\ModuleTrait; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; abstract class EntityCommand extends Command { diff --git a/src/Command/Generate/EntityConfigCommand.php b/src/Command/Generate/EntityConfigCommand.php index 7c4450b63..13df41dc3 100644 --- a/src/Command/Generate/EntityConfigCommand.php +++ b/src/Command/Generate/EntityConfigCommand.php @@ -13,7 +13,7 @@ use Drupal\Console\Generator\EntityConfigGenerator; use Drupal\Console\Extension\Manager; use Drupal\Console\Utils\Validator; -use Drupal\Console\Utils\StringConverter; +use Drupal\Console\Core\Utils\StringConverter; class EntityConfigCommand extends EntityCommand { diff --git a/src/Command/Generate/EntityContentCommand.php b/src/Command/Generate/EntityContentCommand.php index 89ef1d956..57ec10f3c 100644 --- a/src/Command/Generate/EntityContentCommand.php +++ b/src/Command/Generate/EntityContentCommand.php @@ -12,10 +12,10 @@ use Symfony\Component\Console\Output\OutputInterface; use Drupal\Console\Generator\EntityContentGenerator; use Drupal\Console\Extension\Manager; -use Drupal\Console\Utils\StringConverter; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Utils\StringConverter; +use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Console\Utils\Validator; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; class EntityContentCommand extends EntityCommand { diff --git a/src/Command/Generate/EventSubscriberCommand.php b/src/Command/Generate/EventSubscriberCommand.php index 8ea3733f2..92914aa68 100644 --- a/src/Command/Generate/EventSubscriberCommand.php +++ b/src/Command/Generate/EventSubscriberCommand.php @@ -16,12 +16,12 @@ use Drupal\Console\Command\Shared\ConfirmationTrait; use Drupal\Console\Command\Shared\EventsTrait; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; -use Drupal\Console\Utils\StringConverter; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Extension\Manager; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Utils\ChainQueue; class EventSubscriberCommand extends Command { diff --git a/src/Command/Generate/FormAlterCommand.php b/src/Command/Generate/FormAlterCommand.php index ea248c863..d4f110f03 100644 --- a/src/Command/Generate/FormAlterCommand.php +++ b/src/Command/Generate/FormAlterCommand.php @@ -17,15 +17,15 @@ use Drupal\Console\Command\Shared\FormTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Utils\StringConverter; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Extension\Manager; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Render\ElementInfoManager; use Drupal\Console\Utils\Validator; use Drupal\Core\Routing\RouteProviderInterface; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Utils\ChainQueue; use Drupal\webprofiler\Profiler\Profiler; class FormAlterCommand extends Command diff --git a/src/Command/Generate/FormCommand.php b/src/Command/Generate/FormCommand.php index a464211ca..bbf62a5a8 100644 --- a/src/Command/Generate/FormCommand.php +++ b/src/Command/Generate/FormCommand.php @@ -15,12 +15,12 @@ use Drupal\Console\Command\Shared\MenuTrait; use Drupal\Console\Command\Shared\FormTrait; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Generator\FormGenerator; use Drupal\Console\Extension\Manager; -use Drupal\Console\Utils\ChainQueue; -use Drupal\Console\Utils\StringConverter; +use Drupal\Console\Core\Utils\ChainQueue; +use Drupal\Console\Core\Utils\StringConverter; use Drupal\Core\Render\ElementInfoManager; use Drupal\Core\Routing\RouteProviderInterface; diff --git a/src/Command/Generate/HelpCommand.php b/src/Command/Generate/HelpCommand.php index c71e21b3e..ccbf09222 100644 --- a/src/Command/Generate/HelpCommand.php +++ b/src/Command/Generate/HelpCommand.php @@ -14,11 +14,11 @@ use Drupal\Console\Generator\HelpGenerator; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Extension\Manager; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\Site; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Utils\ChainQueue; class HelpCommand extends Command { diff --git a/src/Command/Generate/ModuleCommand.php b/src/Command/Generate/ModuleCommand.php index 202cc82d9..cf06427a1 100644 --- a/src/Command/Generate/ModuleCommand.php +++ b/src/Command/Generate/ModuleCommand.php @@ -14,10 +14,10 @@ use Drupal\Console\Generator\ModuleGenerator; use Drupal\Console\Command\Shared\ConfirmationTrait; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\Validator; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Utils\StringConverter; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Utils\DrupalApi; use GuzzleHttp\Client; use Drupal\Console\Utils\Site; diff --git a/src/Command/Generate/ModuleFileCommand.php b/src/Command/Generate/ModuleFileCommand.php index a0457281d..83cc2cebc 100644 --- a/src/Command/Generate/ModuleFileCommand.php +++ b/src/Command/Generate/ModuleFileCommand.php @@ -11,12 +11,12 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Generator\ModuleFileGenerator; use Drupal\Console\Command\Shared\ConfirmationTrait; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Extension\Manager; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class ModuleFileCommand diff --git a/src/Command/Generate/PermissionCommand.php b/src/Command/Generate/PermissionCommand.php index 107a95786..da464fb81 100644 --- a/src/Command/Generate/PermissionCommand.php +++ b/src/Command/Generate/PermissionCommand.php @@ -15,10 +15,10 @@ use Drupal\Console\Command\Shared\PermissionTrait; use Drupal\Console\Generator\PermissionGenerator; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Utils\StringConverter; +use Drupal\Console\Core\Utils\StringConverter; class PermissionCommand extends Command { diff --git a/src/Command/Generate/PluginBlockCommand.php b/src/Command/Generate/PluginBlockCommand.php index 5f8aa71ab..10847f19a 100644 --- a/src/Command/Generate/PluginBlockCommand.php +++ b/src/Command/Generate/PluginBlockCommand.php @@ -16,12 +16,12 @@ use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\FormTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Extension\Manager; use Drupal\Console\Utils\Validator; -use Drupal\Console\Utils\StringConverter; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Utils\StringConverter; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Render\ElementInfoManagerInterface; diff --git a/src/Command/Generate/PluginCKEditorButtonCommand.php b/src/Command/Generate/PluginCKEditorButtonCommand.php index cbae078de..af5bcd3d4 100644 --- a/src/Command/Generate/PluginCKEditorButtonCommand.php +++ b/src/Command/Generate/PluginCKEditorButtonCommand.php @@ -14,11 +14,11 @@ use Drupal\Console\Generator\PluginCKEditorButtonGenerator; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Console\Extension\Manager; -use Drupal\Console\Utils\StringConverter; +use Drupal\Console\Core\Utils\StringConverter; class PluginCKEditorButtonCommand extends Command { diff --git a/src/Command/Generate/PluginConditionCommand.php b/src/Command/Generate/PluginConditionCommand.php index 3aacc0922..8a92feec8 100644 --- a/src/Command/Generate/PluginConditionCommand.php +++ b/src/Command/Generate/PluginConditionCommand.php @@ -12,14 +12,14 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Drupal\Core\Entity\EntityTypeRepository; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Generator\PluginConditionGenerator; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Utils\ChainQueue; -use Drupal\Console\Utils\StringConverter; +use Drupal\Console\Core\Utils\ChainQueue; +use Drupal\Console\Core\Utils\StringConverter; /** * Class PluginConditionCommand diff --git a/src/Command/Generate/PluginFieldCommand.php b/src/Command/Generate/PluginFieldCommand.php index e49ef37fd..f909c6d3b 100644 --- a/src/Command/Generate/PluginFieldCommand.php +++ b/src/Command/Generate/PluginFieldCommand.php @@ -13,11 +13,11 @@ use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Utils\StringConverter; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Utils\StringConverter; +use Drupal\Console\Core\Utils\ChainQueue; class PluginFieldCommand extends Command { diff --git a/src/Command/Generate/PluginFieldFormatterCommand.php b/src/Command/Generate/PluginFieldFormatterCommand.php index 0e4d45485..b6fab9f12 100644 --- a/src/Command/Generate/PluginFieldFormatterCommand.php +++ b/src/Command/Generate/PluginFieldFormatterCommand.php @@ -14,12 +14,12 @@ use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Core\Field\FieldTypePluginManager; use Drupal\Console\Extension\Manager; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Utils\StringConverter; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Utils\StringConverter; +use Drupal\Console\Core\Utils\ChainQueue; /** * Class PluginFieldFormatterCommand diff --git a/src/Command/Generate/PluginFieldTypeCommand.php b/src/Command/Generate/PluginFieldTypeCommand.php index c9e99d15d..68365d356 100644 --- a/src/Command/Generate/PluginFieldTypeCommand.php +++ b/src/Command/Generate/PluginFieldTypeCommand.php @@ -14,11 +14,11 @@ use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Utils\StringConverter; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Utils\StringConverter; +use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Core\Field\FieldTypePluginManager; /** diff --git a/src/Command/Generate/PluginFieldWidgetCommand.php b/src/Command/Generate/PluginFieldWidgetCommand.php index fcdc4a20d..b35c65102 100644 --- a/src/Command/Generate/PluginFieldWidgetCommand.php +++ b/src/Command/Generate/PluginFieldWidgetCommand.php @@ -14,11 +14,11 @@ use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Utils\StringConverter; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Utils\StringConverter; +use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Core\Field\FieldTypePluginManager; /** diff --git a/src/Command/Generate/PluginImageEffectCommand.php b/src/Command/Generate/PluginImageEffectCommand.php index c2fed7e30..98dc7370e 100644 --- a/src/Command/Generate/PluginImageEffectCommand.php +++ b/src/Command/Generate/PluginImageEffectCommand.php @@ -14,11 +14,11 @@ use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Utils\StringConverter; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Utils\StringConverter; +use Drupal\Console\Core\Utils\ChainQueue; /** * Class PluginImageEffectCommand diff --git a/src/Command/Generate/PluginImageFormatterCommand.php b/src/Command/Generate/PluginImageFormatterCommand.php index 8a30100d1..595a4c511 100644 --- a/src/Command/Generate/PluginImageFormatterCommand.php +++ b/src/Command/Generate/PluginImageFormatterCommand.php @@ -14,12 +14,12 @@ use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Utils\StringConverter; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Utils\Validator; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Utils\ChainQueue; class PluginImageFormatterCommand extends Command { diff --git a/src/Command/Generate/PluginMailCommand.php b/src/Command/Generate/PluginMailCommand.php index 254b50894..1365af9f7 100644 --- a/src/Command/Generate/PluginMailCommand.php +++ b/src/Command/Generate/PluginMailCommand.php @@ -16,12 +16,12 @@ use Drupal\Console\Command\Shared\ConfirmationTrait; use Drupal\Console\Generator\PluginMailGenerator; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; -use Drupal\Console\Utils\StringConverter; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Utils\Validator; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Utils\ChainQueue; /** * Class PluginMailCommand diff --git a/src/Command/Generate/PluginMigrateSourceCommand.php b/src/Command/Generate/PluginMigrateSourceCommand.php index 287a1ef86..b19c36a03 100644 --- a/src/Command/Generate/PluginMigrateSourceCommand.php +++ b/src/Command/Generate/PluginMigrateSourceCommand.php @@ -14,12 +14,12 @@ use Drupal\Console\Generator\PluginMigrateSourceGenerator; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Extension\Manager; use Drupal\Console\Utils\Validator; -use Drupal\Console\Utils\StringConverter; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Utils\StringConverter; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Render\ElementInfoManagerInterface; diff --git a/src/Command/Generate/PluginRestResourceCommand.php b/src/Command/Generate/PluginRestResourceCommand.php index bee7d0205..6160fbcc9 100644 --- a/src/Command/Generate/PluginRestResourceCommand.php +++ b/src/Command/Generate/PluginRestResourceCommand.php @@ -16,11 +16,11 @@ use Drupal\Console\Generator\PluginRestResourceGenerator; use Drupal\Console\Command\Shared\ConfirmationTrait; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Utils\StringConverter; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Utils\StringConverter; +use Drupal\Console\Core\Utils\ChainQueue; /** * Class PluginRestResourceCommand diff --git a/src/Command/Generate/PluginRulesActionCommand.php b/src/Command/Generate/PluginRulesActionCommand.php index 76f596795..83f40f4f9 100644 --- a/src/Command/Generate/PluginRulesActionCommand.php +++ b/src/Command/Generate/PluginRulesActionCommand.php @@ -16,11 +16,11 @@ use Drupal\Console\Command\Shared\FormTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Utils\StringConverter; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Utils\StringConverter; +use Drupal\Console\Core\Utils\ChainQueue; /** * Class PluginRulesActionCommand diff --git a/src/Command/Generate/PluginSkeletonCommand.php b/src/Command/Generate/PluginSkeletonCommand.php index 56367ffe7..5420a927e 100644 --- a/src/Command/Generate/PluginSkeletonCommand.php +++ b/src/Command/Generate/PluginSkeletonCommand.php @@ -15,11 +15,11 @@ use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; use Drupal\Console\Command\Shared\ServicesTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; -use Drupal\Console\Utils\StringConverter; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Utils\StringConverter; +use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Console\Utils\Validator; /** diff --git a/src/Command/Generate/PluginTypeAnnotationCommand.php b/src/Command/Generate/PluginTypeAnnotationCommand.php index a84d5a5b7..1975528a8 100644 --- a/src/Command/Generate/PluginTypeAnnotationCommand.php +++ b/src/Command/Generate/PluginTypeAnnotationCommand.php @@ -16,10 +16,10 @@ use Drupal\Console\Command\Shared\FormTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Extension\Manager; -use Drupal\Console\Utils\StringConverter; +use Drupal\Console\Core\Utils\StringConverter; /** * Class PluginTypeAnnotationCommand diff --git a/src/Command/Generate/PluginTypeYamlCommand.php b/src/Command/Generate/PluginTypeYamlCommand.php index 686c91a53..ca9e13087 100644 --- a/src/Command/Generate/PluginTypeYamlCommand.php +++ b/src/Command/Generate/PluginTypeYamlCommand.php @@ -16,11 +16,11 @@ use Drupal\Console\Command\Shared\FormTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Utils\StringConverter; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Utils\StringConverter; +use Drupal\Console\Core\Utils\ChainQueue; /** * Class PluginTypeYamlCommand diff --git a/src/Command/Generate/PluginViewsFieldCommand.php b/src/Command/Generate/PluginViewsFieldCommand.php index 44e879581..bc794ba93 100644 --- a/src/Command/Generate/PluginViewsFieldCommand.php +++ b/src/Command/Generate/PluginViewsFieldCommand.php @@ -14,12 +14,12 @@ use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Utils\ChainQueue; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Utils\ChainQueue; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Utils\Site; -use Drupal\Console\Utils\StringConverter; +use Drupal\Console\Core\Utils\StringConverter; /** * Class PluginViewsFieldCommand diff --git a/src/Command/Generate/PostUpdateCommand.php b/src/Command/Generate/PostUpdateCommand.php index ec5f582e0..a34ed5c88 100644 --- a/src/Command/Generate/PostUpdateCommand.php +++ b/src/Command/Generate/PostUpdateCommand.php @@ -14,10 +14,10 @@ use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Utils\ChainQueue; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Utils\ChainQueue; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Utils\Site; use Drupal\Console\Utils\Validator; diff --git a/src/Command/Generate/ProfileCommand.php b/src/Command/Generate/ProfileCommand.php index db2580a44..67e908862 100644 --- a/src/Command/Generate/ProfileCommand.php +++ b/src/Command/Generate/ProfileCommand.php @@ -13,10 +13,10 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Extension\Manager; -use Drupal\Console\Utils\StringConverter; +use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Utils\Validator; use Drupal\Console\Utils\Site; use GuzzleHttp\Client; diff --git a/src/Command/Generate/RouteSubscriberCommand.php b/src/Command/Generate/RouteSubscriberCommand.php index f58a7c780..d3af1f27c 100644 --- a/src/Command/Generate/RouteSubscriberCommand.php +++ b/src/Command/Generate/RouteSubscriberCommand.php @@ -14,10 +14,10 @@ use Drupal\Console\Generator\RouteSubscriberGenerator; use Drupal\Console\Command\Shared\ConfirmationTrait; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Utils\ChainQueue; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Utils\ChainQueue; +use Drupal\Console\Core\Command\Shared\CommandTrait; /** * Class RouteSubscriberCommand diff --git a/src/Command/Generate/ServiceCommand.php b/src/Command/Generate/ServiceCommand.php index b31c7e2bb..8f3358c8f 100644 --- a/src/Command/Generate/ServiceCommand.php +++ b/src/Command/Generate/ServiceCommand.php @@ -15,11 +15,11 @@ use Drupal\Console\Generator\ServiceGenerator; use Drupal\Console\Command\Shared\ConfirmationTrait; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Extension\Manager; -use Drupal\Console\Utils\ChainQueue; -use Drupal\Console\Utils\StringConverter; +use Drupal\Console\Core\Utils\ChainQueue; +use Drupal\Console\Core\Utils\StringConverter; /** * Class ServiceCommand diff --git a/src/Command/Generate/ThemeCommand.php b/src/Command/Generate/ThemeCommand.php index b05b55c08..5d12786c9 100644 --- a/src/Command/Generate/ThemeCommand.php +++ b/src/Command/Generate/ThemeCommand.php @@ -15,11 +15,11 @@ use Drupal\Console\Generator\ThemeGenerator; use Drupal\Console\Command\Shared\ConfirmationTrait; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; use Drupal\Console\Utils\Site; -use Drupal\Console\Utils\StringConverter; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Utils\StringConverter; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Utils\Validator; use Drupal\Core\Extension\ThemeHandler; diff --git a/src/Command/Generate/TwigExtensionCommand.php b/src/Command/Generate/TwigExtensionCommand.php index ed9529247..8b6bdb090 100644 --- a/src/Command/Generate/TwigExtensionCommand.php +++ b/src/Command/Generate/TwigExtensionCommand.php @@ -11,15 +11,15 @@ use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ServicesTrait; use Drupal\Console\Generator\TwigExtensionGenerator; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Drupal\Console\Extension\Manager; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Console\Utils\Site; -use Drupal\Console\Utils\StringConverter; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Utils\StringConverter; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; /** * Class TwigExtensionCommand diff --git a/src/Command/Generate/UpdateCommand.php b/src/Command/Generate/UpdateCommand.php index c65f89050..faf76db82 100644 --- a/src/Command/Generate/UpdateCommand.php +++ b/src/Command/Generate/UpdateCommand.php @@ -14,10 +14,10 @@ use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Console\Utils\Site; /** diff --git a/src/Command/Image/StylesDebugCommand.php b/src/Command/Image/StylesDebugCommand.php index 878717d03..67524584b 100644 --- a/src/Command/Image/StylesDebugCommand.php +++ b/src/Command/Image/StylesDebugCommand.php @@ -11,8 +11,8 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class StylesDebugCommand @@ -69,7 +69,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } /** - * @param \Drupal\Console\Style\DrupalStyle $io + * @param \Drupal\Console\Core\Style\DrupalStyle $io * @param $imageStyle */ protected function imageStyleList(DrupalStyle $io, $imageStyle) diff --git a/src/Command/Image/StylesFlushCommand.php b/src/Command/Image/StylesFlushCommand.php index 06b0c394d..955febbb7 100644 --- a/src/Command/Image/StylesFlushCommand.php +++ b/src/Command/Image/StylesFlushCommand.php @@ -11,8 +11,8 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; class StylesFlushCommand extends Command { diff --git a/src/Command/Libraries/DebugCommand.php b/src/Command/Libraries/DebugCommand.php index 8989b799c..a97bb5a2b 100644 --- a/src/Command/Libraries/DebugCommand.php +++ b/src/Command/Libraries/DebugCommand.php @@ -15,8 +15,8 @@ use Drupal\Core\Extension\ThemeHandlerInterface; use Drupal\Core\Asset\LibraryDiscoveryInterface; use Drupal\Component\Serialization\Yaml; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; class DebugCommand extends Command { diff --git a/src/Command/Locale/LanguageAddCommand.php b/src/Command/Locale/LanguageAddCommand.php index ba43f027f..f8ad40be9 100644 --- a/src/Command/Locale/LanguageAddCommand.php +++ b/src/Command/Locale/LanguageAddCommand.php @@ -12,9 +12,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Drupal\language\Entity\ConfigurableLanguage; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Command\Shared\LocaleTrait; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Console\Utils\Site; use Drupal\Console\Annotations\DrupalCommand; diff --git a/src/Command/Locale/LanguageDeleteCommand.php b/src/Command/Locale/LanguageDeleteCommand.php index 9cf290c4b..b0d9eff60 100644 --- a/src/Command/Locale/LanguageDeleteCommand.php +++ b/src/Command/Locale/LanguageDeleteCommand.php @@ -7,13 +7,13 @@ namespace Drupal\Console\Command\Locale; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Drupal\Console\Command\Shared\LocaleTrait; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Console\Utils\Site; diff --git a/src/Command/Locale/TranslationStatusCommand.php b/src/Command/Locale/TranslationStatusCommand.php index 6c800291a..a68a17a12 100644 --- a/src/Command/Locale/TranslationStatusCommand.php +++ b/src/Command/Locale/TranslationStatusCommand.php @@ -11,9 +11,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Command\Shared\LocaleTrait; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Utils\Site; use Drupal\Console\Extension\Manager; use Drupal\Console\Annotations\DrupalCommand; diff --git a/src/Command/Migrate/DebugCommand.php b/src/Command/Migrate/DebugCommand.php index 761cc9b8e..574f4d84e 100644 --- a/src/Command/Migrate/DebugCommand.php +++ b/src/Command/Migrate/DebugCommand.php @@ -11,10 +11,10 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Drupal\Console\Command\Shared\MigrationTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Annotations\DrupalCommand; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\migrate\Plugin\MigrationPluginManagerInterface; /** diff --git a/src/Command/Migrate/ExecuteCommand.php b/src/Command/Migrate/ExecuteCommand.php index b68586a08..4142fb6cd 100644 --- a/src/Command/Migrate/ExecuteCommand.php +++ b/src/Command/Migrate/ExecuteCommand.php @@ -16,8 +16,8 @@ use Drupal\Console\Utils\MigrateExecuteMessageCapture; use Drupal\Console\Command\Shared\MigrationTrait; use Drupal\Console\Command\Shared\DatabaseTrait; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\migrate\Plugin\MigrationInterface; use Drupal\State\StateInterface; use Symfony\Component\Console\Command\Command; diff --git a/src/Command/Migrate/SetupCommand.php b/src/Command/Migrate/SetupCommand.php index 9dba61e83..239dac522 100644 --- a/src/Command/Migrate/SetupCommand.php +++ b/src/Command/Migrate/SetupCommand.php @@ -7,13 +7,13 @@ namespace Drupal\Console\Command\Migrate; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Core\State\StateInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Command\Shared\DatabaseTrait; use Drupal\Console\Command\Shared\MigrationTrait; use Drupal\migrate\Plugin\MigrationPluginManagerInterface; diff --git a/src/Command/Module/DebugCommand.php b/src/Command/Module/DebugCommand.php index 59372172c..e3ab8b5ef 100644 --- a/src/Command/Module/DebugCommand.php +++ b/src/Command/Module/DebugCommand.php @@ -12,11 +12,11 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\Site; use GuzzleHttp\Client; -use Drupal\Console\Utils\ConfigurationManager; +use Drupal\Console\Core\Utils\ConfigurationManager; class DebugCommand extends Command { diff --git a/src/Command/Module/DownloadCommand.php b/src/Command/Module/DownloadCommand.php index 450db99fe..2db940a3d 100644 --- a/src/Command/Module/DownloadCommand.php +++ b/src/Command/Module/DownloadCommand.php @@ -7,21 +7,21 @@ namespace Drupal\Console\Command\Module; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Drupal\Console\Command\Shared\ProjectDownloadTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\DrupalApi; use GuzzleHttp\Client; use Drupal\Console\Extension\Manager; use Drupal\Console\Utils\Validator; use Drupal\Console\Utils\Site; -use Drupal\Console\Utils\ConfigurationManager; -use Drupal\Console\Utils\ShellProcess; +use Drupal\Console\Core\Utils\ConfigurationManager; +use Drupal\Console\Core\Utils\ShellProcess; class DownloadCommand extends Command { diff --git a/src/Command/Module/InstallCommand.php b/src/Command/Module/InstallCommand.php index 039c3ecb6..f0649372a 100644 --- a/src/Command/Module/InstallCommand.php +++ b/src/Command/Module/InstallCommand.php @@ -7,7 +7,7 @@ namespace Drupal\Console\Command\Module; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; @@ -17,13 +17,13 @@ use Symfony\Component\Console\Command\Command; use Drupal\Console\Command\Shared\ProjectDownloadTrait; use Drupal\Console\Command\Shared\ModuleTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\Site; use Drupal\Console\Utils\Validator; use Drupal\Core\ProxyClass\Extension\ModuleInstaller; use Drupal\Console\Utils\DrupalApi; use Drupal\Console\Extension\Manager; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Utils\ChainQueue; /** * Class InstallCommand diff --git a/src/Command/Module/InstallDependencyCommand.php b/src/Command/Module/InstallDependencyCommand.php index 4bc60f4b0..8a7d3917a 100644 --- a/src/Command/Module/InstallDependencyCommand.php +++ b/src/Command/Module/InstallDependencyCommand.php @@ -7,7 +7,7 @@ namespace Drupal\Console\Command\Module; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; @@ -15,11 +15,11 @@ use Symfony\Component\Console\Command\Command; use Drupal\Console\Command\Shared\ProjectDownloadTrait; use Drupal\Console\Command\Shared\ModuleTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\Site; use Drupal\Console\Utils\Validator; use Drupal\Core\ProxyClass\Extension\ModuleInstaller; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Utils\ChainQueue; /** * Class InstallDependencyCommand diff --git a/src/Command/Module/PathCommand.php b/src/Command/Module/PathCommand.php index 86cc2beda..b76ebe3db 100644 --- a/src/Command/Module/PathCommand.php +++ b/src/Command/Module/PathCommand.php @@ -12,9 +12,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Command\Shared\ModuleTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; class PathCommand extends Command diff --git a/src/Command/Module/UninstallCommand.php b/src/Command/Module/UninstallCommand.php index ac42d2cfa..63e22ac46 100755 --- a/src/Command/Module/UninstallCommand.php +++ b/src/Command/Module/UninstallCommand.php @@ -7,18 +7,18 @@ namespace Drupal\Console\Command\Module; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Drupal\Console\Command\Shared\ProjectDownloadTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\Site; use Drupal\Console\Utils\Validator; use Drupal\Core\ProxyClass\Extension\ModuleInstaller; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Core\Config\ConfigFactory; class UninstallCommand extends Command diff --git a/src/Command/Module/UpdateCommand.php b/src/Command/Module/UpdateCommand.php index 586e1ea7d..58d45aef2 100644 --- a/src/Command/Module/UpdateCommand.php +++ b/src/Command/Module/UpdateCommand.php @@ -7,15 +7,15 @@ namespace Drupal\Console\Command\Module; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Command\Shared\ProjectDownloadTrait; -use Drupal\Console\Utils\ShellProcess; +use Drupal\Console\Core\Utils\ShellProcess; class UpdateCommand extends Command { diff --git a/src/Command/Multisite/DebugCommand.php b/src/Command/Multisite/DebugCommand.php index a1036d805..0a04491e1 100644 --- a/src/Command/Multisite/DebugCommand.php +++ b/src/Command/Multisite/DebugCommand.php @@ -10,8 +10,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class SiteDebugCommand diff --git a/src/Command/Multisite/NewCommand.php b/src/Command/Multisite/NewCommand.php index 6d0c18b57..d5000080e 100644 --- a/src/Command/Multisite/NewCommand.php +++ b/src/Command/Multisite/NewCommand.php @@ -7,8 +7,8 @@ namespace Drupal\Console\Command\Multisite; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; diff --git a/src/Command/Node/AccessRebuildCommand.php b/src/Command/Node/AccessRebuildCommand.php index 8d8e6c130..a6331aa49 100644 --- a/src/Command/Node/AccessRebuildCommand.php +++ b/src/Command/Node/AccessRebuildCommand.php @@ -12,8 +12,8 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Drupal\Core\State\StateInterface; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class AccessRebuildCommand diff --git a/src/Command/PermissionDebugCommand.php b/src/Command/PermissionDebugCommand.php index 6afa4c8b0..719a50c0d 100644 --- a/src/Command/PermissionDebugCommand.php +++ b/src/Command/PermissionDebugCommand.php @@ -11,8 +11,8 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class DebugCommand diff --git a/src/Command/PluginDebugCommand.php b/src/Command/PluginDebugCommand.php index 21d4c473a..ee47a0e82 100644 --- a/src/Command/PluginDebugCommand.php +++ b/src/Command/PluginDebugCommand.php @@ -12,8 +12,8 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Command\Command; use Symfony\Component\Yaml\Yaml; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class DebugCommand diff --git a/src/Command/Queue/DebugCommand.php b/src/Command/Queue/DebugCommand.php index fd2d050c2..e43695eb8 100644 --- a/src/Command/Queue/DebugCommand.php +++ b/src/Command/Queue/DebugCommand.php @@ -11,8 +11,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Drupal\Core\Queue\QueueWorkerManagerInterface; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class DebugCommand diff --git a/src/Command/Queue/RunCommand.php b/src/Command/Queue/RunCommand.php index 3185e4a70..8da251f1f 100644 --- a/src/Command/Queue/RunCommand.php +++ b/src/Command/Queue/RunCommand.php @@ -13,8 +13,8 @@ use Symfony\Component\Console\Output\OutputInterface; use Drupal\Core\Queue\QueueWorkerManagerInterface; use Drupal\Core\Queue\QueueFactory; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class RunCommand diff --git a/src/Command/Rest/DebugCommand.php b/src/Command/Rest/DebugCommand.php index 2f4bb8343..33d59c56b 100644 --- a/src/Command/Rest/DebugCommand.php +++ b/src/Command/Rest/DebugCommand.php @@ -12,9 +12,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Annotations\DrupalCommand; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Command\Shared\RestTrait; use Drupal\rest\Plugin\Type\ResourcePluginManager; diff --git a/src/Command/Rest/DisableCommand.php b/src/Command/Rest/DisableCommand.php index bca821d26..957c4ffff 100644 --- a/src/Command/Rest/DisableCommand.php +++ b/src/Command/Rest/DisableCommand.php @@ -11,9 +11,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Annotations\DrupalCommand; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Command\Shared\RestTrait; use Drupal\Core\Config\ConfigFactory; use Drupal\rest\Plugin\Type\ResourcePluginManager; diff --git a/src/Command/Rest/EnableCommand.php b/src/Command/Rest/EnableCommand.php index 814a075c8..96536cb1d 100644 --- a/src/Command/Rest/EnableCommand.php +++ b/src/Command/Rest/EnableCommand.php @@ -11,10 +11,10 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Annotations\DrupalCommand; use Drupal\rest\RestResourceConfigInterface; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Command\Shared\RestTrait; use Drupal\rest\Plugin\Type\ResourcePluginManager; use Drupal\Core\Authentication\AuthenticationCollector; diff --git a/src/Command/Router/DebugCommand.php b/src/Command/Router/DebugCommand.php index 4c5a6bb79..4d9970b72 100644 --- a/src/Command/Router/DebugCommand.php +++ b/src/Command/Router/DebugCommand.php @@ -12,8 +12,8 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Drupal\Core\Routing\RouteProviderInterface; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Component\Serialization\Yaml; class DebugCommand extends Command diff --git a/src/Command/Router/RebuildCommand.php b/src/Command/Router/RebuildCommand.php index eaf788b30..e4a59fc94 100644 --- a/src/Command/Router/RebuildCommand.php +++ b/src/Command/Router/RebuildCommand.php @@ -11,8 +11,8 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Drupal\Core\Routing\RouteBuilderInterface; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; class RebuildCommand extends Command { diff --git a/src/Command/ServerCommand.php b/src/Command/ServerCommand.php index c721b3428..1c91129f4 100644 --- a/src/Command/ServerCommand.php +++ b/src/Command/ServerCommand.php @@ -13,8 +13,8 @@ use Symfony\Component\Process\ProcessBuilder; use Symfony\Component\Process\PhpExecutableFinder; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class ServerCommand diff --git a/src/Command/Shared/ConfirmationTrait.php b/src/Command/Shared/ConfirmationTrait.php index 1f213a3a2..6619148eb 100644 --- a/src/Command/Shared/ConfirmationTrait.php +++ b/src/Command/Shared/ConfirmationTrait.php @@ -7,7 +7,7 @@ namespace Drupal\Console\Command\Shared; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class ConfirmationTrait diff --git a/src/Command/Shared/ConnectTrait.php b/src/Command/Shared/ConnectTrait.php index 4e57573fd..ee93c63a7 100644 --- a/src/Command/Shared/ConnectTrait.php +++ b/src/Command/Shared/ConnectTrait.php @@ -7,7 +7,7 @@ namespace Drupal\Console\Command\Shared; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Core\Database\Database; trait ConnectTrait diff --git a/src/Command/Shared/DatabaseTrait.php b/src/Command/Shared/DatabaseTrait.php index ebc5ef79d..f17f49934 100644 --- a/src/Command/Shared/DatabaseTrait.php +++ b/src/Command/Shared/DatabaseTrait.php @@ -8,7 +8,7 @@ namespace Drupal\Console\Command\Shared; use Symfony\Component\Console\Input\InputInterface; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class DatabaseTrait diff --git a/src/Command/Shared/EventsTrait.php b/src/Command/Shared/EventsTrait.php index 14322866a..25f49d0e0 100644 --- a/src/Command/Shared/EventsTrait.php +++ b/src/Command/Shared/EventsTrait.php @@ -7,7 +7,7 @@ namespace Drupal\Console\Command\Shared; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class EventsTrait diff --git a/src/Command/Shared/ExportTrait.php b/src/Command/Shared/ExportTrait.php index 508f8a203..d565fad30 100644 --- a/src/Command/Shared/ExportTrait.php +++ b/src/Command/Shared/ExportTrait.php @@ -8,7 +8,7 @@ namespace Drupal\Console\Command\Shared; use Drupal\Component\Serialization\Yaml; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class ConfigExportTrait diff --git a/src/Command/Shared/FeatureTrait.php b/src/Command/Shared/FeatureTrait.php index 04cdadf90..ccbb9aa59 100644 --- a/src/Command/Shared/FeatureTrait.php +++ b/src/Command/Shared/FeatureTrait.php @@ -7,7 +7,7 @@ namespace Drupal\Console\Command\Shared; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Symfony\Component\Console\Input\ArgvInput; use Drupal\features\FeaturesManagerInterface; use Drupal\features\ConfigurationItem; diff --git a/src/Command/Shared/FormTrait.php b/src/Command/Shared/FormTrait.php index f4030b297..e94528016 100644 --- a/src/Command/Shared/FormTrait.php +++ b/src/Command/Shared/FormTrait.php @@ -7,7 +7,7 @@ namespace Drupal\Console\Command\Shared; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class FormTrait diff --git a/src/Command/Shared/MenuTrait.php b/src/Command/Shared/MenuTrait.php index 5a3d54540..0a749abee 100644 --- a/src/Command/Shared/MenuTrait.php +++ b/src/Command/Shared/MenuTrait.php @@ -7,7 +7,7 @@ namespace Drupal\Console\Command\Shared; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Symfony\Component\Yaml\Parser; /** @@ -17,7 +17,7 @@ trait MenuTrait { /** - * @param \Drupal\Console\Style\DrupalStyle $io + * @param \Drupal\Console\Core\Style\DrupalStyle $io * @param string $className The form class name * @return string * @throws \Exception diff --git a/src/Command/Shared/MigrationTrait.php b/src/Command/Shared/MigrationTrait.php index 94f5499c8..db861081c 100644 --- a/src/Command/Shared/MigrationTrait.php +++ b/src/Command/Shared/MigrationTrait.php @@ -9,7 +9,7 @@ use Drupal\Core\Database\Connection; use Drupal\Core\Database\Database; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Symfony\Component\Console\Input\ArgvInput; /** @@ -150,7 +150,7 @@ protected function getDBInfo() } /** - * @param \Drupal\Console\Style\DrupalStyle $io + * @param \Drupal\Console\Core\Style\DrupalStyle $io * @param $target * @param $key */ diff --git a/src/Command/Shared/ModuleTrait.php b/src/Command/Shared/ModuleTrait.php index e16700a3d..f20de7c93 100644 --- a/src/Command/Shared/ModuleTrait.php +++ b/src/Command/Shared/ModuleTrait.php @@ -7,7 +7,7 @@ namespace Drupal\Console\Command\Shared; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class ModuleTrait @@ -16,7 +16,7 @@ trait ModuleTrait { /** - * @param \Drupal\Console\Style\DrupalStyle $io + * @param \Drupal\Console\Core\Style\DrupalStyle $io * @param bool|true $showProfile * @return string * @throws \Exception diff --git a/src/Command/Shared/PermissionTrait.php b/src/Command/Shared/PermissionTrait.php index 59075ed72..0fe6a339b 100644 --- a/src/Command/Shared/PermissionTrait.php +++ b/src/Command/Shared/PermissionTrait.php @@ -7,7 +7,7 @@ namespace Drupal\Console\Command\Shared; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; trait PermissionTrait { diff --git a/src/Command/Shared/ProjectDownloadTrait.php b/src/Command/Shared/ProjectDownloadTrait.php index ee3b28b9b..87c927fad 100644 --- a/src/Command/Shared/ProjectDownloadTrait.php +++ b/src/Command/Shared/ProjectDownloadTrait.php @@ -7,7 +7,7 @@ namespace Drupal\Console\Command\Shared; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Zippy\Adapter\TarGzGNUTarForWindowsAdapter; use Drupal\Console\Zippy\FileStrategy\TarGzFileForWindowsStrategy; use Alchemy\Zippy\Zippy; @@ -153,7 +153,7 @@ protected function calculateDependencies($modules) } /** - * @param \Drupal\Console\Style\DrupalStyle $io + * @param \Drupal\Console\Core\Style\DrupalStyle $io * @param $project * @param $version * @param $type @@ -253,7 +253,7 @@ public function downloadProject(DrupalStyle $io, $project, $version, $type, $pat } /** - * @param \Drupal\Console\Style\DrupalStyle $io + * @param \Drupal\Console\Core\Style\DrupalStyle $io * @param string $project * @param bool $latest * @param bool $stable diff --git a/src/Command/Shared/ServicesTrait.php b/src/Command/Shared/ServicesTrait.php index 17fb145f5..8dbcfda39 100644 --- a/src/Command/Shared/ServicesTrait.php +++ b/src/Command/Shared/ServicesTrait.php @@ -7,7 +7,7 @@ namespace Drupal\Console\Command\Shared; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; trait ServicesTrait { diff --git a/src/Command/Shared/ThemeBreakpointTrait.php b/src/Command/Shared/ThemeBreakpointTrait.php index 55e903b12..df1d30af4 100644 --- a/src/Command/Shared/ThemeBreakpointTrait.php +++ b/src/Command/Shared/ThemeBreakpointTrait.php @@ -7,7 +7,7 @@ namespace Drupal\Console\Command\Shared; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; trait ThemeBreakpointTrait { diff --git a/src/Command/Shared/ThemeRegionTrait.php b/src/Command/Shared/ThemeRegionTrait.php index 5edaf8d90..2ed1afe54 100644 --- a/src/Command/Shared/ThemeRegionTrait.php +++ b/src/Command/Shared/ThemeRegionTrait.php @@ -7,7 +7,7 @@ namespace Drupal\Console\Command\Shared; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; trait ThemeRegionTrait { diff --git a/src/Command/Shared/TranslationTrait.php b/src/Command/Shared/TranslationTrait.php index 39890fcbc..8648cf9d3 100644 --- a/src/Command/Shared/TranslationTrait.php +++ b/src/Command/Shared/TranslationTrait.php @@ -7,7 +7,7 @@ namespace Drupal\Console\Command\Shared; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; trait TranslationTrait { diff --git a/src/Command/Site/ImportLocalCommand.php b/src/Command/Site/ImportLocalCommand.php index 5f6c0ddb3..9285cc5fc 100644 --- a/src/Command/Site/ImportLocalCommand.php +++ b/src/Command/Site/ImportLocalCommand.php @@ -12,9 +12,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Utils\ConfigurationManager; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Utils\ConfigurationManager; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Yaml\Yaml; diff --git a/src/Command/Site/InstallCommand.php b/src/Command/Site/InstallCommand.php index a32144063..199db20c4 100644 --- a/src/Command/Site/InstallCommand.php +++ b/src/Command/Site/InstallCommand.php @@ -17,11 +17,11 @@ use Symfony\Component\Console\Command\Command; use Drupal\Core\Database\Database; use Drupal\Core\Installer\Exception\AlreadyInstalledException; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Command\Shared\DatabaseTrait; -use Drupal\Console\Utils\ConfigurationManager; +use Drupal\Console\Core\Utils\ConfigurationManager; use Drupal\Console\Extension\Manager; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Bootstrap\Drupal; use Drupal\Console\Utils\Site; use DrupalFinder\DrupalFinder; diff --git a/src/Command/Site/MaintenanceCommand.php b/src/Command/Site/MaintenanceCommand.php index e562a0df9..908330a4d 100644 --- a/src/Command/Site/MaintenanceCommand.php +++ b/src/Command/Site/MaintenanceCommand.php @@ -11,10 +11,10 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Core\State\StateInterface; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Utils\ChainQueue; class MaintenanceCommand extends Command { diff --git a/src/Command/Site/ModeCommand.php b/src/Command/Site/ModeCommand.php index b70e42442..c6b22ac13 100644 --- a/src/Command/Site/ModeCommand.php +++ b/src/Command/Site/ModeCommand.php @@ -15,11 +15,11 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Filesystem\Filesystem; use Novia713\Maginot\Maginot; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Utils\ConfigurationManager; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Utils\ConfigurationManager; use Drupal\Core\Config\ConfigFactory; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Utils\ChainQueue; class ModeCommand extends Command { diff --git a/src/Command/Site/StatisticsCommand.php b/src/Command/Site/StatisticsCommand.php index be80636f1..d93a89b1d 100644 --- a/src/Command/Site/StatisticsCommand.php +++ b/src/Command/Site/StatisticsCommand.php @@ -10,8 +10,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\DrupalApi; use Drupal\Core\Entity\Query\QueryFactory; use Drupal\Console\Extension\Manager; diff --git a/src/Command/Site/StatusCommand.php b/src/Command/Site/StatusCommand.php index 453a3d1cf..38b92e147 100644 --- a/src/Command/Site/StatusCommand.php +++ b/src/Command/Site/StatusCommand.php @@ -12,8 +12,8 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Drupal\Core\Database\Database; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\system\SystemManager; use Drupal\Core\Site\Settings; use Drupal\Core\Config\ConfigFactory; diff --git a/src/Command/State/DebugCommand.php b/src/Command/State/DebugCommand.php index a3f639467..0f9c0ada8 100644 --- a/src/Command/State/DebugCommand.php +++ b/src/Command/State/DebugCommand.php @@ -13,8 +13,8 @@ use Symfony\Component\Console\Command\Command; use Drupal\Core\KeyValueStore\KeyValueFactoryInterface; use Drupal\Core\State\StateInterface; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Component\Serialization\Yaml; /** diff --git a/src/Command/State/DeleteCommand.php b/src/Command/State/DeleteCommand.php index 082b2e90a..7c7f5e9e6 100644 --- a/src/Command/State/DeleteCommand.php +++ b/src/Command/State/DeleteCommand.php @@ -12,8 +12,8 @@ use Symfony\Component\Console\Command\Command; use Drupal\Core\KeyValueStore\KeyValueFactoryInterface; use Drupal\Core\State\StateInterface; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; class DeleteCommand extends Command { diff --git a/src/Command/State/OverrideCommand.php b/src/Command/State/OverrideCommand.php index 333854bde..6c74628c1 100644 --- a/src/Command/State/OverrideCommand.php +++ b/src/Command/State/OverrideCommand.php @@ -13,8 +13,8 @@ use Symfony\Component\Console\Command\Command; use Drupal\Core\KeyValueStore\KeyValueFactoryInterface; use Drupal\Core\State\StateInterface; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Component\Serialization\Yaml; /** diff --git a/src/Command/Taxonomy/DeleteTermCommand.php b/src/Command/Taxonomy/DeleteTermCommand.php index bb3f996b4..f54353b3c 100644 --- a/src/Command/Taxonomy/DeleteTermCommand.php +++ b/src/Command/Taxonomy/DeleteTermCommand.php @@ -9,8 +9,8 @@ use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\taxonomy\Entity\Term; use Drupal\taxonomy\Entity\Vocabulary; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class DeleteTermCommand. diff --git a/src/Command/Test/DebugCommand.php b/src/Command/Test/DebugCommand.php index 32fef1cd6..f00828f9c 100644 --- a/src/Command/Test/DebugCommand.php +++ b/src/Command/Test/DebugCommand.php @@ -13,9 +13,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Drupal\Component\Serialization\Yaml; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Annotations\DrupalCommand; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\simpletest\TestDiscovery; /** diff --git a/src/Command/Test/RunCommand.php b/src/Command/Test/RunCommand.php index 2b945057b..eec86c8a7 100644 --- a/src/Command/Test/RunCommand.php +++ b/src/Command/Test/RunCommand.php @@ -13,9 +13,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Drupal\Component\Utility\Timer; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Annotations\DrupalCommand; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\simpletest\TestDiscovery; use Drupal\Core\Datetime\DateFormatter; diff --git a/src/Command/Theme/DebugCommand.php b/src/Command/Theme/DebugCommand.php index c0fd81674..2957807c3 100644 --- a/src/Command/Theme/DebugCommand.php +++ b/src/Command/Theme/DebugCommand.php @@ -11,10 +11,10 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Extension\ThemeHandler; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; class DebugCommand extends Command { diff --git a/src/Command/Theme/DownloadCommand.php b/src/Command/Theme/DownloadCommand.php index c3e3919b1..83b5ab12b 100644 --- a/src/Command/Theme/DownloadCommand.php +++ b/src/Command/Theme/DownloadCommand.php @@ -12,8 +12,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Command\Shared\ProjectDownloadTrait; use Drupal\Console\Utils\DrupalApi; use GuzzleHttp\Client; diff --git a/src/Command/Theme/InstallCommand.php b/src/Command/Theme/InstallCommand.php index f6ba43e6d..e2d518f9b 100644 --- a/src/Command/Theme/InstallCommand.php +++ b/src/Command/Theme/InstallCommand.php @@ -12,12 +12,12 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Extension\ThemeHandler; use Drupal\Core\Config\UnmetDependenciesException; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Utils\ChainQueue; class InstallCommand extends Command { diff --git a/src/Command/Theme/PathCommand.php b/src/Command/Theme/PathCommand.php index 3ba3cf432..cb0a5322e 100644 --- a/src/Command/Theme/PathCommand.php +++ b/src/Command/Theme/PathCommand.php @@ -12,10 +12,10 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Extension\Manager; use Drupal\Console\Command\Shared\ModuleTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; class PathCommand extends Command { diff --git a/src/Command/Theme/UninstallCommand.php b/src/Command/Theme/UninstallCommand.php index a22e3d7c4..a3a610ae8 100644 --- a/src/Command/Theme/UninstallCommand.php +++ b/src/Command/Theme/UninstallCommand.php @@ -11,12 +11,12 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Extension\ThemeHandler; use Drupal\Core\Config\UnmetDependenciesException; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Utils\ChainQueue; class UninstallCommand extends Command { diff --git a/src/Command/Update/DebugCommand.php b/src/Command/Update/DebugCommand.php index 6fbc2fd53..8157ff2a3 100644 --- a/src/Command/Update/DebugCommand.php +++ b/src/Command/Update/DebugCommand.php @@ -11,9 +11,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Drupal\Core\Update\UpdateRegistry; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Utils\Site; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; class DebugCommand extends Command { @@ -83,7 +83,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } /** - * @param \Drupal\Console\Style\DrupalStyle $io + * @param \Drupal\Console\Core\Style\DrupalStyle $io * @param $requirements */ private function populateRequirements(DrupalStyle $io, $requirements) @@ -117,7 +117,7 @@ private function populateRequirements(DrupalStyle $io, $requirements) } /** - * @param \Drupal\Console\Style\DrupalStyle $io + * @param \Drupal\Console\Core\Style\DrupalStyle $io * @param $updates */ private function populateUpdate(DrupalStyle $io, $updates) @@ -143,7 +143,7 @@ private function populateUpdate(DrupalStyle $io, $updates) } /** - * @param \Drupal\Console\Style\DrupalStyle $io + * @param \Drupal\Console\Core\Style\DrupalStyle $io */ private function populatePostUpdate(DrupalStyle $io) { diff --git a/src/Command/Update/EntitiesCommand.php b/src/Command/Update/EntitiesCommand.php index 521bb6e0f..80f7f16d6 100644 --- a/src/Command/Update/EntitiesCommand.php +++ b/src/Command/Update/EntitiesCommand.php @@ -10,13 +10,13 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Entity\EntityStorageException; use Drupal\Core\Utility\Error; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Core\State\StateInterface; use Drupal\Core\Entity\EntityDefinitionUpdateManager; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Utils\ChainQueue; /** * Class EntitiesCommand. diff --git a/src/Command/Update/ExecuteCommand.php b/src/Command/Update/ExecuteCommand.php index d84d78b4a..cc66641c5 100644 --- a/src/Command/Update/ExecuteCommand.php +++ b/src/Command/Update/ExecuteCommand.php @@ -14,11 +14,11 @@ use Drupal\Core\State\StateInterface; use Drupal\Core\Extension\ModuleHandler; use Drupal\Core\Update\UpdateRegistry; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\Site; use Drupal\Console\Extension\Manager; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Utils\ChainQueue; class ExecuteCommand extends Command { @@ -147,7 +147,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } /** - * @param \Drupal\Console\Style\DrupalStyle $io + * @param \Drupal\Console\Core\Style\DrupalStyle $io */ private function checkUpdates(DrupalStyle $io) { @@ -178,7 +178,7 @@ private function checkUpdates(DrupalStyle $io) } /** - * @param \Drupal\Console\Style\DrupalStyle $io + * @param \Drupal\Console\Core\Style\DrupalStyle $io * @param $updates */ private function runUpdates(DrupalStyle $io, $updates) @@ -221,7 +221,7 @@ private function runUpdates(DrupalStyle $io, $updates) } /** - * @param \Drupal\Console\Style\DrupalStyle $io + * @param \Drupal\Console\Core\Style\DrupalStyle $io */ private function runPostUpdates(DrupalStyle $io) { diff --git a/src/Command/User/CreateCommand.php b/src/Command/User/CreateCommand.php index 797b370d9..f883887d1 100644 --- a/src/Command/User/CreateCommand.php +++ b/src/Command/User/CreateCommand.php @@ -11,15 +11,15 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Database\Connection; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Datetime\DateFormatterInterface; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Console\Utils\DrupalApi; use Drupal\Console\Command\Shared\ConfirmationTrait; use Drupal\user\Entity\User; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; class CreateCommand extends Command { diff --git a/src/Command/User/DebugCommand.php b/src/Command/User/DebugCommand.php index b03222e3c..05e82ee23 100644 --- a/src/Command/User/DebugCommand.php +++ b/src/Command/User/DebugCommand.php @@ -11,10 +11,10 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\Query\QueryFactory; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\DrupalApi; /** diff --git a/src/Command/User/DeleteCommand.php b/src/Command/User/DeleteCommand.php index 4c0611ce4..79d080485 100644 --- a/src/Command/User/DeleteCommand.php +++ b/src/Command/User/DeleteCommand.php @@ -11,10 +11,10 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\Query\QueryFactory; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\DrupalApi; /** diff --git a/src/Command/User/LoginCleanAttemptsCommand.php b/src/Command/User/LoginCleanAttemptsCommand.php index 6ca7e66ea..831830582 100644 --- a/src/Command/User/LoginCleanAttemptsCommand.php +++ b/src/Command/User/LoginCleanAttemptsCommand.php @@ -12,9 +12,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Drupal\Console\Command\Shared\ConfirmationTrait; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Database\Connection; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\user\Entity\User; class LoginCleanAttemptsCommand extends Command diff --git a/src/Command/User/LoginUrlCommand.php b/src/Command/User/LoginUrlCommand.php index 3edfb1850..ddf904674 100644 --- a/src/Command/User/LoginUrlCommand.php +++ b/src/Command/User/LoginUrlCommand.php @@ -11,9 +11,9 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class UserLoginCommand. diff --git a/src/Command/User/PasswordHashCommand.php b/src/Command/User/PasswordHashCommand.php index c31044cee..817280899 100644 --- a/src/Command/User/PasswordHashCommand.php +++ b/src/Command/User/PasswordHashCommand.php @@ -11,10 +11,10 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Password\PasswordInterface; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; class PasswordHashCommand extends Command { diff --git a/src/Command/User/PasswordResetCommand.php b/src/Command/User/PasswordResetCommand.php index 47a964f7a..fddfc5762 100644 --- a/src/Command/User/PasswordResetCommand.php +++ b/src/Command/User/PasswordResetCommand.php @@ -10,12 +10,12 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Database\Connection; -use Drupal\Console\Utils\ChainQueue; +use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Console\Command\Shared\ConfirmationTrait; use Drupal\user\Entity\User; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; class PasswordResetCommand extends Command { diff --git a/src/Command/User/RoleCommand.php b/src/Command/User/RoleCommand.php index 9d9f75231..c9730b887 100644 --- a/src/Command/User/RoleCommand.php +++ b/src/Command/User/RoleCommand.php @@ -11,9 +11,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Utils\DrupalApi; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class DebugCommand diff --git a/src/Command/Views/DebugCommand.php b/src/Command/Views/DebugCommand.php index 1b261337f..a263b7ae4 100644 --- a/src/Command/Views/DebugCommand.php +++ b/src/Command/Views/DebugCommand.php @@ -13,9 +13,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Drupal\views\Entity\View; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class DebugCommand @@ -93,7 +93,7 @@ protected function execute(InputInterface $input, OutputInterface $output) /** - * @param \Drupal\Console\Style\DrupalStyle $io + * @param \Drupal\Console\Core\Style\DrupalStyle $io * @param $view_id * @return bool */ @@ -142,7 +142,7 @@ private function viewDetail(DrupalStyle $io, $view_id) } /** - * @param \Drupal\Console\Style\DrupalStyle $io + * @param \Drupal\Console\Core\Style\DrupalStyle $io * @param $tag * @param $status */ diff --git a/src/Command/Views/DisableCommand.php b/src/Command/Views/DisableCommand.php index 7d849aa4d..d08f577c5 100644 --- a/src/Command/Views/DisableCommand.php +++ b/src/Command/Views/DisableCommand.php @@ -11,10 +11,10 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\Query\QueryFactory; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class DisableCommand diff --git a/src/Command/Views/EnableCommand.php b/src/Command/Views/EnableCommand.php index 5c76d096d..c110ca25b 100644 --- a/src/Command/Views/EnableCommand.php +++ b/src/Command/Views/EnableCommand.php @@ -12,10 +12,10 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Config\Definition\Exception\Exception; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\Query\QueryFactory; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Style\DrupalStyle; /** * Class EnableCommand diff --git a/src/Command/Views/PluginsDebugCommand.php b/src/Command/Views/PluginsDebugCommand.php index 6939f801a..49fd0c869 100644 --- a/src/Command/Views/PluginsDebugCommand.php +++ b/src/Command/Views/PluginsDebugCommand.php @@ -11,8 +11,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\ContainerAwareCommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\views\Views; /** @@ -49,7 +49,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } /** - * @param \Drupal\Console\Style\DrupalStyle $io + * @param \Drupal\Console\Core\Style\DrupalStyle $io * @param $type */ protected function pluginList(DrupalStyle $io, $type) diff --git a/src/Command/Yaml/DiffCommand.php b/src/Command/Yaml/DiffCommand.php index dc21cb4d6..8bf203e49 100644 --- a/src/Command/Yaml/DiffCommand.php +++ b/src/Command/Yaml/DiffCommand.php @@ -13,9 +13,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Yaml\Parser; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Utils\NestedArray; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Utils\NestedArray; class DiffCommand extends Command { diff --git a/src/Command/Yaml/GetValueCommand.php b/src/Command/Yaml/GetValueCommand.php index ee5df1f53..cca41162a 100644 --- a/src/Command/Yaml/GetValueCommand.php +++ b/src/Command/Yaml/GetValueCommand.php @@ -12,9 +12,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Yaml\Parser; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Utils\NestedArray; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Utils\NestedArray; class GetValueCommand extends Command { diff --git a/src/Command/Yaml/MergeCommand.php b/src/Command/Yaml/MergeCommand.php index df80b4e7f..93e0f6e68 100644 --- a/src/Command/Yaml/MergeCommand.php +++ b/src/Command/Yaml/MergeCommand.php @@ -13,8 +13,8 @@ use Symfony\Component\Yaml\Dumper; use Symfony\Component\Yaml\Parser; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; class MergeCommand extends Command { diff --git a/src/Command/Yaml/SplitCommand.php b/src/Command/Yaml/SplitCommand.php index 313cfc97f..28f8748f2 100644 --- a/src/Command/Yaml/SplitCommand.php +++ b/src/Command/Yaml/SplitCommand.php @@ -14,9 +14,9 @@ use Symfony\Component\Yaml\Dumper; use Symfony\Component\Yaml\Parser; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Utils\NestedArray; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Utils\NestedArray; class SplitCommand extends Command { diff --git a/src/Command/Yaml/UnsetKeyCommand.php b/src/Command/Yaml/UnsetKeyCommand.php index add8e252c..24d833c48 100644 --- a/src/Command/Yaml/UnsetKeyCommand.php +++ b/src/Command/Yaml/UnsetKeyCommand.php @@ -13,9 +13,9 @@ use Symfony\Component\Yaml\Dumper; use Symfony\Component\Yaml\Parser; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Utils\NestedArray; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Utils\NestedArray; class UnsetKeyCommand extends Command { diff --git a/src/Command/Yaml/UpdateKeyCommand.php b/src/Command/Yaml/UpdateKeyCommand.php index be9a7d27f..dc2cbda76 100644 --- a/src/Command/Yaml/UpdateKeyCommand.php +++ b/src/Command/Yaml/UpdateKeyCommand.php @@ -13,9 +13,9 @@ use Symfony\Component\Yaml\Dumper; use Symfony\Component\Yaml\Parser; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Utils\NestedArray; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Utils\NestedArray; class UpdateKeyCommand extends Command { diff --git a/src/Command/Yaml/UpdateValueCommand.php b/src/Command/Yaml/UpdateValueCommand.php index a78823143..1d56a0109 100644 --- a/src/Command/Yaml/UpdateValueCommand.php +++ b/src/Command/Yaml/UpdateValueCommand.php @@ -13,9 +13,9 @@ use Symfony\Component\Yaml\Dumper; use Symfony\Component\Yaml\Parser; use Symfony\Component\Console\Command\Command; -use Drupal\Console\Command\Shared\CommandTrait; -use Drupal\Console\Style\DrupalStyle; -use Drupal\Console\Utils\NestedArray; +use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Core\Utils\NestedArray; class UpdateValueCommand extends Command { diff --git a/src/Generator/AuthenticationProviderGenerator.php b/src/Generator/AuthenticationProviderGenerator.php index dd5598f82..890e92675 100644 --- a/src/Generator/AuthenticationProviderGenerator.php +++ b/src/Generator/AuthenticationProviderGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class AuthenticationProviderGenerator extends Generator diff --git a/src/Generator/BreakPointGenerator.php b/src/Generator/BreakPointGenerator.php index 7b7432f29..f1bc4f1eb 100644 --- a/src/Generator/BreakPointGenerator.php +++ b/src/Generator/BreakPointGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; /** diff --git a/src/Generator/CommandGenerator.php b/src/Generator/CommandGenerator.php index b882b1776..bbd3de4a1 100644 --- a/src/Generator/CommandGenerator.php +++ b/src/Generator/CommandGenerator.php @@ -8,9 +8,8 @@ namespace Drupal\Console\Generator; use Drupal\Console\Extension\Manager; -use Drupal\Console\Utils\TranslatorManager; -use Symfony\Component\Filesystem\Filesystem; -use Symfony\Component\Yaml\Yaml; +use Drupal\Console\Core\Utils\TranslatorManager; +use Drupal\Console\Core\Generator\Generator; /** * Class CommandGenerator diff --git a/src/Generator/ControllerGenerator.php b/src/Generator/ControllerGenerator.php index 1f046bda9..430f559b8 100644 --- a/src/Generator/ControllerGenerator.php +++ b/src/Generator/ControllerGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class ControllerGenerator extends Generator diff --git a/src/Generator/DatabaseSettingsGenerator.php b/src/Generator/DatabaseSettingsGenerator.php index 617f842e4..868daf4e2 100644 --- a/src/Generator/DatabaseSettingsGenerator.php +++ b/src/Generator/DatabaseSettingsGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Core\DrupalKernelInterface; class DatabaseSettingsGenerator extends Generator diff --git a/src/Generator/EntityBundleGenerator.php b/src/Generator/EntityBundleGenerator.php index 176d911eb..24d6230e9 100644 --- a/src/Generator/EntityBundleGenerator.php +++ b/src/Generator/EntityBundleGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class EntityBundleGenerator extends Generator diff --git a/src/Generator/EntityConfigGenerator.php b/src/Generator/EntityConfigGenerator.php index 7ed90b7fc..5291d1e03 100644 --- a/src/Generator/EntityConfigGenerator.php +++ b/src/Generator/EntityConfigGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class EntityConfigGenerator extends Generator diff --git a/src/Generator/EntityContentGenerator.php b/src/Generator/EntityContentGenerator.php index d6b0abaa3..67978e78d 100644 --- a/src/Generator/EntityContentGenerator.php +++ b/src/Generator/EntityContentGenerator.php @@ -7,10 +7,10 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; use Drupal\Console\Utils\Site; -use Drupal\Console\Utils\TwigRenderer; -use Drupal\Console\Style\DrupalStyle; +use Drupal\Console\Core\Utils\TwigRenderer; class EntityContentGenerator extends Generator { diff --git a/src/Generator/EventSubscriberGenerator.php b/src/Generator/EventSubscriberGenerator.php index 5356efd6a..afe88f8db 100644 --- a/src/Generator/EventSubscriberGenerator.php +++ b/src/Generator/EventSubscriberGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class EventSubscriberGenerator extends Generator diff --git a/src/Generator/FormAlterGenerator.php b/src/Generator/FormAlterGenerator.php index 49ac143f5..137fdd9bb 100644 --- a/src/Generator/FormAlterGenerator.php +++ b/src/Generator/FormAlterGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class FormAlterGenerator extends Generator diff --git a/src/Generator/FormGenerator.php b/src/Generator/FormGenerator.php index e1c73d7af..49b787f87 100644 --- a/src/Generator/FormGenerator.php +++ b/src/Generator/FormGenerator.php @@ -7,8 +7,9 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; -use Drupal\Console\Utils\StringConverter; +use Drupal\Console\Core\Utils\StringConverter; class FormGenerator extends Generator { diff --git a/src/Generator/GeneratorInterface.php b/src/Generator/GeneratorInterface.php deleted file mode 100644 index 83a61a760..000000000 --- a/src/Generator/GeneratorInterface.php +++ /dev/null @@ -1,8 +0,0 @@ -extensionManager = $extensionManager; } - /** * Generator Plugin CKEditor Button. * diff --git a/src/Generator/PluginConditionGenerator.php b/src/Generator/PluginConditionGenerator.php index 5655c0975..511876c26 100644 --- a/src/Generator/PluginConditionGenerator.php +++ b/src/Generator/PluginConditionGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; /** diff --git a/src/Generator/PluginFieldFormatterGenerator.php b/src/Generator/PluginFieldFormatterGenerator.php index 97c5dff33..ab409b720 100644 --- a/src/Generator/PluginFieldFormatterGenerator.php +++ b/src/Generator/PluginFieldFormatterGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class PluginFieldFormatterGenerator extends Generator diff --git a/src/Generator/PluginFieldTypeGenerator.php b/src/Generator/PluginFieldTypeGenerator.php index b33129d21..ee4d6107c 100644 --- a/src/Generator/PluginFieldTypeGenerator.php +++ b/src/Generator/PluginFieldTypeGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class PluginFieldTypeGenerator extends Generator @@ -21,7 +22,6 @@ public function __construct( $this->extensionManager = $extensionManager; } - /** * Generator Plugin Field Type. * diff --git a/src/Generator/PluginFieldWidgetGenerator.php b/src/Generator/PluginFieldWidgetGenerator.php index 1528eff48..fe4a561a4 100644 --- a/src/Generator/PluginFieldWidgetGenerator.php +++ b/src/Generator/PluginFieldWidgetGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class PluginFieldWidgetGenerator extends Generator diff --git a/src/Generator/PluginImageEffectGenerator.php b/src/Generator/PluginImageEffectGenerator.php index c8c5994ce..6fe35d584 100644 --- a/src/Generator/PluginImageEffectGenerator.php +++ b/src/Generator/PluginImageEffectGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class PluginImageEffectGenerator extends Generator diff --git a/src/Generator/PluginImageFormatterGenerator.php b/src/Generator/PluginImageFormatterGenerator.php index b9d43dbfc..7a6639091 100644 --- a/src/Generator/PluginImageFormatterGenerator.php +++ b/src/Generator/PluginImageFormatterGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class PluginImageFormatterGenerator extends Generator diff --git a/src/Generator/PluginMailGenerator.php b/src/Generator/PluginMailGenerator.php index edc247cd7..940afb0b5 100644 --- a/src/Generator/PluginMailGenerator.php +++ b/src/Generator/PluginMailGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class PluginMailGenerator extends Generator diff --git a/src/Generator/PluginMigrateSourceGenerator.php b/src/Generator/PluginMigrateSourceGenerator.php index 163d4861c..fe0bbb8aa 100644 --- a/src/Generator/PluginMigrateSourceGenerator.php +++ b/src/Generator/PluginMigrateSourceGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class PluginMigrateSourceGenerator extends Generator diff --git a/src/Generator/PluginRestResourceGenerator.php b/src/Generator/PluginRestResourceGenerator.php index 38734b4fe..7d5cc2e0f 100644 --- a/src/Generator/PluginRestResourceGenerator.php +++ b/src/Generator/PluginRestResourceGenerator.php @@ -7,10 +7,16 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class PluginRestResourceGenerator extends Generator { + /** + * @var Manager + */ + protected $extensionManager; + /** * PluginRestResourceGenerator constructor. * @param Manager $extensionManager diff --git a/src/Generator/PluginRulesActionGenerator.php b/src/Generator/PluginRulesActionGenerator.php index 1b27f3860..7263b0c5b 100644 --- a/src/Generator/PluginRulesActionGenerator.php +++ b/src/Generator/PluginRulesActionGenerator.php @@ -7,10 +7,17 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class PluginRulesActionGenerator extends Generator { + + /** + * @var Manager + */ + protected $extensionManager; + /** * PluginRulesActionGenerator constructor. * @param Manager $extensionManager diff --git a/src/Generator/PluginSkeletonGenerator.php b/src/Generator/PluginSkeletonGenerator.php index 4b98165c0..187b9ded6 100644 --- a/src/Generator/PluginSkeletonGenerator.php +++ b/src/Generator/PluginSkeletonGenerator.php @@ -7,10 +7,17 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class PluginSkeletonGenerator extends Generator { + + /** + * @var Manager + */ + protected $extensionManager; + /** * PluginSkeletonGenerator constructor. * @param Manager $extensionManager @@ -26,7 +33,7 @@ public function __construct( * * @param $module * @param $pluginId - * * @param $plugin + * @param $plugin * @param $className * @param $pluginMetaData * @param $services @@ -35,7 +42,6 @@ public function generate($module, $pluginId, $plugin, $className, $pluginMetaDat { $module_path = $this->extensionManager->getModule($module)->getPath(); - $parameters = [ 'module' => $module, 'plugin_id' => $pluginId, diff --git a/src/Generator/PluginTypeAnnotationGenerator.php b/src/Generator/PluginTypeAnnotationGenerator.php index 8c3683fc8..07b63c15a 100644 --- a/src/Generator/PluginTypeAnnotationGenerator.php +++ b/src/Generator/PluginTypeAnnotationGenerator.php @@ -7,10 +7,17 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class PluginTypeAnnotationGenerator extends Generator { + + /** + * @var Manager + */ + protected $extensionManager; + /** * PluginTypeAnnotationGenerator constructor. * @param Manager $extensionManager diff --git a/src/Generator/PluginTypeYamlGenerator.php b/src/Generator/PluginTypeYamlGenerator.php index 04eff53e0..0a176e3ec 100644 --- a/src/Generator/PluginTypeYamlGenerator.php +++ b/src/Generator/PluginTypeYamlGenerator.php @@ -7,10 +7,17 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class PluginTypeYamlGenerator extends Generator { + + /** + * @var Manager + */ + protected $extensionManager; + /** * PluginTypeYamlGenerator constructor. * @param Manager $extensionManager diff --git a/src/Generator/PluginViewsFieldGenerator.php b/src/Generator/PluginViewsFieldGenerator.php index 65d1871f3..89461be54 100644 --- a/src/Generator/PluginViewsFieldGenerator.php +++ b/src/Generator/PluginViewsFieldGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class PluginViewsFieldGenerator extends Generator diff --git a/src/Generator/PostUpdateGenerator.php b/src/Generator/PostUpdateGenerator.php index ecf8333dd..87c0a2a69 100644 --- a/src/Generator/PostUpdateGenerator.php +++ b/src/Generator/PostUpdateGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class PostUpdateGenerator extends Generator diff --git a/src/Generator/ProfileGenerator.php b/src/Generator/ProfileGenerator.php index fb6c5a28e..cfbc8a0f6 100644 --- a/src/Generator/ProfileGenerator.php +++ b/src/Generator/ProfileGenerator.php @@ -7,6 +7,8 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; + class ProfileGenerator extends Generator { public function generate( diff --git a/src/Generator/RouteSubscriberGenerator.php b/src/Generator/RouteSubscriberGenerator.php index e80c89236..c1fd08bb1 100644 --- a/src/Generator/RouteSubscriberGenerator.php +++ b/src/Generator/RouteSubscriberGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class RouteSubscriberGenerator extends Generator diff --git a/src/Generator/ServiceGenerator.php b/src/Generator/ServiceGenerator.php index 20c65945f..b43579a80 100644 --- a/src/Generator/ServiceGenerator.php +++ b/src/Generator/ServiceGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class ServiceGenerator extends Generator diff --git a/src/Generator/ThemeGenerator.php b/src/Generator/ThemeGenerator.php index d9cf133fd..09a89cea3 100644 --- a/src/Generator/ThemeGenerator.php +++ b/src/Generator/ThemeGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; /** diff --git a/src/Generator/TwigExtensionGenerator.php b/src/Generator/TwigExtensionGenerator.php index aec492bb4..6efbe0f7f 100644 --- a/src/Generator/TwigExtensionGenerator.php +++ b/src/Generator/TwigExtensionGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; /** diff --git a/src/Generator/UpdateGenerator.php b/src/Generator/UpdateGenerator.php index f170c1728..dd8b59096 100644 --- a/src/Generator/UpdateGenerator.php +++ b/src/Generator/UpdateGenerator.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Generator; +use Drupal\Console\Core\Generator\Generator; use Drupal\Console\Extension\Manager; class UpdateGenerator extends Generator diff --git a/src/Utils/Validator.php b/src/Utils/Validator.php index 89670949c..dbf4468fb 100644 --- a/src/Utils/Validator.php +++ b/src/Utils/Validator.php @@ -21,7 +21,7 @@ class Validator /** * Site constructor. - * @param Manager extensionManager + * @param Manager $extensionManager */ public function __construct(Manager $extensionManager) { From e53c805fb8fe90b3c7317c3b14d86c563ed13a94 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 28 Dec 2016 19:32:54 -0800 Subject: [PATCH 106/321] [yaml:*] Relocate commands to console-core. (#3052) --- config/services/drupal-console/yaml.yml | 35 ---- src/Command/Yaml/DiffCommand.php | 243 ------------------------ src/Command/Yaml/GetValueCommand.php | 96 ---------- src/Command/Yaml/MergeCommand.php | 201 -------------------- src/Command/Yaml/SplitCommand.php | 239 ----------------------- src/Command/Yaml/UnsetKeyCommand.php | 109 ----------- src/Command/Yaml/UpdateKeyCommand.php | 117 ------------ src/Command/Yaml/UpdateValueCommand.php | 116 ----------- 8 files changed, 1156 deletions(-) delete mode 100644 config/services/drupal-console/yaml.yml delete mode 100644 src/Command/Yaml/DiffCommand.php delete mode 100644 src/Command/Yaml/GetValueCommand.php delete mode 100644 src/Command/Yaml/MergeCommand.php delete mode 100644 src/Command/Yaml/SplitCommand.php delete mode 100644 src/Command/Yaml/UnsetKeyCommand.php delete mode 100644 src/Command/Yaml/UpdateKeyCommand.php delete mode 100644 src/Command/Yaml/UpdateValueCommand.php diff --git a/config/services/drupal-console/yaml.yml b/config/services/drupal-console/yaml.yml deleted file mode 100644 index 436986d60..000000000 --- a/config/services/drupal-console/yaml.yml +++ /dev/null @@ -1,35 +0,0 @@ -services: - console.yaml_diff: - class: Drupal\Console\Command\Yaml\DiffCommand - arguments: ['@console.nested_array'] - tags: - - { name: drupal.command } - console.yaml_get_value: - class: Drupal\Console\Command\Yaml\GetValueCommand - arguments: ['@console.nested_array'] - tags: - - { name: drupal.command } - console.yaml_merge: - class: Drupal\Console\Command\Yaml\MergeCommand - tags: - - { name: drupal.command } - console.yaml_split: - class: Drupal\Console\Command\Yaml\SplitCommand - arguments: ['@console.nested_array'] - tags: - - { name: drupal.command } - console.yaml_update_key: - class: Drupal\Console\Command\Yaml\UpdateKeyCommand - arguments: ['@console.nested_array'] - tags: - - { name: drupal.command } - console.yaml_update_value: - class: Drupal\Console\Command\Yaml\UpdateValueCommand - arguments: ['@console.nested_array'] - tags: - - { name: drupal.command } - console.yaml_unset_key: - class: Drupal\Console\Command\Yaml\UnsetKeyCommand - arguments: ['@console.nested_array'] - tags: - - { name: drupal.command } diff --git a/src/Command/Yaml/DiffCommand.php b/src/Command/Yaml/DiffCommand.php deleted file mode 100644 index 8bf203e49..000000000 --- a/src/Command/Yaml/DiffCommand.php +++ /dev/null @@ -1,243 +0,0 @@ -nestedArray = $nestedArray; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('yaml:diff') - ->setDescription($this->trans('commands.yaml.diff.description')) - ->addArgument( - 'yaml-left', - InputArgument::REQUIRED, - $this->trans('commands.yaml.diff.arguments.yaml-left') - ) - ->addArgument( - 'yaml-right', - InputArgument::REQUIRED, - $this->trans('commands.yaml.diff.arguments.yaml-right') - ) - ->addOption( - 'stats', - false, - InputOption::VALUE_NONE, - $this->trans('commands.yaml.diff.options.stats') - ) - ->addOption( - 'negate', - false, - InputOption::VALUE_NONE, - $this->trans('commands.yaml.diff.options.negate') - ) - ->addOption( - 'limit', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.yaml.diff.options.limit') - ) - ->addOption( - 'offset', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.yaml.diff.options.offset') - ); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $yaml = new Parser(); - - $yaml_left = $input->getArgument('yaml-left'); - $yaml_right = $input->getArgument('yaml-right'); - - $stats = $input->getOption('stats'); - - $negate = $input->getOption('negate'); - - $limit = $input->getOption('limit'); - $offset = $input->getOption('offset'); - - if ($negate == 1 || $negate == 'TRUE') { - $negate = true; - } else { - $negate = false; - } - - try { - $yamlLeftParsed = $yaml->parse(file_get_contents($yaml_left)); - - if (empty($yamlLeftParsed)) { - $io->error( - sprintf( - $this->trans('commands.yaml.merge.messages.wrong-parse'), - $yaml_left - ) - ); - } - - $yamlRightParsed = $yaml->parse(file_get_contents($yaml_right)); - - if (empty($yamlRightParsed)) { - $io->error( - sprintf( - $this->trans('commands.yaml.merge.messages.wrong-parse'), - $yaml_right - ) - ); - } - } catch (\Exception $e) { - $io->error($this->trans('commands.yaml.merge.messages.error-parsing').': '.$e->getMessage()); - - return; - } - - $statistics = ['total' => 0, 'equal'=> 0 , 'diff' => 0]; - /* print_r($yamlLeftParsed); - print_r($yamlRightParsed);*/ - $diff = $this->nestedArray->arrayDiff($yamlLeftParsed, $yamlRightParsed, $negate, $statistics); - print_r($diff); - - if ($stats) { - $io->info( - sprintf( - $this->trans('commands.yaml.diff.messages.total'), - $statistics['total'] - ) - ); - - $io->info( - sprintf( - $this->trans('commands.yaml.diff.messages.diff'), - $statistics['diff'] - ) - ); - - $io->info( - sprintf( - $this->trans('commands.yaml.diff.messages.equal'), - $statistics['equal'] - ) - ); - - return; - } - // FLAT YAML file to display full yaml to be used with command yaml:update:key or yaml:update:value - $diffFlatten = array(); - $keyFlatten = ''; - $this->nestedArray->yamlFlattenArray($diff, $diffFlatten, $keyFlatten); - - if ($limit !== null) { - if (!$offset) { - $offset = 0; - } - $diffFlatten = array_slice($diffFlatten, $offset, $limit); - } - - $tableHeader = [ - $this->trans('commands.yaml.diff.messages.key'), - $this->trans('commands.yaml.diff.messages.value'), - ]; - - $tableRows = []; - foreach ($diffFlatten as $yamlKey => $yamlValue) { - $tableRows[] = [ - $yamlKey, - $yamlValue - ]; - print $yamlKey . "\n"; - print $yamlValue . "\n"; - } - - $io->table($tableHeader, $tableRows, 'compact'); - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $validator_filename = function ($value) use ($io) { - if (!strlen(trim($value)) || !is_file($value)) { - $io->error($this->trans('commands.common.errors.invalid-file-path')); - - return false; - } - - return $value; - }; - - // --yaml-left option - $yaml_left = $input->getArgument('yaml-left'); - if (!$yaml_left) { - while (true) { - $yaml_left = $output->ask( - $this->trans('commands.yaml.diff.questions.yaml-left'), - null, - $validator_filename - ); - - if ($yaml_left) { - break; - } - } - - $input->setArgument('yaml-left', $yaml_left); - } - - // --yaml-right option - $yaml_right = $input->getArgument('yaml-right'); - if (!$yaml_right) { - while (true) { - $yaml_right = $output->ask( - $this->trans('commands.yaml.diff.questions.yaml-right'), - null, - $validator_filename - ); - - if ($yaml_right) { - break; - } - } - - $input->setArgument('yaml-right', $yaml_right); - } - } -} diff --git a/src/Command/Yaml/GetValueCommand.php b/src/Command/Yaml/GetValueCommand.php deleted file mode 100644 index cca41162a..000000000 --- a/src/Command/Yaml/GetValueCommand.php +++ /dev/null @@ -1,96 +0,0 @@ -nestedArray = $nestedArray; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('yaml:get:value') - ->setDescription($this->trans('commands.yaml.get.value.description')) - ->addArgument( - 'yaml-file', - InputArgument::REQUIRED, - $this->trans('commands.yaml.get.value.arguments.yaml-file') - ) - ->addArgument( - 'yaml-key', - InputArgument::REQUIRED, - $this->trans('commands.yaml.get.value.arguments.yaml-key') - ); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $yaml = new Parser(); - - $yaml_file = $input->getArgument('yaml-file'); - $yaml_key = $input->getArgument('yaml-key'); - - try { - $yaml_parsed = $yaml->parse(file_get_contents($yaml_file), true); - } catch (\Exception $e) { - $io->error($this->trans('commands.yaml.merge.messages.error-parsing').': '.$e->getMessage()); - return; - } - - if (empty($yaml_parsed)) { - $io->info( - sprintf( - $this->trans('commands.yaml.merge.messages.wrong-parse'), - $yaml_file - ) - ); - } else { - $key_exists = null; - $parents = explode(".", $yaml_key); - $yaml_value = $this->nestedArray->getValue($yaml_parsed, $parents, $key_exists); - - if (!$key_exists) { - $io->info( - sprintf( - $this->trans('commands.yaml.get.value.messages.invalid-key'), - $yaml_key, - $yaml_file - ) - ); - } - - $output->writeln($yaml_value); - } - } -} diff --git a/src/Command/Yaml/MergeCommand.php b/src/Command/Yaml/MergeCommand.php deleted file mode 100644 index 93e0f6e68..000000000 --- a/src/Command/Yaml/MergeCommand.php +++ /dev/null @@ -1,201 +0,0 @@ -setName('yaml:merge') - ->setDescription($this->trans('commands.yaml.merge.description')) - ->addArgument( - 'yaml-destination', - InputArgument::REQUIRED, - $this->trans('commands.yaml.merge.arguments.yaml-destination') - ) - ->addArgument( - 'yaml-files', - InputArgument::IS_ARRAY, - $this->trans('commands.yaml.merge.arguments.yaml-files') - ); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $yaml = new Parser(); - $dumper = new Dumper(); - - $final_yaml = array(); - $yaml_destination = realpath($input->getArgument('yaml-destination')); - $yaml_files = $input->getArgument('yaml-files'); - - if (count($yaml_files) < 2) { - $io->error($this->trans('commands.yaml.merge.messages.two-files-required')); - - return; - } - - foreach ($yaml_files as $yaml_file) { - try { - $yaml_parsed = $yaml->parse(file_get_contents($yaml_file)); - } catch (\Exception $e) { - $io->error( - sprintf( - '%s: %s', - $this->trans('commands.yaml.merge.messages.error-parsing'), - $e->getMessage() - ) - ); - - return; - } - - if (empty($yaml_parsed)) { - $io->error( - sprintf( - $this->trans('commands.yaml.merge.messages.wrong-parse'), - $yaml_file - ) - ); - } - - // Merge arrays - $final_yaml = array_replace_recursive($final_yaml, $yaml_parsed); - } - - try { - $yaml = $dumper->dump($final_yaml, 10); - } catch (\Exception $e) { - $io->error( - sprintf( - '%s: %s', - $this->trans('commands.yaml.merge.messages.error-generating'), - $e->getMessage() - ) - ); - - return; - } - - try { - file_put_contents($yaml_destination, $yaml); - } catch (\Exception $e) { - $io->error( - sprintf( - '%s: %s', - $this->trans('commands.yaml.merge.messages.error-writing'), - $e->getMessage() - ) - ); - - return; - } - - $io->success( - sprintf( - $this->trans('commands.yaml.merge.messages.merged'), - $yaml_destination - ) - ); - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $validator_filename = function ($value) use ($io) { - if (!strlen(trim($value)) || !is_file($value)) { - $io->error($this->trans('commands.common.errors.invalid-file-path')); - - return false; - } - - return $value; - }; - - // --yaml-destination option - $yaml_destination = $input->getArgument('yaml-destination'); - if (!$yaml_destination) { - while (true) { - $yaml_destination = $io->ask( - $this->trans('commands.yaml.merge.questions.yaml-destination'), - '', - $validator_filename - ); - - if ($yaml_destination) { - break; - } - } - - $input->setArgument('yaml-destination', $yaml_destination); - } - - $yaml_files = $input->getArgument('yaml-files'); - if (!$yaml_files) { - $yaml_files = array(); - - while (true) { - // Set the string key based on among files provided - if (count($yaml_files) >= 2) { - $questionStringKey = 'commands.yaml.merge.questions.other-file'; - } else { - $questionStringKey = 'commands.yaml.merge.questions.file'; - } - - $yaml_file = $io->ask( - $this->trans($questionStringKey), - '', - function ($file) use ($yaml_files, $io) { - if (count($yaml_files) < 2 && empty($file)) { - $io->error($this->trans('commands.yaml.merge.questions.invalid-file')); - return false; - } elseif (!empty($file) && in_array($file, $yaml_files)) { - $io->error( - sprintf($this->trans('commands.yaml.merge.questions.file-already-added'), $file) - ); - - return false; - } elseif ($file == '') { - return true; - } else { - return $file; - } - } - ); - - if ($yaml_file && !is_string($yaml_file)) { - break; - } - - if ($yaml_file) { - $yaml_files[] = realpath($yaml_file); - } - } - - $input->setArgument('yaml-files', $yaml_files); - } - } -} diff --git a/src/Command/Yaml/SplitCommand.php b/src/Command/Yaml/SplitCommand.php deleted file mode 100644 index 28f8748f2..000000000 --- a/src/Command/Yaml/SplitCommand.php +++ /dev/null @@ -1,239 +0,0 @@ -nestedArray = $nestedArray; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('yaml:split') - ->setDescription($this->trans('commands.yaml.split.description')) - ->addArgument( - 'yaml-file', - InputArgument::REQUIRED, - $this->trans('commands.yaml.split.value.arguments.yaml-file') - ) - ->addOption( - 'indent-level', - false, - InputOption::VALUE_REQUIRED, - $this->trans('commands.yaml.split.options.indent-level') - ) - ->addOption( - 'file-output-prefix', - false, - InputOption::VALUE_REQUIRED, - $this->trans('commands.yaml.split.options.file-output-prefix') - ) - ->addOption( - 'file-output-suffix', - false, - InputOption::VALUE_REQUIRED, - $this->trans('commands.yaml.split.options.file-output-suffix') - ) - ->addOption( - 'starting-key', - false, - InputOption::VALUE_REQUIRED, - $this->trans('commands.yaml.split.options.starting-key') - ) - ->addOption( - 'exclude-parents-key', - false, - InputOption::VALUE_NONE, - $this->trans('commands.yaml.split.options.exclude-parents-key') - ); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $yaml = new Parser(); - - $yaml_file = $input->getArgument('yaml-file'); - $indent_level = $input->getOption('indent-level'); - $exclude_parents_key = $input->getOption('exclude-parents-key'); - $starting_key = $input->getOption('starting-key'); - $file_output_prefix = $input->getOption('file-output-prefix'); - $file_output_suffix = $input->getOption('file-output-suffix'); - - if ($exclude_parents_key == 1 || $exclude_parents_key == 'TRUE') { - $exclude_parents_key = true; - } else { - $exclude_parents_key = false; - } - - try { - $yaml_file_parsed = $yaml->parse(file_get_contents($yaml_file)); - - if (empty($yaml_file_parsed)) { - $io->error( - sprintf( - $this->trans('commands.yaml.merge.messages.wrong-parse'), - $yaml_file - ) - ); - - return; - } - } catch (\Exception $e) { - $io->error( - sprintf( - '%s: %s', - $this->trans('commands.yaml.merge.messages.error-parsing'), - $e->getMessage() - ) - ); - - return; - } - - if ($starting_key) { - $parents = explode(".", $starting_key); - if ($this->nestedArray->keyExists($yaml_file_parsed, $parents)) { - $yaml_file_parsed = $this->nestedArray->getValue($yaml_file_parsed, $parents); - } else { - $io->error($this->trans('commands.yaml.merge.messages.invalid-key')); - } - - if ($indent_level == 0) { - $yaml_split[$starting_key] = $yaml_file_parsed; - } - } else { - // Set minimum level to split - $indent_level = empty($indent_level) ? 1 : $indent_level; - - $yaml_split = array(); - $key_flatten = ''; - $initial_level = 1; - - $this->nestedArray->yamlSplitArray($yaml_file_parsed, $yaml_split, $indent_level, $key_flatten, $initial_level, $exclude_parents_key); - } - - $this->writeSplittedFile($yaml_split, $file_output_prefix, $file_output_suffix, $io); - } - - protected function writeSplittedFile($yaml_splitted, $file_output_prefix = '', $file_output_suffix = '', DrupalStyle $io) - { - $dumper = new Dumper(); - - $io->info($this->trans('commands.yaml.split.messages.generating-split')); - - foreach ($yaml_splitted as $key => $value) { - if ($file_output_prefix) { - $key = $file_output_prefix . '.' . $key; - } - - if ($file_output_suffix) { - $key.= '.' . $file_output_suffix; - } - $filename = $key . '.yml'; - - try { - $yaml = $dumper->dump($value, 10); - } catch (\Exception $e) { - $io->error( - sprintf( - '%s: %s', - $this->trans('commands.yaml.merge.messages.error-generating'), - $e->getMessage() - ) - ); - - return; - } - - try { - file_put_contents($filename, $yaml); - } catch (\Exception $e) { - $io->error( - sprintf( - '%s: %s', - $this->trans('commands.yaml.merge.messages.error-writing'), - $e->getMessage() - ) - ); - - return; - } - - $io->success( - sprintf( - $this->trans('commands.yaml.split.messages.split-generated'), - $filename - ) - ); - } - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $validator_filename = function ($value) use ($io) { - if (!strlen(trim($value)) || !is_file($value)) { - $io->error($this->trans('commands.common.errors.invalid-file-path')); - - return false; - } - - return $value; - }; - - // --yaml-left option - $yaml_file = $input->getArgument('yaml-file'); - if (!$yaml_file) { - while (true) { - $yaml_file = $io->ask( - $this->trans('commands.yaml.diff.questions.yaml-left'), - '', - $validator_filename - ); - - if ($yaml_file) { - break; - } - } - - $input->setArgument('yaml-file', $yaml_file); - } - } -} diff --git a/src/Command/Yaml/UnsetKeyCommand.php b/src/Command/Yaml/UnsetKeyCommand.php deleted file mode 100644 index 24d833c48..000000000 --- a/src/Command/Yaml/UnsetKeyCommand.php +++ /dev/null @@ -1,109 +0,0 @@ -nestedArray = $nestedArray; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('yaml:unset:key') - ->setDescription($this->trans('commands.yaml.unset.key.description')) - ->addArgument( - 'yaml-file', - InputArgument::REQUIRED, - $this->trans('commands.yaml.unset.value.arguments.yaml-file') - ) - ->addArgument( - 'yaml-key', - InputArgument::REQUIRED, - $this->trans('commands.yaml.unset.value.arguments.yaml-key') - ); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $yaml = new Parser(); - $dumper = new Dumper(); - - $yaml_file = $input->getArgument('yaml-file'); - $yaml_key = $input->getArgument('yaml-key'); - - try { - $yaml_parsed = $yaml->parse(file_get_contents($yaml_file)); - } catch (\Exception $e) { - $io->error($this->trans('commands.yaml.merge.messages.error-parsing').': '.$e->getMessage()); - - return; - } - - if (empty($yaml_parsed)) { - $io->info( - sprintf( - $this->trans('commands.yaml.merge.messages.wrong-parse'), - $yaml_file - ) - ); - } - - $parents = explode(".", $yaml_key); - $this->nestedArray->unsetValue($yaml_parsed, $parents); - - try { - $yaml = $dumper->dump($yaml_parsed, 10); - } catch (\Exception $e) { - $io->error($this->trans('commands.yaml.merge.messages.error-generating').': '.$e->getMessage()); - - return; - } - - try { - file_put_contents($yaml_file, $yaml); - } catch (\Exception $e) { - $io->error($this->trans('commands.yaml.merge.messages.error-writing').': '.$e->getMessage()); - - return; - } - - $io->info( - sprintf( - $this->trans('commands.yaml.unset.value.messages.unset'), - $yaml_file - ) - ); - } -} diff --git a/src/Command/Yaml/UpdateKeyCommand.php b/src/Command/Yaml/UpdateKeyCommand.php deleted file mode 100644 index dc2cbda76..000000000 --- a/src/Command/Yaml/UpdateKeyCommand.php +++ /dev/null @@ -1,117 +0,0 @@ -nestedArray = $nestedArray; - parent::__construct(); - } - - - protected function configure() - { - $this - ->setName('yaml:update:key') - ->setDescription($this->trans('commands.yaml.update.key.description')) - ->addArgument( - 'yaml-file', - InputArgument::REQUIRED, - $this->trans('commands.yaml.update.value.arguments.yaml-file') - ) - ->addArgument( - 'yaml-key', - InputArgument::REQUIRED, - $this->trans('commands.yaml.update.value.arguments.yaml-key') - ) - ->addArgument( - 'yaml-new-key', - InputArgument::REQUIRED, - $this->trans('commands.yaml.update.value.arguments.yaml-new-key') - ); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $yaml = new Parser(); - $dumper = new Dumper(); - - $yaml_file = $input->getArgument('yaml-file'); - $yaml_key = $input->getArgument('yaml-key'); - $yaml_new_key = $input->getArgument('yaml-new-key'); - - - try { - $yaml_parsed = $yaml->parse(file_get_contents($yaml_file)); - } catch (\Exception $e) { - $io->error($this->trans('commands.yaml.merge.messages.error-parsing').': '.$e->getMessage()); - - return; - } - - if (empty($yaml_parsed)) { - $io->info( - sprintf( - $this->trans('commands.yaml.merge.messages.wrong-parse'), - $yaml_file - ) - ); - } - - $parents = explode(".", $yaml_key); - $this->nestedArray->replaceKey($yaml_parsed, $parents, $yaml_new_key); - - try { - $yaml = $dumper->dump($yaml_parsed, 10); - } catch (\Exception $e) { - $io->error($this->trans('commands.yaml.merge.messages.error-generating').': '.$e->getMessage()); - - return; - } - - try { - file_put_contents($yaml_file, $yaml); - } catch (\Exception $e) { - $io->error($this->trans('commands.yaml.merge.messages.error-writing').': '.$e->getMessage()); - - return; - } - - $io->info( - sprintf( - $this->trans('commands.yaml.update.value.messages.updated'), - $yaml_file - ) - ); - } -} diff --git a/src/Command/Yaml/UpdateValueCommand.php b/src/Command/Yaml/UpdateValueCommand.php deleted file mode 100644 index 1d56a0109..000000000 --- a/src/Command/Yaml/UpdateValueCommand.php +++ /dev/null @@ -1,116 +0,0 @@ -nestedArray = $nestedArray; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('yaml:update:value') - ->setDescription($this->trans('commands.yaml.update.value.description')) - ->addArgument( - 'yaml-file', - InputArgument::REQUIRED, - $this->trans('commands.yaml.update.value.arguments.yaml-file') - ) - ->addArgument( - 'yaml-key', - InputArgument::REQUIRED, - $this->trans('commands.yaml.update.value.arguments.yaml-key') - ) - ->addArgument( - 'yaml-value', - InputArgument::REQUIRED, - $this->trans('commands.yaml.update.value.arguments.yaml-value') - ); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $yaml = new Parser(); - $dumper = new Dumper(); - - $yaml_file = $input->getArgument('yaml-file'); - $yaml_key = $input->getArgument('yaml-key'); - $yaml_value = $input->getArgument('yaml-value'); - - - try { - $yaml_parsed = $yaml->parse(file_get_contents($yaml_file)); - } catch (\Exception $e) { - $io->error($this->trans('commands.yaml.merge.messages.error-parsing').': '.$e->getMessage()); - return; - } - - if (empty($yaml_parsed)) { - $io->info( - sprintf( - $this->trans('commands.yaml.merge.messages.wrong-parse'), - $yaml_file - ) - ); - } - - $parents = explode(".", $yaml_key); - $this->nestedArray->setValue($yaml_parsed, $parents, $yaml_value, true); - - - try { - $yaml = $dumper->dump($yaml_parsed, 10); - } catch (\Exception $e) { - $io->error($this->trans('commands.yaml.merge.messages.error-generating').': '.$e->getMessage()); - - return; - } - - try { - file_put_contents($yaml_file, $yaml); - } catch (\Exception $e) { - $io->error($this->trans('commands.yaml.merge.messages.error-writing').': '.$e->getMessage()); - - return; - } - - $io->info( - sprintf( - $this->trans('commands.yaml.update.value.messages.updated'), - $yaml_file - ) - ); - } -} From ac7612648a5c96b93fc868133585ec79e25d8709 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 29 Dec 2016 16:43:14 -0800 Subject: [PATCH 107/321] [console] Apply PSR-2 code style. (#3055) --- src/Command/Database/AddCommand.php | 6 +++--- src/Command/Database/DatabaseLogBase.php | 4 ++-- src/Command/Generate/ModuleCommand.php | 2 +- src/Command/Generate/PluginMigrateSourceCommand.php | 2 +- src/Command/Shared/MenuTrait.php | 2 +- src/Command/Shared/ModuleTrait.php | 2 +- src/Command/Shared/ProjectDownloadTrait.php | 6 +++--- src/Generator/DatabaseSettingsGenerator.php | 5 ++--- src/Generator/PluginMigrateSourceGenerator.php | 1 - src/Generator/PluginRulesActionGenerator.php | 1 - src/Generator/PluginSkeletonGenerator.php | 1 - src/Generator/PluginTypeAnnotationGenerator.php | 1 - src/Generator/PluginTypeYamlGenerator.php | 1 - 13 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/Command/Database/AddCommand.php b/src/Command/Database/AddCommand.php index 928383f4e..4aa839494 100644 --- a/src/Command/Database/AddCommand.php +++ b/src/Command/Database/AddCommand.php @@ -101,7 +101,7 @@ protected function execute(InputInterface $input, OutputInterface $output) ->generator ->generate($input->getOptions()); if (!$result) { - $io->error($this->trans('commands.database.add.error')); + $io->error($this->trans('commands.database.add.error')); } } @@ -140,7 +140,7 @@ protected function interact(InputInterface $input, OutputInterface $output) if (!$prefix) { $prefix = $io->ask( $this->trans('commands.database.add.questions.prefix'), - FALSE + false ); } $input->setOption('prefix', $prefix); @@ -169,4 +169,4 @@ protected function interact(InputInterface $input, OutputInterface $output) } $input->setOption('driver', $driver); } -} \ No newline at end of file +} diff --git a/src/Command/Database/DatabaseLogBase.php b/src/Command/Database/DatabaseLogBase.php index 2d1073633..29a243db3 100644 --- a/src/Command/Database/DatabaseLogBase.php +++ b/src/Command/Database/DatabaseLogBase.php @@ -139,8 +139,8 @@ protected function getDefaultOptions(InputInterface $input) /** * @param \Drupal\Console\Core\Style\DrupalStyle $io - * @param null $offset - * @param int $range + * @param null $offset + * @param int $range * @return bool|\Drupal\Core\Database\Query\SelectInterface */ protected function makeQuery(DrupalStyle $io, $offset = null, $range = 1000) diff --git a/src/Command/Generate/ModuleCommand.php b/src/Command/Generate/ModuleCommand.php index cf06427a1..e0b9d0c99 100644 --- a/src/Command/Generate/ModuleCommand.php +++ b/src/Command/Generate/ModuleCommand.php @@ -88,7 +88,7 @@ public function __construct( DrupalApi $drupalApi, Client $httpClient, Site $site, - $twigtemplate = NULL + $twigtemplate = null ) { $this->generator = $generator; $this->validator = $validator; diff --git a/src/Command/Generate/PluginMigrateSourceCommand.php b/src/Command/Generate/PluginMigrateSourceCommand.php index b19c36a03..c04f83e47 100644 --- a/src/Command/Generate/PluginMigrateSourceCommand.php +++ b/src/Command/Generate/PluginMigrateSourceCommand.php @@ -243,7 +243,7 @@ function ($class) { $fields = $input->getOption('fields'); if (!$fields) { $fields = []; - while(true) { + while (true) { $id = $io->ask( $this->trans('commands.generate.plugin.migrate.source.questions.fields.id'), false diff --git a/src/Command/Shared/MenuTrait.php b/src/Command/Shared/MenuTrait.php index 0a749abee..5e2869c12 100644 --- a/src/Command/Shared/MenuTrait.php +++ b/src/Command/Shared/MenuTrait.php @@ -18,7 +18,7 @@ trait MenuTrait { /** * @param \Drupal\Console\Core\Style\DrupalStyle $io - * @param string $className The form class name + * @param string $className The form class name * @return string * @throws \Exception */ diff --git a/src/Command/Shared/ModuleTrait.php b/src/Command/Shared/ModuleTrait.php index f20de7c93..e5bfd55b5 100644 --- a/src/Command/Shared/ModuleTrait.php +++ b/src/Command/Shared/ModuleTrait.php @@ -17,7 +17,7 @@ trait ModuleTrait { /** * @param \Drupal\Console\Core\Style\DrupalStyle $io - * @param bool|true $showProfile + * @param bool|true $showProfile * @return string * @throws \Exception */ diff --git a/src/Command/Shared/ProjectDownloadTrait.php b/src/Command/Shared/ProjectDownloadTrait.php index 87c927fad..c24a3a35a 100644 --- a/src/Command/Shared/ProjectDownloadTrait.php +++ b/src/Command/Shared/ProjectDownloadTrait.php @@ -254,9 +254,9 @@ public function downloadProject(DrupalStyle $io, $project, $version, $type, $pat /** * @param \Drupal\Console\Core\Style\DrupalStyle $io - * @param string $project - * @param bool $latest - * @param bool $stable + * @param string $project + * @param bool $latest + * @param bool $stable * @return string */ public function releasesQuestion(DrupalStyle $io, $project, $latest = false, $stable = false) diff --git a/src/Generator/DatabaseSettingsGenerator.php b/src/Generator/DatabaseSettingsGenerator.php index 868daf4e2..38f3a8329 100644 --- a/src/Generator/DatabaseSettingsGenerator.php +++ b/src/Generator/DatabaseSettingsGenerator.php @@ -12,7 +12,6 @@ class DatabaseSettingsGenerator extends Generator { - /** * @var DrupalKernelInterface */ @@ -38,7 +37,7 @@ public function generate($parameters) { $settingsFile = $this->kernel->getSitePath().'/settings.php'; if (!is_writable($settingsFile)) { - return false; + return false; } return $this->renderFile( 'database/add.php.twig', @@ -47,4 +46,4 @@ public function generate($parameters) FILE_APPEND ); } -} \ No newline at end of file +} diff --git a/src/Generator/PluginMigrateSourceGenerator.php b/src/Generator/PluginMigrateSourceGenerator.php index fe0bbb8aa..c1b8cd914 100644 --- a/src/Generator/PluginMigrateSourceGenerator.php +++ b/src/Generator/PluginMigrateSourceGenerator.php @@ -40,7 +40,6 @@ public function __construct( */ public function generate($module, $class_name, $plugin_id, $table, $alias, $group_by, $fields) { - $parameters = [ 'module' => $module, 'class_name' => $class_name, diff --git a/src/Generator/PluginRulesActionGenerator.php b/src/Generator/PluginRulesActionGenerator.php index 7263b0c5b..6a0c3429f 100644 --- a/src/Generator/PluginRulesActionGenerator.php +++ b/src/Generator/PluginRulesActionGenerator.php @@ -12,7 +12,6 @@ class PluginRulesActionGenerator extends Generator { - /** * @var Manager */ diff --git a/src/Generator/PluginSkeletonGenerator.php b/src/Generator/PluginSkeletonGenerator.php index 187b9ded6..b358e0056 100644 --- a/src/Generator/PluginSkeletonGenerator.php +++ b/src/Generator/PluginSkeletonGenerator.php @@ -12,7 +12,6 @@ class PluginSkeletonGenerator extends Generator { - /** * @var Manager */ diff --git a/src/Generator/PluginTypeAnnotationGenerator.php b/src/Generator/PluginTypeAnnotationGenerator.php index 07b63c15a..5ccc7ee99 100644 --- a/src/Generator/PluginTypeAnnotationGenerator.php +++ b/src/Generator/PluginTypeAnnotationGenerator.php @@ -12,7 +12,6 @@ class PluginTypeAnnotationGenerator extends Generator { - /** * @var Manager */ diff --git a/src/Generator/PluginTypeYamlGenerator.php b/src/Generator/PluginTypeYamlGenerator.php index 0a176e3ec..1337fc3cf 100644 --- a/src/Generator/PluginTypeYamlGenerator.php +++ b/src/Generator/PluginTypeYamlGenerator.php @@ -12,7 +12,6 @@ class PluginTypeYamlGenerator extends Generator { - /** * @var Manager */ From 85cac52fd121f4550b5b8a316b0566e78724604a Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Sun, 1 Jan 2017 05:01:50 +0100 Subject: [PATCH 108/321] [config:export] simplify the creation of the target directory (#3054) The $directory variable is a loop invariant, there is no need to try to create the directory for each configuration entry, so move the creation of the target directory out of the loop. While at it move it also before the $tar conditional block, in this way the same code will be used whether --tar has been used or not. --- src/Command/Config/ExportCommand.php | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/Command/Config/ExportCommand.php b/src/Command/Config/ExportCommand.php index 1cdfc4bb7..d6a10bf2f 100644 --- a/src/Command/Config/ExportCommand.php +++ b/src/Command/Config/ExportCommand.php @@ -85,11 +85,19 @@ protected function execute(InputInterface $input, OutputInterface $output) $directory = config_get_config_directory(CONFIG_SYNC_DIRECTORY); } - if ($tar) { - if (!is_dir($directory)) { - mkdir($directory, 0777, true); - } + $fileSystem = new Filesystem(); + try { + $fileSystem->mkdir($directory); + } catch (IOExceptionInterface $e) { + $io->error( + sprintf( + $this->trans('commands.config.export.messages.error'), + $e->getPath() + ) + ); + } + if ($tar) { $dateTime = new \DateTime(); $archiveFile = sprintf( @@ -126,17 +134,6 @@ protected function execute(InputInterface $input, OutputInterface $output) $configFileName = sprintf('%s/%s', $directory, $configName); - $fileSystem = new Filesystem(); - try { - $fileSystem->mkdir($directory); - } catch (IOExceptionInterface $e) { - $io->error( - sprintf( - $this->trans('commands.config.export.messages.error'), - $e->getPath() - ) - ); - } file_put_contents($configFileName, $ymlData); } } catch (\Exception $e) { From 1897832d1135d3e9d74d3ab6bad8ff7da4fa195d Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Sun, 1 Jan 2017 05:03:28 +0100 Subject: [PATCH 109/321] [console] use a more recent alchemy/zipper which fixes GNU tar usage (#3053) Fixes #2584 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index fc1217cb3..78920b86f 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "require": { "php": "^5.5.9 || ^7.0", "drupal/console-core" : "dev-master", - "alchemy/zippy": "0.3.5", + "alchemy/zippy": "0.4.3", "composer/installers": "~1.0", "symfony/css-selector": ">=2.7 <3.2", "symfony/dom-crawler": ">=2.7 <3.2", From b1a8b9900b9d5682d8fbaab1f91610b5564675e4 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sat, 31 Dec 2016 20:33:41 -0800 Subject: [PATCH 110/321] [console] Convert array short syntax. (#3057) --- .php_cs | 10 +++++++-- phpqa.yml | 6 ++--- .../DrupalCommandAnnotationReader.php | 1 + src/Application.php | 9 +++++++- src/Bootstrap/AddServicesCompilerPass.php | 1 + src/Bootstrap/Drupal.php | 3 ++- src/Bootstrap/DrupalKernel.php | 1 + src/Bootstrap/DrupalServiceModifier.php | 1 + src/Bootstrap/FindCommandsCompilerPass.php | 1 + src/Bootstrap/FindGeneratorsCompilerPass.php | 1 + src/Command/Breakpoints/DebugCommand.php | 1 + src/Command/Cache/RebuildCommand.php | 2 ++ src/Command/Config/DebugCommand.php | 1 + src/Command/Config/DeleteCommand.php | 1 + src/Command/Config/DiffCommand.php | 1 + src/Command/Config/EditCommand.php | 5 +++-- src/Command/Config/ExportCommand.php | 1 + .../Config/ExportContentTypeCommand.php | 13 ++++++----- src/Command/Config/ExportSingleCommand.php | 5 +++-- src/Command/Config/ExportViewCommand.php | 3 ++- src/Command/Config/ImportCommand.php | 1 + src/Command/Config/ImportSingleCommand.php | 3 ++- src/Command/Config/OverrideCommand.php | 1 + src/Command/Config/SettingsDebugCommand.php | 2 ++ src/Command/Config/ValidateDebugCommand.php | 2 +- src/Command/ContainerDebugCommand.php | 1 + src/Command/Create/CommentsCommand.php | 4 +++- src/Command/Create/NodesCommand.php | 4 +++- src/Command/Create/TermsCommand.php | 2 ++ src/Command/Create/UsersCommand.php | 4 +++- src/Command/Create/VocabulariesCommand.php | 2 ++ src/Command/Cron/DebugCommand.php | 1 + src/Command/Cron/ExecuteCommand.php | 1 + src/Command/Cron/ReleaseCommand.php | 1 + src/Command/Database/AddCommand.php | 1 + src/Command/Database/DatabaseLogBase.php | 2 +- src/Command/Database/DropCommand.php | 2 ++ src/Command/Database/DumpCommand.php | 1 + src/Command/Database/LogClearCommand.php | 1 + src/Command/Database/RestoreCommand.php | 1 + src/Command/Database/TableDebugCommand.php | 2 ++ src/Command/Develop/ExampleCommand.php | 1 + .../Develop/ExampleContainerAwareCommand.php | 1 + .../Develop/GenerateDocCheatsheetCommand.php | 6 ++--- .../Develop/GenerateDocDashCommand.php | 1 + .../Develop/GenerateDocGitbookCommand.php | 1 + .../Develop/TranslationCleanupCommand.php | 2 +- .../Develop/TranslationPendingCommand.php | 4 ++-- .../Develop/TranslationStatsCommand.php | 5 ++--- .../Develop/TranslationSyncCommand.php | 2 +- src/Command/Entity/DebugCommand.php | 1 + src/Command/Entity/DeleteCommand.php | 1 + src/Command/EventDebugCommand.php | 2 ++ src/Command/Field/InfoCommand.php | 1 + .../AuthenticationProviderCommand.php | 5 +++-- src/Command/Generate/BreakPointCommand.php | 5 +++-- src/Command/Generate/CommandCommand.php | 1 + .../Generate/ConfigFormBaseCommand.php | 3 ++- src/Command/Generate/ControllerCommand.php | 9 ++++---- src/Command/Generate/EntityBundleCommand.php | 5 +++-- src/Command/Generate/EntityConfigCommand.php | 5 +++-- src/Command/Generate/EntityContentCommand.php | 1 + .../Generate/EventSubscriberCommand.php | 1 + src/Command/Generate/FormAlterCommand.php | 15 +++++++------ src/Command/Generate/FormCommand.php | 7 +++--- src/Command/Generate/HelpCommand.php | 5 +++-- src/Command/Generate/ModuleCommand.php | 11 +++++----- src/Command/Generate/ModuleFileCommand.php | 6 +++-- src/Command/Generate/PermissionCommand.php | 1 + src/Command/Generate/PluginBlockCommand.php | 1 + .../Generate/PluginCKEditorButtonCommand.php | 5 +++-- .../Generate/PluginConditionCommand.php | 8 ++++--- src/Command/Generate/PluginFieldCommand.php | 3 ++- .../Generate/PluginFieldFormatterCommand.php | 8 ++++--- .../Generate/PluginFieldTypeCommand.php | 6 +++-- .../Generate/PluginFieldWidgetCommand.php | 12 +++++----- .../Generate/PluginImageEffectCommand.php | 6 +++-- .../Generate/PluginImageFormatterCommand.php | 7 +++--- src/Command/Generate/PluginMailCommand.php | 8 ++++--- .../Generate/PluginMigrateSourceCommand.php | 1 + .../Generate/PluginRestResourceCommand.php | 8 ++++--- .../Generate/PluginRulesActionCommand.php | 6 +++-- .../Generate/PluginSkeletonCommand.php | 10 +++++---- .../Generate/PluginTypeAnnotationCommand.php | 6 +++-- .../Generate/PluginTypeYamlCommand.php | 6 +++-- .../Generate/PluginViewsFieldCommand.php | 6 +++-- src/Command/Generate/PostUpdateCommand.php | 8 ++++--- src/Command/Generate/ProfileCommand.php | 22 ++++++++++--------- .../Generate/RouteSubscriberCommand.php | 6 +++-- src/Command/Generate/ServiceCommand.php | 6 +++-- src/Command/Generate/ThemeCommand.php | 10 +++++---- src/Command/Generate/TwigExtensionCommand.php | 6 +++-- src/Command/Generate/UpdateCommand.php | 6 +++-- src/Command/Image/StylesDebugCommand.php | 2 ++ src/Command/Image/StylesFlushCommand.php | 1 + src/Command/Libraries/DebugCommand.php | 9 ++++---- src/Command/Locale/LanguageAddCommand.php | 1 + src/Command/Locale/LanguageDeleteCommand.php | 1 + .../Locale/TranslationStatusCommand.php | 1 + src/Command/Migrate/DebugCommand.php | 1 + src/Command/Migrate/ExecuteCommand.php | 5 +++-- src/Command/Migrate/SetupCommand.php | 1 + src/Command/Module/DebugCommand.php | 2 ++ src/Command/Module/DownloadCommand.php | 13 ++++++----- src/Command/Module/InstallCommand.php | 10 +++++---- .../Module/InstallDependencyCommand.php | 6 +++-- src/Command/Module/PathCommand.php | 1 + src/Command/Module/UninstallCommand.php | 7 +++--- src/Command/Module/UpdateCommand.php | 3 ++- src/Command/Multisite/DebugCommand.php | 2 ++ src/Command/Multisite/NewCommand.php | 2 ++ src/Command/Node/AccessRebuildCommand.php | 2 ++ src/Command/PermissionDebugCommand.php | 1 + src/Command/PluginDebugCommand.php | 1 + src/Command/Queue/DebugCommand.php | 2 ++ src/Command/Queue/RunCommand.php | 2 ++ src/Command/Rest/DebugCommand.php | 1 + src/Command/Rest/DisableCommand.php | 5 +++-- src/Command/Rest/EnableCommand.php | 3 ++- src/Command/Router/DebugCommand.php | 1 + src/Command/Router/RebuildCommand.php | 1 + src/Command/ServerCommand.php | 2 ++ src/Command/Shared/ConfirmationTrait.php | 1 + src/Command/Shared/ConnectTrait.php | 2 +- src/Command/Shared/CreateTrait.php | 1 + src/Command/Shared/DatabaseTrait.php | 1 + src/Command/Shared/EventsTrait.php | 1 + src/Command/Shared/ExportTrait.php | 3 ++- src/Command/Shared/FeatureTrait.php | 7 +++--- src/Command/Shared/FormTrait.php | 5 +++-- src/Command/Shared/MenuTrait.php | 1 + src/Command/Shared/MigrationTrait.php | 3 ++- src/Command/Shared/ModuleTrait.php | 3 ++- src/Command/Shared/ProjectDownloadTrait.php | 5 +++-- src/Command/Shared/RestTrait.php | 2 +- src/Command/Site/ImportLocalCommand.php | 2 ++ src/Command/Site/InstallCommand.php | 6 +++-- src/Command/Site/MaintenanceCommand.php | 1 + src/Command/Site/ModeCommand.php | 2 +- src/Command/Site/StatisticsCommand.php | 2 ++ src/Command/Site/StatusCommand.php | 1 + src/Command/State/DebugCommand.php | 2 ++ src/Command/State/DeleteCommand.php | 1 + src/Command/State/OverrideCommand.php | 2 ++ src/Command/Taxonomy/DeleteTermCommand.php | 2 ++ src/Command/Test/DebugCommand.php | 1 + src/Command/Test/RunCommand.php | 5 +++-- src/Command/Theme/DebugCommand.php | 1 + src/Command/Theme/DownloadCommand.php | 1 + src/Command/Theme/InstallCommand.php | 1 + src/Command/Theme/PathCommand.php | 1 + src/Command/Theme/UninstallCommand.php | 1 + src/Command/Update/DebugCommand.php | 1 + src/Command/Update/EntitiesCommand.php | 1 + src/Command/Update/ExecuteCommand.php | 3 ++- src/Command/User/CreateCommand.php | 1 + src/Command/User/DebugCommand.php | 2 ++ src/Command/User/DeleteCommand.php | 2 ++ .../User/LoginCleanAttemptsCommand.php | 1 + src/Command/User/LoginUrlCommand.php | 1 + src/Command/User/PasswordHashCommand.php | 1 + src/Command/User/PasswordResetCommand.php | 2 +- src/Command/User/RoleCommand.php | 2 ++ src/Command/Views/DebugCommand.php | 8 ++++--- src/Command/Views/DisableCommand.php | 2 ++ src/Command/Views/EnableCommand.php | 2 ++ src/Command/Views/PluginsDebugCommand.php | 1 + src/Extension/Discovery.php | 2 +- src/Extension/Extension.php | 1 + src/Extension/Manager.php | 2 ++ .../AuthenticationProviderGenerator.php | 3 ++- src/Generator/BreakPointGenerator.php | 6 +++-- src/Generator/CommandGenerator.php | 2 ++ src/Generator/ControllerGenerator.php | 3 ++- src/Generator/DatabaseSettingsGenerator.php | 1 + src/Generator/EntityBundleGenerator.php | 3 ++- src/Generator/EntityConfigGenerator.php | 3 ++- src/Generator/EntityContentGenerator.php | 3 ++- src/Generator/EventSubscriberGenerator.php | 5 +++-- src/Generator/FormAlterGenerator.php | 3 ++- src/Generator/FormGenerator.php | 7 +++--- src/Generator/HelpGenerator.php | 3 ++- src/Generator/ModuleFileGenerator.php | 5 +++-- src/Generator/ModuleGenerator.php | 13 ++++++----- src/Generator/PermissionGenerator.php | 5 +++-- src/Generator/PluginBlockGenerator.php | 1 + .../PluginCKEditorButtonGenerator.php | 3 ++- src/Generator/PluginConditionGenerator.php | 4 +++- .../PluginFieldFormatterGenerator.php | 1 + src/Generator/PluginFieldTypeGenerator.php | 1 + src/Generator/PluginFieldWidgetGenerator.php | 1 + src/Generator/PluginImageEffectGenerator.php | 1 + .../PluginImageFormatterGenerator.php | 1 + src/Generator/PluginMailGenerator.php | 1 + .../PluginMigrateSourceGenerator.php | 1 + src/Generator/PluginRestResourceGenerator.php | 1 + src/Generator/PluginRulesActionGenerator.php | 1 + src/Generator/PluginSkeletonGenerator.php | 1 + .../PluginTypeAnnotationGenerator.php | 1 + src/Generator/PluginTypeYamlGenerator.php | 1 + src/Generator/PluginViewsFieldGenerator.php | 3 ++- src/Generator/PostUpdateGenerator.php | 3 ++- src/Generator/ProfileGenerator.php | 6 ++--- src/Generator/RouteSubscriberGenerator.php | 5 +++-- src/Generator/ServiceGenerator.php | 3 ++- src/Generator/ThemeGenerator.php | 9 ++++---- src/Generator/TwigExtensionGenerator.php | 4 +++- src/Generator/UpdateGenerator.php | 3 ++- src/Utils/AnnotationValidator.php | 2 ++ src/Utils/Create/Base.php | 2 ++ src/Utils/Create/CommentData.php | 1 + src/Utils/Create/NodeData.php | 1 + src/Utils/Create/TermData.php | 5 +++-- src/Utils/Create/UserData.php | 1 + src/Utils/Create/VocabularyData.php | 1 + src/Utils/DrupalApi.php | 5 ++++- src/Utils/MigrateExecuteMessageCapture.php | 4 ++-- src/Utils/Site.php | 3 ++- src/Utils/Validator.php | 11 +++++----- .../Adapter/TarGzGNUTarForWindowsAdapter.php | 3 ++- .../TarGzFileForWindowsStrategy.php | 5 +++-- 221 files changed, 509 insertions(+), 232 deletions(-) diff --git a/.php_cs b/.php_cs index 9e1054c9a..f396a6704 100644 --- a/.php_cs +++ b/.php_cs @@ -1,4 +1,10 @@ level(Symfony\CS\FixerInterface::PSR2_LEVEL); +return PhpCsFixer\Config::create() + ->setRules( + [ + '@PSR2' => true, + 'array_syntax' => ['syntax' => 'short'], + ] + ) + ->setUsingCache(false); diff --git a/phpqa.yml b/phpqa.yml index 30c73aab2..f4ac5224f 100644 --- a/phpqa.yml +++ b/phpqa.yml @@ -17,9 +17,9 @@ application: php-cs-fixer: enabled: true exception: false - file: - config-file: .php_cs - single-execution: false +# file: +# config-file: .php_cs +# single-execution: false options: level: psr2 arguments: diff --git a/src/Annotations/DrupalCommandAnnotationReader.php b/src/Annotations/DrupalCommandAnnotationReader.php index b432bdb0b..476acb381 100644 --- a/src/Annotations/DrupalCommandAnnotationReader.php +++ b/src/Annotations/DrupalCommandAnnotationReader.php @@ -6,6 +6,7 @@ /** * Class DrupalCommandReader + * * @package Drupal\Console\Annotations */ class DrupalCommandAnnotationReader diff --git a/src/Application.php b/src/Application.php index 94ceb25b9..ae97a3c53 100644 --- a/src/Application.php +++ b/src/Application.php @@ -12,6 +12,7 @@ /** * Class Application + * * @package Drupal\Console */ class Application extends BaseApplication @@ -70,7 +71,13 @@ private function registerGenerators() continue; } - $generator = $this->container->get($name); + try { + $generator = $this->container->get($name); + } catch (\Exception $e) { + echo $name . ' - ' . $e->getMessage() . PHP_EOL; + + continue; + } if (!$generator) { continue; diff --git a/src/Bootstrap/AddServicesCompilerPass.php b/src/Bootstrap/AddServicesCompilerPass.php index f7763b1b7..65dc8f332 100644 --- a/src/Bootstrap/AddServicesCompilerPass.php +++ b/src/Bootstrap/AddServicesCompilerPass.php @@ -21,6 +21,7 @@ class AddServicesCompilerPass implements CompilerPassInterface /** * AddCommandsCompilerPass constructor. + * * @param string $root */ public function __construct($root) diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index 80ed8fd99..6ac073a23 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -15,6 +15,7 @@ class Drupal /** * Drupal constructor. + * * @param $autoload * @param $root * @param $appRoot @@ -49,7 +50,7 @@ public function boot() $uri .= '/'; } $uri .= 'index.php'; - $request = Request::create($uri, 'GET', array(), array(), array(), array('SCRIPT_NAME' => $this->appRoot . '/index.php')); + $request = Request::create($uri, 'GET', [], [], [], ['SCRIPT_NAME' => $this->appRoot . '/index.php']); } else { $request = Request::createFromGlobals(); } diff --git a/src/Bootstrap/DrupalKernel.php b/src/Bootstrap/DrupalKernel.php index 16ee21d5f..e4b086811 100644 --- a/src/Bootstrap/DrupalKernel.php +++ b/src/Bootstrap/DrupalKernel.php @@ -8,6 +8,7 @@ /** * Class DrupalKernel + * * @package Drupal\Console\Utils */ class DrupalKernel extends DrupalKernelBase diff --git a/src/Bootstrap/DrupalServiceModifier.php b/src/Bootstrap/DrupalServiceModifier.php index ed1f4ddab..806a8426c 100644 --- a/src/Bootstrap/DrupalServiceModifier.php +++ b/src/Bootstrap/DrupalServiceModifier.php @@ -24,6 +24,7 @@ class DrupalServiceModifier implements ServiceModifierInterface /** * DrupalServiceModifier constructor. + * * @param string $root * @param string $serviceTag * @param string $generatorTag diff --git a/src/Bootstrap/FindCommandsCompilerPass.php b/src/Bootstrap/FindCommandsCompilerPass.php index be47496d7..42648b4ee 100644 --- a/src/Bootstrap/FindCommandsCompilerPass.php +++ b/src/Bootstrap/FindCommandsCompilerPass.php @@ -17,6 +17,7 @@ class FindCommandsCompilerPass implements CompilerPassInterface /** * FindCommandsCompilerPass constructor. + * * @param $serviceTag */ public function __construct($serviceTag) diff --git a/src/Bootstrap/FindGeneratorsCompilerPass.php b/src/Bootstrap/FindGeneratorsCompilerPass.php index 12081bec4..601a9d952 100644 --- a/src/Bootstrap/FindGeneratorsCompilerPass.php +++ b/src/Bootstrap/FindGeneratorsCompilerPass.php @@ -17,6 +17,7 @@ class FindGeneratorsCompilerPass implements CompilerPassInterface /** * FindCommandsCompilerPass constructor. + * * @param $serviceTag */ public function __construct($serviceTag) diff --git a/src/Command/Breakpoints/DebugCommand.php b/src/Command/Breakpoints/DebugCommand.php index fae24f0aa..fd23dd52d 100644 --- a/src/Command/Breakpoints/DebugCommand.php +++ b/src/Command/Breakpoints/DebugCommand.php @@ -39,6 +39,7 @@ class DebugCommand extends Command /** * DebugCommand constructor. + * * @param BreakpointManagerInterface $breakpointManager * @param string $appRoot */ diff --git a/src/Command/Cache/RebuildCommand.php b/src/Command/Cache/RebuildCommand.php index 0144f8157..c3a98ab3d 100644 --- a/src/Command/Cache/RebuildCommand.php +++ b/src/Command/Cache/RebuildCommand.php @@ -19,6 +19,7 @@ /** * Class RebuildCommand + * * @package Drupal\Console\Command\Cache */ class RebuildCommand extends Command @@ -43,6 +44,7 @@ class RebuildCommand extends Command /** * RebuildCommand constructor. + * * @param DrupalApi $drupalApi * @param Site $site * @param $classLoader diff --git a/src/Command/Config/DebugCommand.php b/src/Command/Config/DebugCommand.php index 321707193..ab0545626 100644 --- a/src/Command/Config/DebugCommand.php +++ b/src/Command/Config/DebugCommand.php @@ -33,6 +33,7 @@ class DebugCommand extends Command /** * DebugCommand constructor. + * * @param ConfigFactory $configFactory * @param CachedStorage $configStorage */ diff --git a/src/Command/Config/DeleteCommand.php b/src/Command/Config/DeleteCommand.php index 14525d012..b235f625a 100644 --- a/src/Command/Config/DeleteCommand.php +++ b/src/Command/Config/DeleteCommand.php @@ -40,6 +40,7 @@ class DeleteCommand extends Command /** * DeleteCommand constructor. + * * @param ConfigFactory $configFactory * @param CachedStorage $configStorage * @param FileStorage $configStorageSync diff --git a/src/Command/Config/DiffCommand.php b/src/Command/Config/DiffCommand.php index 63802ccb5..83470488e 100644 --- a/src/Command/Config/DiffCommand.php +++ b/src/Command/Config/DiffCommand.php @@ -34,6 +34,7 @@ class DiffCommand extends Command /** * DiffCommand constructor. + * * @param CachedStorage $configStorage * @param ConfigManager $configManager */ diff --git a/src/Command/Config/EditCommand.php b/src/Command/Config/EditCommand.php index 973b2d31c..5f0c1bebe 100644 --- a/src/Command/Config/EditCommand.php +++ b/src/Command/Config/EditCommand.php @@ -43,6 +43,7 @@ class EditCommand extends Command /** * EditCommand constructor. + * * @param ConfigFactory $configFactory * @param CachedStorage $configStorage * @param ConfigurationManager $configurationManager @@ -110,7 +111,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if (!$editor) { $editor = $this->getEditor(); } - $processBuilder = new ProcessBuilder(array($editor, $configFile)); + $processBuilder = new ProcessBuilder([$editor, $configFile]); $process = $processBuilder->getProcess(); $process->setTty('true'); $process->run(); @@ -169,7 +170,7 @@ protected function getEditor() return trim($editor); } - $processBuilder = new ProcessBuilder(array('bash')); + $processBuilder = new ProcessBuilder(['bash']); $process = $processBuilder->getProcess(); $process->setCommandLine('echo ${EDITOR:-${VISUAL:-vi}}'); $process->run(); diff --git a/src/Command/Config/ExportCommand.php b/src/Command/Config/ExportCommand.php index d6a10bf2f..8544d6cf6 100644 --- a/src/Command/Config/ExportCommand.php +++ b/src/Command/Config/ExportCommand.php @@ -29,6 +29,7 @@ class ExportCommand extends Command /** * ExportCommand constructor. + * * @param ConfigManager $configManager */ public function __construct(ConfigManager $configManager) diff --git a/src/Command/Config/ExportContentTypeCommand.php b/src/Command/Config/ExportContentTypeCommand.php index 6a0a5ff83..130533f5a 100644 --- a/src/Command/Config/ExportContentTypeCommand.php +++ b/src/Command/Config/ExportContentTypeCommand.php @@ -45,6 +45,7 @@ class ExportContentTypeCommand extends Command /** * ExportContentTypeCommand constructor. + * * @param EntityTypeManagerInterface $entityTypeManager * @param CachedStorage $configStorage * @param Manager $extensionManager @@ -80,7 +81,7 @@ protected function configure() $this->trans('commands.config.export.content.type.options.optional-config') ); - $this->configExport = array(); + $this->configExport = []; } /** @@ -102,7 +103,7 @@ protected function interact(InputInterface $input, OutputInterface $output) $contentType = $input->getArgument('content-type'); if (!$contentType) { $bundles_entities = $this->entityTypeManager->getStorage('node_type')->loadMultiple(); - $bundles = array(); + $bundles = []; foreach ($bundles_entities as $entity) { $bundles[$entity->id()] = $entity->label(); } @@ -140,7 +141,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $contentTypeNameConfig = $this->getConfiguration($contentTypeName); - $this->configExport[$contentTypeName] = array('data' => $contentTypeNameConfig, 'optional' => $optionalConfig); + $this->configExport[$contentTypeName] = ['data' => $contentTypeNameConfig, 'optional' => $optionalConfig]; $this->getFields($contentType, $optionalConfig); @@ -161,7 +162,7 @@ protected function getFields($contentType, $optional = false) $field_name_config = $this->getConfiguration($field_name); // Only select fields related with content type if ($field_name_config['bundle'] == $contentType) { - $this->configExport[$field_name] = array('data' => $field_name_config, 'optional' => $optional); + $this->configExport[$field_name] = ['data' => $field_name_config, 'optional' => $optional]; // Include dependencies in export files if ($dependencies = $this->fetchDependencies($field_name_config, 'config')) { $this->resolveDependencies($dependencies, $optional); @@ -179,7 +180,7 @@ protected function getFormDisplays($contentType, $optional = false) $form_display_name_config = $this->getConfiguration($form_display_name); // Only select fields related with content type if ($form_display_name_config['bundle'] == $contentType) { - $this->configExport[$form_display_name] = array('data' => $form_display_name_config, 'optional' => $optional); + $this->configExport[$form_display_name] = ['data' => $form_display_name_config, 'optional' => $optional]; // Include dependencies in export files if ($dependencies = $this->fetchDependencies($form_display_name_config, 'config')) { $this->resolveDependencies($dependencies, $optional); @@ -197,7 +198,7 @@ protected function getViewDisplays($contentType, $optional = false) $view_display_name_config = $this->getConfiguration($view_display_name); // Only select fields related with content type if ($view_display_name_config['bundle'] == $contentType) { - $this->configExport[$view_display_name] = array('data' => $view_display_name_config, 'optional' => $optional); + $this->configExport[$view_display_name] = ['data' => $view_display_name_config, 'optional' => $optional]; // Include dependencies in export files if ($dependencies = $this->fetchDependencies($view_display_name_config, 'config')) { $this->resolveDependencies($dependencies, $optional); diff --git a/src/Command/Config/ExportSingleCommand.php b/src/Command/Config/ExportSingleCommand.php index 449b17ccc..a3b728811 100644 --- a/src/Command/Config/ExportSingleCommand.php +++ b/src/Command/Config/ExportSingleCommand.php @@ -43,6 +43,7 @@ class ExportSingleCommand extends Command /** * ExportSingleCommand constructor. + * * @param EntityTypeManagerInterface $entityTypeManager * @param CachedStorage $configStorage */ @@ -118,9 +119,9 @@ function ($definition) { ); uasort($entity_types, 'strnatcasecmp'); - $config_types = array( + $config_types = [ 'system.simple' => $this->trans('commands.config.export.single.options.simple-configuration'), - ) + $entity_types; + ] + $entity_types; return $config_types; } diff --git a/src/Command/Config/ExportViewCommand.php b/src/Command/Config/ExportViewCommand.php index 1f7cf3a23..246b09e26 100644 --- a/src/Command/Config/ExportViewCommand.php +++ b/src/Command/Config/ExportViewCommand.php @@ -46,6 +46,7 @@ class ExportViewCommand extends Command /** * ExportViewCommand constructor. + * * @param EntityTypeManagerInterface $entityTypeManager * @param CachedStorage $configStorage * @param Manager $extensionManager @@ -156,7 +157,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $viewNameConfig = $this->getConfiguration($viewTypeName); - $this->configExport[$viewTypeName] = array('data' => $viewNameConfig, 'optional' => $optionalConfig); + $this->configExport[$viewTypeName] = ['data' => $viewNameConfig, 'optional' => $optionalConfig]; // Include config dependencies in export files if ($dependencies = $this->fetchDependencies($viewNameConfig, 'config')) { diff --git a/src/Command/Config/ImportCommand.php b/src/Command/Config/ImportCommand.php index 25b83a8b6..0375d4548 100644 --- a/src/Command/Config/ImportCommand.php +++ b/src/Command/Config/ImportCommand.php @@ -38,6 +38,7 @@ class ImportCommand extends Command /** * ImportCommand constructor. + * * @param CachedStorage $configStorage * @param ConfigManager $configManager */ diff --git a/src/Command/Config/ImportSingleCommand.php b/src/Command/Config/ImportSingleCommand.php index 06a8a5611..6204a3d85 100644 --- a/src/Command/Config/ImportSingleCommand.php +++ b/src/Command/Config/ImportSingleCommand.php @@ -37,6 +37,7 @@ class ImportSingleCommand extends Command /** * ImportSingleCommand constructor. + * * @param CachedStorage $configStorage * @param ConfigManager $configManager */ @@ -158,7 +159,7 @@ private function configImport($io, StorageComparer $storageComparer) $sync_steps = $configImporter->initialize(); foreach ($sync_steps as $step) { - $context = array(); + $context = []; do { $configImporter->doSyncStep($step, $context); } while ($context['finished'] < 1); diff --git a/src/Command/Config/OverrideCommand.php b/src/Command/Config/OverrideCommand.php index 3ff545aa6..2f690ef44 100644 --- a/src/Command/Config/OverrideCommand.php +++ b/src/Command/Config/OverrideCommand.php @@ -32,6 +32,7 @@ class OverrideCommand extends Command /** * OverrideCommand constructor. + * * @param CachedStorage $configStorage * @param ConfigFactory $configFactory */ diff --git a/src/Command/Config/SettingsDebugCommand.php b/src/Command/Config/SettingsDebugCommand.php index 032a8d144..15c7b5e8a 100644 --- a/src/Command/Config/SettingsDebugCommand.php +++ b/src/Command/Config/SettingsDebugCommand.php @@ -17,6 +17,7 @@ /** * Class DebugCommand + * * @package Drupal\Console\Command\Config */ class SettingsDebugCommand extends Command @@ -30,6 +31,7 @@ class SettingsDebugCommand extends Command /** * SettingsDebugCommand constructor. + * * @param Settings $settings */ public function __construct(Settings $settings) diff --git a/src/Command/Config/ValidateDebugCommand.php b/src/Command/Config/ValidateDebugCommand.php index fc8e17107..8ee48d0f8 100644 --- a/src/Command/Config/ValidateDebugCommand.php +++ b/src/Command/Config/ValidateDebugCommand.php @@ -96,7 +96,7 @@ private function manualCheckConfigSchema(TypedConfigManagerInterface $typed_conf { $data_definition = $typed_config->buildDataDefinition($config_schema, $config_data); $this->schema = $typed_config->create($data_definition, $config_data); - $errors = array(); + $errors = []; foreach ($config_data as $key => $value) { $errors = array_merge($errors, $this->checkValue($key, $value)); } diff --git a/src/Command/ContainerDebugCommand.php b/src/Command/ContainerDebugCommand.php index 8d9a8be7b..db128a41a 100644 --- a/src/Command/ContainerDebugCommand.php +++ b/src/Command/ContainerDebugCommand.php @@ -18,6 +18,7 @@ /** * Class ContainerDebugCommand + * * @package Drupal\Console\Command */ class ContainerDebugCommand extends Command diff --git a/src/Command/Create/CommentsCommand.php b/src/Command/Create/CommentsCommand.php index 4267e78b4..ff04f0584 100644 --- a/src/Command/Create/CommentsCommand.php +++ b/src/Command/Create/CommentsCommand.php @@ -17,6 +17,7 @@ /** * Class CommentsCommand + * * @package Drupal\Console\Command\Generate */ class CommentsCommand extends Command @@ -31,6 +32,7 @@ class CommentsCommand extends Command /** * CommentsCommand constructor. + * * @param CommentData $createCommentData */ public function __construct(CommentData $createCommentData) @@ -116,7 +118,7 @@ protected function interact(InputInterface $input, OutputInterface $output) array_values($timeRanges) ); - $input->setOption('time-range', array_search($timeRange, $timeRanges)); + $input->setOption('time-range', array_search($timeRange, $timeRanges)); } } diff --git a/src/Command/Create/NodesCommand.php b/src/Command/Create/NodesCommand.php index 23244baad..d0553b953 100644 --- a/src/Command/Create/NodesCommand.php +++ b/src/Command/Create/NodesCommand.php @@ -20,6 +20,7 @@ /** * Class NodesCommand + * * @package Drupal\Console\Command\Generate */ class NodesCommand extends Command @@ -38,6 +39,7 @@ class NodesCommand extends Command /** * NodesCommand constructor. + * * @param DrupalApi $drupalApi * @param NodeData $createNodeData */ @@ -138,7 +140,7 @@ function ($contentType) use ($bundles) { array_values($timeRanges) ); - $input->setOption('time-range', array_search($timeRange, $timeRanges)); + $input->setOption('time-range', array_search($timeRange, $timeRanges)); } } diff --git a/src/Command/Create/TermsCommand.php b/src/Command/Create/TermsCommand.php index 0e2b95c86..69afca43d 100644 --- a/src/Command/Create/TermsCommand.php +++ b/src/Command/Create/TermsCommand.php @@ -19,6 +19,7 @@ /** * Class TermsCommand + * * @package Drupal\Console\Command\Generate */ class TermsCommand extends Command @@ -36,6 +37,7 @@ class TermsCommand extends Command /** * TermsCommand constructor. + * * @param DrupalApi $drupalApi * @param TermData $createTermData */ diff --git a/src/Command/Create/UsersCommand.php b/src/Command/Create/UsersCommand.php index 33ecc6593..4fc6c1f74 100644 --- a/src/Command/Create/UsersCommand.php +++ b/src/Command/Create/UsersCommand.php @@ -20,6 +20,7 @@ /** * Class UsersCommand + * * @package Drupal\Console\Command\Create */ class UsersCommand extends Command @@ -38,6 +39,7 @@ class UsersCommand extends Command /** * UsersCommand constructor. + * * @param DrupalApi $drupalApi * @param UserData $createUserData */ @@ -138,7 +140,7 @@ function ($role) use ($roles) { array_values($timeRanges) ); - $input->setOption('time-range', array_search($timeRange, $timeRanges)); + $input->setOption('time-range', array_search($timeRange, $timeRanges)); } } diff --git a/src/Command/Create/VocabulariesCommand.php b/src/Command/Create/VocabulariesCommand.php index bff958c12..4af224444 100644 --- a/src/Command/Create/VocabulariesCommand.php +++ b/src/Command/Create/VocabulariesCommand.php @@ -17,6 +17,7 @@ /** * Class VocabulariesCommand + * * @package Drupal\Console\Command\Generate */ class VocabulariesCommand extends Command @@ -30,6 +31,7 @@ class VocabulariesCommand extends Command /** * UsersCommand constructor. + * * @param $vocabularyData */ public function __construct(VocabularyData $vocabularyData) diff --git a/src/Command/Cron/DebugCommand.php b/src/Command/Cron/DebugCommand.php index 43ef9d5a4..7e38a0e30 100644 --- a/src/Command/Cron/DebugCommand.php +++ b/src/Command/Cron/DebugCommand.php @@ -25,6 +25,7 @@ class DebugCommand extends Command /** * DebugCommand constructor. + * * @param ModuleHandlerInterface $moduleHandler */ public function __construct(ModuleHandlerInterface $moduleHandler) diff --git a/src/Command/Cron/ExecuteCommand.php b/src/Command/Cron/ExecuteCommand.php index 203919da6..eba3f431d 100644 --- a/src/Command/Cron/ExecuteCommand.php +++ b/src/Command/Cron/ExecuteCommand.php @@ -44,6 +44,7 @@ class ExecuteCommand extends Command /** * DebugCommand constructor. + * * @param ModuleHandlerInterface $moduleHandler * @param LockBackendInterface $lock * @param StateInterface $state diff --git a/src/Command/Cron/ReleaseCommand.php b/src/Command/Cron/ReleaseCommand.php index 57f51a727..2fa9541ad 100644 --- a/src/Command/Cron/ReleaseCommand.php +++ b/src/Command/Cron/ReleaseCommand.php @@ -32,6 +32,7 @@ class ReleaseCommand extends Command /** * ReleaseCommand constructor. + * * @param LockBackendInterface $lock * @param ChainQueue $chainQueue */ diff --git a/src/Command/Database/AddCommand.php b/src/Command/Database/AddCommand.php index 4aa839494..d62c17836 100644 --- a/src/Command/Database/AddCommand.php +++ b/src/Command/Database/AddCommand.php @@ -30,6 +30,7 @@ class AddCommand extends Command /** * FormCommand constructor. + * * @param DatabaseSettingsGenerator $generator */ public function __construct( diff --git a/src/Command/Database/DatabaseLogBase.php b/src/Command/Database/DatabaseLogBase.php index 29a243db3..c1ed83184 100644 --- a/src/Command/Database/DatabaseLogBase.php +++ b/src/Command/Database/DatabaseLogBase.php @@ -221,7 +221,7 @@ protected function createTableRow(\stdClass $dblog) { /** - * @var User $user + * @var User $user */ $user = $this->userStorage->load($dblog->uid); diff --git a/src/Command/Database/DropCommand.php b/src/Command/Database/DropCommand.php index 266370374..f729395a4 100644 --- a/src/Command/Database/DropCommand.php +++ b/src/Command/Database/DropCommand.php @@ -18,6 +18,7 @@ /** * Class DropCommand + * * @package Drupal\Console\Command\Database */ class DropCommand extends Command @@ -32,6 +33,7 @@ class DropCommand extends Command /** * DropCommand constructor. + * * @param Connection $database */ public function __construct(Connection $database) diff --git a/src/Command/Database/DumpCommand.php b/src/Command/Database/DumpCommand.php index 34f2c938c..cc5888be5 100644 --- a/src/Command/Database/DumpCommand.php +++ b/src/Command/Database/DumpCommand.php @@ -31,6 +31,7 @@ class DumpCommand extends Command /** * DumpCommand constructor. + * * @param $appRoot * @param ShellProcess $shellProcess */ diff --git a/src/Command/Database/LogClearCommand.php b/src/Command/Database/LogClearCommand.php index 3da85b8b9..ac87b8036 100644 --- a/src/Command/Database/LogClearCommand.php +++ b/src/Command/Database/LogClearCommand.php @@ -28,6 +28,7 @@ class LogClearCommand extends Command /** * LogClearCommand constructor. + * * @param Connection $database */ public function __construct(Connection $database) diff --git a/src/Command/Database/RestoreCommand.php b/src/Command/Database/RestoreCommand.php index 8294b6227..d94b336d9 100644 --- a/src/Command/Database/RestoreCommand.php +++ b/src/Command/Database/RestoreCommand.php @@ -29,6 +29,7 @@ class RestoreCommand extends Command /** * RestoreCommand constructor. + * * @param string $appRoot */ public function __construct($appRoot) diff --git a/src/Command/Database/TableDebugCommand.php b/src/Command/Database/TableDebugCommand.php index ee3490a07..3621074d7 100644 --- a/src/Command/Database/TableDebugCommand.php +++ b/src/Command/Database/TableDebugCommand.php @@ -20,6 +20,7 @@ /** * Class TableDebugCommand + * * @package Drupal\Console\Command\Database */ class TableDebugCommand extends Command @@ -39,6 +40,7 @@ class TableDebugCommand extends Command /** * TableDebugCommand constructor. + * * @param R $redBean * @param Connection $database */ diff --git a/src/Command/Develop/ExampleCommand.php b/src/Command/Develop/ExampleCommand.php index c3fe7c61a..54ee68c18 100644 --- a/src/Command/Develop/ExampleCommand.php +++ b/src/Command/Develop/ExampleCommand.php @@ -15,6 +15,7 @@ /** * Class ExampleCommand + * * @package Drupal\Console\Command\Develop */ class ExampleCommand extends Command diff --git a/src/Command/Develop/ExampleContainerAwareCommand.php b/src/Command/Develop/ExampleContainerAwareCommand.php index 085430b88..0028bb1a5 100644 --- a/src/Command/Develop/ExampleContainerAwareCommand.php +++ b/src/Command/Develop/ExampleContainerAwareCommand.php @@ -15,6 +15,7 @@ /** * Class ExampleContainerAwareCommand + * * @package Drupal\Console\Command\Develop */ class ExampleContainerAwareCommand extends Command diff --git a/src/Command/Develop/GenerateDocCheatsheetCommand.php b/src/Command/Develop/GenerateDocCheatsheetCommand.php index a607ff424..474ab6e0c 100644 --- a/src/Command/Develop/GenerateDocCheatsheetCommand.php +++ b/src/Command/Develop/GenerateDocCheatsheetCommand.php @@ -175,7 +175,7 @@ protected function prepareHtml($array_content, $path, $io) // 1st page foreach ($this->orderCommands as $command) { - $str .= $this->doTable($command, $array_content[$command]); + $str .= $this->doTable($command, $array_content[$command]); } // 2nd page @@ -184,8 +184,8 @@ protected function prepareHtml($array_content, $path, $io) $str .= "

DrupalConsole Cheatsheet



"; - $str .= $this->doTable("generate", $array_content["generate"]); - $str .= $this->doTable("miscelaneous", $array_content["none"]); + $str .= $this->doTable("generate", $array_content["generate"]); + $str .= $this->doTable("miscelaneous", $array_content["none"]); $this->doPdf($str, $path, $io); } diff --git a/src/Command/Develop/GenerateDocDashCommand.php b/src/Command/Develop/GenerateDocDashCommand.php index 5850eee3a..82f7f581b 100644 --- a/src/Command/Develop/GenerateDocDashCommand.php +++ b/src/Command/Develop/GenerateDocDashCommand.php @@ -71,6 +71,7 @@ class GenerateDocDashCommand extends Command /** * GenerateDocDashCommand constructor. + * * @param $renderer * @param $consoleRoot */ diff --git a/src/Command/Develop/GenerateDocGitbookCommand.php b/src/Command/Develop/GenerateDocGitbookCommand.php index 328c244d1..18bb4c1fc 100644 --- a/src/Command/Develop/GenerateDocGitbookCommand.php +++ b/src/Command/Develop/GenerateDocGitbookCommand.php @@ -25,6 +25,7 @@ class GenerateDocGitbookCommand extends Command /** * GenerateDocGitbookCommand constructor. + * * @param TwigRenderer $renderer */ public function __construct(TwigRenderer $renderer) diff --git a/src/Command/Develop/TranslationCleanupCommand.php b/src/Command/Develop/TranslationCleanupCommand.php index 27e10c44c..9263f4ba4 100644 --- a/src/Command/Develop/TranslationCleanupCommand.php +++ b/src/Command/Develop/TranslationCleanupCommand.php @@ -25,7 +25,7 @@ class TranslationCleanupCommand extends Command /** * @var string */ - protected $consoleRoot; + protected $consoleRoot; /** * @var ConfigurationManager diff --git a/src/Command/Develop/TranslationPendingCommand.php b/src/Command/Develop/TranslationPendingCommand.php index 12f483e40..3e479bdcd 100644 --- a/src/Command/Develop/TranslationPendingCommand.php +++ b/src/Command/Develop/TranslationPendingCommand.php @@ -29,7 +29,7 @@ class TranslationPendingCommand extends Command /** * @var string */ - protected $consoleRoot; + protected $consoleRoot; /** * @var ConfigurationManager @@ -195,7 +195,7 @@ protected function determinePendingTranslation($io, $language = null, $languages $diff = $this->nestedArray->arrayDiff($englishFileParsed, $resourceTranslatedParsed, true, $diffStatistics); if (!empty($diff)) { - $diffFlatten = array(); + $diffFlatten = []; $keyFlatten = ''; $this->nestedArray->yamlFlattenArray($diff, $diffFlatten, $keyFlatten); diff --git a/src/Command/Develop/TranslationStatsCommand.php b/src/Command/Develop/TranslationStatsCommand.php index c37abe670..723ba787d 100644 --- a/src/Command/Develop/TranslationStatsCommand.php +++ b/src/Command/Develop/TranslationStatsCommand.php @@ -30,7 +30,7 @@ class TranslationStatsCommand extends Command /** * @var string */ - protected $consoleRoot; + protected $consoleRoot; /** * @var ConfigurationManager @@ -209,7 +209,7 @@ protected function calculateStats($io, $language = null, $languages) $yamlKeys = 0; if (!empty($diff)) { - $diffFlatten = array(); + $diffFlatten = []; $keyFlatten = ''; $this->nestedArray->yamlFlattenArray($diff, $diffFlatten, $keyFlatten); @@ -240,7 +240,6 @@ protected function calculateStats($io, $language = null, $languages) usort( $stats, function ($a, $b) { return $a["percentage"] < $b["percentage"]; - } ); diff --git a/src/Command/Develop/TranslationSyncCommand.php b/src/Command/Develop/TranslationSyncCommand.php index c5a8c8ada..5d2cd7076 100644 --- a/src/Command/Develop/TranslationSyncCommand.php +++ b/src/Command/Develop/TranslationSyncCommand.php @@ -26,7 +26,7 @@ class TranslationSyncCommand extends Command /** * @var string */ - protected $consoleRoot; + protected $consoleRoot; /** * @var ConfigurationManager diff --git a/src/Command/Entity/DebugCommand.php b/src/Command/Entity/DebugCommand.php index e43d4eb49..d041d56f7 100644 --- a/src/Command/Entity/DebugCommand.php +++ b/src/Command/Entity/DebugCommand.php @@ -31,6 +31,7 @@ class DebugCommand extends Command /** * DeleteCommand constructor. + * * @param EntityTypeRepository $entityTypeRepository * @param EntityTypeManagerInterface $entityTypeManager */ diff --git a/src/Command/Entity/DeleteCommand.php b/src/Command/Entity/DeleteCommand.php index c2cbfa8c8..895db67d6 100644 --- a/src/Command/Entity/DeleteCommand.php +++ b/src/Command/Entity/DeleteCommand.php @@ -31,6 +31,7 @@ class DeleteCommand extends Command /** * DeleteCommand constructor. + * * @param EntityTypeRepository $entityTypeRepository * @param EntityTypeManagerInterface $entityTypeManager */ diff --git a/src/Command/EventDebugCommand.php b/src/Command/EventDebugCommand.php index 60198a166..38c05a43e 100644 --- a/src/Command/EventDebugCommand.php +++ b/src/Command/EventDebugCommand.php @@ -16,6 +16,7 @@ /** * Class EventDebugCommand + * * @package Drupal\Console\Command */ class EventDebugCommand extends Command @@ -26,6 +27,7 @@ class EventDebugCommand extends Command /** * EventDebugCommand constructor. + * * @param $eventDispatcher */ public function __construct($eventDispatcher) diff --git a/src/Command/Field/InfoCommand.php b/src/Command/Field/InfoCommand.php index 656834d9e..7810be768 100644 --- a/src/Command/Field/InfoCommand.php +++ b/src/Command/Field/InfoCommand.php @@ -36,6 +36,7 @@ class InfoCommand extends Command /** * InfoCommand constructor. + * * @param EntityTypeManagerInterface $entityTypeManager * @param EntityFieldManagerInterface $entityFieldManager */ diff --git a/src/Command/Generate/AuthenticationProviderCommand.php b/src/Command/Generate/AuthenticationProviderCommand.php index faaf36d13..a05aadecb 100644 --- a/src/Command/Generate/AuthenticationProviderCommand.php +++ b/src/Command/Generate/AuthenticationProviderCommand.php @@ -30,12 +30,12 @@ class AuthenticationProviderCommand extends Command use CommandTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var AuthenticationProviderGenerator + * @var AuthenticationProviderGenerator */ protected $generator; @@ -47,6 +47,7 @@ class AuthenticationProviderCommand extends Command /** * AuthenticationProviderCommand constructor. + * * @param Manager $extensionManager * @param AuthenticationProviderGenerator $generator * @param StringConverter $stringConverter diff --git a/src/Command/Generate/BreakPointCommand.php b/src/Command/Generate/BreakPointCommand.php index e34ab6c85..5ffe47470 100644 --- a/src/Command/Generate/BreakPointCommand.php +++ b/src/Command/Generate/BreakPointCommand.php @@ -53,7 +53,7 @@ class BreakPointCommand extends Command /** - * @var Validator + * @var Validator */ protected $validator; @@ -64,8 +64,9 @@ class BreakPointCommand extends Command /** * BreakPointCommand constructor. + * * @param BreakPointGenerator $generator - * @param $appRoot + * @param $appRoot * @param ThemeHandler $themeHandler * @param Validator $validator * @param StringConverter $stringConverter diff --git a/src/Command/Generate/CommandCommand.php b/src/Command/Generate/CommandCommand.php index 00826aeac..eb9752f5c 100644 --- a/src/Command/Generate/CommandCommand.php +++ b/src/Command/Generate/CommandCommand.php @@ -50,6 +50,7 @@ class CommandCommand extends Command /** * CommandCommand constructor. + * * @param CommandGenerator $generator * @param Manager $extensionManager * @param Validator $validator diff --git a/src/Command/Generate/ConfigFormBaseCommand.php b/src/Command/Generate/ConfigFormBaseCommand.php index be31efc32..3496b1cc6 100644 --- a/src/Command/Generate/ConfigFormBaseCommand.php +++ b/src/Command/Generate/ConfigFormBaseCommand.php @@ -53,12 +53,13 @@ class ConfigFormBaseCommand extends FormCommand /** * ConfigFormBaseCommand constructor. + * * @param Manager $extensionManager * @param FormGenerator $generator * @param StringConverter $stringConverter * @param RouteProviderInterface $routeProvider * @param ElementInfoManager $elementInfoManager - * @param $appRoot + * @param $appRoot * @param ChainQueue $chainQueue */ public function __construct( diff --git a/src/Command/Generate/ControllerCommand.php b/src/Command/Generate/ControllerCommand.php index ba5a8e04a..6ab08915a 100644 --- a/src/Command/Generate/ControllerCommand.php +++ b/src/Command/Generate/ControllerCommand.php @@ -33,12 +33,12 @@ class ControllerCommand extends Command use ContainerAwareCommandTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var ControllerGenerator + * @var ControllerGenerator */ protected $generator; @@ -48,12 +48,12 @@ class ControllerCommand extends Command protected $stringConverter; /** - * @var Validator + * @var Validator */ protected $validator; /** - * @var RouteProviderInterface + * @var RouteProviderInterface */ protected $routeProvider; @@ -64,6 +64,7 @@ class ControllerCommand extends Command /** * ControllerCommand constructor. + * * @param Manager $extensionManager * @param ControllerGenerator $generator * @param StringConverter $stringConverter diff --git a/src/Command/Generate/EntityBundleCommand.php b/src/Command/Generate/EntityBundleCommand.php index a12020316..7fc27a58c 100644 --- a/src/Command/Generate/EntityBundleCommand.php +++ b/src/Command/Generate/EntityBundleCommand.php @@ -35,17 +35,18 @@ class EntityBundleCommand extends Command protected $validator; /** - * @var EntityBundleGenerator + * @var EntityBundleGenerator */ protected $generator; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** * EntityBundleCommand constructor. + * * @param Validator $validator * @param EntityBundleGenerator $generator * @param Manager $extensionManager diff --git a/src/Command/Generate/EntityConfigCommand.php b/src/Command/Generate/EntityConfigCommand.php index 13df41dc3..5af38622c 100644 --- a/src/Command/Generate/EntityConfigCommand.php +++ b/src/Command/Generate/EntityConfigCommand.php @@ -18,12 +18,12 @@ class EntityConfigCommand extends EntityCommand { /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var EntityConfigGenerator + * @var EntityConfigGenerator */ protected $generator; @@ -39,6 +39,7 @@ class EntityConfigCommand extends EntityCommand /** * EntityConfigCommand constructor. + * * @param Manager $extensionManager * @param EntityConfigGenerator $generator * @param Validator $validator diff --git a/src/Command/Generate/EntityContentCommand.php b/src/Command/Generate/EntityContentCommand.php index 57ec10f3c..187cd3737 100644 --- a/src/Command/Generate/EntityContentCommand.php +++ b/src/Command/Generate/EntityContentCommand.php @@ -46,6 +46,7 @@ class EntityContentCommand extends EntityCommand /** * EntityContentCommand constructor. + * * @param ChainQueue $chainQueue * @param EntityContentGenerator $generator * @param StringConverter $stringConverter diff --git a/src/Command/Generate/EventSubscriberCommand.php b/src/Command/Generate/EventSubscriberCommand.php index 92914aa68..e91ee3439 100644 --- a/src/Command/Generate/EventSubscriberCommand.php +++ b/src/Command/Generate/EventSubscriberCommand.php @@ -58,6 +58,7 @@ class EventSubscriberCommand extends Command /** * EventSubscriberCommand constructor. + * * @param Manager $extensionManager * @param EventSubscriberGenerator $generator * @param StringConverter $stringConverter diff --git a/src/Command/Generate/FormAlterCommand.php b/src/Command/Generate/FormAlterCommand.php index d4f110f03..f838827f6 100644 --- a/src/Command/Generate/FormAlterCommand.php +++ b/src/Command/Generate/FormAlterCommand.php @@ -38,12 +38,12 @@ class FormAlterCommand extends Command use CommandTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var FormAlterGenerator + * @var FormAlterGenerator */ protected $generator; @@ -63,12 +63,12 @@ class FormAlterCommand extends Command protected $elementInfoManager; /** - * @var Validator + * @var Validator */ protected $validator; /** - * @var RouteProviderInterface + * @var RouteProviderInterface */ protected $routeProvider; @@ -90,13 +90,14 @@ class FormAlterCommand extends Command /** * FormAlterCommand constructor. + * * @param Manager $extensionManager * @param FormAlterGenerator $generator * @param StringConverter $stringConverter * @param ModuleHandlerInterface $moduleHandler * @param ElementInfoManager $elementInfoManager * @param Profiler $profiler - * @param $appRoot + * @param $appRoot * @param ChainQueue $chainQueue */ public function __construct( @@ -256,7 +257,7 @@ protected function interact(InputInterface $input, OutputInterface $output) true ); - $this->metadata['unset'] = array_filter(array_map('trim', $formItemsToHide)); + $this->metadata['unset'] = array_filter(array_map('trim', $formItemsToHide)); } $input->setOption('form-id', $formId); @@ -303,7 +304,7 @@ protected function createGenerator() public function getWebprofilerForms() { $tokens = $this->profiler->find(null, null, 1000, null, '', ''); - $forms = array(); + $forms = []; foreach ($tokens as $token) { $token = [$token['token']]; $profile = $this->profiler->loadProfile($token); diff --git a/src/Command/Generate/FormCommand.php b/src/Command/Generate/FormCommand.php index bbf62a5a8..8014462eb 100644 --- a/src/Command/Generate/FormCommand.php +++ b/src/Command/Generate/FormCommand.php @@ -36,17 +36,17 @@ abstract class FormCommand extends Command private $commandName; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var FormGenerator + * @var FormGenerator */ protected $generator; /** - * @var ChainQueue + * @var ChainQueue */ protected $chainQueue; @@ -68,6 +68,7 @@ abstract class FormCommand extends Command /** * FormCommand constructor. + * * @param Manager $extensionManager * @param FormGenerator $generator * @param ChainQueue $chainQueue diff --git a/src/Command/Generate/HelpCommand.php b/src/Command/Generate/HelpCommand.php index ccbf09222..afbf98a70 100644 --- a/src/Command/Generate/HelpCommand.php +++ b/src/Command/Generate/HelpCommand.php @@ -27,7 +27,7 @@ class HelpCommand extends Command use ConfirmationTrait; /** - * @var HelpGenerator + * @var HelpGenerator */ protected $generator; @@ -37,7 +37,7 @@ class HelpCommand extends Command protected $site; /** - * @var Manager + * @var Manager */ protected $extensionManager; @@ -49,6 +49,7 @@ class HelpCommand extends Command /** * HelpCommand constructor. + * * @param HelpGenerator $generator * @param Site $site * @param Manager $extensionManager diff --git a/src/Command/Generate/ModuleCommand.php b/src/Command/Generate/ModuleCommand.php index e0b9d0c99..1127bcefe 100644 --- a/src/Command/Generate/ModuleCommand.php +++ b/src/Command/Generate/ModuleCommand.php @@ -29,12 +29,12 @@ class ModuleCommand extends Command use CommandTrait; /** - * @var ModuleGenerator + * @var ModuleGenerator */ protected $generator; /** - * @var Validator + * @var Validator */ protected $validator; @@ -71,14 +71,15 @@ class ModuleCommand extends Command /** * ModuleCommand constructor. + * * @param ModuleGenerator $generator * @param Validator $validator - * @param $appRoot + * @param $appRoot * @param StringConverter $stringConverter * @param DrupalApi $drupalApi * @param Client $httpClient * @param Site $site - * @param $twigtemplate + * @param $twigtemplate */ public function __construct( ModuleGenerator $generator, @@ -251,7 +252,7 @@ protected function execute(InputInterface $input, OutputInterface $output) private function checkDependencies(array $dependencies, DrupalStyle $io) { $this->site->loadLegacyFile('/core/modules/system/system.module'); - $localModules = array(); + $localModules = []; $modules = system_rebuild_module_data(); foreach ($modules as $module_id => $module) { diff --git a/src/Command/Generate/ModuleFileCommand.php b/src/Command/Generate/ModuleFileCommand.php index 83cc2cebc..33bdf7e5f 100644 --- a/src/Command/Generate/ModuleFileCommand.php +++ b/src/Command/Generate/ModuleFileCommand.php @@ -20,6 +20,7 @@ /** * Class ModuleFileCommand + * * @package Drupal\Console\Command\Generate */ class ModuleFileCommand extends Command @@ -29,18 +30,19 @@ class ModuleFileCommand extends Command use ModuleTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var ModuleFileGenerator + * @var ModuleFileGenerator */ protected $generator; /** * ModuleFileCommand constructor. + * * @param Manager $extensionManager * @param ModuleFileGenerator $generator */ diff --git a/src/Command/Generate/PermissionCommand.php b/src/Command/Generate/PermissionCommand.php index da464fb81..373d347e4 100644 --- a/src/Command/Generate/PermissionCommand.php +++ b/src/Command/Generate/PermissionCommand.php @@ -44,6 +44,7 @@ class PermissionCommand extends Command /** * PermissionCommand constructor. + * * @param Manager $extensionManager * @param StringConverter $stringConverter */ diff --git a/src/Command/Generate/PluginBlockCommand.php b/src/Command/Generate/PluginBlockCommand.php index 10847f19a..c32e4ea9d 100644 --- a/src/Command/Generate/PluginBlockCommand.php +++ b/src/Command/Generate/PluginBlockCommand.php @@ -76,6 +76,7 @@ class PluginBlockCommand extends Command /** * PluginBlockCommand constructor. + * * @param ConfigFactory $configFactory * @param ChainQueue $chainQueue * @param PluginBlockGenerator $generator diff --git a/src/Command/Generate/PluginCKEditorButtonCommand.php b/src/Command/Generate/PluginCKEditorButtonCommand.php index af5bcd3d4..e6091fdbe 100644 --- a/src/Command/Generate/PluginCKEditorButtonCommand.php +++ b/src/Command/Generate/PluginCKEditorButtonCommand.php @@ -34,12 +34,12 @@ class PluginCKEditorButtonCommand extends Command /** - * @var PluginCKEditorButtonGenerator + * @var PluginCKEditorButtonGenerator */ protected $generator; /** - * @var Manager + * @var Manager */ protected $extensionManager; @@ -51,6 +51,7 @@ class PluginCKEditorButtonCommand extends Command /** * PluginCKEditorButtonCommand constructor. + * * @param ChainQueue $chainQueue * @param PluginCKEditorButtonGenerator $generator * @param Manager $extensionManager diff --git a/src/Command/Generate/PluginConditionCommand.php b/src/Command/Generate/PluginConditionCommand.php index 8a92feec8..372ee4293 100644 --- a/src/Command/Generate/PluginConditionCommand.php +++ b/src/Command/Generate/PluginConditionCommand.php @@ -23,6 +23,7 @@ /** * Class PluginConditionCommand + * * @package Drupal\Console\Command\Generate */ class PluginConditionCommand extends Command @@ -32,12 +33,12 @@ class PluginConditionCommand extends Command use ConfirmationTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var PluginConditionGenerator + * @var PluginConditionGenerator */ protected $generator; @@ -54,6 +55,7 @@ class PluginConditionCommand extends Command /** * PluginConditionCommand constructor. + * * @param Manager $extensionManager * @param PluginConditionGenerator $generator * @param ChainQueue $chainQueue @@ -195,7 +197,7 @@ protected function interact(InputInterface $input, OutputInterface $output) $context_definition_id = $input->getOption('context-definition-id'); if (!$context_definition_id) { - $context_type = array('language' => 'Language', "entity" => "Entity"); + $context_type = ['language' => 'Language', "entity" => "Entity"]; $context_type_sel = $io->choice( $this->trans('commands.generate.plugin.condition.questions.context-type'), array_values($context_type) diff --git a/src/Command/Generate/PluginFieldCommand.php b/src/Command/Generate/PluginFieldCommand.php index f909c6d3b..3254afed2 100644 --- a/src/Command/Generate/PluginFieldCommand.php +++ b/src/Command/Generate/PluginFieldCommand.php @@ -26,7 +26,7 @@ class PluginFieldCommand extends Command use CommandTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; @@ -43,6 +43,7 @@ class PluginFieldCommand extends Command /** * PluginFieldCommand constructor. + * * @param Manager $extensionManager * @param StringConverter $stringConverter * @param ChainQueue $chainQueue diff --git a/src/Command/Generate/PluginFieldFormatterCommand.php b/src/Command/Generate/PluginFieldFormatterCommand.php index b6fab9f12..b0e94117c 100644 --- a/src/Command/Generate/PluginFieldFormatterCommand.php +++ b/src/Command/Generate/PluginFieldFormatterCommand.php @@ -23,6 +23,7 @@ /** * Class PluginFieldFormatterCommand + * * @package Drupal\Console\Command\Generate */ class PluginFieldFormatterCommand extends Command @@ -32,12 +33,12 @@ class PluginFieldFormatterCommand extends Command use CommandTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var PluginFieldFormatterGenerator + * @var PluginFieldFormatterGenerator */ protected $generator; @@ -47,7 +48,7 @@ class PluginFieldFormatterCommand extends Command protected $stringConverter; /** - * @var FieldTypePluginManager + * @var FieldTypePluginManager */ protected $fieldTypePluginManager; @@ -59,6 +60,7 @@ class PluginFieldFormatterCommand extends Command /** * PluginImageFormatterCommand constructor. + * * @param Manager $extensionManager * @param PluginFieldFormatterGenerator $generator * @param StringConverter $stringConverter diff --git a/src/Command/Generate/PluginFieldTypeCommand.php b/src/Command/Generate/PluginFieldTypeCommand.php index 68365d356..d60c4bcb5 100644 --- a/src/Command/Generate/PluginFieldTypeCommand.php +++ b/src/Command/Generate/PluginFieldTypeCommand.php @@ -23,6 +23,7 @@ /** * Class PluginFieldTypeCommand + * * @package Drupal\Console\Command\Generate */ class PluginFieldTypeCommand extends Command @@ -32,12 +33,12 @@ class PluginFieldTypeCommand extends Command use CommandTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var PluginFieldTypeGenerator + * @var PluginFieldTypeGenerator */ protected $generator; @@ -54,6 +55,7 @@ class PluginFieldTypeCommand extends Command /** * PluginFieldTypeCommand constructor. + * * @param Manager $extensionManager * @param PluginFieldTypeGenerator $generator * @param StringConverter $stringConverter diff --git a/src/Command/Generate/PluginFieldWidgetCommand.php b/src/Command/Generate/PluginFieldWidgetCommand.php index b35c65102..89817bcad 100644 --- a/src/Command/Generate/PluginFieldWidgetCommand.php +++ b/src/Command/Generate/PluginFieldWidgetCommand.php @@ -23,6 +23,7 @@ /** * Class PluginFieldWidgetCommand + * * @package Drupal\Console\Command\Generate */ class PluginFieldWidgetCommand extends Command @@ -32,12 +33,12 @@ class PluginFieldWidgetCommand extends Command use CommandTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var PluginFieldWidgetGenerator + * @var PluginFieldWidgetGenerator */ protected $generator; @@ -47,12 +48,12 @@ class PluginFieldWidgetCommand extends Command protected $stringConverter; /** - * @var Validator + * @var Validator */ protected $validator; /** - * @var FieldTypePluginManager + * @var FieldTypePluginManager */ protected $fieldTypePluginManager; @@ -64,6 +65,7 @@ class PluginFieldWidgetCommand extends Command /** * PluginFieldWidgetCommand constructor. + * * @param Manager $extensionManager * @param PluginFieldWidgetGenerator $generator * @param StringConverter $stringConverter @@ -187,7 +189,7 @@ protected function interact(InputInterface $input, OutputInterface $output) $field_type = $input->getOption('field-type'); if (!$field_type) { // Gather valid field types. - $field_type_options = array(); + $field_type_options = []; foreach ($this->fieldTypePluginManager->getGroupedDefinitions($this->fieldTypePluginManager->getUiDefinitions()) as $category => $field_types) { foreach ($field_types as $name => $field_type) { $field_type_options[] = $name; diff --git a/src/Command/Generate/PluginImageEffectCommand.php b/src/Command/Generate/PluginImageEffectCommand.php index 98dc7370e..d66a90421 100644 --- a/src/Command/Generate/PluginImageEffectCommand.php +++ b/src/Command/Generate/PluginImageEffectCommand.php @@ -22,6 +22,7 @@ /** * Class PluginImageEffectCommand + * * @package Drupal\Console\Command\Generate */ class PluginImageEffectCommand extends Command @@ -31,12 +32,12 @@ class PluginImageEffectCommand extends Command use CommandTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var PluginImageEffectGenerator + * @var PluginImageEffectGenerator */ protected $generator; @@ -53,6 +54,7 @@ class PluginImageEffectCommand extends Command /** * PluginImageEffectCommand constructor. + * * @param Manager $extensionManager * @param PluginImageEffectGenerator $generator * @param StringConverter $stringConverter diff --git a/src/Command/Generate/PluginImageFormatterCommand.php b/src/Command/Generate/PluginImageFormatterCommand.php index 595a4c511..9672a97e1 100644 --- a/src/Command/Generate/PluginImageFormatterCommand.php +++ b/src/Command/Generate/PluginImageFormatterCommand.php @@ -28,12 +28,12 @@ class PluginImageFormatterCommand extends Command use CommandTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var PluginImageFormatterGenerator + * @var PluginImageFormatterGenerator */ protected $generator; @@ -43,7 +43,7 @@ class PluginImageFormatterCommand extends Command protected $stringConverter; /** - * @var Validator + * @var Validator */ protected $validator; @@ -55,6 +55,7 @@ class PluginImageFormatterCommand extends Command /** * PluginImageFormatterCommand constructor. + * * @param Manager $extensionManager * @param PluginImageFormatterGenerator $generator * @param StringConverter $stringConverter diff --git a/src/Command/Generate/PluginMailCommand.php b/src/Command/Generate/PluginMailCommand.php index 1365af9f7..73cd2f75d 100644 --- a/src/Command/Generate/PluginMailCommand.php +++ b/src/Command/Generate/PluginMailCommand.php @@ -25,6 +25,7 @@ /** * Class PluginMailCommand + * * @package Drupal\Console\Command\Generate */ class PluginMailCommand extends Command @@ -36,12 +37,12 @@ class PluginMailCommand extends Command use ContainerAwareCommandTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var PluginMailGenerator + * @var PluginMailGenerator */ protected $generator; @@ -51,7 +52,7 @@ class PluginMailCommand extends Command protected $stringConverter; /** - * @var Validator + * @var Validator */ protected $validator; @@ -63,6 +64,7 @@ class PluginMailCommand extends Command /** * PluginMailCommand constructor. + * * @param Manager $extensionManager * @param PluginMailGenerator $generator * @param StringConverter $stringConverter diff --git a/src/Command/Generate/PluginMigrateSourceCommand.php b/src/Command/Generate/PluginMigrateSourceCommand.php index c04f83e47..0bd731479 100644 --- a/src/Command/Generate/PluginMigrateSourceCommand.php +++ b/src/Command/Generate/PluginMigrateSourceCommand.php @@ -72,6 +72,7 @@ class PluginMigrateSourceCommand extends Command /** * PluginBlockCommand constructor. + * * @param ConfigFactory $configFactory * @param ChainQueue $chainQueue * @param PluginBlockGenerator $generator diff --git a/src/Command/Generate/PluginRestResourceCommand.php b/src/Command/Generate/PluginRestResourceCommand.php index 6160fbcc9..aa187a23d 100644 --- a/src/Command/Generate/PluginRestResourceCommand.php +++ b/src/Command/Generate/PluginRestResourceCommand.php @@ -24,6 +24,7 @@ /** * Class PluginRestResourceCommand + * * @package Drupal\Console\Command\Generate */ class PluginRestResourceCommand extends Command @@ -35,12 +36,12 @@ class PluginRestResourceCommand extends Command use CommandTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var PluginRestResourceGenerator + * @var PluginRestResourceGenerator */ protected $generator; @@ -57,6 +58,7 @@ class PluginRestResourceCommand extends Command /** * PluginRestResourceCommand constructor. + * * @param Manager $extensionManager * @param PluginRestResourceGenerator $generator * @param StringConverter $stringConverter @@ -206,7 +208,7 @@ function ($class_name) use ($stringUtils) { // --plugin-states option $plugin_states = $input->getOption('plugin-states'); if (!$plugin_states) { - $states = array('GET', 'PUT', 'POST', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS'); + $states = ['GET', 'PUT', 'POST', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS']; $plugin_states = $io->choice( $this->trans('commands.generate.plugin.rest.resource.questions.plugin-states'), $states, diff --git a/src/Command/Generate/PluginRulesActionCommand.php b/src/Command/Generate/PluginRulesActionCommand.php index 83f40f4f9..4163e51ad 100644 --- a/src/Command/Generate/PluginRulesActionCommand.php +++ b/src/Command/Generate/PluginRulesActionCommand.php @@ -24,6 +24,7 @@ /** * Class PluginRulesActionCommand + * * @package Drupal\Console\Command\Generate */ class PluginRulesActionCommand extends Command @@ -35,12 +36,12 @@ class PluginRulesActionCommand extends Command use CommandTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var PluginRulesActionGenerator + * @var PluginRulesActionGenerator */ protected $generator; @@ -57,6 +58,7 @@ class PluginRulesActionCommand extends Command /** * PluginRulesActionCommand constructor. + * * @param Manager $extensionManager * @param PluginRulesActionGenerator $generator * @param StringConverter $stringConverter diff --git a/src/Command/Generate/PluginSkeletonCommand.php b/src/Command/Generate/PluginSkeletonCommand.php index 5420a927e..39494b501 100644 --- a/src/Command/Generate/PluginSkeletonCommand.php +++ b/src/Command/Generate/PluginSkeletonCommand.php @@ -24,6 +24,7 @@ /** * Class PluginSkeletonCommand + * * @package Drupal\Console\Command\Generate */ class PluginSkeletonCommand extends Command @@ -34,12 +35,12 @@ class PluginSkeletonCommand extends Command use ContainerAwareCommandTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var PluginSkeletonGenerator + * @var PluginSkeletonGenerator */ protected $generator; @@ -49,7 +50,7 @@ class PluginSkeletonCommand extends Command protected $stringConverter; /** - * @var Validator + * @var Validator */ protected $validator; @@ -61,6 +62,7 @@ class PluginSkeletonCommand extends Command /** * PluginSkeletonCommand constructor. + * * @param Manager $extensionManager * @param PluginSkeletonGenerator $generator * @param StringConverter $stringConverter @@ -258,7 +260,7 @@ protected function getPluginMetadata($pluginId) } if (empty($pluginMetaData['pluginInterface'])) { - $pluginMetaData['pluginInterfaceMethods'] = array(); + $pluginMetaData['pluginInterfaceMethods'] = []; } else { $pluginMetaData['pluginInterfaceMethods'] = $this->getClassMethods($pluginMetaData['pluginInterface']); } diff --git a/src/Command/Generate/PluginTypeAnnotationCommand.php b/src/Command/Generate/PluginTypeAnnotationCommand.php index 1975528a8..5462596de 100644 --- a/src/Command/Generate/PluginTypeAnnotationCommand.php +++ b/src/Command/Generate/PluginTypeAnnotationCommand.php @@ -23,6 +23,7 @@ /** * Class PluginTypeAnnotationCommand + * * @package Drupal\Console\Command\Generate */ class PluginTypeAnnotationCommand extends Command @@ -34,12 +35,12 @@ class PluginTypeAnnotationCommand extends Command use CommandTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var PluginTypeAnnotationGenerator + * @var PluginTypeAnnotationGenerator */ protected $generator; @@ -50,6 +51,7 @@ class PluginTypeAnnotationCommand extends Command /** * PluginTypeAnnotationCommand constructor. + * * @param Manager $extensionManager * @param PluginTypeAnnotationGenerator $generator * @param StringConverter $stringConverter diff --git a/src/Command/Generate/PluginTypeYamlCommand.php b/src/Command/Generate/PluginTypeYamlCommand.php index ca9e13087..6295481f9 100644 --- a/src/Command/Generate/PluginTypeYamlCommand.php +++ b/src/Command/Generate/PluginTypeYamlCommand.php @@ -24,6 +24,7 @@ /** * Class PluginTypeYamlCommand + * * @package Drupal\Console\Command\Generate */ class PluginTypeYamlCommand extends Command @@ -35,12 +36,12 @@ class PluginTypeYamlCommand extends Command use CommandTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var PluginTypeYamlGenerator + * @var PluginTypeYamlGenerator */ protected $generator; @@ -51,6 +52,7 @@ class PluginTypeYamlCommand extends Command /** * PluginTypeYamlCommand constructor. + * * @param Manager $extensionManager * @param PluginTypeYamlGenerator $generator * @param StringConverter $stringConverter diff --git a/src/Command/Generate/PluginViewsFieldCommand.php b/src/Command/Generate/PluginViewsFieldCommand.php index bc794ba93..c0962a2b7 100644 --- a/src/Command/Generate/PluginViewsFieldCommand.php +++ b/src/Command/Generate/PluginViewsFieldCommand.php @@ -23,6 +23,7 @@ /** * Class PluginViewsFieldCommand + * * @package Drupal\Console\Command\Generate */ class PluginViewsFieldCommand extends Command @@ -33,12 +34,12 @@ class PluginViewsFieldCommand extends Command /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var PluginViewsFieldGenerator + * @var PluginViewsFieldGenerator */ protected $generator; @@ -59,6 +60,7 @@ class PluginViewsFieldCommand extends Command /** * PluginViewsFieldCommand constructor. + * * @param Manager $extensionManager * @param PluginViewsFieldGenerator $generator * @param Site $site diff --git a/src/Command/Generate/PostUpdateCommand.php b/src/Command/Generate/PostUpdateCommand.php index a34ed5c88..0a0fba1ad 100644 --- a/src/Command/Generate/PostUpdateCommand.php +++ b/src/Command/Generate/PostUpdateCommand.php @@ -23,6 +23,7 @@ /** * Class PostUpdateCommand + * * @package Drupal\Console\Command\Generate */ class PostUpdateCommand extends Command @@ -32,12 +33,12 @@ class PostUpdateCommand extends Command use CommandTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var PostUpdateGenerator + * @var PostUpdateGenerator */ protected $generator; @@ -47,7 +48,7 @@ class PostUpdateCommand extends Command protected $site; /** - * @var Validator + * @var Validator */ protected $validator; @@ -58,6 +59,7 @@ class PostUpdateCommand extends Command /** * PostUpdateCommand constructor. + * * @param Manager $extensionManager * @param PostUpdateGenerator $generator * @param Site $site diff --git a/src/Command/Generate/ProfileCommand.php b/src/Command/Generate/ProfileCommand.php index 67e908862..8a29a7be8 100644 --- a/src/Command/Generate/ProfileCommand.php +++ b/src/Command/Generate/ProfileCommand.php @@ -23,6 +23,7 @@ /** * Class ProfileCommand + * * @package Drupal\Console\Command\Generate */ @@ -32,12 +33,12 @@ class ProfileCommand extends Command use CommandTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var ProfileGenerator + * @var ProfileGenerator */ protected $generator; @@ -47,7 +48,7 @@ class ProfileCommand extends Command protected $stringConverter; /** - * @var Validator + * @var Validator */ protected $validator; @@ -63,11 +64,12 @@ class ProfileCommand extends Command /** * ProfileCommand constructor. + * * @param Manager $extensionManager * @param ProfileGenerator $generator * @param StringConverter $stringConverter * @param Validator $validator - * @param $appRoot + * @param $appRoot * @param Site $site * @param Client $httpClient */ @@ -188,18 +190,18 @@ protected function execute(InputInterface $input, OutputInterface $output) private function checkDependencies(array $dependencies) { $this->site->loadLegacyFile('/core/modules/system/system.module'); - $local_modules = array(); + $local_modules = []; $modules = system_rebuild_module_data(); foreach ($modules as $module_id => $module) { array_push($local_modules, basename($module->subpath)); } - $checked_dependencies = array( - 'local_modules' => array(), - 'drupal_modules' => array(), - 'no_modules' => array(), - ); + $checked_dependencies = [ + 'local_modules' => [], + 'drupal_modules' => [], + 'no_modules' => [], + ]; foreach ($dependencies as $module) { if (in_array($module, $local_modules)) { diff --git a/src/Command/Generate/RouteSubscriberCommand.php b/src/Command/Generate/RouteSubscriberCommand.php index d3af1f27c..505b64e94 100644 --- a/src/Command/Generate/RouteSubscriberCommand.php +++ b/src/Command/Generate/RouteSubscriberCommand.php @@ -21,6 +21,7 @@ /** * Class RouteSubscriberCommand + * * @package Drupal\Console\Command\Generate */ class RouteSubscriberCommand extends Command @@ -30,12 +31,12 @@ class RouteSubscriberCommand extends Command use CommandTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var RouteSubscriberGenerator + * @var RouteSubscriberGenerator */ protected $generator; @@ -46,6 +47,7 @@ class RouteSubscriberCommand extends Command /** * RouteSubscriberCommand constructor. + * * @param Manager $extensionManager * @param RouteSubscriberGenerator $generator * @param ChainQueue $chainQueue diff --git a/src/Command/Generate/ServiceCommand.php b/src/Command/Generate/ServiceCommand.php index 8f3358c8f..e71edc113 100644 --- a/src/Command/Generate/ServiceCommand.php +++ b/src/Command/Generate/ServiceCommand.php @@ -23,6 +23,7 @@ /** * Class ServiceCommand + * * @package Drupal\Console\Command\Generate */ class ServiceCommand extends Command @@ -33,12 +34,12 @@ class ServiceCommand extends Command use ContainerAwareCommandTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var ServiceGenerator + * @var ServiceGenerator */ protected $generator; @@ -54,6 +55,7 @@ class ServiceCommand extends Command /** * ServiceCommand constructor. + * * @param Manager $extensionManager * @param ServiceGenerator $generator * @param StringConverter $stringConverter diff --git a/src/Command/Generate/ThemeCommand.php b/src/Command/Generate/ThemeCommand.php index 5d12786c9..00d20e3a0 100644 --- a/src/Command/Generate/ThemeCommand.php +++ b/src/Command/Generate/ThemeCommand.php @@ -25,6 +25,7 @@ /** * Class ThemeCommand + * * @package Drupal\Console\Command\Generate */ class ThemeCommand extends Command @@ -35,17 +36,17 @@ class ThemeCommand extends Command use CommandTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var ThemeGenerator + * @var ThemeGenerator */ protected $generator; /** - * @var Validator + * @var Validator */ protected $validator; @@ -71,10 +72,11 @@ class ThemeCommand extends Command /** * ThemeCommand constructor. + * * @param Manager $extensionManager * @param ThemeGenerator $generator * @param Validator $validator - * @param $appRoot + * @param $appRoot * @param ThemeHandler $themeHandler * @param Site $site * @param StringConverter $stringConverter diff --git a/src/Command/Generate/TwigExtensionCommand.php b/src/Command/Generate/TwigExtensionCommand.php index 8b6bdb090..843803d4a 100644 --- a/src/Command/Generate/TwigExtensionCommand.php +++ b/src/Command/Generate/TwigExtensionCommand.php @@ -23,6 +23,7 @@ /** * Class TwigExtensionCommand + * * @package Drupal\Console\Command\Generate */ class TwigExtensionCommand extends Command @@ -33,12 +34,12 @@ class TwigExtensionCommand extends Command use ContainerAwareCommandTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var TwigExtensionGenerator + * @var TwigExtensionGenerator */ protected $generator; @@ -60,6 +61,7 @@ class TwigExtensionCommand extends Command /** * TwigExtensionCommand constructor. + * * @param Manager $extensionManager * @param TwigExtensionGenerator $generator * @param StringConverter $stringConverter diff --git a/src/Command/Generate/UpdateCommand.php b/src/Command/Generate/UpdateCommand.php index faf76db82..9fec18453 100644 --- a/src/Command/Generate/UpdateCommand.php +++ b/src/Command/Generate/UpdateCommand.php @@ -22,6 +22,7 @@ /** * Class UpdateCommand + * * @package Drupal\Console\Command\Generate */ class UpdateCommand extends Command @@ -31,12 +32,12 @@ class UpdateCommand extends Command use CommandTrait; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var UpdateGenerator + * @var UpdateGenerator */ protected $generator; @@ -53,6 +54,7 @@ class UpdateCommand extends Command /** * UpdateCommand constructor. + * * @param Manager $extensionManager * @param UpdateGenerator $generator * @param StringConverter $stringConverter diff --git a/src/Command/Image/StylesDebugCommand.php b/src/Command/Image/StylesDebugCommand.php index 67524584b..92e548f28 100644 --- a/src/Command/Image/StylesDebugCommand.php +++ b/src/Command/Image/StylesDebugCommand.php @@ -16,6 +16,7 @@ /** * Class StylesDebugCommand + * * @package Drupal\Console\Command\Image */ class StylesDebugCommand extends Command @@ -29,6 +30,7 @@ class StylesDebugCommand extends Command /** * StylesDebugCommand constructor. + * * @param EntityTypeManagerInterface $entityTypeManager */ public function __construct(EntityTypeManagerInterface $entityTypeManager) diff --git a/src/Command/Image/StylesFlushCommand.php b/src/Command/Image/StylesFlushCommand.php index 955febbb7..afc963ef3 100644 --- a/src/Command/Image/StylesFlushCommand.php +++ b/src/Command/Image/StylesFlushCommand.php @@ -25,6 +25,7 @@ class StylesFlushCommand extends Command /** * StylesDebugCommand constructor. + * * @param EntityTypeManagerInterface $entityTypeManager */ public function __construct(EntityTypeManagerInterface $entityTypeManager) diff --git a/src/Command/Libraries/DebugCommand.php b/src/Command/Libraries/DebugCommand.php index a97bb5a2b..bfa501f63 100644 --- a/src/Command/Libraries/DebugCommand.php +++ b/src/Command/Libraries/DebugCommand.php @@ -23,27 +23,28 @@ class DebugCommand extends Command use CommandTrait; /** - * @var ModuleHandlerInterface + * @var ModuleHandlerInterface */ protected $moduleHandler; /** - * @var ThemeHandlerInterface; + * @var ThemeHandlerInterface; */ protected $themeHandler; /** - * @var LibraryDiscoveryInterface + * @var LibraryDiscoveryInterface */ protected $libraryDiscovery; /** - * @var string + * @var string */ protected $appRoot; /** * DebugCommand constructor. + * * @param ModuleHandlerInterface $moduleHandler * @param ThemeHandlerInterface $themeHandler * @param LibraryDiscoveryInterface $libraryDiscovery diff --git a/src/Command/Locale/LanguageAddCommand.php b/src/Command/Locale/LanguageAddCommand.php index f8ad40be9..4baf8ef9e 100644 --- a/src/Command/Locale/LanguageAddCommand.php +++ b/src/Command/Locale/LanguageAddCommand.php @@ -42,6 +42,7 @@ class LanguageAddCommand extends Command /** * LanguageAddCommand constructor. + * * @param Site $site * @param ModuleHandlerInterface $moduleHandler */ diff --git a/src/Command/Locale/LanguageDeleteCommand.php b/src/Command/Locale/LanguageDeleteCommand.php index b0d9eff60..c6689bf12 100644 --- a/src/Command/Locale/LanguageDeleteCommand.php +++ b/src/Command/Locale/LanguageDeleteCommand.php @@ -47,6 +47,7 @@ class LanguageDeleteCommand extends Command /** * LoginUrlCommand constructor. + * * @param Site $site * @param EntityTypeManagerInterface $entityTypeManager * @param ModuleHandlerInterface $moduleHandler diff --git a/src/Command/Locale/TranslationStatusCommand.php b/src/Command/Locale/TranslationStatusCommand.php index a68a17a12..2d92e833d 100644 --- a/src/Command/Locale/TranslationStatusCommand.php +++ b/src/Command/Locale/TranslationStatusCommand.php @@ -41,6 +41,7 @@ class TranslationStatusCommand extends Command /** * TranslationStatusCommand constructor. + * * @param Site $site * @param Manager $extensionManager */ diff --git a/src/Command/Migrate/DebugCommand.php b/src/Command/Migrate/DebugCommand.php index 574f4d84e..bcb95d3c5 100644 --- a/src/Command/Migrate/DebugCommand.php +++ b/src/Command/Migrate/DebugCommand.php @@ -36,6 +36,7 @@ class DebugCommand extends Command /** * DebugCommand constructor. + * * @param MigrationPluginManagerInterface $pluginManagerMigration */ public function __construct(MigrationPluginManagerInterface $pluginManagerMigration) diff --git a/src/Command/Migrate/ExecuteCommand.php b/src/Command/Migrate/ExecuteCommand.php index 4142fb6cd..bc91122c8 100644 --- a/src/Command/Migrate/ExecuteCommand.php +++ b/src/Command/Migrate/ExecuteCommand.php @@ -38,6 +38,7 @@ class ExecuteCommand extends Command /** * DebugCommand constructor. + * * @param MigrationPluginManagerInterface $pluginManagerMigration */ public function __construct(MigrationPluginManagerInterface $pluginManagerMigration) @@ -112,7 +113,7 @@ protected function configure() '', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.migrate.execute.options.exclude'), - array() + [] ) ->addOption( 'source-base_path', @@ -209,7 +210,7 @@ protected function interact(InputInterface $input, OutputInterface $output) $database = $this->getDBInfo(); $version_tag = 'Drupal ' . $drupal_version; - // Get migrations + // Get migrations $migrations_list = $this->getMigrations($version_tag); // --migration-id prefix diff --git a/src/Command/Migrate/SetupCommand.php b/src/Command/Migrate/SetupCommand.php index 239dac522..738c5eb43 100644 --- a/src/Command/Migrate/SetupCommand.php +++ b/src/Command/Migrate/SetupCommand.php @@ -39,6 +39,7 @@ class SetupCommand extends Command /** * SetupCommand constructor. + * * @param StateInterface $pluginManagerMigration */ public function __construct(StateInterface $state, MigrationPluginManagerInterface $pluginManagerMigration) diff --git a/src/Command/Module/DebugCommand.php b/src/Command/Module/DebugCommand.php index e3ab8b5ef..8864c8c05 100644 --- a/src/Command/Module/DebugCommand.php +++ b/src/Command/Module/DebugCommand.php @@ -34,6 +34,7 @@ class DebugCommand extends Command /** * DebugCommand constructor. + * * @param Client $httpClient */ @@ -41,6 +42,7 @@ class DebugCommand extends Command /** * ChainDebugCommand constructor. + * * @param ConfigurationManager $configurationManager * @param Site $site */ diff --git a/src/Command/Module/DownloadCommand.php b/src/Command/Module/DownloadCommand.php index 2db940a3d..09aa2e1df 100644 --- a/src/Command/Module/DownloadCommand.php +++ b/src/Command/Module/DownloadCommand.php @@ -29,12 +29,12 @@ class DownloadCommand extends Command use ProjectDownloadTrait; /** - * @var DrupalApi + * @var DrupalApi */ protected $drupalApi; /** - * @var Client + * @var Client */ protected $httpClient; @@ -44,22 +44,22 @@ class DownloadCommand extends Command protected $appRoot; /** - * @var Manager + * @var Manager */ protected $extensionManager; /** - * @var Validator + * @var Validator */ protected $validator; /** - * @var ConfigurationManager + * @var ConfigurationManager */ protected $configurationManager; /** - * @var ShellProcess + * @var ShellProcess */ protected $shellProcess; @@ -70,6 +70,7 @@ class DownloadCommand extends Command /** * DownloadCommand constructor. + * * @param DrupalApi $drupalApi * @param Client $httpClient * @param $appRoot diff --git a/src/Command/Module/InstallCommand.php b/src/Command/Module/InstallCommand.php index f0649372a..8cb886bb6 100644 --- a/src/Command/Module/InstallCommand.php +++ b/src/Command/Module/InstallCommand.php @@ -27,6 +27,7 @@ /** * Class InstallCommand + * * @package Drupal\Console\Command\Module */ class InstallCommand extends Command @@ -41,22 +42,22 @@ class InstallCommand extends Command protected $site; /** - * @var Validator + * @var Validator */ protected $validator; /** - * @var ModuleInstaller + * @var ModuleInstaller */ protected $moduleInstaller; /** - * @var DrupalApi + * @var DrupalApi */ protected $drupalApi; /** - * @var Manager + * @var Manager */ protected $extensionManager; @@ -72,6 +73,7 @@ class InstallCommand extends Command /** * InstallCommand constructor. + * * @param Site $site * @param Validator $validator * @param ModuleInstaller $moduleInstaller diff --git a/src/Command/Module/InstallDependencyCommand.php b/src/Command/Module/InstallDependencyCommand.php index 8a7d3917a..56ca8694a 100644 --- a/src/Command/Module/InstallDependencyCommand.php +++ b/src/Command/Module/InstallDependencyCommand.php @@ -23,6 +23,7 @@ /** * Class InstallDependencyCommand + * * @package Drupal\Console\Command\Module */ class InstallDependencyCommand extends Command @@ -37,12 +38,12 @@ class InstallDependencyCommand extends Command protected $site; /** - * @var Validator + * @var Validator */ protected $validator; /** - * @var ModuleInstaller + * @var ModuleInstaller */ protected $moduleInstaller; @@ -53,6 +54,7 @@ class InstallDependencyCommand extends Command /** * InstallCommand constructor. + * * @param Site $site * @param Validator $validator * @param ChainQueue $chainQueue diff --git a/src/Command/Module/PathCommand.php b/src/Command/Module/PathCommand.php index b76ebe3db..a716cde0c 100644 --- a/src/Command/Module/PathCommand.php +++ b/src/Command/Module/PathCommand.php @@ -29,6 +29,7 @@ class PathCommand extends Command /** * PathCommand constructor. + * * @param Manager $extensionManager */ public function __construct(Manager $extensionManager) diff --git a/src/Command/Module/UninstallCommand.php b/src/Command/Module/UninstallCommand.php index 63e22ac46..c5d8fac20 100755 --- a/src/Command/Module/UninstallCommand.php +++ b/src/Command/Module/UninstallCommand.php @@ -32,7 +32,7 @@ class UninstallCommand extends Command protected $site; /** - * @var ModuleInstaller + * @var ModuleInstaller */ protected $moduleInstaller; @@ -42,13 +42,14 @@ class UninstallCommand extends Command protected $chainQueue; /** - * @var ConfigFactory + * @var ConfigFactory */ protected $configFactory; /** * InstallCommand constructor. + * * @param Site $site * @param Validator $validator * @param ChainQueue $chainQueue @@ -155,7 +156,7 @@ protected function execute(InputInterface $input, OutputInterface $output) return 1; } - $installedModules = $coreExtension->get('module') ?: array(); + $installedModules = $coreExtension->get('module') ?: []; if (!$moduleList = array_intersect_key($moduleList, $installedModules)) { $io->info($this->trans('commands.module.uninstall.messages.nothing')); diff --git a/src/Command/Module/UpdateCommand.php b/src/Command/Module/UpdateCommand.php index 58d45aef2..76bcf88e6 100644 --- a/src/Command/Module/UpdateCommand.php +++ b/src/Command/Module/UpdateCommand.php @@ -24,7 +24,7 @@ class UpdateCommand extends Command /** - * @var ShellProcess + * @var ShellProcess */ protected $shellProcess; @@ -35,6 +35,7 @@ class UpdateCommand extends Command /** * UpdateCommand constructor. + * * @param ShellProcess $shellProcess * @param $root */ diff --git a/src/Command/Multisite/DebugCommand.php b/src/Command/Multisite/DebugCommand.php index 0a04491e1..00b155511 100644 --- a/src/Command/Multisite/DebugCommand.php +++ b/src/Command/Multisite/DebugCommand.php @@ -15,6 +15,7 @@ /** * Class SiteDebugCommand + * * @package Drupal\Console\Command\Site */ class DebugCommand extends Command @@ -25,6 +26,7 @@ class DebugCommand extends Command /** * DebugCommand constructor. + * * @param $appRoot */ public function __construct($appRoot) diff --git a/src/Command/Multisite/NewCommand.php b/src/Command/Multisite/NewCommand.php index d5000080e..5f8bcf1b5 100644 --- a/src/Command/Multisite/NewCommand.php +++ b/src/Command/Multisite/NewCommand.php @@ -20,6 +20,7 @@ /** * Class NewCommand + * * @package Drupal\Console\Command\Multisite */ class NewCommand extends Command @@ -30,6 +31,7 @@ class NewCommand extends Command /** * DebugCommand constructor. + * * @param $appRoot */ public function __construct($appRoot) diff --git a/src/Command/Node/AccessRebuildCommand.php b/src/Command/Node/AccessRebuildCommand.php index a6331aa49..b950e2d65 100644 --- a/src/Command/Node/AccessRebuildCommand.php +++ b/src/Command/Node/AccessRebuildCommand.php @@ -17,6 +17,7 @@ /** * Class AccessRebuildCommand + * * @package Drupal\Console\Command\Node */ class AccessRebuildCommand extends Command @@ -30,6 +31,7 @@ class AccessRebuildCommand extends Command /** * AccessRebuildCommand constructor. + * * @param StateInterface $state */ public function __construct(StateInterface $state) diff --git a/src/Command/PermissionDebugCommand.php b/src/Command/PermissionDebugCommand.php index 719a50c0d..f32eb504f 100644 --- a/src/Command/PermissionDebugCommand.php +++ b/src/Command/PermissionDebugCommand.php @@ -16,6 +16,7 @@ /** * Class DebugCommand + * * @package Drupal\Console\Command */ class PermissionDebugCommand extends Command diff --git a/src/Command/PluginDebugCommand.php b/src/Command/PluginDebugCommand.php index ee47a0e82..3f3ebe9b1 100644 --- a/src/Command/PluginDebugCommand.php +++ b/src/Command/PluginDebugCommand.php @@ -17,6 +17,7 @@ /** * Class DebugCommand + * * @package Drupal\Console\Command */ class PluginDebugCommand extends Command diff --git a/src/Command/Queue/DebugCommand.php b/src/Command/Queue/DebugCommand.php index e43695eb8..8ed257067 100644 --- a/src/Command/Queue/DebugCommand.php +++ b/src/Command/Queue/DebugCommand.php @@ -16,6 +16,7 @@ /** * Class DebugCommand + * * @package Drupal\Console\Command\Queue */ class DebugCommand extends Command @@ -29,6 +30,7 @@ class DebugCommand extends Command /** * DebugCommand constructor. + * * @param QueueWorkerManagerInterface $queueWorker */ public function __construct(QueueWorkerManagerInterface $queueWorker) diff --git a/src/Command/Queue/RunCommand.php b/src/Command/Queue/RunCommand.php index 8da251f1f..e2df4760c 100644 --- a/src/Command/Queue/RunCommand.php +++ b/src/Command/Queue/RunCommand.php @@ -18,6 +18,7 @@ /** * Class RunCommand + * * @package Drupal\Console\Command\Queue */ class RunCommand extends Command @@ -37,6 +38,7 @@ class RunCommand extends Command /** * DebugCommand constructor. + * * @param QueueWorkerManagerInterface $queueWorker * @param QueueFactory $queue */ diff --git a/src/Command/Rest/DebugCommand.php b/src/Command/Rest/DebugCommand.php index 33d59c56b..708920d3d 100644 --- a/src/Command/Rest/DebugCommand.php +++ b/src/Command/Rest/DebugCommand.php @@ -37,6 +37,7 @@ class DebugCommand extends Command /** * DebugCommand constructor. + * * @param ResourcePluginManager $pluginManagerRest */ public function __construct(ResourcePluginManager $pluginManagerRest) diff --git a/src/Command/Rest/DisableCommand.php b/src/Command/Rest/DisableCommand.php index 957c4ffff..3ed293f6c 100644 --- a/src/Command/Rest/DisableCommand.php +++ b/src/Command/Rest/DisableCommand.php @@ -30,17 +30,18 @@ class DisableCommand extends Command use RestTrait; /** - * @var ConfigFactory + * @var ConfigFactory */ protected $configFactory; /** - * @var ResourcePluginManager + * @var ResourcePluginManager */ protected $pluginManagerRest; /** * DisableCommand constructor. + * * @param ConfigFactory $configFactory * @param ResourcePluginManager $pluginManagerRest */ diff --git a/src/Command/Rest/EnableCommand.php b/src/Command/Rest/EnableCommand.php index 96536cb1d..0b21d5040 100644 --- a/src/Command/Rest/EnableCommand.php +++ b/src/Command/Rest/EnableCommand.php @@ -43,7 +43,7 @@ class EnableCommand extends Command protected $authenticationCollector; /** - * @var ConfigFactory + * @var ConfigFactory */ protected $configFactory; @@ -63,6 +63,7 @@ class EnableCommand extends Command /** * EnableCommand constructor. + * * @param ResourcePluginManager $pluginManagerRest * @param AuthenticationCollector $authenticationCollector * @param ConfigFactory $configFactory diff --git a/src/Command/Router/DebugCommand.php b/src/Command/Router/DebugCommand.php index 4d9970b72..0c0f902f4 100644 --- a/src/Command/Router/DebugCommand.php +++ b/src/Command/Router/DebugCommand.php @@ -27,6 +27,7 @@ class DebugCommand extends Command /** * DebugCommand constructor. + * * @param RouteProviderInterface $routeProvider */ public function __construct(RouteProviderInterface $routeProvider) diff --git a/src/Command/Router/RebuildCommand.php b/src/Command/Router/RebuildCommand.php index e4a59fc94..1bbf20268 100644 --- a/src/Command/Router/RebuildCommand.php +++ b/src/Command/Router/RebuildCommand.php @@ -25,6 +25,7 @@ class RebuildCommand extends Command /** * RebuildCommand constructor. + * * @param RouteBuilderInterface $routerBuilder */ public function __construct(RouteBuilderInterface $routerBuilder) diff --git a/src/Command/ServerCommand.php b/src/Command/ServerCommand.php index 1c91129f4..84f1cb54b 100644 --- a/src/Command/ServerCommand.php +++ b/src/Command/ServerCommand.php @@ -18,6 +18,7 @@ /** * Class ServerCommand + * * @package Drupal\Console\Command */ class ServerCommand extends Command @@ -30,6 +31,7 @@ class ServerCommand extends Command /** * ServerCommand constructor. + * * @param $appRoot * @param $configurationManager */ diff --git a/src/Command/Shared/ConfirmationTrait.php b/src/Command/Shared/ConfirmationTrait.php index 6619148eb..aaf1800e6 100644 --- a/src/Command/Shared/ConfirmationTrait.php +++ b/src/Command/Shared/ConfirmationTrait.php @@ -11,6 +11,7 @@ /** * Class ConfirmationTrait + * * @package Drupal\Console\Command */ trait ConfirmationTrait diff --git a/src/Command/Shared/ConnectTrait.php b/src/Command/Shared/ConnectTrait.php index ee93c63a7..61d38b7fd 100644 --- a/src/Command/Shared/ConnectTrait.php +++ b/src/Command/Shared/ConnectTrait.php @@ -12,7 +12,7 @@ trait ConnectTrait { - protected $supportedDrivers = array('mysql','pgsql'); + protected $supportedDrivers = ['mysql','pgsql']; public function resolveConnection(DrupalStyle $io, $database = 'default') { diff --git a/src/Command/Shared/CreateTrait.php b/src/Command/Shared/CreateTrait.php index 758849dfe..4790177f6 100644 --- a/src/Command/Shared/CreateTrait.php +++ b/src/Command/Shared/CreateTrait.php @@ -9,6 +9,7 @@ /** * Class CreateTrait + * * @package Drupal\Console\Command */ trait CreateTrait diff --git a/src/Command/Shared/DatabaseTrait.php b/src/Command/Shared/DatabaseTrait.php index f17f49934..85ac6456c 100644 --- a/src/Command/Shared/DatabaseTrait.php +++ b/src/Command/Shared/DatabaseTrait.php @@ -12,6 +12,7 @@ /** * Class DatabaseTrait + * * @package Drupal\Console\Command\Shared */ trait DatabaseTrait diff --git a/src/Command/Shared/EventsTrait.php b/src/Command/Shared/EventsTrait.php index 25f49d0e0..83cb54b4a 100644 --- a/src/Command/Shared/EventsTrait.php +++ b/src/Command/Shared/EventsTrait.php @@ -11,6 +11,7 @@ /** * Class EventsTrait + * * @package Drupal\Console\Command */ trait EventsTrait diff --git a/src/Command/Shared/ExportTrait.php b/src/Command/Shared/ExportTrait.php index d565fad30..051f79857 100644 --- a/src/Command/Shared/ExportTrait.php +++ b/src/Command/Shared/ExportTrait.php @@ -12,6 +12,7 @@ /** * Class ConfigExportTrait + * * @package Drupal\Console\Command */ trait ExportTrait @@ -121,7 +122,7 @@ protected function resolveDependencies($dependencies, $optional = false) { foreach ($dependencies as $dependency) { if (!array_key_exists($dependency, $this->configExport)) { - $this->configExport[$dependency] = array('data' => $this->getConfiguration($dependency), 'optional' => $optional); + $this->configExport[$dependency] = ['data' => $this->getConfiguration($dependency), 'optional' => $optional]; if ($dependencies = $this->fetchDependencies($this->configExport[$dependency], 'config')) { $this->resolveDependencies($dependencies, $optional); } diff --git a/src/Command/Shared/FeatureTrait.php b/src/Command/Shared/FeatureTrait.php index ccbb9aa59..1da568408 100644 --- a/src/Command/Shared/FeatureTrait.php +++ b/src/Command/Shared/FeatureTrait.php @@ -17,6 +17,7 @@ /** * Class FeatureTrait + * * @package Drupal\Console\Command */ trait FeatureTrait @@ -86,13 +87,13 @@ protected function getFeatureList($bundle) } if ($feature->getStatus() != FeaturesManagerInterface::STATUS_NO_EXPORT) { - $features[$feature->getMachineName()] = array( + $features[$feature->getMachineName()] = [ 'name' => $feature->getName(), 'machine_name' => $feature->getMachineName(), 'bundle_name' => $feature->getBundle(), 'status' => $manager->statusLabel($feature->getStatus()), 'state' => ($state != FeaturesManagerInterface::STATE_DEFAULT) ? $manager->stateLabel($state) : '', - ); + ]; } } @@ -104,7 +105,7 @@ protected function importFeature($io, $packages) { $manager = $this->getFeatureManager(); - $modules = (is_array($packages)) ? $packages : array($packages); + $modules = (is_array($packages)) ? $packages : [$packages]; $overridden = [] ; foreach ($modules as $module_name) { $package = $manager->loadPackage($module_name, true); diff --git a/src/Command/Shared/FormTrait.php b/src/Command/Shared/FormTrait.php index e94528016..608fa68d1 100644 --- a/src/Command/Shared/FormTrait.php +++ b/src/Command/Shared/FormTrait.php @@ -11,6 +11,7 @@ /** * Class FormTrait + * * @package Drupal\Console\Command */ trait FormTrait @@ -89,7 +90,7 @@ public function formQuestion(DrupalStyle $io) $maxlength = null; $size = null; - if (in_array($input_type, array('textfield', 'password', 'password_confirm'))) { + if (in_array($input_type, ['textfield', 'password', 'password_confirm'])) { $maxlength = $io->ask( 'Maximum amount of characters', '64' @@ -109,7 +110,7 @@ public function formQuestion(DrupalStyle $io) } $input_options = ''; - if (in_array($input_type, array('checkboxes', 'radios', 'select'))) { + if (in_array($input_type, ['checkboxes', 'radios', 'select'])) { $input_options = $io->ask( 'Input options separated by comma' ); diff --git a/src/Command/Shared/MenuTrait.php b/src/Command/Shared/MenuTrait.php index 5e2869c12..dafd48563 100644 --- a/src/Command/Shared/MenuTrait.php +++ b/src/Command/Shared/MenuTrait.php @@ -12,6 +12,7 @@ /** * Class MenuTrait + * * @package Drupal\Console\Command */ trait MenuTrait diff --git a/src/Command/Shared/MigrationTrait.php b/src/Command/Shared/MigrationTrait.php index db861081c..d82496d0b 100644 --- a/src/Command/Shared/MigrationTrait.php +++ b/src/Command/Shared/MigrationTrait.php @@ -14,6 +14,7 @@ /** * Class MigrationTrait + * * @package Drupal\Console\Command */ trait MigrationTrait @@ -42,7 +43,7 @@ protected function getMigrations($version_tag = false, $flatList = false, $confi //Create all migration instances $all_migrations = $this->pluginManagerMigration->createInstances(array_keys($migrations), $migration_plugin_configuration); - $migrations = array(); + $migrations = []; foreach ($all_migrations as $migration) { if ($flatList) { $migrations[$migration->id()] = ucwords($migration->label()); diff --git a/src/Command/Shared/ModuleTrait.php b/src/Command/Shared/ModuleTrait.php index e5bfd55b5..8a835fb69 100644 --- a/src/Command/Shared/ModuleTrait.php +++ b/src/Command/Shared/ModuleTrait.php @@ -11,6 +11,7 @@ /** * Class ModuleTrait + * * @package Drupal\Console\Command */ trait ModuleTrait @@ -57,7 +58,7 @@ public function moduleRequirement($module) foreach ($module as $module_name) { module_load_install($module_name); - if ($requirements = \Drupal::moduleHandler()->invoke($module_name, 'requirements', array('install'))) { + if ($requirements = \Drupal::moduleHandler()->invoke($module_name, 'requirements', ['install'])) { foreach ($requirements as $requirement) { throw new \Exception($module_name .' can not be installed: ' . $requirement['description']); } diff --git a/src/Command/Shared/ProjectDownloadTrait.php b/src/Command/Shared/ProjectDownloadTrait.php index c24a3a35a..d2c70c661 100644 --- a/src/Command/Shared/ProjectDownloadTrait.php +++ b/src/Command/Shared/ProjectDownloadTrait.php @@ -16,6 +16,7 @@ /** * Class ProjectDownloadTrait + * * @package Drupal\Console\Command */ trait ProjectDownloadTrait @@ -266,7 +267,7 @@ public function releasesQuestion(DrupalStyle $io, $project, $latest = false, $st $io->comment( sprintf( $this->trans('commands.'.$commandKey.'.messages.getting-releases'), - implode(',', array($project)) + implode(',', [$project]) ) ); @@ -276,7 +277,7 @@ public function releasesQuestion(DrupalStyle $io, $project, $latest = false, $st $io->error( sprintf( $this->trans('commands.'.$commandKey.'.messages.no-releases'), - implode(',', array($project)) + implode(',', [$project]) ) ); diff --git a/src/Command/Shared/RestTrait.php b/src/Command/Shared/RestTrait.php index af7bd630c..0c5c3c70b 100644 --- a/src/Command/Shared/RestTrait.php +++ b/src/Command/Shared/RestTrait.php @@ -42,7 +42,7 @@ public function getRestResources($rest_status = false) } if (isset($available_resources[$rest_status])) { - return array($rest_status => $available_resources[$rest_status]); + return [$rest_status => $available_resources[$rest_status]]; } return $available_resources; diff --git a/src/Command/Site/ImportLocalCommand.php b/src/Command/Site/ImportLocalCommand.php index 9285cc5fc..5a31a46ea 100644 --- a/src/Command/Site/ImportLocalCommand.php +++ b/src/Command/Site/ImportLocalCommand.php @@ -20,6 +20,7 @@ /** * Class ImportLocalCommand + * * @package Drupal\Console\Command\Site */ class ImportLocalCommand extends Command @@ -38,6 +39,7 @@ class ImportLocalCommand extends Command /** * ImportLocalCommand constructor. + * * @param $appRoot * @param ConfigurationManager $configurationManager */ diff --git a/src/Command/Site/InstallCommand.php b/src/Command/Site/InstallCommand.php index 199db20c4..408d5955c 100644 --- a/src/Command/Site/InstallCommand.php +++ b/src/Command/Site/InstallCommand.php @@ -53,6 +53,7 @@ class InstallCommand extends Command /** * InstallCommand constructor. + * * @param Manager $extensionManager * @param Site $site * @param ConfigurationManager $configurationManager @@ -371,7 +372,7 @@ function ($profile) { protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); - $uri = parse_url($input->getParameterOption(['--uri', '-l']) ?: 'default', PHP_URL_HOST); + $uri = parse_url($input->getParameterOption(['--uri', '-l'], 'default'), PHP_URL_HOST); if ($this->site->multisiteMode($uri)) { if (!$this->site->validMultisite($uri)) { @@ -381,7 +382,8 @@ protected function execute(InputInterface $input, OutputInterface $output) exit(1); } - // Modify $_SERVER environment information to enable the Drupal installer use multisite configuration. + // Modify $_SERVER environment information to enable + // the Drupal installer to use the multi-site configuration. $_SERVER['HTTP_HOST'] = $uri; } diff --git a/src/Command/Site/MaintenanceCommand.php b/src/Command/Site/MaintenanceCommand.php index 908330a4d..3088e9c39 100644 --- a/src/Command/Site/MaintenanceCommand.php +++ b/src/Command/Site/MaintenanceCommand.php @@ -34,6 +34,7 @@ class MaintenanceCommand extends Command /** * DebugCommand constructor. + * * @param StateInterface $state * @param ChainQueue $chainQueue */ diff --git a/src/Command/Site/ModeCommand.php b/src/Command/Site/ModeCommand.php index c6b22ac13..c791f51c9 100644 --- a/src/Command/Site/ModeCommand.php +++ b/src/Command/Site/ModeCommand.php @@ -116,7 +116,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->local = $input->getOption('local'); $loadedConfigurations = []; - if (in_array($this->environment, array('dev', 'prod'))) { + if (in_array($this->environment, ['dev', 'prod'])) { $loadedConfigurations = $this->loadConfigurations($this->environment); } else { $io->error($this->trans('commands.site.mode.messages.invalid-env')); diff --git a/src/Command/Site/StatisticsCommand.php b/src/Command/Site/StatisticsCommand.php index d93a89b1d..bd6f7bff1 100644 --- a/src/Command/Site/StatisticsCommand.php +++ b/src/Command/Site/StatisticsCommand.php @@ -19,6 +19,7 @@ /** * Class StatisticsCommand + * * @package Drupal\Console\Command\Site */ class StatisticsCommand extends Command @@ -47,6 +48,7 @@ class StatisticsCommand extends Command /** * StatisticsCommand constructor. + * * @param DrupalApi $drupalApi * @param QueryFactory $entityQuery; * @param Manager $extensionManager diff --git a/src/Command/Site/StatusCommand.php b/src/Command/Site/StatusCommand.php index 38b92e147..776961b06 100644 --- a/src/Command/Site/StatusCommand.php +++ b/src/Command/Site/StatusCommand.php @@ -72,6 +72,7 @@ class StatusCommand extends Command /** * DebugCommand constructor. + * * @param SystemManager $systemManager * @param Settings $settings * @param ConfigFactory $configFactory diff --git a/src/Command/State/DebugCommand.php b/src/Command/State/DebugCommand.php index 0f9c0ada8..9a4f81f87 100644 --- a/src/Command/State/DebugCommand.php +++ b/src/Command/State/DebugCommand.php @@ -19,6 +19,7 @@ /** * Class DebugCommand + * * @package Drupal\Console\Command\State */ class DebugCommand extends Command @@ -37,6 +38,7 @@ class DebugCommand extends Command /** * DebugCommand constructor. + * * @param StateInterface $state * @param KeyValueFactoryInterface $keyValue */ diff --git a/src/Command/State/DeleteCommand.php b/src/Command/State/DeleteCommand.php index 7c7f5e9e6..402f878aa 100644 --- a/src/Command/State/DeleteCommand.php +++ b/src/Command/State/DeleteCommand.php @@ -31,6 +31,7 @@ class DeleteCommand extends Command /** * DeleteCommand constructor. + * * @param StateInterface $state * @param KeyValueFactoryInterface $keyValue */ diff --git a/src/Command/State/OverrideCommand.php b/src/Command/State/OverrideCommand.php index 6c74628c1..b7a8932bb 100644 --- a/src/Command/State/OverrideCommand.php +++ b/src/Command/State/OverrideCommand.php @@ -19,6 +19,7 @@ /** * Class DebugCommand + * * @package Drupal\Console\Command\State */ class OverrideCommand extends Command @@ -37,6 +38,7 @@ class OverrideCommand extends Command /** * OverrideCommand constructor. + * * @param StateInterface $state * @param KeyValueFactoryInterface $keyValue */ diff --git a/src/Command/Taxonomy/DeleteTermCommand.php b/src/Command/Taxonomy/DeleteTermCommand.php index f54353b3c..097535d09 100644 --- a/src/Command/Taxonomy/DeleteTermCommand.php +++ b/src/Command/Taxonomy/DeleteTermCommand.php @@ -30,6 +30,7 @@ class DeleteTermCommand extends Command /** * InfoCommand constructor. + * * @param EntityTypeManagerInterface $entityTypeManager */ public function __construct(EntityTypeManagerInterface $entityTypeManager) @@ -64,6 +65,7 @@ protected function execute(InputInterface $input, OutputInterface $output) /** * Destroy all existing terms before import + * * @param $vid * @param $io */ diff --git a/src/Command/Test/DebugCommand.php b/src/Command/Test/DebugCommand.php index f00828f9c..e87176ceb 100644 --- a/src/Command/Test/DebugCommand.php +++ b/src/Command/Test/DebugCommand.php @@ -35,6 +35,7 @@ class DebugCommand extends Command /** * DebugCommand constructor. + * * @param TestDiscovery $test_discovery */ public function __construct( diff --git a/src/Command/Test/RunCommand.php b/src/Command/Test/RunCommand.php index eec86c8a7..edeb4c273 100644 --- a/src/Command/Test/RunCommand.php +++ b/src/Command/Test/RunCommand.php @@ -56,6 +56,7 @@ class RunCommand extends Command /** * RunCommand constructor. + * * @param Site $site * @param TestDiscovery $test_discovery * @param ModuleHandlerInterface $moduleHandler @@ -271,9 +272,9 @@ protected function simpletestScriptLoadMessagesByTestIds($test_ids) foreach ($test_ids as $test_id) { $result = \Drupal::database()->query( - "SELECT * FROM {simpletest} WHERE test_id = :test_id ORDER BY test_class, message_group, status", array( + "SELECT * FROM {simpletest} WHERE test_id = :test_id ORDER BY test_class, message_group, status", [ ':test_id' => $test_id, - ) + ] )->fetchAll(); if ($result) { $results = array_merge($results, $result); diff --git a/src/Command/Theme/DebugCommand.php b/src/Command/Theme/DebugCommand.php index 2957807c3..4ed696e4d 100644 --- a/src/Command/Theme/DebugCommand.php +++ b/src/Command/Theme/DebugCommand.php @@ -32,6 +32,7 @@ class DebugCommand extends Command /** * DebugCommand constructor. + * * @param ConfigFactory $configFactory * @param ThemeHandler $themeHandler */ diff --git a/src/Command/Theme/DownloadCommand.php b/src/Command/Theme/DownloadCommand.php index 83b5ab12b..eec5beb37 100644 --- a/src/Command/Theme/DownloadCommand.php +++ b/src/Command/Theme/DownloadCommand.php @@ -42,6 +42,7 @@ class DownloadCommand extends Command /** * DownloadCommand constructor. + * * @param DrupalApi $drupalApi * @param Client $httpClient * @param $appRoot diff --git a/src/Command/Theme/InstallCommand.php b/src/Command/Theme/InstallCommand.php index e2d518f9b..078307d5d 100644 --- a/src/Command/Theme/InstallCommand.php +++ b/src/Command/Theme/InstallCommand.php @@ -40,6 +40,7 @@ class InstallCommand extends Command /** * DebugCommand constructor. + * * @param ConfigFactory $configFactory * @param ThemeHandler $themeHandler * @param ChainQueue $chainQueue diff --git a/src/Command/Theme/PathCommand.php b/src/Command/Theme/PathCommand.php index cb0a5322e..3cb2fba20 100644 --- a/src/Command/Theme/PathCommand.php +++ b/src/Command/Theme/PathCommand.php @@ -29,6 +29,7 @@ class PathCommand extends Command /** * PathCommand constructor. + * * @param Manager $extensionManager */ public function __construct(Manager $extensionManager) diff --git a/src/Command/Theme/UninstallCommand.php b/src/Command/Theme/UninstallCommand.php index a3a610ae8..7561aec24 100644 --- a/src/Command/Theme/UninstallCommand.php +++ b/src/Command/Theme/UninstallCommand.php @@ -39,6 +39,7 @@ class UninstallCommand extends Command /** * DebugCommand constructor. + * * @param ConfigFactory $configFactory * @param ThemeHandler $themeHandler * @param ChainQueue $chainQueue diff --git a/src/Command/Update/DebugCommand.php b/src/Command/Update/DebugCommand.php index 8157ff2a3..a33d136f8 100644 --- a/src/Command/Update/DebugCommand.php +++ b/src/Command/Update/DebugCommand.php @@ -31,6 +31,7 @@ class DebugCommand extends Command /** * DebugCommand constructor. + * * @param Site $site * @param UpdateRegistry $postUpdateRegistry */ diff --git a/src/Command/Update/EntitiesCommand.php b/src/Command/Update/EntitiesCommand.php index 80f7f16d6..85b5007a4 100644 --- a/src/Command/Update/EntitiesCommand.php +++ b/src/Command/Update/EntitiesCommand.php @@ -44,6 +44,7 @@ class EntitiesCommand extends Command /** * EntitiesCommand constructor. + * * @param StateInterface $state * @param EntityDefinitionUpdateManager $entityDefinitionUpdateManager * @param ChainQueue $chainQueue diff --git a/src/Command/Update/ExecuteCommand.php b/src/Command/Update/ExecuteCommand.php index cc66641c5..6f10517ab 100644 --- a/src/Command/Update/ExecuteCommand.php +++ b/src/Command/Update/ExecuteCommand.php @@ -46,7 +46,7 @@ class ExecuteCommand extends Command /** - * @var Manager + * @var Manager */ protected $extensionManager; @@ -67,6 +67,7 @@ class ExecuteCommand extends Command /** * EntitiesCommand constructor. + * * @param Site $site * @param StateInterface $state * @param ModuleHandler $moduleHandler diff --git a/src/Command/User/CreateCommand.php b/src/Command/User/CreateCommand.php index f883887d1..aece1e29a 100644 --- a/src/Command/User/CreateCommand.php +++ b/src/Command/User/CreateCommand.php @@ -48,6 +48,7 @@ class CreateCommand extends Command /** * CreateCommand constructor. + * * @param Connection $database * @param EntityTypeManagerInterface $entityTypeManager * @param DateFormatterInterface $dateFormatter diff --git a/src/Command/User/DebugCommand.php b/src/Command/User/DebugCommand.php index 05e82ee23..0294cf0f2 100644 --- a/src/Command/User/DebugCommand.php +++ b/src/Command/User/DebugCommand.php @@ -19,6 +19,7 @@ /** * Class DebugCommand + * * @package Drupal\Console\Command\User */ class DebugCommand extends Command @@ -42,6 +43,7 @@ class DebugCommand extends Command /** * DebugCommand constructor. + * * @param EntityTypeManagerInterface $entityTypeManager * @param QueryFactory $entityQuery * @param DrupalApi $drupalApi diff --git a/src/Command/User/DeleteCommand.php b/src/Command/User/DeleteCommand.php index 79d080485..3a4b88d25 100644 --- a/src/Command/User/DeleteCommand.php +++ b/src/Command/User/DeleteCommand.php @@ -19,6 +19,7 @@ /** * Class DeleteCommand + * * @package Drupal\Console\Command\User */ class DeleteCommand extends Command @@ -42,6 +43,7 @@ class DeleteCommand extends Command /** * DeleteCommand constructor. + * * @param EntityTypeManagerInterface $entityTypeManager * @param QueryFactory $entityQuery * @param DrupalApi $drupalApi diff --git a/src/Command/User/LoginCleanAttemptsCommand.php b/src/Command/User/LoginCleanAttemptsCommand.php index 831830582..94fd669f4 100644 --- a/src/Command/User/LoginCleanAttemptsCommand.php +++ b/src/Command/User/LoginCleanAttemptsCommand.php @@ -29,6 +29,7 @@ class LoginCleanAttemptsCommand extends Command /** * LoginCleanAttemptsCommand constructor. + * * @param Connection $database */ public function __construct(Connection $database) diff --git a/src/Command/User/LoginUrlCommand.php b/src/Command/User/LoginUrlCommand.php index ddf904674..0b7db7716 100644 --- a/src/Command/User/LoginUrlCommand.php +++ b/src/Command/User/LoginUrlCommand.php @@ -31,6 +31,7 @@ class LoginUrlCommand extends Command /** * LoginUrlCommand constructor. + * * @param EntityTypeManagerInterface $entityTypeManager */ public function __construct(EntityTypeManagerInterface $entityTypeManager) diff --git a/src/Command/User/PasswordHashCommand.php b/src/Command/User/PasswordHashCommand.php index 817280899..208fe98ae 100644 --- a/src/Command/User/PasswordHashCommand.php +++ b/src/Command/User/PasswordHashCommand.php @@ -28,6 +28,7 @@ class PasswordHashCommand extends Command /** * PasswordHashCommand constructor. + * * @param PasswordInterface $password */ public function __construct(PasswordInterface $password) diff --git a/src/Command/User/PasswordResetCommand.php b/src/Command/User/PasswordResetCommand.php index fddfc5762..9f413992b 100644 --- a/src/Command/User/PasswordResetCommand.php +++ b/src/Command/User/PasswordResetCommand.php @@ -34,6 +34,7 @@ class PasswordResetCommand extends Command /** * PasswordHashCommand constructor. + * * @param Connection $database * @param ChainQueue $chainQueue */ @@ -173,7 +174,6 @@ function ($pass) use ($io) { return false; } } - } ); diff --git a/src/Command/User/RoleCommand.php b/src/Command/User/RoleCommand.php index c9730b887..d0cc19733 100644 --- a/src/Command/User/RoleCommand.php +++ b/src/Command/User/RoleCommand.php @@ -17,6 +17,7 @@ /** * Class DebugCommand + * * @package Drupal\Console\Command\User */ class RoleCommand extends Command @@ -30,6 +31,7 @@ class RoleCommand extends Command /** * RoleCommand constructor. + * * @param DrupalApi $drupalApi */ public function __construct(DrupalApi $drupalApi) diff --git a/src/Command/Views/DebugCommand.php b/src/Command/Views/DebugCommand.php index a263b7ae4..087621a22 100644 --- a/src/Command/Views/DebugCommand.php +++ b/src/Command/Views/DebugCommand.php @@ -19,6 +19,7 @@ /** * Class DebugCommand + * * @package Drupal\Console\Command\Views */ class DebugCommand extends Command @@ -32,6 +33,7 @@ class DebugCommand extends Command /** * DebugCommand constructor. + * * @param EntityTypeManagerInterface $entityTypeManager */ public function __construct(EntityTypeManagerInterface $entityTypeManager) @@ -107,7 +109,7 @@ private function viewDetail(DrupalStyle $io, $view_id) return false; } - $configuration = array(); + $configuration = []; $configuration [] = [$this->trans('commands.views.debug.messages.view-id'), $view->get('id')]; $configuration [] = [$this->trans('commands.views.debug.messages.view-name'), (string) $view->get('label')]; $configuration [] = [$this->trans('commands.views.debug.messages.tag'), $view->get('tag')]; @@ -186,7 +188,7 @@ protected function viewList(DrupalStyle $io, $tag, $status) */ protected function viewDisplayPaths(View $view, $display_id = null) { - $all_paths = array(); + $all_paths = []; $executable = $view->getExecutable(); $executable->initDisplay(); foreach ($executable->displayHandlers as $display) { @@ -216,7 +218,7 @@ protected function viewDisplayPaths(View $view, $display_id = null) protected function viewDisplayList(View $view) { $displayManager = $this->getViewDisplayManager(); - $displays = array(); + $displays = []; foreach ($view->get('display') as $display) { $definition = $displayManager->getDefinition($display['display_plugin']); if (!empty($definition['admin'])) { diff --git a/src/Command/Views/DisableCommand.php b/src/Command/Views/DisableCommand.php index d08f577c5..c127f649c 100644 --- a/src/Command/Views/DisableCommand.php +++ b/src/Command/Views/DisableCommand.php @@ -18,6 +18,7 @@ /** * Class DisableCommand + * * @package Drupal\Console\Command\Views */ class DisableCommand extends Command @@ -36,6 +37,7 @@ class DisableCommand extends Command /** * DisableCommand constructor. + * * @param EntityTypeManagerInterface $entityTypeManager * @param QueryFactory $entityQuery */ diff --git a/src/Command/Views/EnableCommand.php b/src/Command/Views/EnableCommand.php index c110ca25b..3fe9ed651 100644 --- a/src/Command/Views/EnableCommand.php +++ b/src/Command/Views/EnableCommand.php @@ -19,6 +19,7 @@ /** * Class EnableCommand + * * @package Drupal\Console\Command\Views */ class EnableCommand extends Command @@ -37,6 +38,7 @@ class EnableCommand extends Command /** * EnableCommand constructor. + * * @param EntityTypeManagerInterface $entityTypeManager * @param QueryFactory $entityQuery */ diff --git a/src/Command/Views/PluginsDebugCommand.php b/src/Command/Views/PluginsDebugCommand.php index 49fd0c869..8e24ef24c 100644 --- a/src/Command/Views/PluginsDebugCommand.php +++ b/src/Command/Views/PluginsDebugCommand.php @@ -17,6 +17,7 @@ /** * Class PluginsDebugCommand + * * @package Drupal\Console\Command\Views */ class PluginsDebugCommand extends Command diff --git a/src/Extension/Discovery.php b/src/Extension/Discovery.php index 87e440b21..cc66a80c5 100644 --- a/src/Extension/Discovery.php +++ b/src/Extension/Discovery.php @@ -20,6 +20,6 @@ class Discovery extends ExtensionDiscovery */ public static function reset() { - static::$files = array(); + static::$files = []; } } diff --git a/src/Extension/Extension.php b/src/Extension/Extension.php index 484f83dc4..6f6c71f11 100644 --- a/src/Extension/Extension.php +++ b/src/Extension/Extension.php @@ -6,6 +6,7 @@ /** * Class Extension + * * @package Drupal\Console\Extension */ class Extension extends BaseExtension diff --git a/src/Extension/Manager.php b/src/Extension/Manager.php index e9113d291..fd388f98b 100644 --- a/src/Extension/Manager.php +++ b/src/Extension/Manager.php @@ -6,6 +6,7 @@ /** * Class ExtensionManager + * * @package Drupal\Console */ class Manager @@ -36,6 +37,7 @@ class Manager /** * ExtensionManager constructor. + * * @param Site $site * @param string $appRoot */ diff --git a/src/Generator/AuthenticationProviderGenerator.php b/src/Generator/AuthenticationProviderGenerator.php index 890e92675..4fd53df28 100644 --- a/src/Generator/AuthenticationProviderGenerator.php +++ b/src/Generator/AuthenticationProviderGenerator.php @@ -13,12 +13,13 @@ class AuthenticationProviderGenerator extends Generator { /** - * @var Manager + * @var Manager */ protected $extensionManager; /** * AuthenticationProviderGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/BreakPointGenerator.php b/src/Generator/BreakPointGenerator.php index f1bc4f1eb..7e91e0e35 100644 --- a/src/Generator/BreakPointGenerator.php +++ b/src/Generator/BreakPointGenerator.php @@ -12,17 +12,19 @@ /** * Class BreakPointGenerator + * * @package Drupal\Console\Generator */ -class BreakPointGenerator extends Generator +class BreakPointGenerator extends Generator { /** - * @var Manager + * @var Manager */ protected $extensionManager; /** * BreakPointGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/CommandGenerator.php b/src/Generator/CommandGenerator.php index bbd3de4a1..018e857de 100644 --- a/src/Generator/CommandGenerator.php +++ b/src/Generator/CommandGenerator.php @@ -13,6 +13,7 @@ /** * Class CommandGenerator + * * @package Drupal\Console\Generator */ class CommandGenerator extends Generator @@ -29,6 +30,7 @@ class CommandGenerator extends Generator /** * CommandGenerator constructor. + * * @param Manager $extensionManager * @param TranslatorManager $translatorManager */ diff --git a/src/Generator/ControllerGenerator.php b/src/Generator/ControllerGenerator.php index 430f559b8..bb95974d8 100644 --- a/src/Generator/ControllerGenerator.php +++ b/src/Generator/ControllerGenerator.php @@ -13,12 +13,13 @@ class ControllerGenerator extends Generator { /** - * @var Manager + * @var Manager */ protected $extensionManager; /** * AuthenticationProviderGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/DatabaseSettingsGenerator.php b/src/Generator/DatabaseSettingsGenerator.php index 38f3a8329..9cda1031f 100644 --- a/src/Generator/DatabaseSettingsGenerator.php +++ b/src/Generator/DatabaseSettingsGenerator.php @@ -19,6 +19,7 @@ class DatabaseSettingsGenerator extends Generator /** * DatabaseSettingsGenerator constructor. + * * @param DrupalKernelInterface $kernel */ public function __construct( diff --git a/src/Generator/EntityBundleGenerator.php b/src/Generator/EntityBundleGenerator.php index 24d6230e9..18e6ac6c5 100644 --- a/src/Generator/EntityBundleGenerator.php +++ b/src/Generator/EntityBundleGenerator.php @@ -13,12 +13,13 @@ class EntityBundleGenerator extends Generator { /** - * @var Manager + * @var Manager */ protected $extensionManager; /** * PermissionGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/EntityConfigGenerator.php b/src/Generator/EntityConfigGenerator.php index 5291d1e03..3a4f752b2 100644 --- a/src/Generator/EntityConfigGenerator.php +++ b/src/Generator/EntityConfigGenerator.php @@ -13,12 +13,13 @@ class EntityConfigGenerator extends Generator { /** - * @var Manager + * @var Manager */ protected $extensionManager; /** * EntityConfigGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/EntityContentGenerator.php b/src/Generator/EntityContentGenerator.php index 67978e78d..3c9f98cce 100644 --- a/src/Generator/EntityContentGenerator.php +++ b/src/Generator/EntityContentGenerator.php @@ -15,7 +15,7 @@ class EntityContentGenerator extends Generator { /** - * @var Manager + * @var Manager */ protected $extensionManager; @@ -33,6 +33,7 @@ class EntityContentGenerator extends Generator /** * EntityContentGenerator constructor. + * * @param Manager $extensionManager * @param Site $site * @param TwigRenderer $twigrenderer diff --git a/src/Generator/EventSubscriberGenerator.php b/src/Generator/EventSubscriberGenerator.php index afe88f8db..f53178be2 100644 --- a/src/Generator/EventSubscriberGenerator.php +++ b/src/Generator/EventSubscriberGenerator.php @@ -13,12 +13,13 @@ class EventSubscriberGenerator extends Generator { /** - * @var Manager + * @var Manager */ protected $extensionManager; /** * AuthenticationProviderGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( @@ -45,7 +46,7 @@ public function generate($module, $name, $class, $events, $services) 'class_path' => sprintf('Drupal\%s\EventSubscriber\%s', $module, $class), 'events' => $events, 'services' => $services, - 'tags' => array('name' => 'event_subscriber'), + 'tags' => ['name' => 'event_subscriber'], 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'), ]; diff --git a/src/Generator/FormAlterGenerator.php b/src/Generator/FormAlterGenerator.php index 137fdd9bb..19fba6d82 100644 --- a/src/Generator/FormAlterGenerator.php +++ b/src/Generator/FormAlterGenerator.php @@ -13,12 +13,13 @@ class FormAlterGenerator extends Generator { /** - * @var Manager + * @var Manager */ protected $extensionManager; /** * AuthenticationProviderGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/FormGenerator.php b/src/Generator/FormGenerator.php index 49b787f87..a05cd1ae9 100644 --- a/src/Generator/FormGenerator.php +++ b/src/Generator/FormGenerator.php @@ -14,7 +14,7 @@ class FormGenerator extends Generator { /** - * @var Manager + * @var Manager */ protected $extensionManager; @@ -25,6 +25,7 @@ class FormGenerator extends Generator /** * AuthenticationProviderGenerator constructor. + * * @param Manager $extensionManager * @param StringConverter $stringConverter */ @@ -55,7 +56,7 @@ public function generate($module, $class_name, $form_id, $form_type, $services, $this->stringConverter->removeSuffix($class_name) ); - $parameters = array( + $parameters = [ 'class_name' => $class_name, 'services' => $services, 'inputs' => $inputs, @@ -67,7 +68,7 @@ public function generate($module, $class_name, $form_id, $form_type, $services, 'menu_parent' => $menu_parent, 'menu_link_desc' => $menu_link_desc, 'class_name_short' => $class_name_short - ); + ]; if ($form_type == 'ConfigFormBase') { $template = 'module/src/Form/form-config.php.twig'; diff --git a/src/Generator/HelpGenerator.php b/src/Generator/HelpGenerator.php index 4af44f836..7c08f6f6b 100644 --- a/src/Generator/HelpGenerator.php +++ b/src/Generator/HelpGenerator.php @@ -13,12 +13,13 @@ class HelpGenerator extends Generator { /** - * @var Manager + * @var Manager */ protected $extensionManager; /** * HelpGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/ModuleFileGenerator.php b/src/Generator/ModuleFileGenerator.php index b52e01a6f..8f8e84e47 100644 --- a/src/Generator/ModuleFileGenerator.php +++ b/src/Generator/ModuleFileGenerator.php @@ -11,6 +11,7 @@ /** * Class ModuleFileGenerator + * * @package Drupal\Console\Generator */ class ModuleFileGenerator extends Generator @@ -36,10 +37,10 @@ public function generate( } } - $parameters = array( + $parameters = [ 'machine_name' => $machine_name, 'file_path' => $file_path , - ); + ]; if ($machine_name) { $this->renderFile( diff --git a/src/Generator/ModuleGenerator.php b/src/Generator/ModuleGenerator.php index f9429cd5d..744b72cea 100644 --- a/src/Generator/ModuleGenerator.php +++ b/src/Generator/ModuleGenerator.php @@ -11,6 +11,7 @@ /** * Class ModuleGenerator + * * @package Drupal\Console\Generator */ class ModuleGenerator extends Generator @@ -54,7 +55,7 @@ public function generate( ); } $files = scandir($dir); - if ($files != array('.', '..')) { + if ($files != ['.', '..']) { throw new \RuntimeException( sprintf( 'Unable to generate the module as the target directory "%s" is not empty.', @@ -72,7 +73,7 @@ public function generate( } } - $parameters = array( + $parameters = [ 'module' => $module, 'machine_name' => $machineName, 'type' => 'module', @@ -82,7 +83,7 @@ public function generate( 'dependencies' => $dependencies, 'test' => $test, 'twigtemplate' => $twigtemplate, - ); + ]; $this->renderFile( 'module/info.yml.twig', @@ -94,9 +95,9 @@ public function generate( $this->renderFile( 'module/features.yml.twig', $dir.'/'.$machineName.'.features.yml', - array( + [ 'bundle' => $featuresBundle, - ) + ] ); } @@ -141,7 +142,7 @@ public function generate( ); } $files = scandir($dir); - if ($files != array('.', '..')) { + if ($files != ['.', '..']) { throw new \RuntimeException( sprintf( 'Unable to generate the templates directory as the target directory "%s" is not empty.', diff --git a/src/Generator/PermissionGenerator.php b/src/Generator/PermissionGenerator.php index b791558a6..643b1f4ba 100644 --- a/src/Generator/PermissionGenerator.php +++ b/src/Generator/PermissionGenerator.php @@ -19,6 +19,7 @@ class PermissionGenerator extends Generator /** * PermissionGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( @@ -34,10 +35,10 @@ public function __construct( */ public function generate($module, $permissions, $learning) { - $parameters = array( + $parameters = [ 'module_name' => $module, 'permissions' => $permissions, - ); + ]; $this->renderFile( 'module/permission.yml.twig', diff --git a/src/Generator/PluginBlockGenerator.php b/src/Generator/PluginBlockGenerator.php index 377652d9b..3755ae193 100644 --- a/src/Generator/PluginBlockGenerator.php +++ b/src/Generator/PluginBlockGenerator.php @@ -19,6 +19,7 @@ class PluginBlockGenerator extends Generator /** * PermissionGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/PluginCKEditorButtonGenerator.php b/src/Generator/PluginCKEditorButtonGenerator.php index 35a80f078..bcbef106b 100644 --- a/src/Generator/PluginCKEditorButtonGenerator.php +++ b/src/Generator/PluginCKEditorButtonGenerator.php @@ -13,12 +13,13 @@ class PluginCKEditorButtonGenerator extends Generator { /** - * @var Manager + * @var Manager */ protected $extensionManager; /** * PermissionGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/PluginConditionGenerator.php b/src/Generator/PluginConditionGenerator.php index 511876c26..3b6fa9ad8 100644 --- a/src/Generator/PluginConditionGenerator.php +++ b/src/Generator/PluginConditionGenerator.php @@ -12,17 +12,19 @@ /** * Class PluginConditionGenerator + * * @package Drupal\Console\Generator */ class PluginConditionGenerator extends Generator { /** - * @var Manager + * @var Manager */ protected $extensionManager; /** * PluginConditionGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/PluginFieldFormatterGenerator.php b/src/Generator/PluginFieldFormatterGenerator.php index ab409b720..b97fee7e3 100644 --- a/src/Generator/PluginFieldFormatterGenerator.php +++ b/src/Generator/PluginFieldFormatterGenerator.php @@ -14,6 +14,7 @@ class PluginFieldFormatterGenerator extends Generator { /** * PluginFieldFormatterGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/PluginFieldTypeGenerator.php b/src/Generator/PluginFieldTypeGenerator.php index ee4d6107c..75f832a9d 100644 --- a/src/Generator/PluginFieldTypeGenerator.php +++ b/src/Generator/PluginFieldTypeGenerator.php @@ -14,6 +14,7 @@ class PluginFieldTypeGenerator extends Generator { /** * PluginFieldTypeGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/PluginFieldWidgetGenerator.php b/src/Generator/PluginFieldWidgetGenerator.php index fe4a561a4..3e252e296 100644 --- a/src/Generator/PluginFieldWidgetGenerator.php +++ b/src/Generator/PluginFieldWidgetGenerator.php @@ -14,6 +14,7 @@ class PluginFieldWidgetGenerator extends Generator { /** * PluginFieldWidgetGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/PluginImageEffectGenerator.php b/src/Generator/PluginImageEffectGenerator.php index 6fe35d584..fa56ef27b 100644 --- a/src/Generator/PluginImageEffectGenerator.php +++ b/src/Generator/PluginImageEffectGenerator.php @@ -14,6 +14,7 @@ class PluginImageEffectGenerator extends Generator { /** * PluginImageEffectGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/PluginImageFormatterGenerator.php b/src/Generator/PluginImageFormatterGenerator.php index 7a6639091..e71e739eb 100644 --- a/src/Generator/PluginImageFormatterGenerator.php +++ b/src/Generator/PluginImageFormatterGenerator.php @@ -14,6 +14,7 @@ class PluginImageFormatterGenerator extends Generator { /** * PluginImageFormatterGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/PluginMailGenerator.php b/src/Generator/PluginMailGenerator.php index 940afb0b5..0c053b5d8 100644 --- a/src/Generator/PluginMailGenerator.php +++ b/src/Generator/PluginMailGenerator.php @@ -14,6 +14,7 @@ class PluginMailGenerator extends Generator { /** * PluginMailGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/PluginMigrateSourceGenerator.php b/src/Generator/PluginMigrateSourceGenerator.php index c1b8cd914..123fab82c 100644 --- a/src/Generator/PluginMigrateSourceGenerator.php +++ b/src/Generator/PluginMigrateSourceGenerator.php @@ -19,6 +19,7 @@ class PluginMigrateSourceGenerator extends Generator /** * PluginMigrateSourceGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/PluginRestResourceGenerator.php b/src/Generator/PluginRestResourceGenerator.php index 7d5cc2e0f..05518ce81 100644 --- a/src/Generator/PluginRestResourceGenerator.php +++ b/src/Generator/PluginRestResourceGenerator.php @@ -19,6 +19,7 @@ class PluginRestResourceGenerator extends Generator /** * PluginRestResourceGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/PluginRulesActionGenerator.php b/src/Generator/PluginRulesActionGenerator.php index 6a0c3429f..a60ee380c 100644 --- a/src/Generator/PluginRulesActionGenerator.php +++ b/src/Generator/PluginRulesActionGenerator.php @@ -19,6 +19,7 @@ class PluginRulesActionGenerator extends Generator /** * PluginRulesActionGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/PluginSkeletonGenerator.php b/src/Generator/PluginSkeletonGenerator.php index b358e0056..1e80864f4 100644 --- a/src/Generator/PluginSkeletonGenerator.php +++ b/src/Generator/PluginSkeletonGenerator.php @@ -19,6 +19,7 @@ class PluginSkeletonGenerator extends Generator /** * PluginSkeletonGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/PluginTypeAnnotationGenerator.php b/src/Generator/PluginTypeAnnotationGenerator.php index 5ccc7ee99..2a5181f17 100644 --- a/src/Generator/PluginTypeAnnotationGenerator.php +++ b/src/Generator/PluginTypeAnnotationGenerator.php @@ -19,6 +19,7 @@ class PluginTypeAnnotationGenerator extends Generator /** * PluginTypeAnnotationGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/PluginTypeYamlGenerator.php b/src/Generator/PluginTypeYamlGenerator.php index 1337fc3cf..8dd2807fb 100644 --- a/src/Generator/PluginTypeYamlGenerator.php +++ b/src/Generator/PluginTypeYamlGenerator.php @@ -19,6 +19,7 @@ class PluginTypeYamlGenerator extends Generator /** * PluginTypeYamlGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/PluginViewsFieldGenerator.php b/src/Generator/PluginViewsFieldGenerator.php index 89461be54..3d0d03681 100644 --- a/src/Generator/PluginViewsFieldGenerator.php +++ b/src/Generator/PluginViewsFieldGenerator.php @@ -13,12 +13,13 @@ class PluginViewsFieldGenerator extends Generator { /** - * @var Manager + * @var Manager */ protected $extensionManager; /** * PluginViewsFieldGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/PostUpdateGenerator.php b/src/Generator/PostUpdateGenerator.php index 87c0a2a69..36ea89a8f 100644 --- a/src/Generator/PostUpdateGenerator.php +++ b/src/Generator/PostUpdateGenerator.php @@ -13,12 +13,13 @@ class PostUpdateGenerator extends Generator { /** - * @var Manager + * @var Manager */ protected $extensionManager; /** * PostUpdateGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/ProfileGenerator.php b/src/Generator/ProfileGenerator.php index cfbc8a0f6..e3431b220 100644 --- a/src/Generator/ProfileGenerator.php +++ b/src/Generator/ProfileGenerator.php @@ -32,7 +32,7 @@ public function generate( ); } $files = scandir($dir); - if ($files != array('.', '..')) { + if ($files != ['.', '..']) { throw new \RuntimeException( sprintf( 'Unable to generate the profile as the target directory "%s" is not empty.', @@ -50,7 +50,7 @@ public function generate( } } - $parameters = array( + $parameters = [ 'profile' => $profile, 'machine_name' => $machine_name, 'type' => 'profile', @@ -58,7 +58,7 @@ public function generate( 'description' => $description, 'dependencies' => $dependencies, 'distribution' => $distribution, - ); + ]; $this->renderFile( 'profile/info.yml.twig', diff --git a/src/Generator/RouteSubscriberGenerator.php b/src/Generator/RouteSubscriberGenerator.php index c1fd08bb1..388991f37 100644 --- a/src/Generator/RouteSubscriberGenerator.php +++ b/src/Generator/RouteSubscriberGenerator.php @@ -13,12 +13,13 @@ class RouteSubscriberGenerator extends Generator { /** - * @var Manager + * @var Manager */ protected $extensionManager; /** * AuthenticationProviderGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( @@ -41,7 +42,7 @@ public function generate($module, $name, $class) 'name' => $name, 'class' => $class, 'class_path' => sprintf('Drupal\%s\Routing\%s', $module, $class), - 'tags' => array('name' => 'event_subscriber'), + 'tags' => ['name' => 'event_subscriber'], 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'), ]; diff --git a/src/Generator/ServiceGenerator.php b/src/Generator/ServiceGenerator.php index b43579a80..855839f80 100644 --- a/src/Generator/ServiceGenerator.php +++ b/src/Generator/ServiceGenerator.php @@ -13,12 +13,13 @@ class ServiceGenerator extends Generator { /** - * @var Manager + * @var Manager */ protected $extensionManager; /** * AuthenticationProviderGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/ThemeGenerator.php b/src/Generator/ThemeGenerator.php index 09a89cea3..e9f15173c 100644 --- a/src/Generator/ThemeGenerator.php +++ b/src/Generator/ThemeGenerator.php @@ -16,12 +16,13 @@ class ThemeGenerator extends Generator { /** - * @var Manager + * @var Manager */ protected $extensionManager; /** * AuthenticationProviderGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( @@ -53,7 +54,7 @@ public function generate( ); } $files = scandir($dir); - if ($files != array('.', '..')) { + if ($files != ['.', '..']) { throw new \RuntimeException( sprintf( 'Unable to generate the bundle as the target directory "%s" is not empty.', @@ -71,7 +72,7 @@ public function generate( } } - $parameters = array( + $parameters = [ 'theme' => $theme, 'machine_name' => $machine_name, 'type' => 'theme', @@ -82,7 +83,7 @@ public function generate( 'global_library' => $global_library, 'regions' => $regions, 'breakpoints' => $breakpoints, - ); + ]; $this->renderFile( 'theme/info.yml.twig', diff --git a/src/Generator/TwigExtensionGenerator.php b/src/Generator/TwigExtensionGenerator.php index 6efbe0f7f..91c522023 100644 --- a/src/Generator/TwigExtensionGenerator.php +++ b/src/Generator/TwigExtensionGenerator.php @@ -12,17 +12,19 @@ /** * Class TwigExtensionGenerator + * * @package Drupal\Console\Generator */ class TwigExtensionGenerator extends Generator { /** - * @var Manager + * @var Manager */ protected $extensionManager; /** * AuthenticationProviderGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Generator/UpdateGenerator.php b/src/Generator/UpdateGenerator.php index dd8b59096..933cab922 100644 --- a/src/Generator/UpdateGenerator.php +++ b/src/Generator/UpdateGenerator.php @@ -13,12 +13,13 @@ class UpdateGenerator extends Generator { /** - * @var Manager + * @var Manager */ protected $extensionManager; /** * AuthenticationProviderGenerator constructor. + * * @param Manager $extensionManager */ public function __construct( diff --git a/src/Utils/AnnotationValidator.php b/src/Utils/AnnotationValidator.php index 43afe07bb..9f9689cfb 100644 --- a/src/Utils/AnnotationValidator.php +++ b/src/Utils/AnnotationValidator.php @@ -7,6 +7,7 @@ /** * Class AnnotationValidator + * * @package Drupal\Console\Utils */ class AnnotationValidator @@ -26,6 +27,7 @@ class AnnotationValidator /** * AnnotationValidator constructor. + * * @param DrupalCommandAnnotationReader $annotationCommandReader * @param Manager $extensionManager */ diff --git a/src/Utils/Create/Base.php b/src/Utils/Create/Base.php index c73e74529..660c778c7 100644 --- a/src/Utils/Create/Base.php +++ b/src/Utils/Create/Base.php @@ -16,6 +16,7 @@ /** * Class ContentNode + * * @package Drupal\Console\Utils */ abstract class Base @@ -37,6 +38,7 @@ abstract class Base /** * ContentNode constructor. + * * @param EntityTypeManagerInterface $entityTypeManager * @param EntityFieldManagerInterface $entityFieldManager * @param DateFormatterInterface $dateFormatter diff --git a/src/Utils/Create/CommentData.php b/src/Utils/Create/CommentData.php index bca5b7072..1a6b9cca8 100644 --- a/src/Utils/Create/CommentData.php +++ b/src/Utils/Create/CommentData.php @@ -13,6 +13,7 @@ /** * Class Nodes + * * @package Drupal\Console\Utils\Create */ class CommentData extends Base diff --git a/src/Utils/Create/NodeData.php b/src/Utils/Create/NodeData.php index 27ba3fe04..0bd8eda92 100644 --- a/src/Utils/Create/NodeData.php +++ b/src/Utils/Create/NodeData.php @@ -14,6 +14,7 @@ /** * Class Nodes + * * @package Drupal\Console\Utils */ class NodeData extends Base diff --git a/src/Utils/Create/TermData.php b/src/Utils/Create/TermData.php index 57ca1176d..3521bc728 100644 --- a/src/Utils/Create/TermData.php +++ b/src/Utils/Create/TermData.php @@ -14,6 +14,7 @@ /** * Class Terms + * * @package Drupal\Console\Utils */ class TermData extends Base @@ -64,10 +65,10 @@ public function create( [ 'vid' => $vocabulary, 'name' => $this->getRandom()->sentences(mt_rand(1, $nameWords), true), - 'description' => array( + 'description' => [ 'value' => $this->getRandom()->sentences(), 'format' => 'full_html', - ), + ], 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, ] ); diff --git a/src/Utils/Create/UserData.php b/src/Utils/Create/UserData.php index 5e1671de5..e60907b31 100644 --- a/src/Utils/Create/UserData.php +++ b/src/Utils/Create/UserData.php @@ -13,6 +13,7 @@ /** * Class Users + * * @package Drupal\Console\Utils\Create */ class UserData extends Base diff --git a/src/Utils/Create/VocabularyData.php b/src/Utils/Create/VocabularyData.php index 337d06b0f..9b0cca4af 100644 --- a/src/Utils/Create/VocabularyData.php +++ b/src/Utils/Create/VocabularyData.php @@ -15,6 +15,7 @@ /** * Class Vocabularies + * * @package Drupal\Console\Utils */ class VocabularyData extends Base diff --git a/src/Utils/DrupalApi.php b/src/Utils/DrupalApi.php index 06d580fef..9295db86a 100644 --- a/src/Utils/DrupalApi.php +++ b/src/Utils/DrupalApi.php @@ -13,6 +13,7 @@ /** * Class DrupalHelper + * * @package Drupal\Console\Utils */ class DrupalApi @@ -27,6 +28,7 @@ class DrupalApi /** * DebugCommand constructor. + * * @param Client $httpClient */ @@ -34,6 +36,7 @@ class DrupalApi /** * ServerCommand constructor. + * * @param $appRoot * @param $entityTypeManager */ @@ -224,7 +227,7 @@ public function downloadProjectRelease($project, $release, $destination = null) public function downloadFile($url, $destination) { - $this->httpClient->get($url, array('sink' => $destination)); + $this->httpClient->get($url, ['sink' => $destination]); return file_exists($destination); } diff --git a/src/Utils/MigrateExecuteMessageCapture.php b/src/Utils/MigrateExecuteMessageCapture.php index 20dccc7e6..bc0565e30 100644 --- a/src/Utils/MigrateExecuteMessageCapture.php +++ b/src/Utils/MigrateExecuteMessageCapture.php @@ -19,7 +19,7 @@ class MigrateExecuteMessageCapture implements MigrateMessageInterface * * @var array */ - protected $messages = array(); + protected $messages = []; /** * {@inheritdoc} @@ -34,7 +34,7 @@ public function display($message, $type = 'status') */ public function clear() { - $this->messages = array(); + $this->messages = []; } /** diff --git a/src/Utils/Site.php b/src/Utils/Site.php index aafe8cbfa..18abd5e9c 100644 --- a/src/Utils/Site.php +++ b/src/Utils/Site.php @@ -16,6 +16,7 @@ class Site /** * Site constructor. + * * @param $appRoot */ public function __construct($appRoot) @@ -103,7 +104,7 @@ protected function setMinimalContainerPreKernel() // Register the stream wrapper manager. $container ->register('stream_wrapper_manager', 'Drupal\Core\StreamWrapper\StreamWrapperManager') - ->addMethodCall('setContainer', array(new Reference('service_container'))); + ->addMethodCall('setContainer', [new Reference('service_container')]); $container ->register('file_system', 'Drupal\Core\File\FileSystem') ->addArgument(new Reference('stream_wrapper_manager')) diff --git a/src/Utils/Validator.php b/src/Utils/Validator.php index dbf4468fb..12b522786 100644 --- a/src/Utils/Validator.php +++ b/src/Utils/Validator.php @@ -21,6 +21,7 @@ class Validator /** * Site constructor. + * * @param Manager $extensionManager */ public function __construct(Manager $extensionManager) @@ -115,13 +116,13 @@ public function validateModulePath($module_path, $create = false) public function validateModuleDependencies($dependencies) { - $dependencies_checked = array( - 'success' => array(), - 'fail' => array(), - ); + $dependencies_checked = [ + 'success' => [], + 'fail' => [], + ]; if (empty($dependencies)) { - return array(); + return []; } $dependencies = explode(',', $this->removeSpaces($dependencies)); diff --git a/src/Zippy/Adapter/TarGzGNUTarForWindowsAdapter.php b/src/Zippy/Adapter/TarGzGNUTarForWindowsAdapter.php index 89b7a7c1f..143c8b94a 100644 --- a/src/Zippy/Adapter/TarGzGNUTarForWindowsAdapter.php +++ b/src/Zippy/Adapter/TarGzGNUTarForWindowsAdapter.php @@ -13,6 +13,7 @@ /** * Class TarGzGNUTarForWindowsAdapter + * * @package Drupal\Console\Zippy\Adapter */ class TarGzGNUTarForWindowsAdapter extends TarGzGNUTarAdapter @@ -30,6 +31,6 @@ protected function doAdd(ResourceInterface $resource, $files, $recursive) */ protected function getLocalOptions() { - return array_merge(parent::getLocalOptions(), array('--force-local')); + return array_merge(parent::getLocalOptions(), ['--force-local']); } } diff --git a/src/Zippy/FileStrategy/TarGzFileForWindowsStrategy.php b/src/Zippy/FileStrategy/TarGzFileForWindowsStrategy.php index 6c83aecca..c0f672ce4 100644 --- a/src/Zippy/FileStrategy/TarGzFileForWindowsStrategy.php +++ b/src/Zippy/FileStrategy/TarGzFileForWindowsStrategy.php @@ -11,6 +11,7 @@ /** * Class TarGzFileForWindowsStrategy + * * @package Drupal\Console\Zippy/Strategy */ class TarGzFileForWindowsStrategy extends AbstractFileStrategy @@ -20,9 +21,9 @@ class TarGzFileForWindowsStrategy extends AbstractFileStrategy */ protected function getServiceNames() { - return array( + return [ 'Drupal\\Console\\Zippy\\Adapter\\TarGzGNUTarForWindowsAdapter' - ); + ]; } /** From 55f964efda5579c1723bff78df9777903ab76786 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 2 Jan 2017 00:02:45 -0800 Subject: [PATCH 111/321] [shell] Relocate command. (#3061) --- bin/php-parse | 1 + bin/psysh | 1 + composer.lock | 346 ++++++++++++++++++++++-- config/services/drupal-console/misc.yml | 4 + src/Command/ShellCommand.php | 40 +++ 5 files changed, 374 insertions(+), 18 deletions(-) create mode 120000 bin/php-parse create mode 120000 bin/psysh create mode 100644 src/Command/ShellCommand.php diff --git a/bin/php-parse b/bin/php-parse new file mode 120000 index 000000000..726f6347e --- /dev/null +++ b/bin/php-parse @@ -0,0 +1 @@ +../vendor/nikic/php-parser/bin/php-parse \ No newline at end of file diff --git a/bin/psysh b/bin/psysh new file mode 120000 index 000000000..b732dc399 --- /dev/null +++ b/bin/psysh @@ -0,0 +1 @@ +../vendor/psy/psysh/bin/psysh \ No newline at end of file diff --git a/composer.lock b/composer.lock index b70a1c57c..a82cc9105 100644 --- a/composer.lock +++ b/composer.lock @@ -4,43 +4,45 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "4fa5e5170d08130d0acc773f3c1a8e44", + "content-hash": "032048728f547cac5ee908eb60dfc4b3", "packages": [ { "name": "alchemy/zippy", - "version": "0.3.5", + "version": "0.4.3", "source": { "type": "git", "url": "https://github.com/alchemy-fr/Zippy.git", - "reference": "92c773f7bbe47fdb30c61dbaea3dcbf4dd13a40a" + "reference": "5ffdc93de0af2770d396bf433d8b2667c77277ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/alchemy-fr/Zippy/zipball/92c773f7bbe47fdb30c61dbaea3dcbf4dd13a40a", - "reference": "92c773f7bbe47fdb30c61dbaea3dcbf4dd13a40a", + "url": "https://api.github.com/repos/alchemy-fr/Zippy/zipball/5ffdc93de0af2770d396bf433d8b2667c77277ea", + "reference": "5ffdc93de0af2770d396bf433d8b2667c77277ea", "shasum": "" }, "require": { "doctrine/collections": "~1.0", "ext-mbstring": "*", - "php": ">=5.3.3", + "php": ">=5.5", "symfony/filesystem": "^2.0.5|^3.0", "symfony/process": "^2.1|^3.0" }, "require-dev": { "ext-zip": "*", "guzzle/guzzle": "~3.0", + "guzzlehttp/guzzle": "^6.0", "phpunit/phpunit": "^4.0|^5.0", "symfony/finder": "^2.0.5|^3.0" }, "suggest": { "ext-zip": "To use the ZipExtensionAdapter", - "guzzle/guzzle": "To use the GuzzleTeleporter" + "guzzle/guzzle": "To use the GuzzleTeleporter with Guzzle 3", + "guzzlehttp/guzzle": "To use the GuzzleTeleporter with Guzzle 6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "0.2.x-dev" + "dev-master": "0.4.x-dev" } }, "autoload": { @@ -66,7 +68,7 @@ "tar", "zip" ], - "time": "2016-02-15T22:46:40+00:00" + "time": "2016-11-03T16:10:31+00:00" }, { "name": "composer/installers", @@ -341,6 +343,39 @@ ], "time": "2012-10-28T21:08:28+00:00" }, + { + "name": "dnoegel/php-xdg-base-dir", + "version": "0.1", + "source": { + "type": "git", + "url": "https://github.com/dnoegel/php-xdg-base-dir.git", + "reference": "265b8593498b997dc2d31e75b89f053b5cc9621a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dnoegel/php-xdg-base-dir/zipball/265b8593498b997dc2d31e75b89f053b5cc9621a", + "reference": "265b8593498b997dc2d31e75b89f053b5cc9621a", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "@stable" + }, + "type": "project", + "autoload": { + "psr-4": { + "XdgBaseDir\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "implementation of xdg base directory specification for php", + "time": "2014-10-24T07:27:01+00:00" + }, { "name": "doctrine/annotations", "version": "v1.2.7", @@ -535,18 +570,19 @@ "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "db06bb9fbe7851417a7abbbae5afe5a973de1a06" + "reference": "99fc36977d967041f43778b8062035bd280242eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/db06bb9fbe7851417a7abbbae5afe5a973de1a06", - "reference": "db06bb9fbe7851417a7abbbae5afe5a973de1a06", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/99fc36977d967041f43778b8062035bd280242eb", + "reference": "99fc36977d967041f43778b8062035bd280242eb", "shasum": "" }, "require": { "dflydev/dot-access-configuration": "dev-master", - "drupal/console-en": "self.version", + "drupal/console-en": "dev-master", "php": "^5.5.9 || ^7.0", + "psy/psysh": "0.6|0.8", "stecman/symfony-console-completion": "~0.7", "symfony/config": ">=2.7 <3.2", "symfony/console": ">=2.7 <3.2", @@ -608,7 +644,7 @@ "drupal", "symfony" ], - "time": "2016-12-28 08:22:19" + "time": "2016-12-30 21:23:02" }, { "name": "drupal/console-en", @@ -616,12 +652,12 @@ "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", - "reference": "815bd92f8984bb3a8ad8fceabdba60b1a50fe345" + "reference": "dfe4ac6103aae66d5dfdb40e8ecf9b94dd0d30ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/815bd92f8984bb3a8ad8fceabdba60b1a50fe345", - "reference": "815bd92f8984bb3a8ad8fceabdba60b1a50fe345", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/dfe4ac6103aae66d5dfdb40e8ecf9b94dd0d30ff", + "reference": "dfe4ac6103aae66d5dfdb40e8ecf9b94dd0d30ff", "shasum": "" }, "type": "drupal-console-language", @@ -662,7 +698,7 @@ "drupal", "symfony" ], - "time": "2016-12-27 01:51:22" + "time": "2016-12-30 22:28:07" }, { "name": "gabordemooij/redbean", @@ -876,6 +912,144 @@ ], "time": "2016-06-24T23:00:38+00:00" }, + { + "name": "jakub-onderka/php-console-color", + "version": "0.1", + "source": { + "type": "git", + "url": "https://github.com/JakubOnderka/PHP-Console-Color.git", + "reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/e0b393dacf7703fc36a4efc3df1435485197e6c1", + "reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "jakub-onderka/php-code-style": "1.0", + "jakub-onderka/php-parallel-lint": "0.*", + "jakub-onderka/php-var-dump-check": "0.*", + "phpunit/phpunit": "3.7.*", + "squizlabs/php_codesniffer": "1.*" + }, + "type": "library", + "autoload": { + "psr-0": { + "JakubOnderka\\PhpConsoleColor": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Jakub Onderka", + "email": "jakub.onderka@gmail.com", + "homepage": "http://www.acci.cz" + } + ], + "time": "2014-04-08T15:00:19+00:00" + }, + { + "name": "jakub-onderka/php-console-highlighter", + "version": "v0.3.2", + "source": { + "type": "git", + "url": "https://github.com/JakubOnderka/PHP-Console-Highlighter.git", + "reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Highlighter/zipball/7daa75df45242c8d5b75a22c00a201e7954e4fb5", + "reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5", + "shasum": "" + }, + "require": { + "jakub-onderka/php-console-color": "~0.1", + "php": ">=5.3.0" + }, + "require-dev": { + "jakub-onderka/php-code-style": "~1.0", + "jakub-onderka/php-parallel-lint": "~0.5", + "jakub-onderka/php-var-dump-check": "~0.1", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~1.5" + }, + "type": "library", + "autoload": { + "psr-0": { + "JakubOnderka\\PhpConsoleHighlighter": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jakub Onderka", + "email": "acci@acci.cz", + "homepage": "http://www.acci.cz/" + } + ], + "time": "2015-04-20T18:58:01+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "adf44419c0fc014a0f191db6f89d3e55d4211744" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/adf44419c0fc014a0f191db6f89d3e55d4211744", + "reference": "adf44419c0fc014a0f191db6f89d3e55d4211744", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "~4.0|~5.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "time": "2016-12-06T11:30:35+00:00" + }, { "name": "psr/cache", "version": "1.0.1", @@ -1019,6 +1193,79 @@ ], "time": "2016-10-10T12:19:37+00:00" }, + { + "name": "psy/psysh", + "version": "v0.8.0", + "source": { + "type": "git", + "url": "https://github.com/bobthecow/psysh.git", + "reference": "4a8860e13aa68a4bbf2476c014f8a1f14f1bf991" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/4a8860e13aa68a4bbf2476c014f8a1f14f1bf991", + "reference": "4a8860e13aa68a4bbf2476c014f8a1f14f1bf991", + "shasum": "" + }, + "require": { + "dnoegel/php-xdg-base-dir": "0.1", + "jakub-onderka/php-console-highlighter": "0.3.*", + "nikic/php-parser": "~1.3|~2.0|~3.0", + "php": ">=5.3.9", + "symfony/console": "~2.3.10|^2.4.2|~3.0", + "symfony/var-dumper": "~2.7|~3.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~1.11", + "hoa/console": "~3.16|~1.14", + "phpunit/phpunit": "~4.4|~5.0", + "symfony/finder": "~2.1|~3.0" + }, + "suggest": { + "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", + "ext-pdo-sqlite": "The doc command requires SQLite to work.", + "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.", + "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history.", + "hoa/console": "A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit." + }, + "bin": [ + "bin/psysh" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.8.x-dev" + } + }, + "autoload": { + "files": [ + "src/Psy/functions.php" + ], + "psr-4": { + "Psy\\": "src/Psy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Justin Hileman", + "email": "justin@justinhileman.info", + "homepage": "http://justinhileman.com" + } + ], + "description": "An interactive shell for modern PHP.", + "homepage": "http://psysh.org", + "keywords": [ + "REPL", + "console", + "interactive", + "shell" + ], + "time": "2016-12-07T17:15:07+00:00" + }, { "name": "stecman/symfony-console-completion", "version": "0.7.0", @@ -1905,6 +2152,69 @@ "homepage": "https://symfony.com", "time": "2016-11-18T21:15:08+00:00" }, + { + "name": "symfony/var-dumper", + "version": "v3.2.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "f722532b0966e9b6fc631e682143c07b2cf583a0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/f722532b0966e9b6fc631e682143c07b2cf583a0", + "reference": "f722532b0966e9b6fc631e682143c07b2cf583a0", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/polyfill-mbstring": "~1.0" + }, + "require-dev": { + "twig/twig": "~1.20|~2.0" + }, + "suggest": { + "ext-symfony_debug": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony mechanism for exploring and dumping PHP variables", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "time": "2016-12-11T14:34:22+00:00" + }, { "name": "symfony/yaml", "version": "v3.1.8", diff --git a/config/services/drupal-console/misc.yml b/config/services/drupal-console/misc.yml index 5073a2823..5dd1d6bc7 100644 --- a/config/services/drupal-console/misc.yml +++ b/config/services/drupal-console/misc.yml @@ -21,3 +21,7 @@ services: arguments: ['@?plugin.manager.devel_dumper'] tags: - { name: drupal.command } + console.shell: + class: Drupal\Console\Command\ShellCommand + tags: + - { name: drupal.command } diff --git a/src/Command/ShellCommand.php b/src/Command/ShellCommand.php new file mode 100644 index 000000000..81b7321bf --- /dev/null +++ b/src/Command/ShellCommand.php @@ -0,0 +1,40 @@ +setName('shell') + ->setDescription($this->trans('commands.shell.description')) + ->setHelp($this->trans('commands.shell.help')); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $config = new Configuration; + $shell = new Shell($config); + $shell->run(); + } +} From 393511bd3dabf93cb0911d4f71c35c4fb9f5795c Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 2 Jan 2017 07:37:57 -0800 Subject: [PATCH 112/321] [console] Update contributing and issue template. (#3062) --- .github/ISSUE_TEMPLATE | 41 +++++++++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 7 ++++--- 2 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE diff --git a/.github/ISSUE_TEMPLATE b/.github/ISSUE_TEMPLATE new file mode 100644 index 000000000..fdf819bc9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE @@ -0,0 +1,41 @@ +### Issue title + +The issue title should comply with the following structure: + +[ *ISSUE-GROUP* ] Short description + +The *ISSUE-GROUP* should be one of: + +* `command:name` +* `console` +* `helper` +* `standard` +* `template` +* `translation` +* `test` +* `docs` + +### Problem/Motivation +A brief statement describing why the issue was filed. + +**Details to include:** +- Why are we doing this? Above all, a summary should explain why a change is needed, in a few short sentences. + +### How to reproduce +Include steps related how to reproduce. + +**Details to include:** +- Drupal version (you can obtain this by running `drupal site:status`). +- Console version (you can obtain this by running `composer show | grep drupal/console`). +- Console Launcher version (you can obtain this by running outside of a drupal site `drupal --version`). +- Steps to reproduce +- Include screen-shot or video whenever necessary. + +### Solution +A brief description of the proposed fix. + +**Details to include:** +- A short summary of the approach proposed or used in the PR. +- Approaches that have been tried and ruled out. +- Links to relevant API documentation or other resources. +- Known workarounds. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d11bb3d37..c1fb6de9b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -35,11 +35,12 @@ A brief statement describing why the issue was filed. - Why are we doing this? Above all, a summary should explain why a change is needed, in a few short sentences. ### How to reproduce -Include steps related how to reproduce. +Include steps related how to reproduce. **Details to include:** -- Drupal version (you can obtain this by running `drupal site:status`). -- Console version (you can obtain this by running `drupal --version`). +- Drupal version (you can obtain this by running `drupal site:status`). +- Console version (you can obtain this by running `composer show | grep drupal/console`). +- Console Launcher version (you can obtain this by running outside of a drupal site `drupal --version`). - Steps to reproduce - Include screen-shot or video whenever necessary. From 6a4fd8d00eeb54a819589e2d878e5c04fd7ff653 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 2 Jan 2017 15:40:33 -0800 Subject: [PATCH 113/321] [console] Apply PSR-2 code style. (#3063) From db1d0868d6b0141189b3cdec7bf4a2a5c9a0dd37 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 2 Jan 2017 15:43:58 -0800 Subject: [PATCH 114/321] [console] Apply PSR-2 code style. (#3064) --- bin/drupal.php | 14 ++++------ composer.json | 3 +- composer.lock | 11 ++++---- phpqa.yml | 3 -- src/Command/Database/DropCommand.php | 3 +- src/Command/Generate/ProfileCommand.php | 6 ++-- src/Command/Generate/ThemeCommand.php | 6 ++-- src/Command/Shared/FormTrait.php | 3 +- src/Command/Shared/MenuTrait.php | 3 +- src/Command/Shared/PermissionTrait.php | 3 +- src/Command/Shared/ServicesTrait.php | 3 +- src/Command/Shared/ThemeBreakpointTrait.php | 3 +- src/Command/Shared/ThemeRegionTrait.php | 3 +- src/Command/ShellCommand.php | 1 + src/Generator/CommandGenerator.php | 10 +++---- src/Plugin/ScriptHandler.php | 28 +++++++++++++++++++ src/Utils/TranslatorManager.php | 15 ++++++++++ templates/module/src/Command/command.php.twig | 6 ++-- 18 files changed, 87 insertions(+), 37 deletions(-) create mode 100644 src/Plugin/ScriptHandler.php create mode 100644 src/Utils/TranslatorManager.php diff --git a/bin/drupal.php b/bin/drupal.php index b54abd93c..cb0204bde 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -7,11 +7,10 @@ set_time_limit(0); -if(file_exists(__DIR__ . '/../autoload.local.php')) { - require_once __DIR__ . '/../autoload.local.php'; -} -else { - $autoloaders = [ +if (file_exists(__DIR__ . '/../autoload.local.php')) { + include_once __DIR__ . '/../autoload.local.php'; +} else { + $autoloaders = [ __DIR__ . '/../../../autoload.php', __DIR__ . '/../vendor/autoload.php' ]; @@ -25,9 +24,8 @@ } if (isset($autoloader)) { - $autoload = require_once $autoloader; -} -else { + $autoload = include_once $autoloader; +} else { echo ' You must set up the project dependencies using `composer install`' . PHP_EOL; exit(1); } diff --git a/composer.json b/composer.json index 78920b86f..695ee2ce5 100644 --- a/composer.json +++ b/composer.json @@ -47,7 +47,8 @@ "gabordemooij/redbean": "~4.3", "doctrine/annotations": "1.2.*", "symfony/expression-language": ">=2.7 <3.2", - "symfony/cache": ">=2.7 <3.2" + "symfony/cache": ">=2.7 <3.2", + "psy/psysh": "0.6|0.8" }, "bin": ["bin/drupal"], "config": { diff --git a/composer.lock b/composer.lock index a82cc9105..e7c4cc40d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "032048728f547cac5ee908eb60dfc4b3", + "content-hash": "0b6e2c2ce06250646c128230ac588d40", "packages": [ { "name": "alchemy/zippy", @@ -570,19 +570,18 @@ "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "99fc36977d967041f43778b8062035bd280242eb" + "reference": "21fa567104b85236287a2c85c2f94b2ac7efb415" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/99fc36977d967041f43778b8062035bd280242eb", - "reference": "99fc36977d967041f43778b8062035bd280242eb", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/21fa567104b85236287a2c85c2f94b2ac7efb415", + "reference": "21fa567104b85236287a2c85c2f94b2ac7efb415", "shasum": "" }, "require": { "dflydev/dot-access-configuration": "dev-master", "drupal/console-en": "dev-master", "php": "^5.5.9 || ^7.0", - "psy/psysh": "0.6|0.8", "stecman/symfony-console-completion": "~0.7", "symfony/config": ">=2.7 <3.2", "symfony/console": ">=2.7 <3.2", @@ -644,7 +643,7 @@ "drupal", "symfony" ], - "time": "2016-12-30 21:23:02" + "time": "2017-01-02 23:11:24" }, { "name": "drupal/console-en", diff --git a/phpqa.yml b/phpqa.yml index f4ac5224f..5998ec92a 100644 --- a/phpqa.yml +++ b/phpqa.yml @@ -17,9 +17,6 @@ application: php-cs-fixer: enabled: true exception: false -# file: -# config-file: .php_cs -# single-execution: false options: level: psr2 arguments: diff --git a/src/Command/Database/DropCommand.php b/src/Command/Database/DropCommand.php index f729395a4..651f5fda4 100644 --- a/src/Command/Database/DropCommand.php +++ b/src/Command/Database/DropCommand.php @@ -77,7 +77,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $databaseConnection['database'] ), true - )) { + ) + ) { return 1; } } diff --git a/src/Command/Generate/ProfileCommand.php b/src/Command/Generate/ProfileCommand.php index 8a29a7be8..f04a3ea09 100644 --- a/src/Command/Generate/ProfileCommand.php +++ b/src/Command/Generate/ProfileCommand.php @@ -293,7 +293,8 @@ function ($machine_name) use ($validators) { if ($io->confirm( $this->trans('commands.generate.profile.questions.dependencies'), true - )) { + ) + ) { $dependencies = $io->ask( $this->trans('commands.generate.profile.options.dependencies'), '' @@ -307,7 +308,8 @@ function ($machine_name) use ($validators) { if ($io->confirm( $this->trans('commands.generate.profile.questions.distribution'), false - )) { + ) + ) { $distribution = $io->ask( $this->trans('commands.generate.profile.options.distribution'), 'My Kick-ass Distribution' diff --git a/src/Command/Generate/ThemeCommand.php b/src/Command/Generate/ThemeCommand.php index 00d20e3a0..e70143574 100644 --- a/src/Command/Generate/ThemeCommand.php +++ b/src/Command/Generate/ThemeCommand.php @@ -332,7 +332,8 @@ function ($theme_path) use ($drupalRoot, $machine_name) { if ($io->confirm( $this->trans('commands.generate.theme.questions.regions'), true - )) { + ) + ) { // @see \Drupal\Console\Command\Shared\ThemeRegionTrait::regionQuestion $regions = $this->regionQuestion($io); $input->setOption('regions', $regions); @@ -345,7 +346,8 @@ function ($theme_path) use ($drupalRoot, $machine_name) { if ($io->confirm( $this->trans('commands.generate.theme.questions.breakpoints'), true - )) { + ) + ) { // @see \Drupal\Console\Command\Shared\ThemeRegionTrait::regionQuestion $breakpoints = $this->breakpointQuestion($io); $input->setOption('breakpoints', $breakpoints); diff --git a/src/Command/Shared/FormTrait.php b/src/Command/Shared/FormTrait.php index 608fa68d1..1f09f5a80 100644 --- a/src/Command/Shared/FormTrait.php +++ b/src/Command/Shared/FormTrait.php @@ -26,7 +26,8 @@ public function formQuestion(DrupalStyle $io) if ($io->confirm( $this->trans('commands.common.questions.inputs.confirm'), true - )) { + ) + ) { $input_types = [ 'fieldset', 'text_format' diff --git a/src/Command/Shared/MenuTrait.php b/src/Command/Shared/MenuTrait.php index dafd48563..ecb510e48 100644 --- a/src/Command/Shared/MenuTrait.php +++ b/src/Command/Shared/MenuTrait.php @@ -28,7 +28,8 @@ public function menuQuestion(DrupalStyle $io, $className) if ($io->confirm( $this->trans('commands.generate.form.questions.menu_link_gen'), true - )) { + ) + ) { // now we need to ask them where to gen the form // get the route $menu_options = [ diff --git a/src/Command/Shared/PermissionTrait.php b/src/Command/Shared/PermissionTrait.php index 0fe6a339b..a3e3f6796 100644 --- a/src/Command/Shared/PermissionTrait.php +++ b/src/Command/Shared/PermissionTrait.php @@ -55,7 +55,8 @@ public function permissionQuestion(DrupalStyle $output) if (!$output->confirm( $this->trans('commands.generate.permission.questions.add'), true - )) { + ) + ) { break; } } diff --git a/src/Command/Shared/ServicesTrait.php b/src/Command/Shared/ServicesTrait.php index 8dbcfda39..7f1b11888 100644 --- a/src/Command/Shared/ServicesTrait.php +++ b/src/Command/Shared/ServicesTrait.php @@ -21,7 +21,8 @@ public function servicesQuestion(DrupalStyle $io) if ($io->confirm( $this->trans('commands.common.questions.services.confirm'), false - )) { + ) + ) { $service_collection = []; $io->writeln($this->trans('commands.common.questions.services.message')); $services = $this->container->getServiceIds(); diff --git a/src/Command/Shared/ThemeBreakpointTrait.php b/src/Command/Shared/ThemeBreakpointTrait.php index df1d30af4..10759e4eb 100644 --- a/src/Command/Shared/ThemeBreakpointTrait.php +++ b/src/Command/Shared/ThemeBreakpointTrait.php @@ -69,7 +69,8 @@ function ($breakPointLabel) use ($validators) { if (!$io->confirm( $this->trans('commands.generate.theme.questions.breakpoint-add'), true - )) { + ) + ) { break; } } diff --git a/src/Command/Shared/ThemeRegionTrait.php b/src/Command/Shared/ThemeRegionTrait.php index 2ed1afe54..cf0e2480e 100644 --- a/src/Command/Shared/ThemeRegionTrait.php +++ b/src/Command/Shared/ThemeRegionTrait.php @@ -46,7 +46,8 @@ function ($regionMachineName) use ($validators) { if (!$io->confirm( $this->trans('commands.generate.theme.questions.region-add'), true - )) { + ) + ) { break; } } diff --git a/src/Command/ShellCommand.php b/src/Command/ShellCommand.php index 81b7321bf..1c9b20c45 100644 --- a/src/Command/ShellCommand.php +++ b/src/Command/ShellCommand.php @@ -11,6 +11,7 @@ /** * Class ShellCommand + * * @package Drupal\Console\Command */ class ShellCommand extends Command diff --git a/src/Generator/CommandGenerator.php b/src/Generator/CommandGenerator.php index 018e857de..18efa06f6 100644 --- a/src/Generator/CommandGenerator.php +++ b/src/Generator/CommandGenerator.php @@ -8,7 +8,7 @@ namespace Drupal\Console\Generator; use Drupal\Console\Extension\Manager; -use Drupal\Console\Core\Utils\TranslatorManager; +use Drupal\Console\Core\Utils\TranslatorManagerInterface; use Drupal\Console\Core\Generator\Generator; /** @@ -24,19 +24,19 @@ class CommandGenerator extends Generator protected $extensionManager; /** - * @var TranslatorManager + * @var TranslatorManagerInterface */ protected $translatorManager; /** * CommandGenerator constructor. * - * @param Manager $extensionManager - * @param TranslatorManager $translatorManager + * @param Manager $extensionManager + * @param TranslatorManagerInterface $translatorManager */ public function __construct( Manager $extensionManager, - TranslatorManager $translatorManager + TranslatorManagerInterface $translatorManager ) { $this->extensionManager = $extensionManager; $this->translatorManager = $translatorManager; diff --git a/src/Plugin/ScriptHandler.php b/src/Plugin/ScriptHandler.php new file mode 100644 index 000000000..3c13f15ba --- /dev/null +++ b/src/Plugin/ScriptHandler.php @@ -0,0 +1,28 @@ +getComposer()->getPackage()->getRequires()); + if (!$packages) { + return; + } + } +} diff --git a/src/Utils/TranslatorManager.php b/src/Utils/TranslatorManager.php new file mode 100644 index 000000000..fc1af26b3 --- /dev/null +++ b/src/Utils/TranslatorManager.php @@ -0,0 +1,15 @@ + Date: Mon, 2 Jan 2017 16:44:57 -0800 Subject: [PATCH 115/321] [console] Add translations contributed modules. (#3065) --- composer.lock | 8 +-- src/Application.php | 7 +++ src/Bootstrap/AddServicesCompilerPass.php | 4 ++ src/Utils/TranslatorManager.php | 53 +++++++++++++++++++ templates/module/src/Command/command.php.twig | 6 +++ 5 files changed, 74 insertions(+), 4 deletions(-) diff --git a/composer.lock b/composer.lock index e7c4cc40d..30c4b80d1 100644 --- a/composer.lock +++ b/composer.lock @@ -570,12 +570,12 @@ "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "21fa567104b85236287a2c85c2f94b2ac7efb415" + "reference": "5a3a930515d826751e97765df964403e4c44bf86" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/21fa567104b85236287a2c85c2f94b2ac7efb415", - "reference": "21fa567104b85236287a2c85c2f94b2ac7efb415", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/5a3a930515d826751e97765df964403e4c44bf86", + "reference": "5a3a930515d826751e97765df964403e4c44bf86", "shasum": "" }, "require": { @@ -643,7 +643,7 @@ "drupal", "symfony" ], - "time": "2017-01-02 23:11:24" + "time": "2017-01-03 00:37:54" }, { "name": "drupal/console-en", diff --git a/src/Application.php b/src/Application.php index ae97a3c53..5d51892fc 100644 --- a/src/Application.php +++ b/src/Application.php @@ -148,6 +148,13 @@ private function registerCommands() continue; } + $tags = $serviceDefinition->getTags(); + if ($tags && array_key_exists('_provider', $tags)) { + $extension = $tags['_provider'][0]['provider']; + $this->container->get('console.translator_manager') + ->addResourceTranslationsByModule($extension); + } + if (!$annotationValidator->isValidCommand($serviceDefinition->getClass())) { continue; } diff --git a/src/Bootstrap/AddServicesCompilerPass.php b/src/Bootstrap/AddServicesCompilerPass.php index 65dc8f332..5911af34b 100644 --- a/src/Bootstrap/AddServicesCompilerPass.php +++ b/src/Bootstrap/AddServicesCompilerPass.php @@ -8,6 +8,7 @@ use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\Finder\Finder; use Drupal\Console\Extension\Manager; +use Drupal\Console\Utils\TranslatorManager; /** * FindCommandsCompilerPass @@ -86,5 +87,8 @@ public function process(ContainerBuilder $container) 'console.service_definitions', $container->getDefinitions() ); + + $definition = $container->getDefinition('console.translator_manager'); + $definition->setClass(TranslatorManager::class); } } diff --git a/src/Utils/TranslatorManager.php b/src/Utils/TranslatorManager.php index fc1af26b3..57831c187 100644 --- a/src/Utils/TranslatorManager.php +++ b/src/Utils/TranslatorManager.php @@ -9,7 +9,60 @@ namespace Drupal\Console\Utils; use Drupal\Console\Core\Utils\TranslatorManager as TranslatorManagerBase; +use Symfony\Component\Yaml\Exception\ParseException; +use Symfony\Component\Finder\Finder; class TranslatorManager extends TranslatorManagerBase { + /** + * @param $extensionPath + */ + private function addResourceTranslationsByExtension($extensionPath) + { + $languageDirectory = sprintf( + '%s/console/translations/%s', + $extensionPath, + $this->language + ); + + if (!is_dir($languageDirectory)) { + return; + } + $finder = new Finder(); + $finder->files() + ->name('*.yml') + ->in($languageDirectory); + foreach ($finder as $file) { + $resource = $languageDirectory . '/' . $file->getBasename(); + $filename = $file->getBasename('.yml'); + $key = 'commands.' . $filename; + try { + $this->loadTranslationByFile($resource, $key); + } catch (ParseException $e) { + echo $key . '.yml ' . $e->getMessage(); + } + } + } + + /** + * @param $module + */ + public function addResourceTranslationsByModule($module) + { + $extensionPath = \Drupal::service('module_handler')->getModule($module)->getPath(); + $this->addResourceTranslationsByExtension( + $extensionPath + ); + } + + /** + * @param $theme + */ + public function addResourceTranslationsByTheme($theme) + { + $extensionPath = \Drupal::service('theme_handler')->getTheme($theme)->getPath(); + $this->addResourceTranslationsByExtension( + $extensionPath + ); + } } diff --git a/templates/module/src/Command/command.php.twig b/templates/module/src/Command/command.php.twig index 2fea2e2d1..a333ccbb5 100644 --- a/templates/module/src/Command/command.php.twig +++ b/templates/module/src/Command/command.php.twig @@ -18,6 +18,7 @@ use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Core\Command\Shared\CommandTrait; {% endif %} use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Annotations\DrupalCommand; {% endblock %} {% block class_declaration %} @@ -25,6 +26,11 @@ use Drupal\Console\Core\Style\DrupalStyle; * Class {{ class_name }}. * * @package Drupal\{{module}} + * + * @DrupalCommand ( + * extension="{{module}}", + * extensionType="module" + * ) */ class {{ class_name }} extends Command {% endblock %} {% block class_construct %} From 84dcc4c704138233fad4f8076f3a4d07f3ac7b6f Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 2 Jan 2017 16:54:32 -0800 Subject: [PATCH 116/321] [console] Code cleanup. (#3066) --- src/Command/Database/DatabaseLogBase.php | 156 +++++++++++------------ src/Utils/TranslatorManager.php | 7 +- 2 files changed, 80 insertions(+), 83 deletions(-) diff --git a/src/Command/Database/DatabaseLogBase.php b/src/Command/Database/DatabaseLogBase.php index c1ed83184..0feb20934 100644 --- a/src/Command/Database/DatabaseLogBase.php +++ b/src/Command/Database/DatabaseLogBase.php @@ -1,9 +1,8 @@ eventType = $input->getOption('type'); @@ -138,24 +137,24 @@ protected function getDefaultOptions(InputInterface $input) } /** - * @param \Drupal\Console\Core\Style\DrupalStyle $io - * @param null $offset - * @param int $range - * @return bool|\Drupal\Core\Database\Query\SelectInterface - */ + * @param DrupalStyle $io + * @param null $offset + * @param int $range + * @return bool|\Drupal\Core\Database\Query\SelectInterface + */ protected function makeQuery(DrupalStyle $io, $offset = null, $range = 1000) { $query = $this->database->select('watchdog', 'w'); $query->fields( 'w', [ - 'wid', - 'uid', - 'severity', - 'type', - 'timestamp', - 'message', - 'variables', + 'wid', + 'uid', + 'severity', + 'type', + 'timestamp', + 'message', + 'variables', ] ); @@ -196,10 +195,10 @@ protected function makeQuery(DrupalStyle $io, $offset = null, $range = 1000) } /** - * Generic logging table header - * - * @return array - */ + * Generic logging table header + * + * @return array + */ protected function createTableHeader() { return [ @@ -212,45 +211,44 @@ protected function createTableHeader() ]; } - /** - * @param \stdClass $dblog - * @return array - */ + * @param \stdClass $dblog + * @return array + */ protected function createTableRow(\stdClass $dblog) { /** - * @var User $user -*/ + * @var User $user + */ $user = $this->userStorage->load($dblog->uid); return [ - $dblog->wid, - $dblog->type, - $this->dateFormatter->format($dblog->timestamp, 'short'), - Unicode::truncate( - Html::decodeEntities(strip_tags($this->formatMessage($dblog))), - 500, - true, - true - ), - $user->getUsername() . ' (' . $user->id() . ')', - $this->severityList[$dblog->severity]->render(), + $dblog->wid, + $dblog->type, + $this->dateFormatter->format($dblog->timestamp, 'short'), + Unicode::truncate( + Html::decodeEntities(strip_tags($this->formatMessage($dblog))), + 500, + true, + true + ), + $user->getUsername() . ' (' . $user->id() . ')', + $this->severityList[$dblog->severity]->render(), ]; } /** - * Formats a database log message. - * - * @param $event - * The record from the watchdog table. The object properties are: wid, uid, - * severity, type, timestamp, message, variables, link, name. - * - * @return string|false - * The formatted log message or FALSE if the message or variables properties - * are not set. - */ + * Formats a database log message. + * + * @param $event + * The record from the watchdog table. The object properties are: wid, uid, + * severity, type, timestamp, message, variables, link, name. + * + * @return string|false + * The formatted log message or FALSE if the message or variables properties + * are not set. + */ protected function formatMessage(\stdClass $event) { $message = false; @@ -272,9 +270,9 @@ protected function formatMessage(\stdClass $event) } /** - * @param $dblog - * @return array - */ + * @param $dblog + * @return array + */ protected function formatSingle($dblog) { return array_combine( diff --git a/src/Utils/TranslatorManager.php b/src/Utils/TranslatorManager.php index 57831c187..65a4a5548 100644 --- a/src/Utils/TranslatorManager.php +++ b/src/Utils/TranslatorManager.php @@ -1,9 +1,8 @@ Date: Tue, 3 Jan 2017 09:42:41 -0800 Subject: [PATCH 117/321] [console] Tag 1.0.0-rc13 release. (#3071) --- composer.json | 2 +- composer.lock | 28 +++++++++++++--------------- src/Application.php | 2 +- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/composer.json b/composer.json index 695ee2ce5..58bca2f0b 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ }, "require": { "php": "^5.5.9 || ^7.0", - "drupal/console-core" : "dev-master", + "drupal/console-core" : "1.0.0-rc13", "alchemy/zippy": "0.4.3", "composer/installers": "~1.0", "symfony/css-selector": ">=2.7 <3.2", diff --git a/composer.lock b/composer.lock index 30c4b80d1..e60584340 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "0b6e2c2ce06250646c128230ac588d40", + "content-hash": "f8fadf941bb185de37bcb57686dcf669", "packages": [ { "name": "alchemy/zippy", @@ -566,21 +566,21 @@ }, { "name": "drupal/console-core", - "version": "dev-master", + "version": "1.0.0-rc13", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "5a3a930515d826751e97765df964403e4c44bf86" + "reference": "1946136a4a1e98956330b71101081075370d6073" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/5a3a930515d826751e97765df964403e4c44bf86", - "reference": "5a3a930515d826751e97765df964403e4c44bf86", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/1946136a4a1e98956330b71101081075370d6073", + "reference": "1946136a4a1e98956330b71101081075370d6073", "shasum": "" }, "require": { "dflydev/dot-access-configuration": "dev-master", - "drupal/console-en": "dev-master", + "drupal/console-en": "1.0.0-rc13", "php": "^5.5.9 || ^7.0", "stecman/symfony-console-completion": "~0.7", "symfony/config": ">=2.7 <3.2", @@ -643,20 +643,20 @@ "drupal", "symfony" ], - "time": "2017-01-03 00:37:54" + "time": "2017-01-03T17:23:55+00:00" }, { "name": "drupal/console-en", - "version": "dev-master", + "version": "1.0.0-rc13", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", - "reference": "dfe4ac6103aae66d5dfdb40e8ecf9b94dd0d30ff" + "reference": "f9f6b87c76e1b66df8121d5ae2b2240b899f86fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/dfe4ac6103aae66d5dfdb40e8ecf9b94dd0d30ff", - "reference": "dfe4ac6103aae66d5dfdb40e8ecf9b94dd0d30ff", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/f9f6b87c76e1b66df8121d5ae2b2240b899f86fb", + "reference": "f9f6b87c76e1b66df8121d5ae2b2240b899f86fb", "shasum": "" }, "type": "drupal-console-language", @@ -697,7 +697,7 @@ "drupal", "symfony" ], - "time": "2016-12-30 22:28:07" + "time": "2017-01-03T17:10:01+00:00" }, { "name": "gabordemooij/redbean", @@ -2365,9 +2365,7 @@ "packages-dev": [], "aliases": [], "minimum-stability": "dev", - "stability-flags": { - "drupal/console-core": 20 - }, + "stability-flags": [], "prefer-stable": true, "prefer-lowest": false, "platform": { diff --git a/src/Application.php b/src/Application.php index 5d51892fc..8dcc876fb 100644 --- a/src/Application.php +++ b/src/Application.php @@ -25,7 +25,7 @@ class Application extends BaseApplication /** * @var string */ - const VERSION = '1.0.0-rc12'; + const VERSION = '1.0.0-rc13'; public function __construct(ContainerInterface $container) { From d5eba734303dfb04272dd27c7d185f6f01cc5117 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 4 Jan 2017 11:10:39 -0800 Subject: [PATCH 118/321] [console] Load contrib commands from console.services.yml file. (#3075) * [console] Load contrib commands from console.services.yml file. * [console] Load contrib commands from console.services.yml file. --- bin/drupal.php | 16 ++++----- services-drupal-install.yml | 1 - services.yml | 2 -- src/Application.php | 35 ++++++++++++++------ src/Bootstrap/AddServicesCompilerPass.php | 40 +++++++++++++++-------- src/Bootstrap/Drupal.php | 23 ++++++++++--- src/Bootstrap/DrupalServiceModifier.php | 10 +++++- src/Generator/CommandGenerator.php | 2 +- src/Utils/TranslatorManager.php | 36 ++++++++++++++++---- 9 files changed, 118 insertions(+), 47 deletions(-) diff --git a/bin/drupal.php b/bin/drupal.php index cb0204bde..3ff716377 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -11,9 +11,9 @@ include_once __DIR__ . '/../autoload.local.php'; } else { $autoloaders = [ - __DIR__ . '/../../../autoload.php', - __DIR__ . '/../vendor/autoload.php' - ]; + __DIR__ . '/../../../autoload.php', + __DIR__ . '/../vendor/autoload.php' + ]; } foreach ($autoloaders as $file) { @@ -31,22 +31,22 @@ } $drupalFinder = new DrupalFinder(); -$drupalFinder->locateRoot(getcwd()); -$composerRoot = $drupalFinder->getComposerRoot(); -$drupalRoot = $drupalFinder->getDrupalRoot(); -if (!$drupalRoot || !$composerRoot) { +if (!$drupalFinder->locateRoot(getcwd())) { echo ' DrupalConsole must be executed within a Drupal Site.'.PHP_EOL; + exit(1); } +$composerRoot = $drupalFinder->getComposerRoot(); +$drupalRoot = $drupalFinder->getDrupalRoot(); chdir($drupalRoot); $drupal = new Drupal($autoload, $composerRoot, $drupalRoot); $container = $drupal->boot(); if (!$container) { - echo ' Something goes wrong. Drupal can not be bootstrapped.'; + echo ' Something was wrong. Drupal can not be bootstrapped.'; exit(1); } diff --git a/services-drupal-install.yml b/services-drupal-install.yml index b338720a5..015cb4b63 100644 --- a/services-drupal-install.yml +++ b/services-drupal-install.yml @@ -1,5 +1,4 @@ services: - # Installer services console.site: class: Drupal\Console\Utils\Site arguments: ['@app.root'] diff --git a/services.yml b/services.yml index f10c23871..32e03500b 100644 --- a/services.yml +++ b/services.yml @@ -1,5 +1,3 @@ -imports: - - { resource: 'services-drupal-install.yml' } services: console.root: class: SplString diff --git a/src/Application.php b/src/Application.php index 8dcc876fb..ecf1b0fc5 100644 --- a/src/Application.php +++ b/src/Application.php @@ -5,7 +5,9 @@ use Doctrine\Common\Annotations\AnnotationRegistry; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\DependencyInjection\ContainerInterface; +use Drupal\Console\Annotations\DrupalCommandAnnotationReader; use Drupal\Console\Utils\AnnotationValidator; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Core\Application as BaseApplication; @@ -37,8 +39,14 @@ public function __construct(ContainerInterface $container) */ public function doRun(InputInterface $input, OutputInterface $output) { + $io = new DrupalStyle($input, $output); $this->registerGenerators(); $this->registerCommands(); +// for ($lines = 0; $lines < 2; $lines++) { +// $io->write("\r\033[K\033[1A\r"); +// } +// $io->clearCurrentLine(); + $clear = $this->container->get('console.configuration_manager') ->getConfiguration() ->get('application.clear')?:false; @@ -47,7 +55,6 @@ public function doRun(InputInterface $input, OutputInterface $output) } parent::doRun($input, $output); if ($this->getCommandName($input) == 'list' && $this->container->hasParameter('console.warning')) { - $io = new DrupalStyle($input, $output); $io->warning( $this->trans($this->container->getParameter('console.warning')) ); @@ -115,10 +122,17 @@ private function registerCommands() $serviceDefinitions = []; $annotationValidator = null; + $annotationCommandReader = null; if ($this->container->hasParameter('console.service_definitions')) { $serviceDefinitions = $this->container ->getParameter('console.service_definitions'); + /** + * @var DrupalCommandAnnotationReader $annotationCommandReader + */ + $annotationCommandReader = $this->container + ->get('console.annotation_command_reader'); + /** * @var AnnotationValidator $annotationValidator */ @@ -143,16 +157,17 @@ private function registerCommands() continue; } - if ($annotationValidator) { + if ($annotationValidator && $annotationCommandReader) { if (!$serviceDefinition = $serviceDefinitions[$name]) { continue; } - $tags = $serviceDefinition->getTags(); - if ($tags && array_key_exists('_provider', $tags)) { - $extension = $tags['_provider'][0]['provider']; + if ($annotation = $annotationCommandReader->readAnnotation($serviceDefinition->getClass())) { $this->container->get('console.translator_manager') - ->addResourceTranslationsByModule($extension); + ->addResourceTranslationsByExtension( + $annotation['extension'], + $annotation['extensionType'] + ); } if (!$annotationValidator->isValidCommand($serviceDefinition->getClass())) { @@ -219,8 +234,8 @@ public function getData() $namespaces = array_filter( $this->getNamespaces(), function ($item) { - return (strpos($item, ':')<=0); - } + return (strpos($item, ':')<=0); + } ); sort($namespaces); array_unshift($namespaces, 'misc'); @@ -229,8 +244,8 @@ public function getData() $commands = $this->all($namespace); usort( $commands, function ($cmd1, $cmd2) { - return strcmp($cmd1->getName(), $cmd2->getName()); - } + return strcmp($cmd1->getName(), $cmd2->getName()); + } ); foreach ($commands as $command) { diff --git a/src/Bootstrap/AddServicesCompilerPass.php b/src/Bootstrap/AddServicesCompilerPass.php index 5911af34b..81b2c161a 100644 --- a/src/Bootstrap/AddServicesCompilerPass.php +++ b/src/Bootstrap/AddServicesCompilerPass.php @@ -2,6 +2,7 @@ namespace Drupal\Console\Bootstrap; +use Drupal\Console\Extension\Extension; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\Config\FileLocator; @@ -20,14 +21,21 @@ class AddServicesCompilerPass implements CompilerPassInterface */ protected $root; + /** + * @var string + */ + protected $appRoot; + /** * AddCommandsCompilerPass constructor. * * @param string $root + * @param string $appRoot */ - public function __construct($root) + public function __construct($root, $appRoot) { $this->root = $root; + $this->appRoot = $appRoot; } /** @@ -41,6 +49,7 @@ public function process(ContainerBuilder $container) ); $loader->load($this->root. DRUPAL_CONSOLE_CORE . 'services.yml'); + $loader->load($this->root. DRUPAL_CONSOLE . 'services-drupal-install.yml'); $loader->load($this->root. DRUPAL_CONSOLE . 'services.yml'); $finder = new Finder(); @@ -61,25 +70,28 @@ public function process(ContainerBuilder $container) * @var Manager $extensionManager */ $extensionManager = $container->get('console.extension_manager'); + /** + * @var Extension[] $modules + */ $modules = $extensionManager->discoverModules() ->showCore() ->showNoCore() ->showInstalled() - ->getList(true); + ->getList(false); - $finder = new Finder(); - $finder->files() - ->name('*.yml') - ->in( - sprintf( - '%s/config/services/drupal-core', - $this->root.DRUPAL_CONSOLE - ) - ); + foreach ($modules as $module) { + if ($module->origin == 'core') { + $consoleServicesFile = $this->root . DRUPAL_CONSOLE . + 'config/services/drupal-core/'.$module->getName().'.yml'; + if (is_file($consoleServicesFile)) { + $loader->load($consoleServicesFile); + } + } - foreach ($finder as $file) { - if (in_array($file->getBasename('.yml'), $modules)) { - $loader->load($file->getPathName()); + $consoleServicesFile = $this->appRoot . '/' . + $module->getPath() . '/console.services.yml'; + if (is_file($consoleServicesFile)) { + $loader->load($consoleServicesFile); } } diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index 6ac073a23..76a470ae2 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -3,6 +3,9 @@ namespace Drupal\Console\Bootstrap; use Doctrine\Common\Annotations\AnnotationRegistry; +use Drupal\Console\Core\Style\DrupalStyle; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\HttpFoundation\Request; use Drupal\Console\Core\Utils\ArgvInputReader; use Drupal\Console\Core\Bootstrap\DrupalConsoleCore; @@ -29,8 +32,12 @@ public function __construct($autoload, $root, $appRoot) public function boot() { + $output = new ConsoleOutput(); + $input = new ArrayInput([]); + $io = new DrupalStyle($input, $output); + if (!class_exists('Drupal\Core\DrupalKernel')) { - echo 'Class Drupal\Core\DrupalKernel do not exists.' . PHP_EOL; + $io->error('Class Drupal\Core\DrupalKernel do not exists.'); $drupal = new DrupalConsoleCore($this->root, $this->appRoot); return $drupal->boot(); } @@ -42,8 +49,9 @@ public function boot() if (file_exists($devDesktopSettingsDir)) { $_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR'] = $devDesktopSettingsDir; } - $argvInputReader = new ArgvInputReader(); + +// $io->writeln('➤ Creating request'); if ($argvInputReader->get('uri')) { $uri = $argvInputReader->get('uri'); if (substr($uri, -1) != '/') { @@ -54,28 +62,35 @@ public function boot() } else { $request = Request::createFromGlobals(); } +// $io->writeln("\r\033[K\033[1A\r✔"); +// $io->writeln('➤ Creating kernel'); $drupalKernel = DrupalKernel::createFromRequest( $request, $this->autoload, 'prod', false ); +// $io->writeln("\r\033[K\033[1A\r✔"); +// $io->writeln('➤ Registering commands'); $drupalKernel->addServiceModifier( new DrupalServiceModifier( $this->root, + $this->appRoot, 'drupal.command', 'drupal.generator' ) ); +// $io->writeln("\r\033[K\033[1A\r✔"); +// $io->writeln('➤ Rebuilding container'); $drupalKernel->invalidateContainer(); $drupalKernel->rebuildContainer(); $drupalKernel->boot(); +// $io->writeln("\r\033[K\033[1A\r✔"); $container = $drupalKernel->getContainer(); - $container->set('console.root', $this->root); AnnotationRegistry::registerLoader([$this->autoload, "loadClass"]); @@ -100,7 +115,7 @@ public function boot() return $container; } catch (\Exception $e) { - echo $e->getMessage() . PHP_EOL; + $io->error($e->getMessage()); $drupal = new DrupalConsoleCore($this->root, $this->appRoot); $container = $drupal->boot(); $container->set('class_loader', $this->autoload); diff --git a/src/Bootstrap/DrupalServiceModifier.php b/src/Bootstrap/DrupalServiceModifier.php index 806a8426c..c3e0ff633 100644 --- a/src/Bootstrap/DrupalServiceModifier.php +++ b/src/Bootstrap/DrupalServiceModifier.php @@ -12,6 +12,11 @@ class DrupalServiceModifier implements ServiceModifierInterface */ protected $root; + /** + * @var string + */ + protected $appRoot; + /** * @var string */ @@ -26,15 +31,18 @@ class DrupalServiceModifier implements ServiceModifierInterface * DrupalServiceModifier constructor. * * @param string $root + * @param string $appRoot * @param string $serviceTag * @param string $generatorTag */ public function __construct( $root = null, + $appRoot = null, $serviceTag, $generatorTag ) { $this->root = $root; + $this->appRoot = $appRoot; $this->commandTag = $serviceTag; $this->generatorTag = $generatorTag; } @@ -46,7 +54,7 @@ public function __construct( public function alter(ContainerBuilder $container) { $container->addCompilerPass( - new AddServicesCompilerPass($this->root) + new AddServicesCompilerPass($this->root, $this->appRoot) ); $container->addCompilerPass( new FindCommandsCompilerPass($this->commandTag) diff --git a/src/Generator/CommandGenerator.php b/src/Generator/CommandGenerator.php index 18efa06f6..df13305f8 100644 --- a/src/Generator/CommandGenerator.php +++ b/src/Generator/CommandGenerator.php @@ -77,7 +77,7 @@ public function generate($module, $name, $class, $containerAware, $services) $this->renderFile( 'module/services.yml.twig', - $this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml', + $this->extensionManager->getModule($module)->getPath() .'/console.services.yml', $parameters, FILE_APPEND ); diff --git a/src/Utils/TranslatorManager.php b/src/Utils/TranslatorManager.php index 65a4a5548..b6e31ea1f 100644 --- a/src/Utils/TranslatorManager.php +++ b/src/Utils/TranslatorManager.php @@ -11,12 +11,17 @@ use Symfony\Component\Yaml\Exception\ParseException; use Symfony\Component\Finder\Finder; +/** + * Class TranslatorManager + * + * @package Drupal\Console\Utils + */ class TranslatorManager extends TranslatorManagerBase { /** * @param $extensionPath */ - private function addResourceTranslationsByExtension($extensionPath) + private function addResourceTranslationsByExtensionPath($extensionPath) { $languageDirectory = sprintf( '%s/console/translations/%s', @@ -46,10 +51,13 @@ private function addResourceTranslationsByExtension($extensionPath) /** * @param $module */ - public function addResourceTranslationsByModule($module) + private function addResourceTranslationsByModule($module) { - $extensionPath = \Drupal::service('module_handler')->getModule($module)->getPath(); - $this->addResourceTranslationsByExtension( + if (!\Drupal::moduleHandler()->moduleExists($module)) { + return; + } + $extensionPath = \Drupal::moduleHandler()->getModule($module)->getPath(); + $this->addResourceTranslationsByExtensionPath( $extensionPath ); } @@ -57,11 +65,27 @@ public function addResourceTranslationsByModule($module) /** * @param $theme */ - public function addResourceTranslationsByTheme($theme) + private function addResourceTranslationsByTheme($theme) { $extensionPath = \Drupal::service('theme_handler')->getTheme($theme)->getPath(); - $this->addResourceTranslationsByExtension( + $this->addResourceTranslationsByExtensionPath( $extensionPath ); } + + /** + * @param $extension + * @param $type + */ + public function addResourceTranslationsByExtension($extension, $type) + { + if ($type == 'module') { + $this->addResourceTranslationsByModule($extension); + return; + } + if ($type == 'theme') { + $this->addResourceTranslationsByTheme($extension); + return; + } + } } From 105fa6818e700aac1dd608cf1ee1c7e8ef2698fc Mon Sep 17 00:00:00 2001 From: Joris Steyn Date: Wed, 4 Jan 2017 20:12:12 +0100 Subject: [PATCH 119/321] Don't crash on updates in installation profiles (#3070) When running 'update:execute' on an installation profile, drupal console crashes because it assumes every update belongs to a module while in practice installation profiles too can contain updates. --- src/Command/Update/ExecuteCommand.php | 10 ++++++++-- src/Extension/Manager.php | 13 +++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/Command/Update/ExecuteCommand.php b/src/Command/Update/ExecuteCommand.php index 6f10517ab..cd36e3560 100644 --- a/src/Command/Update/ExecuteCommand.php +++ b/src/Command/Update/ExecuteCommand.php @@ -185,8 +185,14 @@ private function checkUpdates(DrupalStyle $io) private function runUpdates(DrupalStyle $io, $updates) { foreach ($updates as $module_name => $module_updates) { - $this->site - ->loadLegacyFile($this->extensionManager->getModule($module_name)->getPath() . '/'. $module_name . '.install', false); + $extension = $this->extensionManager->getModule($module_name); + if (!$extension) { + $extension = $this->extensionManager->getProfile($module_name); + } + if ($extension) { + $this->site + ->loadLegacyFile($extension->getPath() . '/'. $module_name . '.install', false); + } foreach ($module_updates['pending'] as $update_number => $update) { if ($this->module != 'all' && $this->update_n !== null && $this->update_n != $update_number) { diff --git a/src/Extension/Manager.php b/src/Extension/Manager.php index fd388f98b..6c977d74d 100644 --- a/src/Extension/Manager.php +++ b/src/Extension/Manager.php @@ -236,6 +236,19 @@ public function getModule($name) return null; } + /** + * @param string $name + * @return \Drupal\Console\Extension\Extension + */ + public function getProfile($name) + { + if ($extension = $this->getExtension('profile', $name)) { + return $this->createExtension($extension); + } + + return null; + } + /** * @param string $name * @return \Drupal\Console\Extension\Extension From 8cf1d3a2cd8d52e451949e5e7346c40893316b3d Mon Sep 17 00:00:00 2001 From: Joris Steyn Date: Wed, 4 Jan 2017 20:12:48 +0100 Subject: [PATCH 120/321] Allow usage of features:import with features_ui disabled (#3069) Before this commit, the features:debug command was available without the UI module enabled but features:import was not. Since the console commands do not depend on the UI this commit allows feature imports with the UI module disabled. --- src/Command/Features/ImportCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Command/Features/ImportCommand.php b/src/Command/Features/ImportCommand.php index 5263d227d..955387e03 100644 --- a/src/Command/Features/ImportCommand.php +++ b/src/Command/Features/ImportCommand.php @@ -19,7 +19,7 @@ /** * @DrupalCommand( - * extension = "features_ui", + * extension = "features", * extensionType = "module" * ) */ From eff9f5c0e6bdfd749880dac51d25eee642b3f7dc Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 4 Jan 2017 11:49:39 -0800 Subject: [PATCH 121/321] [console] Tag 1.0.0-rc14 release. (#3076) --- composer.json | 2 +- composer.lock | 16 ++++++++-------- src/Application.php | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index 58bca2f0b..b06dae806 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ }, "require": { "php": "^5.5.9 || ^7.0", - "drupal/console-core" : "1.0.0-rc13", + "drupal/console-core" : "1.0.0-rc14", "alchemy/zippy": "0.4.3", "composer/installers": "~1.0", "symfony/css-selector": ">=2.7 <3.2", diff --git a/composer.lock b/composer.lock index e60584340..7b2319225 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "f8fadf941bb185de37bcb57686dcf669", + "content-hash": "e22d8079f08d9450c8047cae76318022", "packages": [ { "name": "alchemy/zippy", @@ -566,21 +566,21 @@ }, { "name": "drupal/console-core", - "version": "1.0.0-rc13", + "version": "1.0.0-rc14", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "1946136a4a1e98956330b71101081075370d6073" + "reference": "8adb02bdd99e93f01ffb4897264c44687ac73f62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/1946136a4a1e98956330b71101081075370d6073", - "reference": "1946136a4a1e98956330b71101081075370d6073", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/8adb02bdd99e93f01ffb4897264c44687ac73f62", + "reference": "8adb02bdd99e93f01ffb4897264c44687ac73f62", "shasum": "" }, "require": { "dflydev/dot-access-configuration": "dev-master", - "drupal/console-en": "1.0.0-rc13", + "drupal/console-en": "1.0.0-rc14", "php": "^5.5.9 || ^7.0", "stecman/symfony-console-completion": "~0.7", "symfony/config": ">=2.7 <3.2", @@ -643,11 +643,11 @@ "drupal", "symfony" ], - "time": "2017-01-03T17:23:55+00:00" + "time": "2017-01-04T19:36:23+00:00" }, { "name": "drupal/console-en", - "version": "1.0.0-rc13", + "version": "1.0.0-rc14", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", diff --git a/src/Application.php b/src/Application.php index ecf1b0fc5..a0bd51b5f 100644 --- a/src/Application.php +++ b/src/Application.php @@ -27,7 +27,7 @@ class Application extends BaseApplication /** * @var string */ - const VERSION = '1.0.0-rc13'; + const VERSION = '1.0.0-rc14'; public function __construct(ContainerInterface $container) { From 7fa61ca81bdc619e37f26ce25ea6bdb6e95e308c Mon Sep 17 00:00:00 2001 From: Miguel Date: Fri, 6 Jan 2017 17:24:21 -0600 Subject: [PATCH 122/321] Add migrate rollback command. (#3080) --- config/services/drupal-core/migrate.yml | 5 + src/Command/Migrate/ExecuteCommand.php | 2 +- src/Command/Migrate/RollBackCommand.php | 185 ++++++++++++++++++++++++ src/Command/Shared/MigrationTrait.php | 7 +- 4 files changed, 195 insertions(+), 4 deletions(-) create mode 100644 src/Command/Migrate/RollBackCommand.php diff --git a/config/services/drupal-core/migrate.yml b/config/services/drupal-core/migrate.yml index 17fb889bb..42d5746bb 100644 --- a/config/services/drupal-core/migrate.yml +++ b/config/services/drupal-core/migrate.yml @@ -1,4 +1,9 @@ services: + migrate_rollback: + class: Drupal\Console\Command\Migrate\RollBackCommand + arguments: ['@plugin.manager.migration'] + tags: + - { name: drupal.command } migrate_execute: class: Drupal\Console\Command\Migrate\ExecuteCommand arguments: ['@plugin.manager.migration'] diff --git a/src/Command/Migrate/ExecuteCommand.php b/src/Command/Migrate/ExecuteCommand.php index bc91122c8..325f85515 100644 --- a/src/Command/Migrate/ExecuteCommand.php +++ b/src/Command/Migrate/ExecuteCommand.php @@ -298,7 +298,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } if (!$this->migrateConnection) { - $this->registerMigrateDB($input, $output); + $this->registerMigrateDB($input, $io); $this->migrateConnection = $this->getDBConnection($io, 'default', 'upgrade'); } diff --git a/src/Command/Migrate/RollBackCommand.php b/src/Command/Migrate/RollBackCommand.php new file mode 100644 index 000000000..aa69bc451 --- /dev/null +++ b/src/Command/Migrate/RollBackCommand.php @@ -0,0 +1,185 @@ +pluginManagerMigration = $pluginManagerMigration; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('migrate:rollback') + ->setDescription($this->trans('commands.migrate.rollback.description')) + ->addArgument('migration-ids', InputArgument::IS_ARRAY, $this->trans('commands.migrate.rollback.arguments.id')) + ->addOption( + 'source-base_path', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.migrate.setup.options.source-base_path') + ); + + + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $sourceBasepath = $input->getOption('source-base_path'); + $configuration['source']['constants']['source_base_path'] = rtrim($sourceBasepath, '/') . '/'; + // --migration-id prefix + $migration_id = $input->getArgument('migration-ids'); + $migrations_list = array_keys($this->getMigrations($version_tag)); + // If migrations weren't provided finish execution + if (empty($migration_id)) { + return; + } + + + if (!in_array('all', $migration_id)) { + $migration_ids = $migration_id; + } else { + $migration_ids = $migrations_list; + } + + foreach ($migration_ids as $migration) { + if (!in_array($migration, $migrations_list)) { + $io->warning( + sprintf( + $this->trans('commands.migrate.rollback.messages.not-available'), + $migration + ) + ); + continue; + } + $migration_service = $this->pluginManagerMigration->createInstance($migration, $configuration); + if ($migration_service) { + $messages = new MigrateExecuteMessageCapture(); + $executable = new MigrateExecutable($migration_service, $messages); + + $migration_status = $executable->rollback(); + switch ($migration_status) { + case MigrationInterface::RESULT_COMPLETED: + $io->info( + sprintf( + $this->trans('commands.migrate.rollback.messages.processing'), + $migration + ) + ); + break; + case MigrationInterface::RESULT_INCOMPLETE: + $io->info( + sprintf( + $this->trans('commands.migrate.execute.messages.importing-incomplete'), + $migration + ) + ); + break; + case MigrationInterface::RESULT_STOPPED: + $io->error( + sprintf( + $this->trans('commands.migrate.execute.messages.import-stopped'), + $migration + ) + ); + break; + } + + } + + } + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + // Get migrations + $migrations_list = $this->getMigrations($version_tag); + + // --migration-id prefix + $migration_id = $input->getArgument('migration-ids'); + + + if (!$migration_id) { + $migrations_ids = []; + + while (true) { + $migration_id = $io->choiceNoList( + $this->trans('commands.migrate.execute.questions.id'), + array_keys($migrations_list), + 'all' + ); + + if (empty($migration_id) || $migration_id == 'all') { + // Only add all if it's the first option + if (empty($migrations_ids) && $migration_id == 'all') { + $migrations_ids[] = $migration_id; + } + break; + } else { + $migrations_ids[] = $migration_id; + } + } + + $input->setArgument('migration-ids', $migrations_ids); + } + + // --source-base_path + $sourceBasepath = $input->getOption('source-base_path'); + if (!$sourceBasepath) { + $sourceBasepath = $io->ask( + $this->trans('commands.migrate.setup.questions.source-base_path'), + '' + ); + $input->setOption('source-base_path', $sourceBasepath); + } + + } +} \ No newline at end of file diff --git a/src/Command/Shared/MigrationTrait.php b/src/Command/Shared/MigrationTrait.php index d82496d0b..e020f9ac6 100644 --- a/src/Command/Shared/MigrationTrait.php +++ b/src/Command/Shared/MigrationTrait.php @@ -10,7 +10,8 @@ use Drupal\Core\Database\Connection; use Drupal\Core\Database\Database; use Drupal\Console\Core\Style\DrupalStyle; -use Symfony\Component\Console\Input\ArgvInput; +use Symfony\Component\Console\Input\InputInterface; + /** * Class MigrationTrait @@ -176,7 +177,7 @@ protected function getDBConnection(DrupalStyle $io, $target, $key) * @param InputInterface $input * @param DrupalStyle $io */ - protected function registerMigrateDB(ArgvInput $input, DrupalStyle $io) + protected function registerMigrateDB(InputInterface $input, DrupalStyle $io) { $dbType = $input->getOption('db-type'); $dbHost = $input->getOption('db-host'); @@ -203,7 +204,7 @@ protected function registerMigrateDB(ArgvInput $input, DrupalStyle $io) * @param $dbHost */ protected function addDBConnection(DrupalStyle $io, $key, $target, $dbType, $dbName, $dbUser, $dbPass, $dbPrefix, $dbPort, $dbHost) - { + { $database_type = $this->getDatabaseDrivers(); $reflection = new \ReflectionClass($database_type[$dbType]); $install_namespace = $reflection->getNamespaceName(); From 2379eeae56b477eca915d2b9d485911dbab814e3 Mon Sep 17 00:00:00 2001 From: Joris Steyn Date: Sat, 7 Jan 2017 05:48:47 +0100 Subject: [PATCH 123/321] Allow commands to return an exit code (#3078) It is important for any program to exit with a non-zero exit code if it encountered an error. In Symfony console commands it's common to return with an exit code in the execute() method of a command. Drupal Console disregards this exit code in Application::doRun(), making it harder to use Drupal Console in a scriptable way. --- src/Application.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Application.php b/src/Application.php index a0bd51b5f..38aa22241 100644 --- a/src/Application.php +++ b/src/Application.php @@ -53,12 +53,16 @@ public function doRun(InputInterface $input, OutputInterface $output) if ($clear === true || $clear === 'true') { $output->write(sprintf("\033\143")); } - parent::doRun($input, $output); + + $exitCode = parent::doRun($input, $output); + if ($this->getCommandName($input) == 'list' && $this->container->hasParameter('console.warning')) { $io->warning( $this->trans($this->container->getParameter('console.warning')) ); } + + return $exitCode; } private function registerGenerators() From 9e6ba52b84d6b70bd6bebd1edefabf62418a82e1 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 9 Jan 2017 09:15:24 -0800 Subject: [PATCH 124/321] [console] Output on debug option. (#3087) --- bin/drupal.php | 10 ++++++---- composer.json | 2 +- composer.lock | 28 +++++++++++++++------------- src/Application.php | 13 ------------- src/Bootstrap/Drupal.php | 34 +++++++++++++++++++++------------- 5 files changed, 43 insertions(+), 44 deletions(-) diff --git a/bin/drupal.php b/bin/drupal.php index 3ff716377..6554c5197 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -1,5 +1,6 @@ hasParameterOption(['--debug']); +$drupalFinder = new DrupalFinder(); if (!$drupalFinder->locateRoot(getcwd())) { echo ' DrupalConsole must be executed within a Drupal Site.'.PHP_EOL; @@ -43,10 +46,10 @@ chdir($drupalRoot); $drupal = new Drupal($autoload, $composerRoot, $drupalRoot); -$container = $drupal->boot(); +$container = $drupal->boot($debug); if (!$container) { - echo ' Something was wrong. Drupal can not be bootstrapped.'; + echo ' Something was wrong. Drupal can not be bootstrap.'; exit(1); } @@ -61,7 +64,6 @@ $argvInputReader->setOptionsFromConfiguration($options); } $argvInputReader->setOptionsAsArgv(); - $application = new Application($container); $application->setDefaultCommand('about'); $application->run(); diff --git a/composer.json b/composer.json index b06dae806..695ee2ce5 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ }, "require": { "php": "^5.5.9 || ^7.0", - "drupal/console-core" : "1.0.0-rc14", + "drupal/console-core" : "dev-master", "alchemy/zippy": "0.4.3", "composer/installers": "~1.0", "symfony/css-selector": ">=2.7 <3.2", diff --git a/composer.lock b/composer.lock index 7b2319225..377f3faa0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "e22d8079f08d9450c8047cae76318022", + "content-hash": "0b6e2c2ce06250646c128230ac588d40", "packages": [ { "name": "alchemy/zippy", @@ -566,21 +566,21 @@ }, { "name": "drupal/console-core", - "version": "1.0.0-rc14", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "8adb02bdd99e93f01ffb4897264c44687ac73f62" + "reference": "4bc30ba4e76f0c9e26d761a6b3367827997d3df9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/8adb02bdd99e93f01ffb4897264c44687ac73f62", - "reference": "8adb02bdd99e93f01ffb4897264c44687ac73f62", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/4bc30ba4e76f0c9e26d761a6b3367827997d3df9", + "reference": "4bc30ba4e76f0c9e26d761a6b3367827997d3df9", "shasum": "" }, "require": { "dflydev/dot-access-configuration": "dev-master", - "drupal/console-en": "1.0.0-rc14", + "drupal/console-en": "dev-master", "php": "^5.5.9 || ^7.0", "stecman/symfony-console-completion": "~0.7", "symfony/config": ">=2.7 <3.2", @@ -643,20 +643,20 @@ "drupal", "symfony" ], - "time": "2017-01-04T19:36:23+00:00" + "time": "2017-01-08 05:11:34" }, { "name": "drupal/console-en", - "version": "1.0.0-rc14", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", - "reference": "f9f6b87c76e1b66df8121d5ae2b2240b899f86fb" + "reference": "2da817d8cc862b694bc14941c91201e778f801ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/f9f6b87c76e1b66df8121d5ae2b2240b899f86fb", - "reference": "f9f6b87c76e1b66df8121d5ae2b2240b899f86fb", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/2da817d8cc862b694bc14941c91201e778f801ae", + "reference": "2da817d8cc862b694bc14941c91201e778f801ae", "shasum": "" }, "type": "drupal-console-language", @@ -697,7 +697,7 @@ "drupal", "symfony" ], - "time": "2017-01-03T17:10:01+00:00" + "time": "2017-01-07 03:56:38" }, { "name": "gabordemooij/redbean", @@ -2365,7 +2365,9 @@ "packages-dev": [], "aliases": [], "minimum-stability": "dev", - "stability-flags": [], + "stability-flags": { + "drupal/console-core": 20 + }, "prefer-stable": true, "prefer-lowest": false, "platform": { diff --git a/src/Application.php b/src/Application.php index 38aa22241..465cb8b2d 100644 --- a/src/Application.php +++ b/src/Application.php @@ -39,14 +39,8 @@ public function __construct(ContainerInterface $container) */ public function doRun(InputInterface $input, OutputInterface $output) { - $io = new DrupalStyle($input, $output); $this->registerGenerators(); $this->registerCommands(); -// for ($lines = 0; $lines < 2; $lines++) { -// $io->write("\r\033[K\033[1A\r"); -// } -// $io->clearCurrentLine(); - $clear = $this->container->get('console.configuration_manager') ->getConfiguration() ->get('application.clear')?:false; @@ -55,13 +49,6 @@ public function doRun(InputInterface $input, OutputInterface $output) } $exitCode = parent::doRun($input, $output); - - if ($this->getCommandName($input) == 'list' && $this->container->hasParameter('console.warning')) { - $io->warning( - $this->trans($this->container->getParameter('console.warning')) - ); - } - return $exitCode; } diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index 76a470ae2..5c5775f69 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -3,10 +3,10 @@ namespace Drupal\Console\Bootstrap; use Doctrine\Common\Annotations\AnnotationRegistry; -use Drupal\Console\Core\Style\DrupalStyle; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\HttpFoundation\Request; +use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Core\Utils\ArgvInputReader; use Drupal\Console\Core\Bootstrap\DrupalConsoleCore; @@ -30,7 +30,7 @@ public function __construct($autoload, $root, $appRoot) $this->appRoot = $appRoot; } - public function boot() + public function boot($debug) { $output = new ConsoleOutput(); $input = new ArrayInput([]); @@ -51,7 +51,9 @@ public function boot() } $argvInputReader = new ArgvInputReader(); -// $io->writeln('➤ Creating request'); + if ($debug) { + $io->writeln('➤ Creating request'); + } if ($argvInputReader->get('uri')) { $uri = $argvInputReader->get('uri'); if (substr($uri, -1) != '/') { @@ -62,18 +64,20 @@ public function boot() } else { $request = Request::createFromGlobals(); } -// $io->writeln("\r\033[K\033[1A\r✔"); - -// $io->writeln('➤ Creating kernel'); + if ($debug) { + $io->writeln("\r\033[K\033[1A\r✔"); + $io->writeln('➤ Creating Drupal kernel'); + } $drupalKernel = DrupalKernel::createFromRequest( $request, $this->autoload, 'prod', false ); -// $io->writeln("\r\033[K\033[1A\r✔"); - -// $io->writeln('➤ Registering commands'); + if ($debug) { + $io->writeln("\r\033[K\033[1A\r✔"); + $io->writeln('➤ Providing dynamic services'); + } $drupalKernel->addServiceModifier( new DrupalServiceModifier( $this->root, @@ -82,13 +86,17 @@ public function boot() 'drupal.generator' ) ); -// $io->writeln("\r\033[K\033[1A\r✔"); - -// $io->writeln('➤ Rebuilding container'); + if ($debug) { + $io->writeln("\r\033[K\033[1A\r✔"); + $io->writeln('➤ Rebuilding container'); + } $drupalKernel->invalidateContainer(); $drupalKernel->rebuildContainer(); $drupalKernel->boot(); -// $io->writeln("\r\033[K\033[1A\r✔"); + + if ($debug) { + $io->writeln("\r\033[K\033[1A\r✔"); + } $container = $drupalKernel->getContainer(); $container->set('console.root', $this->root); From d4ebf7b2f770dd141739688ebf51bb365ddc6916 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Tue, 17 Jan 2017 20:15:11 -0800 Subject: [PATCH 125/321] [console] Remove directory avoid executing cache:rebuild command. (#3090) --- src/Bootstrap/Drupal.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index 5c5775f69..2bbf399d1 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -6,6 +6,7 @@ use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Filesystem\Filesystem; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Core\Utils\ArgvInputReader; use Drupal\Console\Core\Bootstrap\DrupalConsoleCore; @@ -64,6 +65,14 @@ public function boot($debug) } else { $request = Request::createFromGlobals(); } + + if ($debug) { + $io->writeln("\r\033[K\033[1A\r✔"); + $io->writeln('➤ Deleting local PHP files'); + } + $fs = new Filesystem(); + $fs ->remove($this->appRoot.'/sites/default/files/php/'); + if ($debug) { $io->writeln("\r\033[K\033[1A\r✔"); $io->writeln('➤ Creating Drupal kernel'); From e025d4af0c42926ecf8ba70394bd76a1bc1c698b Mon Sep 17 00:00:00 2001 From: Rob Bayliss Date: Wed, 18 Jan 2017 00:05:02 -0500 Subject: [PATCH 126/321] Use Symfony Process TTY detection, handle no-tty gracefully for server command (#3088) * Do not require TTY to start server * Use appRoot to determine working directory * Use the right exception class * Use process helper in server command --- src/Command/ServerCommand.php | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/src/Command/ServerCommand.php b/src/Command/ServerCommand.php index 84f1cb54b..26707ba57 100644 --- a/src/Command/ServerCommand.php +++ b/src/Command/ServerCommand.php @@ -10,6 +10,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Process\Exception\RuntimeException; use Symfony\Component\Process\ProcessBuilder; use Symfony\Component\Process\PhpExecutableFinder; use Symfony\Component\Console\Command\Command; @@ -75,34 +76,24 @@ protected function execute(InputInterface $input, OutputInterface $output) } $router = $this->getRouterPath(); - $cli = sprintf( - '%s %s %s %s', - $binary, - '-S', - $address, - $router - ); + $processBuilder = new ProcessBuilder([$binary, '-S', $address, $router]); + $processBuilder->setTimeout(NULL); + $processBuilder->setWorkingDirectory($this->appRoot); + $process = $processBuilder->getProcess(); if ($learning) { - $io->commentBlock($cli); + $io->commentBlock($process->getCommandLine()); } $io->success( - sprintf( - $this->trans('commands.server.messages.executing'), - $binary - ) + sprintf( + $this->trans('commands.server.messages.executing'), + $binary + ) ); - $processBuilder = new ProcessBuilder(explode(' ', $cli)); - $process = $processBuilder->getProcess(); - $process->setWorkingDirectory($this->appRoot); - if ('\\' !== DIRECTORY_SEPARATOR && file_exists('/dev/tty') && is_readable('/dev/tty')) { - $process->setTty('true'); - } else { - $process->setTimeout(null); - } - $process->run(); + // Use the process helper to copy process output to console output. + $this->getHelper('process')->run($output, $process, null, null); if (!$process->isSuccessful()) { $io->error($process->getErrorOutput()); From 47785d536c76736b584f30a58551abdc8b66c274 Mon Sep 17 00:00:00 2001 From: Christoph Burschka Date: Wed, 18 Jan 2017 06:08:14 +0100 Subject: [PATCH 127/321] [config:import] return exit code on error (#3083) (#3084) * [config:import] return exit code on error (#3083) * [config:import] Print "importing" before starting (#3083) This is more accurate than printing it after the import has finished. --- src/Command/Config/ImportCommand.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Command/Config/ImportCommand.php b/src/Command/Config/ImportCommand.php index 0375d4548..20ca002c4 100644 --- a/src/Command/Config/ImportCommand.php +++ b/src/Command/Config/ImportCommand.php @@ -106,6 +106,9 @@ protected function execute(InputInterface $input, OutputInterface $output) if ($this->configImport($io, $storage_comparer)) { $io->success($this->trans('commands.config.import.messages.imported')); } + else { + return 1; + } } @@ -127,8 +130,9 @@ private function configImport(DrupalStyle $io, StorageComparer $storage_comparer $io->success($this->trans('commands.config.import.messages.already-imported')); } else { try { - $config_importer->import(); $io->info($this->trans('commands.config.import.messages.importing')); + $config_importer->import(); + return TRUE; } catch (ConfigImporterException $e) { $message = 'The import failed due for the following reasons:' . "\n"; $message .= implode("\n", $config_importer->getErrors()); From bf81eaacbdd37279ef37f98ca8b5fcef8333a100 Mon Sep 17 00:00:00 2001 From: "Alvaro J. Hurtado Villegas" Date: Wed, 18 Jan 2017 18:14:19 +0100 Subject: [PATCH 128/321] 3093: change symfony/dom-crawler to >=2.7 <3.2 (#3094) --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 695ee2ce5..9f36ab252 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,7 @@ "alchemy/zippy": "0.4.3", "composer/installers": "~1.0", "symfony/css-selector": ">=2.7 <3.2", - "symfony/dom-crawler": ">=2.7 <3.2", + "symfony/dom-crawler": ">=2.7 <3.3", "symfony/http-foundation": ">=2.7 <3.2", "guzzlehttp/guzzle": "~6.1", "gabordemooij/redbean": "~4.3", From 97bce0eeaaf32547241d6f90f1ef5c83dd78d8d3 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 18 Jan 2017 22:41:38 -0800 Subject: [PATCH 129/321] Rollback delete php storage (#3103) * [console] Remove dead code. * [console] Rollback #3090 delete php storage. * [console] Validate DrupalKernel creation when is not a multisite. * [console] Show database error only on list command. --- bin/drupal.php | 2 -- src/Bootstrap/Drupal.php | 20 +++++++------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/bin/drupal.php b/bin/drupal.php index 6554c5197..d73c44267 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -57,8 +57,6 @@ $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); diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index 2bbf399d1..23be21cbc 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -6,7 +6,6 @@ use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Filesystem\Filesystem; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Core\Utils\ArgvInputReader; use Drupal\Console\Core\Bootstrap\DrupalConsoleCore; @@ -36,6 +35,7 @@ public function boot($debug) $output = new ConsoleOutput(); $input = new ArrayInput([]); $io = new DrupalStyle($input, $output); + $argvInputReader = new ArgvInputReader(); if (!class_exists('Drupal\Core\DrupalKernel')) { $io->error('Class Drupal\Core\DrupalKernel do not exists.'); @@ -50,13 +50,12 @@ public function boot($debug) if (file_exists($devDesktopSettingsDir)) { $_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR'] = $devDesktopSettingsDir; } - $argvInputReader = new ArgvInputReader(); if ($debug) { $io->writeln('➤ Creating request'); } - if ($argvInputReader->get('uri')) { - $uri = $argvInputReader->get('uri'); + $uri = $argvInputReader->get('uri'); + if ($uri && $uri != 'http://default') { if (substr($uri, -1) != '/') { $uri .= '/'; } @@ -68,14 +67,7 @@ public function boot($debug) if ($debug) { $io->writeln("\r\033[K\033[1A\r✔"); - $io->writeln('➤ Deleting local PHP files'); - } - $fs = new Filesystem(); - $fs ->remove($this->appRoot.'/sites/default/files/php/'); - - if ($debug) { - $io->writeln("\r\033[K\033[1A\r✔"); - $io->writeln('➤ Creating Drupal kernel'); + $io->writeln('➤ Creating Drupal kernel'); } $drupalKernel = DrupalKernel::createFromRequest( $request, @@ -132,7 +124,9 @@ public function boot($debug) return $container; } catch (\Exception $e) { - $io->error($e->getMessage()); + if ($argvInputReader->get('command') == 'list') { + $io->error($e->getMessage()); + } $drupal = new DrupalConsoleCore($this->root, $this->appRoot); $container = $drupal->boot(); $container->set('class_loader', $this->autoload); From 4346e5f80284c65a40162f6508f3e63464036862 Mon Sep 17 00:00:00 2001 From: Dave Vasilevsky Date: Thu, 19 Jan 2017 07:20:01 +0000 Subject: [PATCH 130/321] Compatibility with Windows Acquia Dev Desktop (#3101) --- src/Bootstrap/Drupal.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index 23be21cbc..14cb7c33d 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -44,12 +44,20 @@ public function boot($debug) } try { - // Add support for Acquia Dev Desktop sites on Mac OS X - // @TODO: Check if this condition works in Windows - $devDesktopSettingsDir = getenv('HOME') . "/.acquia/DevDesktop/DrupalSettings"; - if (file_exists($devDesktopSettingsDir)) { - $_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR'] = $devDesktopSettingsDir; + // Add support for Acquia Dev Desktop sites. + // Try both Mac and Windows home locations. + $home = getenv('HOME'); + if (empty($home)) { + $home = getenv('USERPROFILE'); } + if (!empty($home)) { + $devDesktopSettingsDir = $home . "/.acquia/DevDesktop/DrupalSettings"; + if (file_exists($devDesktopSettingsDir)) { + $_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR'] = $devDesktopSettingsDir; + } + } + + $argvInputReader = new ArgvInputReader(); if ($debug) { $io->writeln('➤ Creating request'); From 1c3ffa111f03b6ed7fe907a25764816263cd2104 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 19 Jan 2017 00:08:49 -0800 Subject: [PATCH 131/321] [console] Update symfony dependencies. (#3104) --- composer.json | 5 +- composer.lock | 569 +++++++++++++++++++++++++++----------------------- 2 files changed, 311 insertions(+), 263 deletions(-) diff --git a/composer.json b/composer.json index 9f36ab252..92afb93ca 100644 --- a/composer.json +++ b/composer.json @@ -42,12 +42,11 @@ "composer/installers": "~1.0", "symfony/css-selector": ">=2.7 <3.2", "symfony/dom-crawler": ">=2.7 <3.3", - "symfony/http-foundation": ">=2.7 <3.2", + "symfony/http-foundation": ">=2.7 <3.0", "guzzlehttp/guzzle": "~6.1", "gabordemooij/redbean": "~4.3", "doctrine/annotations": "1.2.*", - "symfony/expression-language": ">=2.7 <3.2", - "symfony/cache": ">=2.7 <3.2", + "symfony/expression-language": ">=2.7 <3.0", "psy/psysh": "0.6|0.8" }, "bin": ["bin/drupal"], diff --git a/composer.lock b/composer.lock index 377f3faa0..060896fdc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "0b6e2c2ce06250646c128230ac588d40", + "content-hash": "1252f8ea080f0076e3dbd69d1eb1eb3f", "packages": [ { "name": "alchemy/zippy", @@ -179,16 +179,16 @@ }, { "name": "dflydev/dot-access-configuration", - "version": "dev-master", + "version": "v1.0.1", "source": { "type": "git", "url": "https://github.com/dflydev/dflydev-dot-access-configuration.git", - "reference": "ae6e7138b1d9063d343322cca63994ee1ac5161d" + "reference": "9b65c83159c9003e00284ea1144ad96b69d9c8b9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-configuration/zipball/ae6e7138b1d9063d343322cca63994ee1ac5161d", - "reference": "ae6e7138b1d9063d343322cca63994ee1ac5161d", + "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-configuration/zipball/9b65c83159c9003e00284ea1144ad96b69d9c8b9", + "reference": "9b65c83159c9003e00284ea1144ad96b69d9c8b9", "shasum": "" }, "require": { @@ -235,7 +235,7 @@ "config", "configuration" ], - "time": "2016-12-12 17:43:40" + "time": "2014-11-14T03:26:12+00:00" }, { "name": "dflydev/dot-access-data", @@ -570,29 +570,29 @@ "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "4bc30ba4e76f0c9e26d761a6b3367827997d3df9" + "reference": "22db58d5433bad1bb0341a0349a8201ed61e782f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/4bc30ba4e76f0c9e26d761a6b3367827997d3df9", - "reference": "4bc30ba4e76f0c9e26d761a6b3367827997d3df9", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/22db58d5433bad1bb0341a0349a8201ed61e782f", + "reference": "22db58d5433bad1bb0341a0349a8201ed61e782f", "shasum": "" }, "require": { - "dflydev/dot-access-configuration": "dev-master", + "dflydev/dot-access-configuration": "~1.0.1", "drupal/console-en": "dev-master", "php": "^5.5.9 || ^7.0", "stecman/symfony-console-completion": "~0.7", - "symfony/config": ">=2.7 <3.2", - "symfony/console": ">=2.7 <3.2", - "symfony/debug": ">=2.6 <3.2", - "symfony/dependency-injection": ">=2.7 <3.2", - "symfony/event-dispatcher": ">=2.7 <3.2", - "symfony/filesystem": ">=2.7 <3.2", - "symfony/finder": ">=2.7 <3.2", - "symfony/process": ">=2.7 <3.2", - "symfony/translation": ">=2.7 <3.2", - "symfony/yaml": ">=2.7 <3.2", + "symfony/config": ">=2.7 <3.0", + "symfony/console": ">=2.7 <3.0", + "symfony/debug": ">=2.6 <3.0", + "symfony/dependency-injection": ">=2.7 <3.0", + "symfony/event-dispatcher": ">=2.7 <3.0", + "symfony/filesystem": ">=2.7 <3.0", + "symfony/finder": ">=2.7 <3.0", + "symfony/process": ">=2.7 <3.0", + "symfony/translation": ">=2.7 <3.0", + "symfony/yaml": ">=2.7 <3.0", "twig/twig": "^1.23.1", "webflo/drupal-finder": "0.*" }, @@ -643,7 +643,7 @@ "drupal", "symfony" ], - "time": "2017-01-08 05:11:34" + "time": "2017-01-19 07:18:36" }, { "name": "drupal/console-en", @@ -911,6 +911,48 @@ ], "time": "2016-06-24T23:00:38+00:00" }, + { + "name": "ircmaxell/password-compat", + "version": "v1.0.4", + "source": { + "type": "git", + "url": "https://github.com/ircmaxell/password_compat.git", + "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ircmaxell/password_compat/zipball/5c5cde8822a69545767f7c7f3058cb15ff84614c", + "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "4.*" + }, + "type": "library", + "autoload": { + "files": [ + "lib/password.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anthony Ferrara", + "email": "ircmaxell@php.net", + "homepage": "http://blog.ircmaxell.com" + } + ], + "description": "A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash", + "homepage": "https://github.com/ircmaxell/password_compat", + "keywords": [ + "hashing", + "password" + ], + "time": "2014-11-20T16:49:30+00:00" + }, { "name": "jakub-onderka/php-console-color", "version": "0.1", @@ -1049,52 +1091,6 @@ ], "time": "2016-12-06T11:30:35+00:00" }, - { - "name": "psr/cache", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/cache.git", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Cache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for caching libraries", - "keywords": [ - "cache", - "psr", - "psr-6" - ], - "time": "2016-08-06T20:24:11+00:00" - }, { "name": "psr/http-message", "version": "1.0.1", @@ -1310,92 +1306,26 @@ "description": "Automatic BASH completion for Symfony Console Component based applications.", "time": "2016-02-24T05:08:54+00:00" }, - { - "name": "symfony/cache", - "version": "v3.1.8", - "source": { - "type": "git", - "url": "https://github.com/symfony/cache.git", - "reference": "0f5881c9b8a03cef13fdee381f8ee623d0429cf4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/0f5881c9b8a03cef13fdee381f8ee623d0429cf4", - "reference": "0f5881c9b8a03cef13fdee381f8ee623d0429cf4", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "psr/cache": "~1.0", - "psr/log": "~1.0" - }, - "provide": { - "psr/cache-implementation": "1.0" - }, - "require-dev": { - "cache/integration-tests": "dev-master", - "doctrine/cache": "~1.6", - "predis/predis": "~1.0" - }, - "suggest": { - "symfony/polyfill-apcu": "For using ApcuAdapter on HHVM" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Cache\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony implementation of PSR-6", - "homepage": "https://symfony.com", - "keywords": [ - "caching", - "psr6" - ], - "time": "2016-11-09T14:09:05+00:00" - }, { "name": "symfony/config", - "version": "v3.1.8", + "version": "v2.8.16", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "b0fe918a721df5194ec5785fabb771302f2ca474" + "reference": "4537f2413348fe271c2c4b09da219ed615d79f9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/b0fe918a721df5194ec5785fabb771302f2ca474", - "reference": "b0fe918a721df5194ec5785fabb771302f2ca474", + "url": "https://api.github.com/repos/symfony/config/zipball/4537f2413348fe271c2c4b09da219ed615d79f9c", + "reference": "4537f2413348fe271c2c4b09da219ed615d79f9c", "shasum": "" }, "require": { - "php": ">=5.5.9", - "symfony/filesystem": "~2.8|~3.0" + "php": ">=5.3.9", + "symfony/filesystem": "~2.3|~3.0.0" }, "require-dev": { - "symfony/yaml": "~2.7|~3.0" + "symfony/yaml": "~2.7|~3.0.0" }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" @@ -1403,7 +1333,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "2.8-dev" } }, "autoload": { @@ -1430,31 +1360,31 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2016-12-10T08:22:22+00:00" + "time": "2017-01-02T20:30:24+00:00" }, { "name": "symfony/console", - "version": "v3.1.8", + "version": "v2.8.16", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "221a60fb2f369a065eea1ed96b61183219fdfa6e" + "reference": "2e18b8903d9c498ba02e1dfa73f64d4894bb6912" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/221a60fb2f369a065eea1ed96b61183219fdfa6e", - "reference": "221a60fb2f369a065eea1ed96b61183219fdfa6e", + "url": "https://api.github.com/repos/symfony/console/zipball/2e18b8903d9c498ba02e1dfa73f64d4894bb6912", + "reference": "2e18b8903d9c498ba02e1dfa73f64d4894bb6912", "shasum": "" }, "require": { - "php": ">=5.5.9", - "symfony/debug": "~2.8|~3.0", + "php": ">=5.3.9", + "symfony/debug": "~2.7,>=2.7.2|~3.0.0", "symfony/polyfill-mbstring": "~1.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.8|~3.0", - "symfony/process": "~2.8|~3.0" + "symfony/event-dispatcher": "~2.1|~3.0.0", + "symfony/process": "~2.1|~3.0.0" }, "suggest": { "psr/log": "For using the console logger", @@ -1464,7 +1394,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "2.8-dev" } }, "autoload": { @@ -1491,20 +1421,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-12-08T14:58:14+00:00" + "time": "2017-01-08T20:43:03+00:00" }, { "name": "symfony/css-selector", - "version": "v3.1.8", + "version": "v3.1.9", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "a37b3359566415a91cba55a2d95820b3fa1a9658" + "reference": "722a87478a72d95dc2a3bcf41dc9c2d13fd4cb2d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/a37b3359566415a91cba55a2d95820b3fa1a9658", - "reference": "a37b3359566415a91cba55a2d95820b3fa1a9658", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/722a87478a72d95dc2a3bcf41dc9c2d13fd4cb2d", + "reference": "722a87478a72d95dc2a3bcf41dc9c2d13fd4cb2d", "shasum": "" }, "require": { @@ -1544,37 +1474,37 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2016-11-03T08:04:31+00:00" + "time": "2017-01-02T20:31:54+00:00" }, { "name": "symfony/debug", - "version": "v3.1.8", + "version": "v2.8.16", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "c058661c32f5b462722e36d120905940089cbd9a" + "reference": "567681e2c4e5431704e884e4be25a95fd900770f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/c058661c32f5b462722e36d120905940089cbd9a", - "reference": "c058661c32f5b462722e36d120905940089cbd9a", + "url": "https://api.github.com/repos/symfony/debug/zipball/567681e2c4e5431704e884e4be25a95fd900770f", + "reference": "567681e2c4e5431704e884e4be25a95fd900770f", "shasum": "" }, "require": { - "php": ">=5.5.9", + "php": ">=5.3.9", "psr/log": "~1.0" }, "conflict": { "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" }, "require-dev": { - "symfony/class-loader": "~2.8|~3.0", - "symfony/http-kernel": "~2.8|~3.0" + "symfony/class-loader": "~2.2|~3.0.0", + "symfony/http-kernel": "~2.3.24|~2.5.9|~2.6,>=2.6.2|~3.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "2.8-dev" } }, "autoload": { @@ -1601,29 +1531,32 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2016-11-15T12:55:20+00:00" + "time": "2017-01-02T20:30:24+00:00" }, { "name": "symfony/dependency-injection", - "version": "v3.1.8", + "version": "v2.8.16", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "bd2a915cd29ccfc93c2835765a8b06dd1cc83aa9" + "reference": "b75356611675364607d697f314850d9d870a84aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/bd2a915cd29ccfc93c2835765a8b06dd1cc83aa9", - "reference": "bd2a915cd29ccfc93c2835765a8b06dd1cc83aa9", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/b75356611675364607d697f314850d9d870a84aa", + "reference": "b75356611675364607d697f314850d9d870a84aa", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": ">=5.3.9" + }, + "conflict": { + "symfony/expression-language": "<2.6" }, "require-dev": { - "symfony/config": "~2.8|~3.0", - "symfony/expression-language": "~2.8|~3.0", - "symfony/yaml": "~2.8.7|~3.0.7|~3.1.1|~3.2" + "symfony/config": "~2.2|~3.0.0", + "symfony/expression-language": "~2.6|~3.0.0", + "symfony/yaml": "~2.3.42|~2.7.14|~2.8.7|~3.0.7" }, "suggest": { "symfony/config": "", @@ -1634,7 +1567,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "2.8-dev" } }, "autoload": { @@ -1661,20 +1594,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2016-12-08T14:58:14+00:00" + "time": "2017-01-10T14:27:01+00:00" }, { "name": "symfony/dom-crawler", - "version": "v3.1.8", + "version": "v3.2.2", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "51e979357eba65b1e6aac7cba75cf5aa6379b8f3" + "reference": "27d9790840a4efd3b7bb8f5f4f9efc27b36b7024" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/51e979357eba65b1e6aac7cba75cf5aa6379b8f3", - "reference": "51e979357eba65b1e6aac7cba75cf5aa6379b8f3", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/27d9790840a4efd3b7bb8f5f4f9efc27b36b7024", + "reference": "27d9790840a4efd3b7bb8f5f4f9efc27b36b7024", "shasum": "" }, "require": { @@ -1690,7 +1623,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -1717,31 +1650,31 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2016-12-10T14:24:45+00:00" + "time": "2017-01-02T20:32:22+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v3.1.8", + "version": "v2.8.16", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "28b0832b2553ffb80cabef6a7a812ff1e670c0bc" + "reference": "74877977f90fb9c3e46378d5764217c55f32df34" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/28b0832b2553ffb80cabef6a7a812ff1e670c0bc", - "reference": "28b0832b2553ffb80cabef6a7a812ff1e670c0bc", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/74877977f90fb9c3e46378d5764217c55f32df34", + "reference": "74877977f90fb9c3e46378d5764217c55f32df34", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": ">=5.3.9" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~2.8|~3.0", - "symfony/expression-language": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0" + "symfony/config": "~2.0,>=2.0.5|~3.0.0", + "symfony/dependency-injection": "~2.6|~3.0.0", + "symfony/expression-language": "~2.6|~3.0.0", + "symfony/stopwatch": "~2.3|~3.0.0" }, "suggest": { "symfony/dependency-injection": "", @@ -1750,7 +1683,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "2.8-dev" } }, "autoload": { @@ -1777,29 +1710,29 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2016-10-13T06:28:43+00:00" + "time": "2017-01-02T20:30:24+00:00" }, { "name": "symfony/expression-language", - "version": "v3.1.8", + "version": "v2.8.16", "source": { "type": "git", "url": "https://github.com/symfony/expression-language.git", - "reference": "b39826dc179f4d45c6c9a3bd4b51912726c344a3" + "reference": "44b85c40c4982f45ef88bbde107463e912fb7a04" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/expression-language/zipball/b39826dc179f4d45c6c9a3bd4b51912726c344a3", - "reference": "b39826dc179f4d45c6c9a3bd4b51912726c344a3", + "url": "https://api.github.com/repos/symfony/expression-language/zipball/44b85c40c4982f45ef88bbde107463e912fb7a04", + "reference": "44b85c40c4982f45ef88bbde107463e912fb7a04", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": ">=5.3.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "2.8-dev" } }, "autoload": { @@ -1826,29 +1759,29 @@ ], "description": "Symfony ExpressionLanguage Component", "homepage": "https://symfony.com", - "time": "2016-11-03T08:04:31+00:00" + "time": "2017-01-02T20:30:24+00:00" }, { "name": "symfony/filesystem", - "version": "v3.1.8", + "version": "v2.8.16", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "509b2bc3636f11be17f5d8b5f083803c3257dc65" + "reference": "5b77d49ab76e5b12743b359ef4b4a712e6f5360d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/509b2bc3636f11be17f5d8b5f083803c3257dc65", - "reference": "509b2bc3636f11be17f5d8b5f083803c3257dc65", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/5b77d49ab76e5b12743b359ef4b4a712e6f5360d", + "reference": "5b77d49ab76e5b12743b359ef4b4a712e6f5360d", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": ">=5.3.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "2.8-dev" } }, "autoload": { @@ -1875,29 +1808,29 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2016-11-24T00:33:22+00:00" + "time": "2017-01-08T20:43:03+00:00" }, { "name": "symfony/finder", - "version": "v3.1.8", + "version": "v2.8.16", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "74dcd370c8d057882575e535616fde935e411b19" + "reference": "355fccac526522dc5fca8ecf0e62749a149f3b8b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/74dcd370c8d057882575e535616fde935e411b19", - "reference": "74dcd370c8d057882575e535616fde935e411b19", + "url": "https://api.github.com/repos/symfony/finder/zipball/355fccac526522dc5fca8ecf0e62749a149f3b8b", + "reference": "355fccac526522dc5fca8ecf0e62749a149f3b8b", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": ">=5.3.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "2.8-dev" } }, "autoload": { @@ -1924,33 +1857,35 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2016-12-13T09:38:21+00:00" + "time": "2017-01-02T20:30:24+00:00" }, { "name": "symfony/http-foundation", - "version": "v3.1.8", + "version": "v2.8.16", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "88a1d3cee2dbd06f7103ff63938743b903b65a92" + "reference": "464cdde6757a40701d758112cc7ff2c6adf6e82f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/88a1d3cee2dbd06f7103ff63938743b903b65a92", - "reference": "88a1d3cee2dbd06f7103ff63938743b903b65a92", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/464cdde6757a40701d758112cc7ff2c6adf6e82f", + "reference": "464cdde6757a40701d758112cc7ff2c6adf6e82f", "shasum": "" }, "require": { - "php": ">=5.5.9", - "symfony/polyfill-mbstring": "~1.1" + "php": ">=5.3.9", + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php54": "~1.0", + "symfony/polyfill-php55": "~1.0" }, "require-dev": { - "symfony/expression-language": "~2.8|~3.0" + "symfony/expression-language": "~2.4|~3.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "2.8-dev" } }, "autoload": { @@ -1977,7 +1912,7 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2016-11-27T04:21:07+00:00" + "time": "2017-01-08T20:43:03+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -2038,27 +1973,141 @@ ], "time": "2016-11-14T01:06:16+00:00" }, + { + "name": "symfony/polyfill-php54", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php54.git", + "reference": "90e085822963fdcc9d1c5b73deb3d2e5783b16a0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/90e085822963fdcc9d1c5b73deb3d2e5783b16a0", + "reference": "90e085822963fdcc9d1c5b73deb3d2e5783b16a0", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php54\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 5.4+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2016-11-14T01:06:16+00:00" + }, + { + "name": "symfony/polyfill-php55", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php55.git", + "reference": "03e3f0350bca2220e3623a0e340eef194405fc67" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/03e3f0350bca2220e3623a0e340eef194405fc67", + "reference": "03e3f0350bca2220e3623a0e340eef194405fc67", + "shasum": "" + }, + "require": { + "ircmaxell/password-compat": "~1.0", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php55\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2016-11-14T01:06:16+00:00" + }, { "name": "symfony/process", - "version": "v3.1.8", + "version": "v2.8.16", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "d23427a7f97a373129f61bc3b876fe4c66e2b3c7" + "reference": "ebb3c2abe0940a703f08e0cbe373f62d97d40231" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/d23427a7f97a373129f61bc3b876fe4c66e2b3c7", - "reference": "d23427a7f97a373129f61bc3b876fe4c66e2b3c7", + "url": "https://api.github.com/repos/symfony/process/zipball/ebb3c2abe0940a703f08e0cbe373f62d97d40231", + "reference": "ebb3c2abe0940a703f08e0cbe373f62d97d40231", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": ">=5.3.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "2.8-dev" } }, "autoload": { @@ -2085,34 +2134,34 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2016-11-24T01:08:05+00:00" + "time": "2017-01-02T20:30:24+00:00" }, { "name": "symfony/translation", - "version": "v3.1.8", + "version": "v2.8.16", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "2f4b6114b75c506dd1ee7eb485b35facbcb2d873" + "reference": "b4ac4a393f6970cc157fba17be537380de396a86" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/2f4b6114b75c506dd1ee7eb485b35facbcb2d873", - "reference": "2f4b6114b75c506dd1ee7eb485b35facbcb2d873", + "url": "https://api.github.com/repos/symfony/translation/zipball/b4ac4a393f6970cc157fba17be537380de396a86", + "reference": "b4ac4a393f6970cc157fba17be537380de396a86", "shasum": "" }, "require": { - "php": ">=5.5.9", + "php": ">=5.3.9", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/config": "<2.8" + "symfony/config": "<2.7" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/intl": "~2.8|~3.0", - "symfony/yaml": "~2.8|~3.0" + "symfony/config": "~2.8", + "symfony/intl": "~2.4|~3.0.0", + "symfony/yaml": "~2.2|~3.0.0" }, "suggest": { "psr/log": "To use logging capability in translator", @@ -2122,7 +2171,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "2.8-dev" } }, "autoload": { @@ -2149,20 +2198,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2016-11-18T21:15:08+00:00" + "time": "2017-01-02T20:30:24+00:00" }, { "name": "symfony/var-dumper", - "version": "v3.2.1", + "version": "v3.2.2", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "f722532b0966e9b6fc631e682143c07b2cf583a0" + "reference": "b54b23f9a19b465e76fdaac0f6732410467c83b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/f722532b0966e9b6fc631e682143c07b2cf583a0", - "reference": "f722532b0966e9b6fc631e682143c07b2cf583a0", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/b54b23f9a19b465e76fdaac0f6732410467c83b2", + "reference": "b54b23f9a19b465e76fdaac0f6732410467c83b2", "shasum": "" }, "require": { @@ -2212,29 +2261,29 @@ "debug", "dump" ], - "time": "2016-12-11T14:34:22+00:00" + "time": "2017-01-03T08:53:57+00:00" }, { "name": "symfony/yaml", - "version": "v3.1.8", + "version": "v2.8.16", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "da61ca54e755bda2108f97ce67c37f0713df15b2" + "reference": "dbe61fed9cd4a44c5b1d14e5e7b1a8640cfb2bf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/da61ca54e755bda2108f97ce67c37f0713df15b2", - "reference": "da61ca54e755bda2108f97ce67c37f0713df15b2", + "url": "https://api.github.com/repos/symfony/yaml/zipball/dbe61fed9cd4a44c5b1d14e5e7b1a8640cfb2bf2", + "reference": "dbe61fed9cd4a44c5b1d14e5e7b1a8640cfb2bf2", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": ">=5.3.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "2.8-dev" } }, "autoload": { @@ -2261,20 +2310,20 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-12-03T10:04:08+00:00" + "time": "2017-01-03T13:49:52+00:00" }, { "name": "twig/twig", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "c6ff71094fde15d12398eaba029434b013dc5e59" + "reference": "ddc9e3e20ee9c0b6908f401ac8353635b750eca7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/c6ff71094fde15d12398eaba029434b013dc5e59", - "reference": "c6ff71094fde15d12398eaba029434b013dc5e59", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/ddc9e3e20ee9c0b6908f401ac8353635b750eca7", + "reference": "ddc9e3e20ee9c0b6908f401ac8353635b750eca7", "shasum": "" }, "require": { @@ -2282,12 +2331,12 @@ }, "require-dev": { "symfony/debug": "~2.7", - "symfony/phpunit-bridge": "~3.2@dev" + "symfony/phpunit-bridge": "~3.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.30-dev" + "dev-master": "1.31-dev" } }, "autoload": { @@ -2322,7 +2371,7 @@ "keywords": [ "templating" ], - "time": "2016-12-23T11:06:22+00:00" + "time": "2017-01-11T19:36:15+00:00" }, { "name": "webflo/drupal-finder", From a66a5c7ed528f5a9ba80b08b73778689c2c1b9c2 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 19 Jan 2017 00:14:54 -0800 Subject: [PATCH 132/321] [console] Update symfony/css-selector dependecy. (#3105) --- composer.json | 2 +- composer.lock | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 92afb93ca..0561dbe15 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,7 @@ "drupal/console-core" : "dev-master", "alchemy/zippy": "0.4.3", "composer/installers": "~1.0", - "symfony/css-selector": ">=2.7 <3.2", + "symfony/css-selector": ">=2.7 <3.0", "symfony/dom-crawler": ">=2.7 <3.3", "symfony/http-foundation": ">=2.7 <3.0", "guzzlehttp/guzzle": "~6.1", diff --git a/composer.lock b/composer.lock index 060896fdc..344d5fa49 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "1252f8ea080f0076e3dbd69d1eb1eb3f", + "content-hash": "4f2fa6a1acdd2ccf0ecf3626f4d03843", "packages": [ { "name": "alchemy/zippy", @@ -1425,25 +1425,25 @@ }, { "name": "symfony/css-selector", - "version": "v3.1.9", + "version": "v2.8.16", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "722a87478a72d95dc2a3bcf41dc9c2d13fd4cb2d" + "reference": "f45daea42232d9ca5cf561ec64f0d4aea820877f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/722a87478a72d95dc2a3bcf41dc9c2d13fd4cb2d", - "reference": "722a87478a72d95dc2a3bcf41dc9c2d13fd4cb2d", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/f45daea42232d9ca5cf561ec64f0d4aea820877f", + "reference": "f45daea42232d9ca5cf561ec64f0d4aea820877f", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": ">=5.3.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "2.8-dev" } }, "autoload": { @@ -1474,7 +1474,7 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2017-01-02T20:31:54+00:00" + "time": "2017-01-02T20:30:24+00:00" }, { "name": "symfony/debug", From 3cc1e8b862130a6279b95a5d90ec2f81177fe536 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 19 Jan 2017 00:22:57 -0800 Subject: [PATCH 133/321] [database:log:poll] Register commmand. (#3106) --- config/services/drupal-console/database.yml | 5 +++ src/Command/Database/LogPollCommand.php | 43 ++++++++++----------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/config/services/drupal-console/database.yml b/config/services/drupal-console/database.yml index 65327cec7..354a26c03 100644 --- a/config/services/drupal-console/database.yml +++ b/config/services/drupal-console/database.yml @@ -36,6 +36,11 @@ services: arguments: ['@database', '@date.formatter', '@entity_type.manager', '@string_translation'] tags: - { name: drupal.command } + console.database_log_poll: + class: Drupal\Console\Command\Database\LogPollCommand + arguments: ['@database', '@date.formatter', '@entity_type.manager', '@string_translation'] + tags: + - { name: drupal.command } console.database_restore: class: Drupal\Console\Command\Database\RestoreCommand arguments: ['@app.root'] diff --git a/src/Command/Database/LogPollCommand.php b/src/Command/Database/LogPollCommand.php index 438ab8c81..46a0d6257 100644 --- a/src/Command/Database/LogPollCommand.php +++ b/src/Command/Database/LogPollCommand.php @@ -15,13 +15,28 @@ class LogPollCommand extends DatabaseLogBase { /** - * @var - */ + * @var + */ protected $duration; /** - * - */ + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $io->note($this->trans('commands.database.log.poll.messages.warning')); + + $this->getDefaultOptions($input); + $this->duration = $input->getArgument('duration'); + + $this->pollForEvents($io); + } + + /** + * {@inheritdoc} + */ protected function configure() { $this @@ -39,24 +54,8 @@ protected function configure() } /** - * @param \Symfony\Component\Console\Input\InputInterface $input - * @param \Symfony\Component\Console\Output\OutputInterface $output - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $io->note($this->trans('commands.database.log.poll.messages.warning')); - - $this->getDefaultOptions($input); - $this->duration = $input->getArgument('duration'); - - $this->pollForEvents($io); - } - - /** - * @param \Drupal\Console\Core\Style\DrupalStyle $io - */ + * @param DrupalStyle $io + */ protected function pollForEvents(DrupalStyle $io) { $query = $this->makeQuery($io)->countQuery(); From 14c4eb873eb9f8ba0c6b9f12773d8fd0aa1b2be1 Mon Sep 17 00:00:00 2001 From: Rohit Joshi Date: Thu, 19 Jan 2017 19:50:54 +0530 Subject: [PATCH 134/321] [generate:cache:context] New command to generate cache context (#3099) * Adding new command to generate custom cache context * Updating the cache context name default value. --- config/services/drupal-console/generate.yml | 5 + config/services/drupal-console/generator.yml | 5 + src/Command/Generate/CacheContextCommand.php | 132 +++++++++++++++++++ src/Generator/CacheContextGenerator.php | 62 +++++++++ templates/module/src/cache-context.php.twig | 55 ++++++++ 5 files changed, 259 insertions(+) create mode 100644 src/Command/Generate/CacheContextCommand.php create mode 100644 src/Generator/CacheContextGenerator.php create mode 100644 templates/module/src/cache-context.php.twig diff --git a/config/services/drupal-console/generate.yml b/config/services/drupal-console/generate.yml index 41a8cfdf2..c1ec8ea50 100644 --- a/config/services/drupal-console/generate.yml +++ b/config/services/drupal-console/generate.yml @@ -194,3 +194,8 @@ services: arguments: ['@console.extension_manager', '@console.entityconfig_generator', '@console.validator', '@console.string_converter'] tags: - { name: drupal.command } + console.generate_cache_context: + class: Drupal\Console\Command\Generate\CacheContextCommand + arguments: [ '@console.cache_context_generator', '@console.chain_queue'] + tags: + - { name: drupal.command } diff --git a/config/services/drupal-console/generator.yml b/config/services/drupal-console/generator.yml index 2b7ea49bb..ca9e6a950 100644 --- a/config/services/drupal-console/generator.yml +++ b/config/services/drupal-console/generator.yml @@ -191,3 +191,8 @@ services: arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + console.cache_context_generator: + class: Drupal\Console\Generator\CacheContextGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } diff --git a/src/Command/Generate/CacheContextCommand.php b/src/Command/Generate/CacheContextCommand.php new file mode 100644 index 000000000..05e737f04 --- /dev/null +++ b/src/Command/Generate/CacheContextCommand.php @@ -0,0 +1,132 @@ +generator = $generator; + $this->chainQueue = $chainQueue; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('generate:cache:context') + ->setDescription($this->trans('commands.generate.cache.context.description')) + ->setHelp($this->trans('commands.generate.cache.context.description')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'cache_context', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.cache.context.questions.name') + ) + ->addOption( + 'class', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.cache.context.questions.class') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return; + } + + $module = $input->getOption('module'); + $cache_context = $input->getOption('cache_context'); + $class = $input->getOption('class'); + + $this->generator->generate($module, $cache_context, $class); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --cache_context option + $cache_context = $input->getOption('cache_context'); + if (!$cache_context) { + $cache_context = $io->ask( + $this->trans('ccommands.generate.cache.context.questions.name'), + sprintf('%s', $module) + ); + $input->setOption('name', $cache_context); + } + + // --class option + $class = $input->getOption('class'); + if (!$class) { + $class = $io->ask( + $this->trans('commands.generate.cache.context.questions.class'), + 'DefaultCacheContext' + ); + $input->setOption('class', $class); + } + } +} diff --git a/src/Generator/CacheContextGenerator.php b/src/Generator/CacheContextGenerator.php new file mode 100644 index 000000000..08e052742 --- /dev/null +++ b/src/Generator/CacheContextGenerator.php @@ -0,0 +1,62 @@ +extensionManager = $extensionManager; + } + + /** + * Generator Service. + * + * @param string $module Module name + * @param string $cache_context Cache context name + * @param string $class Class name + */ + public function generate($module, $cache_context, $class) + { + $parameters = [ + 'module' => $module, + 'name' => 'cache_context.' . $cache_context, + 'class' => $class, + 'class_path' => sprintf('Drupal\%s\CacheContext\%s', $module, $class), + 'tags' => ['name' => 'cache_context'], + 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'), + ]; + + $this->renderFile( + 'module/src/cache-context.php.twig', + $this->extensionManager->getModule($module)->getSourcePath().'/CacheContext/'.$class.'.php', + $parameters + ); + + $this->renderFile( + 'module/services.yml.twig', + $this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml', + $parameters, + FILE_APPEND + ); + } +} diff --git a/templates/module/src/cache-context.php.twig b/templates/module/src/cache-context.php.twig new file mode 100644 index 000000000..1719f153c --- /dev/null +++ b/templates/module/src/cache-context.php.twig @@ -0,0 +1,55 @@ +{% extends "base/class.php.twig" %} + +{% block file_path %} + \Drupal\{{module}}\{{ class }}. +{% endblock %} + +{% block namespace_class %} + namespace Drupal\{{module}}\CacheContext; +{% endblock %} + +{% block use_class %} + use Drupal\Core\Cache\Context\CacheContextInterface; +{% endblock %} + +{% block class_declaration %} + /** + * Class {{ class }}. + * + * @package Drupal\{{module}} + */ + class {{ class }} implements CacheContextInterface {% endblock %} + +{% block class_construct %} + + /** + * Constructor. + */ + public function __construct({{ servicesAsParameters(services)|join(', ') }}) { + {{ serviceClassInitialization(services) }} + } + +{% endblock %} + +{% block class_methods %} + /** + * {@inheritdoc} + */ + static function getLabel() { + drupal_set_message('Lable of cache context'); + } + + /** + * {@inheritdoc} + */ + public function getContext() { + // Actual logic of context variation will lie here. + } + + /** + * {@inheritdoc} + */ + public function getCacheableMetadata() { + // The buble cache metadata. + } +{% endblock %} From 4a34cf427a173e2ceaae020d221b4be2a9531413 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 19 Jan 2017 20:49:12 -0800 Subject: [PATCH 135/321] [console] Update DrupalKernel class. (#3110) --- src/Bootstrap/Drupal.php | 5 +++-- src/Bootstrap/DrupalKernel.php | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index 14cb7c33d..50525785a 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -81,11 +81,12 @@ public function boot($debug) $request, $this->autoload, 'prod', - false + false, + $this->appRoot ); if ($debug) { $io->writeln("\r\033[K\033[1A\r✔"); - $io->writeln('➤ Providing dynamic services'); + $io->writeln('➤ Registering dynamic services'); } $drupalKernel->addServiceModifier( new DrupalServiceModifier( diff --git a/src/Bootstrap/DrupalKernel.php b/src/Bootstrap/DrupalKernel.php index e4b086811..0bf201230 100644 --- a/src/Bootstrap/DrupalKernel.php +++ b/src/Bootstrap/DrupalKernel.php @@ -23,8 +23,8 @@ class DrupalKernel extends DrupalKernelBase */ public static function createFromRequest(Request $request, $class_loader, $environment, $allow_dumping = true, $app_root = null) { - $kernel = new static($environment, $class_loader, $allow_dumping); - static::bootEnvironment(); + $kernel = new static($environment, $class_loader, $allow_dumping, $app_root); + static::bootEnvironment($app_root); $kernel->initializeSettings($request); $kernel->handle($request); return $kernel; From 37a1f6bf942424bfb48b9db34393e7069245e1cd Mon Sep 17 00:00:00 2001 From: Rohit Joshi Date: Fri, 20 Jan 2017 23:35:04 +0530 Subject: [PATCH 136/321] Adding missing required dependency (#3114) * Adding required missing extension manager service. * Adding option to load services from container. * Adding string converter service. --- config/services/drupal-console/generate.yml | 2 +- src/Command/Generate/CacheContextCommand.php | 46 +++++++++++-- src/Generator/CacheContextGenerator.php | 4 +- templates/module/src/cache-context.php.twig | 70 ++++++++++---------- 4 files changed, 81 insertions(+), 41 deletions(-) diff --git a/config/services/drupal-console/generate.yml b/config/services/drupal-console/generate.yml index c1ec8ea50..5f61fd8a7 100644 --- a/config/services/drupal-console/generate.yml +++ b/config/services/drupal-console/generate.yml @@ -196,6 +196,6 @@ services: - { name: drupal.command } console.generate_cache_context: class: Drupal\Console\Command\Generate\CacheContextCommand - arguments: [ '@console.cache_context_generator', '@console.chain_queue'] + arguments: [ '@console.cache_context_generator', '@console.chain_queue', '@console.extension_manager', '@console.string_converter''] tags: - { name: drupal.command } diff --git a/src/Command/Generate/CacheContextCommand.php b/src/Command/Generate/CacheContextCommand.php index 05e737f04..7fdc5ed6b 100644 --- a/src/Command/Generate/CacheContextCommand.php +++ b/src/Command/Generate/CacheContextCommand.php @@ -17,12 +17,16 @@ use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Core\Utils\ChainQueue; +use Drupal\Console\Extension\Manager; +use Drupal\Console\Command\Shared\ServicesTrait; +use Drupal\Console\Core\Utils\StringConverter; class CacheContextCommand extends Command { use ModuleTrait; use ConfirmationTrait; use ContainerAwareCommandTrait; + use ServicesTrait; /** * @var CacheContextGenerator @@ -34,18 +38,34 @@ class CacheContextCommand extends Command */ protected $chainQueue; + /** + * @var Manager + */ + protected $extensionManager; + + /** + * @var StringConverter + */ + protected $stringConverter; + /** * CacheContextCommand constructor. * * @param CacheContextGenerator $generator * @param ChainQueue $chainQueue + * @param Manager $extensionManager + * @param StringConverter $stringConverter */ public function __construct( CacheContextGenerator $generator, - ChainQueue $chainQueue + ChainQueue $chainQueue, + Manager $extensionManager, + StringConverter $stringConverter ) { $this->generator = $generator; $this->chainQueue = $chainQueue; + $this->extensionManager = $extensionManager; + $this->stringConverter = $stringConverter; parent::__construct(); } @@ -70,6 +90,12 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.cache.context.questions.class') + ) + ->addOption( + 'services', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.common.options.services') ); } @@ -88,8 +114,12 @@ protected function execute(InputInterface $input, OutputInterface $output) $module = $input->getOption('module'); $cache_context = $input->getOption('cache_context'); $class = $input->getOption('class'); + $services = $input->getOption('services'); - $this->generator->generate($module, $cache_context, $class); + // @see Drupal\Console\Command\Shared\ServicesTrait::buildServices + $buildServices = $this->buildServices($services); + + $this->generator->generate($module, $cache_context, $class, $buildServices); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); } @@ -113,10 +143,10 @@ protected function interact(InputInterface $input, OutputInterface $output) $cache_context = $input->getOption('cache_context'); if (!$cache_context) { $cache_context = $io->ask( - $this->trans('ccommands.generate.cache.context.questions.name'), + $this->trans('commands.generate.cache.context.questions.name'), sprintf('%s', $module) ); - $input->setOption('name', $cache_context); + $input->setOption('cache_context', $cache_context); } // --class option @@ -128,5 +158,13 @@ protected function interact(InputInterface $input, OutputInterface $output) ); $input->setOption('class', $class); } + + // --services option + $services = $input->getOption('services'); + if (!$services) { + // @see Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion + $services = $this->servicesQuestion($io); + $input->setOption('services', $services); + } } } diff --git a/src/Generator/CacheContextGenerator.php b/src/Generator/CacheContextGenerator.php index 08e052742..ea30605be 100644 --- a/src/Generator/CacheContextGenerator.php +++ b/src/Generator/CacheContextGenerator.php @@ -34,13 +34,15 @@ public function __construct( * @param string $module Module name * @param string $cache_context Cache context name * @param string $class Class name + * @param array $services List of services */ - public function generate($module, $cache_context, $class) + public function generate($module, $cache_context, $class, $services) { $parameters = [ 'module' => $module, 'name' => 'cache_context.' . $cache_context, 'class' => $class, + 'services' => $services, 'class_path' => sprintf('Drupal\%s\CacheContext\%s', $module, $class), 'tags' => ['name' => 'cache_context'], 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'), diff --git a/templates/module/src/cache-context.php.twig b/templates/module/src/cache-context.php.twig index 1719f153c..09c3e4b9f 100644 --- a/templates/module/src/cache-context.php.twig +++ b/templates/module/src/cache-context.php.twig @@ -1,55 +1,55 @@ {% extends "base/class.php.twig" %} {% block file_path %} - \Drupal\{{module}}\{{ class }}. +\Drupal\{{module}}\{{ class }}. {% endblock %} {% block namespace_class %} - namespace Drupal\{{module}}\CacheContext; +namespace Drupal\{{module}}\CacheContext; {% endblock %} {% block use_class %} - use Drupal\Core\Cache\Context\CacheContextInterface; +use Drupal\Core\Cache\Context\CacheContextInterface; {% endblock %} {% block class_declaration %} - /** - * Class {{ class }}. - * - * @package Drupal\{{module}} - */ - class {{ class }} implements CacheContextInterface {% endblock %} +/** +* Class {{ class }}. +* +* @package Drupal\{{module}} +*/ +class {{ class }} implements CacheContextInterface {% endblock %} {% block class_construct %} - /** - * Constructor. - */ - public function __construct({{ servicesAsParameters(services)|join(', ') }}) { - {{ serviceClassInitialization(services) }} - } + /** + * Constructor. + */ + public function __construct({{ servicesAsParameters(services)|join(', ') }}) { + {{ serviceClassInitialization(services) }} + } {% endblock %} {% block class_methods %} - /** - * {@inheritdoc} - */ - static function getLabel() { - drupal_set_message('Lable of cache context'); - } - - /** - * {@inheritdoc} - */ - public function getContext() { - // Actual logic of context variation will lie here. - } - - /** - * {@inheritdoc} - */ - public function getCacheableMetadata() { - // The buble cache metadata. - } + /** + * {@inheritdoc} + */ + static function getLabel() { + drupal_set_message('Lable of cache context'); + } + + /** + * {@inheritdoc} + */ + public function getContext() { + // Actual logic of context variation will lie here. + } + + /** + * {@inheritdoc} + */ + public function getCacheableMetadata() { + // The buble cache metadata. + } {% endblock %} From 4a1aef811cdd9b88669f9c11b3f2adb0dac1ed5c Mon Sep 17 00:00:00 2001 From: Davvid Date: Sat, 21 Jan 2017 20:03:58 +0100 Subject: [PATCH 137/321] Add location for contributed database drivers. (#3112) --- src/Utils/Site.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Utils/Site.php b/src/Utils/Site.php index 18abd5e9c..b60231c64 100644 --- a/src/Utils/Site.php +++ b/src/Utils/Site.php @@ -66,6 +66,7 @@ public function getDatabaseTypes() $finder = new Finder(); $finder->directories() ->in($this->appRoot . '/core/lib/Drupal/Core/Database/Driver') + ->in($this->appRoot . '/drivers/lib/Drupal/Driver/Database') ->depth('== 0'); $databases = []; From 18a445c240c281115c18c5c350885025cf2aef63 Mon Sep 17 00:00:00 2001 From: Rohit Joshi Date: Sun, 22 Jan 2017 03:18:49 +0530 Subject: [PATCH 138/321] Adding new command to generate process plugin of migrate. (#3116) * Adding new command to generate process plugin of migrate. * Fixing corrupted yaml. --- config/services/drupal-console/generate.yml | 7 +- config/services/drupal-console/generator.yml | 5 + .../Generate/PluginMigrateProcessCommand.php | 147 ++++++++++++++++++ .../PluginMigrateProcessGenerator.php | 52 +++++++ .../Plugin/migrate/process/process.php.twig | 33 ++++ 5 files changed, 243 insertions(+), 1 deletion(-) create mode 100644 src/Command/Generate/PluginMigrateProcessCommand.php create mode 100644 src/Generator/PluginMigrateProcessGenerator.php create mode 100644 templates/module/src/Plugin/migrate/process/process.php.twig diff --git a/config/services/drupal-console/generate.yml b/config/services/drupal-console/generate.yml index 5f61fd8a7..f5894a994 100644 --- a/config/services/drupal-console/generate.yml +++ b/config/services/drupal-console/generate.yml @@ -104,6 +104,11 @@ services: arguments: ['@config.factory', '@console.chain_queue', '@console.plugin_migrate_source_generator', '@entity_type.manager', '@console.extension_manager', '@console.validator', '@console.string_converter', '@plugin.manager.element_info'] tags: - { name: drupal.command } + console.generate_plugin_migrate_process: + class: Drupal\Console\Command\Generate\PluginMigrateProcessCommand + arguments: [ '@console.plugin_migrate_process_generator', '@console.chain_queue', '@console.extension_manager', '@console.string_converter'] + tags: + - { name: drupal.command } console.generate_plugin_rest_resource: class: Drupal\Console\Command\Generate\PluginRestResourceCommand arguments: ['@console.extension_manager', '@console.plugin_rest_resource_generator','@console.string_converter', '@console.chain_queue'] @@ -196,6 +201,6 @@ services: - { name: drupal.command } console.generate_cache_context: class: Drupal\Console\Command\Generate\CacheContextCommand - arguments: [ '@console.cache_context_generator', '@console.chain_queue', '@console.extension_manager', '@console.string_converter''] + arguments: [ '@console.cache_context_generator', '@console.chain_queue', '@console.extension_manager', '@console.string_converter'] tags: - { name: drupal.command } diff --git a/config/services/drupal-console/generator.yml b/config/services/drupal-console/generator.yml index ca9e6a950..41ccdebda 100644 --- a/config/services/drupal-console/generator.yml +++ b/config/services/drupal-console/generator.yml @@ -101,6 +101,11 @@ services: arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + console.plugin_migrate_process_generator: + class: Drupal\Console\Generator\PluginMigrateProcessGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } console.plugin_rest_resource_generator: class: Drupal\Console\Generator\PluginRestResourceGenerator arguments: ['@console.extension_manager'] diff --git a/src/Command/Generate/PluginMigrateProcessCommand.php b/src/Command/Generate/PluginMigrateProcessCommand.php new file mode 100644 index 000000000..cd1b75919 --- /dev/null +++ b/src/Command/Generate/PluginMigrateProcessCommand.php @@ -0,0 +1,147 @@ +generator = $generator; + $this->chainQueue = $chainQueue; + $this->extensionManager = $extensionManager; + $this->stringConverter = $stringConverter; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:plugin:migrate:process') + ->setDescription($this->trans('commands.generate.plugin.migrate.process.description')) + ->setHelp($this->trans('commands.generate.plugin.migrate.process.help')) + ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'class', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.migrate.process.options.class') + ) + ->addOption( + 'plugin-id', + '', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.migrate.process.options.plugin-id') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $class_name = $input->getOption('class'); + $plugin_id = $input->getOption('plugin-id'); + + $this->generator->generate($module, $class_name, $plugin_id); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // 'module-name' option. + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // 'class-name' option + $class = $input->getOption('class'); + if (!$class) { + $class = $io->ask( + $this->trans('commands.generate.plugin.migrate.process.questions.class'), + ucfirst($this->stringConverter->underscoreToCamelCase($module)) + ); + $input->setOption('class', $class); + } + + // 'plugin-id' option. + $pluginId = $input->getOption('plugin-id'); + if (!$pluginId) { + $pluginId = $io->ask( + $this->trans('commands.generate.plugin.migrate.source.questions.plugin-id'), + $this->stringConverter->camelCaseToUnderscore($class) + ); + $input->setOption('plugin-id', $pluginId); + } + } +} diff --git a/src/Generator/PluginMigrateProcessGenerator.php b/src/Generator/PluginMigrateProcessGenerator.php new file mode 100644 index 000000000..227a5eda8 --- /dev/null +++ b/src/Generator/PluginMigrateProcessGenerator.php @@ -0,0 +1,52 @@ +extensionManager = $extensionManager; + } + + /** + * Generate Migrate Source plugin code. + * + * @param $module + * @param $class_name + * @param $plugin_id + */ + public function generate($module, $class_name, $plugin_id) + { + $parameters = [ + 'module' => $module, + 'class_name' => $class_name, + 'plugin_id' => $plugin_id, + ]; + + $this->renderFile( + 'module/src/Plugin/migrate/process/process.php.twig', + $this->extensionManager->getPluginPath($module, 'migrate').'/process/'.$class_name.'.php', + $parameters + ); + } +} diff --git a/templates/module/src/Plugin/migrate/process/process.php.twig b/templates/module/src/Plugin/migrate/process/process.php.twig new file mode 100644 index 000000000..fe18d3208 --- /dev/null +++ b/templates/module/src/Plugin/migrate/process/process.php.twig @@ -0,0 +1,33 @@ +{% extends "base/class.php.twig" %} + +{% block file_path %} +\Drupal\{{module}}\Plugin\migrate\process\{{class_name}}. +{% endblock %} + +{% block namespace_class %} +namespace Drupal\{{module}}\Plugin\migrate\process; +{% endblock %} + +{% block use_class %} +use Drupal\migrate\ProcessPluginBase; +use Drupal\migrate\MigrateExecutableInterface; +use Drupal\migrate\Row; +{% endblock %} + +{% block class_declaration %} +/** + * Provides a '{{class_name}}' migrate process plugin. + * + * @MigrateProcess( + * id = "{{plugin_id}}" + * ) + */ +class {{class_name}} extends ProcessPluginBase {% endblock %} +{% block class_methods %} + /** + * {@inheritdoc} + */ + public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { + // Plugin logic goes here. + } +{% endblock %} From d76f8ff752be545e07ae88a5f82d009e58fa3080 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 22 Jan 2017 00:57:44 -0800 Subject: [PATCH 139/321] [server] Show listening on address. (#3117) --- src/Command/ServerCommand.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Command/ServerCommand.php b/src/Command/ServerCommand.php index 26707ba57..8d468f59d 100644 --- a/src/Command/ServerCommand.php +++ b/src/Command/ServerCommand.php @@ -10,7 +10,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Process\Exception\RuntimeException; use Symfony\Component\Process\ProcessBuilder; use Symfony\Component\Process\PhpExecutableFinder; use Symfony\Component\Console\Command\Command; @@ -81,10 +80,6 @@ protected function execute(InputInterface $input, OutputInterface $output) $processBuilder->setWorkingDirectory($this->appRoot); $process = $processBuilder->getProcess(); - if ($learning) { - $io->commentBlock($process->getCommandLine()); - } - $io->success( sprintf( $this->trans('commands.server.messages.executing'), @@ -92,6 +87,13 @@ protected function execute(InputInterface $input, OutputInterface $output) ) ); + $io->commentBlock( + sprintf( + $this->trans('commands.server.messages.listening'), + $address + ) + ); + // Use the process helper to copy process output to console output. $this->getHelper('process')->run($output, $process, null, null); From 5431707e9c0e0cd08cb128b1e9706fd81b261d6b Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 22 Jan 2017 01:04:09 -0800 Subject: [PATCH 140/321] [config:delete] Use StorageInterface. (#3118) --- src/Command/Config/DeleteCommand.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Command/Config/DeleteCommand.php b/src/Command/Config/DeleteCommand.php index b235f625a..eb6afdcad 100644 --- a/src/Command/Config/DeleteCommand.php +++ b/src/Command/Config/DeleteCommand.php @@ -6,12 +6,12 @@ namespace Drupal\Console\Command\Config; -use Drupal\Core\Config\FileStorage; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Yaml\Exception\RuntimeException; use Symfony\Component\Console\Command\Command; +use Drupal\Core\Config\StorageInterface; use Drupal\Core\Config\CachedStorage; use Drupal\Core\Config\ConfigFactory; use Drupal\Console\Core\Command\Shared\CommandTrait; @@ -34,21 +34,21 @@ class DeleteCommand extends Command protected $configStorage; /** - * @var FileStorage + * @var StorageInterface */ protected $configStorageSync; /** * DeleteCommand constructor. * - * @param ConfigFactory $configFactory - * @param CachedStorage $configStorage - * @param FileStorage $configStorageSync + * @param ConfigFactory $configFactory + * @param CachedStorage $configStorage + * @param StorageInterface $configStorageSync */ public function __construct( ConfigFactory $configFactory, CachedStorage $configStorage, - FileStorage $configStorageSync + StorageInterface $configStorageSync ) { $this->configFactory = $configFactory; $this->configStorage = $configStorage; From dc13714af917ab2205b0bb9de965f0ffdaae591a Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 22 Jan 2017 01:18:36 -0800 Subject: [PATCH 141/321] [config:*] Fix transaltion keys. (#3119) --- src/Command/Config/ImportCommand.php | 3 --- src/Command/Config/ValidateCommand.php | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Command/Config/ImportCommand.php b/src/Command/Config/ImportCommand.php index 20ca002c4..5dc076e31 100644 --- a/src/Command/Config/ImportCommand.php +++ b/src/Command/Config/ImportCommand.php @@ -6,12 +6,9 @@ namespace Drupal\Console\Command\Config; -use Symfony\Component\Config\Definition\Exception\Exception; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Yaml\Parser; -use Symfony\Component\Finder\Finder; use Symfony\Component\Console\Command\Command; use Drupal\Core\Config\CachedStorage; use Drupal\Core\Config\ConfigManager; diff --git a/src/Command/Config/ValidateCommand.php b/src/Command/Config/ValidateCommand.php index 186a394c1..3c8934558 100644 --- a/src/Command/Config/ValidateCommand.php +++ b/src/Command/Config/ValidateCommand.php @@ -34,7 +34,7 @@ protected function configure() { $this ->setName('config:validate') - ->setDescription($this->trans('commands.config.default.description')) + ->setDescription($this->trans('commands.config.validate.description')) ->addArgument('config.name', InputArgument::REQUIRED); } @@ -54,7 +54,7 @@ protected function execute(InputInterface $input, OutputInterface $output) //Test the config name and see if a schema exists, if not it will fail $name = $input->getArgument('config.name'); if (!$typedConfigManager->hasConfigSchema($name)) { - $io->warning($this->trans('commands.config.default.messages.noconf')); + $io->warning($this->trans('commands.config.validate.messages.no-conf')); return 1; } From e5b00f2b46b77997b6eeed89b731276c14960c0c Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 22 Jan 2017 01:29:57 -0800 Subject: [PATCH 142/321] [features:import] Fix translations keys. (#3120) --- src/Command/Features/ImportCommand.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Command/Features/ImportCommand.php b/src/Command/Features/ImportCommand.php index 955387e03..31ae21481 100644 --- a/src/Command/Features/ImportCommand.php +++ b/src/Command/Features/ImportCommand.php @@ -43,9 +43,13 @@ protected function configure() 'bundle', '', InputOption::VALUE_OPTIONAL, - $this->trans('commands.features.import.options.packages') + $this->trans('commands.features.import.options.bundle') ) - ->addArgument('packages', InputArgument::IS_ARRAY, $this->trans('commands.features.import.arguments.packages')); + ->addArgument( + 'packages', + InputArgument::IS_ARRAY, + $this->trans('commands.features.import.arguments.packages') + ); } protected function execute(InputInterface $input, OutputInterface $output) From 133ad47e1b79872307d1cffe24baa0ff5a76afea Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 22 Jan 2017 20:33:31 -0800 Subject: [PATCH 143/321] [generate:controller] Rename module as extension. (#3122) [generate:controller] Rename option module as extension. --- src/Application.php | 14 +-- src/Bootstrap/AddServicesCompilerPass.php | 16 ++++ src/Command/Generate/CommandCommand.php | 40 +++++--- src/Command/Shared/ExtensionTrait.php | 94 +++++++++++++++++++ src/Command/Shared/ModuleTrait.php | 2 +- src/Extension/Manager.php | 11 +++ src/Generator/CommandGenerator.php | 22 +++-- templates/module/src/Command/command.php.twig | 10 +- 8 files changed, 173 insertions(+), 36 deletions(-) create mode 100644 src/Command/Shared/ExtensionTrait.php diff --git a/src/Application.php b/src/Application.php index 465cb8b2d..3242260d9 100644 --- a/src/Application.php +++ b/src/Application.php @@ -5,11 +5,9 @@ use Doctrine\Common\Annotations\AnnotationRegistry; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Console\Annotations\DrupalCommandAnnotationReader; use Drupal\Console\Utils\AnnotationValidator; -use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Core\Application as BaseApplication; /** @@ -153,7 +151,9 @@ private function registerCommands() continue; } - if ($annotation = $annotationCommandReader->readAnnotation($serviceDefinition->getClass())) { + $annotation = $annotationCommandReader + ->readAnnotation($serviceDefinition->getClass()); + if ($annotation) { $this->container->get('console.translator_manager') ->addResourceTranslationsByExtension( $annotation['extension'], @@ -225,8 +225,8 @@ public function getData() $namespaces = array_filter( $this->getNamespaces(), function ($item) { - return (strpos($item, ':')<=0); - } + return (strpos($item, ':')<=0); + } ); sort($namespaces); array_unshift($namespaces, 'misc'); @@ -235,8 +235,8 @@ public function getData() $commands = $this->all($namespace); usort( $commands, function ($cmd1, $cmd2) { - return strcmp($cmd1->getName(), $cmd2->getName()); - } + return strcmp($cmd1->getName(), $cmd2->getName()); + } ); foreach ($commands as $command) { diff --git a/src/Bootstrap/AddServicesCompilerPass.php b/src/Bootstrap/AddServicesCompilerPass.php index 81b2c161a..2d7d9c2ab 100644 --- a/src/Bootstrap/AddServicesCompilerPass.php +++ b/src/Bootstrap/AddServicesCompilerPass.php @@ -95,6 +95,22 @@ public function process(ContainerBuilder $container) } } + /** + * @var Extension[] $themes + */ + $themes = $extensionManager->discoverThemes() + ->showNoCore() + ->showInstalled() + ->getList(false); + + foreach ($themes as $theme) { + $consoleServicesFile = $this->appRoot . '/' . + $theme->getPath() . '/console.services.yml'; + if (is_file($consoleServicesFile)) { + $loader->load($consoleServicesFile); + } + } + $container->setParameter( 'console.service_definitions', $container->getDefinitions() diff --git a/src/Command/Generate/CommandCommand.php b/src/Command/Generate/CommandCommand.php index eb9752f5c..7255609cd 100644 --- a/src/Command/Generate/CommandCommand.php +++ b/src/Command/Generate/CommandCommand.php @@ -7,6 +7,7 @@ namespace Drupal\Console\Command\Generate; +use Drupal\Console\Command\Shared\ExtensionTrait; use Drupal\Console\Command\Shared\ServicesTrait; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -27,6 +28,7 @@ class CommandCommand extends Command use ConfirmationTrait; use ServicesTrait; use ModuleTrait; + use ExtensionTrait; /** * @var CommandGenerator @@ -79,10 +81,16 @@ protected function configure() ->setDescription($this->trans('commands.generate.command.description')) ->setHelp($this->trans('commands.generate.command.help')) ->addOption( - 'module', + 'extension', '', InputOption::VALUE_REQUIRED, - $this->trans('commands.common.options.module') + $this->trans('commands.common.options.extension') + ) + ->addOption( + 'extension-type', + '', + InputOption::VALUE_REQUIRED, + $this->trans('commands.common.options.extension-type') ) ->addOption( 'class', @@ -117,7 +125,8 @@ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); - $module = $input->getOption('module'); + $extension = $input->getOption('extension'); + $extensionType = $input->getOption('extension-type'); $class = $input->getOption('class'); $name = $input->getOption('name'); $containerAware = $input->getOption('container-aware'); @@ -133,7 +142,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $build_services = $this->buildServices($services); $this->generator->generate( - $module, + $extension, + $extensionType, $name, $class, $containerAware, @@ -148,24 +158,28 @@ protected function interact(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); - // --module option - $module = $input->getOption('module'); - if (!$module) { - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); + $extension = $input->getOption('extension'); + if (!$extension) { + $extension = $this->extensionQuestion($io, true, true); + $input->setOption('extension', $extension->getName()); + $input->setOption('extension-type', $extension->getType()); + } + + $extensionType = $input->getOption('extension-type'); + if (!$extensionType) { + $extensionType = $this->extensionTypeQuestion($io); + $input->setOption('extension-type', $extensionType); } - // --name $name = $input->getOption('name'); if (!$name) { $name = $io->ask( $this->trans('commands.generate.command.questions.name'), - sprintf('%s:default', $module) + sprintf('%s:default', $extension->getName()) ); $input->setOption('name', $name); } - // --class option $class = $input->getOption('class'); if (!$class) { $class = $io->ask( @@ -178,7 +192,6 @@ function ($class) { $input->setOption('class', $class); } - // --container-aware option $containerAware = $input->getOption('container-aware'); if (!$containerAware) { $containerAware = $io->confirm( @@ -189,7 +202,6 @@ function ($class) { } if (!$containerAware) { - // --services option // @see use Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion $services = $this->servicesQuestion($io); $input->setOption('services', $services); diff --git a/src/Command/Shared/ExtensionTrait.php b/src/Command/Shared/ExtensionTrait.php new file mode 100644 index 000000000..982c41167 --- /dev/null +++ b/src/Command/Shared/ExtensionTrait.php @@ -0,0 +1,94 @@ +extensionManager->discoverModules() + ->showInstalled() + ->showUninstalled() + ->showNoCore() + ->getList(); + } + + if ($theme) { + $themes = $this->extensionManager->discoverThemes() + ->showInstalled() + ->showUninstalled() + ->showNoCore() + ->getList(); + } + + if ($profile) { + $profiles = $this->extensionManager->discoverProfiles() + ->showInstalled() + ->showUninstalled() + ->showNoCore() + ->showCore() + ->getList(); + } + + $extensions = array_merge( + $modules, + $themes, + $profiles + ); + + if (empty($extensions)) { + throw new \Exception('No extension available, execute the proper generator command to generate one.'); + } + + $extension = $io->choiceNoList( + $this->trans('commands.common.questions.extension'), + array_keys($extensions) + ); + + return $extensions[$extension]; + } + + /** + * @param DrupalStyle $io + * + * @return string + * + * @throws \Exception + */ + public function extensionTypeQuestion(DrupalStyle $io) + { + $extensionType = $io->choiceNoList( + $this->trans('commands.common.questions.extension-type'), + array_keys(['module', 'theme', 'profile']) + ); + + return $extensionType; + } +} diff --git a/src/Command/Shared/ModuleTrait.php b/src/Command/Shared/ModuleTrait.php index 8a835fb69..a8a30eb4d 100644 --- a/src/Command/Shared/ModuleTrait.php +++ b/src/Command/Shared/ModuleTrait.php @@ -42,7 +42,7 @@ public function moduleQuestion(DrupalStyle $io, $showProfile = true) } if (empty($modules)) { - throw new \Exception('No modules available, execute `generate:module` command to generate one.'); + throw new \Exception('No extension available, execute the proper generator command to generate one.'); } $module = $io->choiceNoList( diff --git a/src/Extension/Manager.php b/src/Extension/Manager.php index 6c977d74d..a1a79a1a0 100644 --- a/src/Extension/Manager.php +++ b/src/Extension/Manager.php @@ -213,6 +213,11 @@ private function discoverExtensions($type) system_rebuild_module_data(); } + if ($type === 'theme') { + $themeHandler = \Drupal::service('theme_handler'); + $themeHandler->rebuildThemeData(); + } + /* * @see Remove DrupalExtensionDiscovery subclass once * https://www.drupal.org/node/2503927 is fixed. @@ -336,4 +341,10 @@ public function getPluginPath($moduleName, $pluginType) return $module->getPath() . '/src/Plugin/'.$pluginType; } + + public function getDrupalExtension($type, $name) + { + $extension = $this->getExtension($type, $name); + return $this->createExtension($extension); + } } diff --git a/src/Generator/CommandGenerator.php b/src/Generator/CommandGenerator.php index df13305f8..ff01bd572 100644 --- a/src/Generator/CommandGenerator.php +++ b/src/Generator/CommandGenerator.php @@ -45,46 +45,50 @@ public function __construct( /** * Generate. * - * @param string $module Module name + * @param string $extension Extension name + * @param string $extensionType Extension type * @param string $name Command name * @param string $class Class name * @param boolean $containerAware Container Aware command * @param array $services Services array */ - public function generate($module, $name, $class, $containerAware, $services) + public function generate($extension, $extensionType, $name, $class, $containerAware, $services) { $command_key = str_replace(':', '.', $name); + $extensionObject = $this->extensionManager->getDrupalExtension($extensionType, $extension); + $parameters = [ - 'module' => $module, + 'extension' => $extension, + 'extensionType' => $extensionType, 'name' => $name, 'class_name' => $class, 'container_aware' => $containerAware, 'command_key' => $command_key, 'services' => $services, 'tags' => ['name' => 'drupal.command'], - 'class_path' => sprintf('Drupal\%s\Command\%s', $module, $class), - 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'), + 'class_path' => sprintf('Drupal\%s\Command\%s', $extension, $class), + 'file_exists' => file_exists($extensionObject->getPath().'/console.services.yml'), ]; $this->renderFile( 'module/src/Command/command.php.twig', - $this->extensionManager->getModule($module)->getCommandDirectory().'/'.$class.'.php', + $extensionObject->getCommandDirectory().$class.'.php', $parameters ); - $parameters['name'] = $module.'.'.str_replace(':', '_', $name); + $parameters['name'] = $extension.'.'.str_replace(':', '_', $name); $this->renderFile( 'module/services.yml.twig', - $this->extensionManager->getModule($module)->getPath() .'/console.services.yml', + $extensionObject->getPath() .'/console.services.yml', $parameters, FILE_APPEND ); $this->renderFile( 'module/src/Command/console/translations/en/command.yml.twig', - $this->extensionManager->getModule($module)->getPath().'/console/translations/en/'.$command_key.'.yml' + $extensionObject->getPath().'/console/translations/en/'.$command_key.'.yml' ); } } diff --git a/templates/module/src/Command/command.php.twig b/templates/module/src/Command/command.php.twig index a333ccbb5..305095753 100644 --- a/templates/module/src/Command/command.php.twig +++ b/templates/module/src/Command/command.php.twig @@ -1,11 +1,11 @@ {% extends "base/class.php.twig" %} {% block file_path %} -\Drupal\{{module}}\Command\{{ class }}. +\Drupal\{{extension}}\Command\{{ class }}. {% endblock %} {% block namespace_class %} -namespace Drupal\{{module}}\Command; +namespace Drupal\{{extension}}\Command; {% endblock %} {% block use_class %} @@ -25,11 +25,11 @@ use Drupal\Console\Annotations\DrupalCommand; /** * Class {{ class_name }}. * - * @package Drupal\{{module}} + * @package Drupal\{{extension}} * * @DrupalCommand ( - * extension="{{module}}", - * extensionType="module" + * extension="{{extension}}", + * extensionType="{{ extensionType }}" * ) */ class {{ class_name }} extends Command {% endblock %} From 4ebf74284f37920f54a65f2edd37bcd388fc40b9 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 23 Jan 2017 08:29:00 -0800 Subject: [PATCH 144/321] Load extend command services. (#3123) --- src/Application.php | 2 ++ src/Bootstrap/AddServicesCompilerPass.php | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/Application.php b/src/Application.php index 3242260d9..deb43709c 100644 --- a/src/Application.php +++ b/src/Application.php @@ -212,8 +212,10 @@ public function getData() 'help', 'init', 'list', + 'shell', 'server' ]; + $languages = $this->container->get('console.configuration_manager') ->getConfiguration() ->get('application.languages'); diff --git a/src/Bootstrap/AddServicesCompilerPass.php b/src/Bootstrap/AddServicesCompilerPass.php index 2d7d9c2ab..585d2c6c2 100644 --- a/src/Bootstrap/AddServicesCompilerPass.php +++ b/src/Bootstrap/AddServicesCompilerPass.php @@ -111,6 +111,17 @@ public function process(ContainerBuilder $container) } } + $configurationManager = $container->get('console.configuration_manager'); + $directory = $configurationManager->getConsoleDirectory() . 'extend/'; + $autoloadFile = $directory . 'vendor/autoload.php'; + if (is_file($autoloadFile)) { + include_once $autoloadFile; + $extendService = $directory . 'extend.console.services.yml'; + if (is_file($extendService)) { + $loader->load($extendService); + } + } + $container->setParameter( 'console.service_definitions', $container->getDefinitions() From 7450efd95a8571e54b2705cb532e4f5093908596 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 23 Jan 2017 10:24:42 -0800 Subject: [PATCH 145/321] [console] Tag 1.0.0-rc15 release. (#3124) * [console] Tag 1.0.0-rc15 release. * [console] Force doctrine/collections version. --- composer.json | 3 ++- composer.lock | 45 ++++++++++++++++++++++++--------------------- src/Application.php | 2 +- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/composer.json b/composer.json index 0561dbe15..a3e0306c7 100644 --- a/composer.json +++ b/composer.json @@ -37,8 +37,9 @@ }, "require": { "php": "^5.5.9 || ^7.0", - "drupal/console-core" : "dev-master", + "drupal/console-core" : "1.0.0-rc15", "alchemy/zippy": "0.4.3", + "doctrine/collections":"1.3.0", "composer/installers": "~1.0", "symfony/css-selector": ">=2.7 <3.0", "symfony/dom-crawler": ">=2.7 <3.3", diff --git a/composer.lock b/composer.lock index 344d5fa49..da44a7ec4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "4f2fa6a1acdd2ccf0ecf3626f4d03843", + "content-hash": "ec3fa8fd2544e01fbbbddf1a050df357", "packages": [ { "name": "alchemy/zippy", @@ -239,16 +239,16 @@ }, { "name": "dflydev/dot-access-data", - "version": "v1.0.1", + "version": "v1.1.0", "source": { "type": "git", "url": "https://github.com/dflydev/dflydev-dot-access-data.git", - "reference": "7a0960d088119818ce7687d200c363b01d183cbe" + "reference": "3fbd874921ab2c041e899d044585a2ab9795df8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-data/zipball/7a0960d088119818ce7687d200c363b01d183cbe", - "reference": "7a0960d088119818ce7687d200c363b01d183cbe", + "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-data/zipball/3fbd874921ab2c041e899d044585a2ab9795df8a", + "reference": "3fbd874921ab2c041e899d044585a2ab9795df8a", "shasum": "" }, "require": { @@ -279,6 +279,11 @@ "name": "Beau Simensen", "email": "beau@dflydev.com", "homepage": "http://beausimensen.com" + }, + { + "name": "Carlos Frutos", + "email": "carlos@kiwing.it", + "homepage": "https://github.com/cfrutos" } ], "description": "Given a deep data structure, access data by dot notation.", @@ -289,7 +294,7 @@ "dot", "notation" ], - "time": "2015-08-13T03:51:18+00:00" + "time": "2017-01-20T21:14:22+00:00" }, { "name": "dflydev/placeholder-resolver", @@ -566,21 +571,21 @@ }, { "name": "drupal/console-core", - "version": "dev-master", + "version": "1.0.0-rc15", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "22db58d5433bad1bb0341a0349a8201ed61e782f" + "reference": "3b82904b14c40877497d34a2901a72cc987a5808" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/22db58d5433bad1bb0341a0349a8201ed61e782f", - "reference": "22db58d5433bad1bb0341a0349a8201ed61e782f", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/3b82904b14c40877497d34a2901a72cc987a5808", + "reference": "3b82904b14c40877497d34a2901a72cc987a5808", "shasum": "" }, "require": { - "dflydev/dot-access-configuration": "~1.0.1", - "drupal/console-en": "dev-master", + "dflydev/dot-access-configuration": "1.0.1", + "drupal/console-en": "1.0.0-rc15", "php": "^5.5.9 || ^7.0", "stecman/symfony-console-completion": "~0.7", "symfony/config": ">=2.7 <3.0", @@ -643,20 +648,20 @@ "drupal", "symfony" ], - "time": "2017-01-19 07:18:36" + "time": "2017-01-23T18:02:51+00:00" }, { "name": "drupal/console-en", - "version": "dev-master", + "version": "1.0.0-rc15", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", - "reference": "2da817d8cc862b694bc14941c91201e778f801ae" + "reference": "87a886d5084d33f813e0d7c0547534ac43e75da8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/2da817d8cc862b694bc14941c91201e778f801ae", - "reference": "2da817d8cc862b694bc14941c91201e778f801ae", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/87a886d5084d33f813e0d7c0547534ac43e75da8", + "reference": "87a886d5084d33f813e0d7c0547534ac43e75da8", "shasum": "" }, "type": "drupal-console-language", @@ -697,7 +702,7 @@ "drupal", "symfony" ], - "time": "2017-01-07 03:56:38" + "time": "2017-01-23T14:59:05+00:00" }, { "name": "gabordemooij/redbean", @@ -2414,9 +2419,7 @@ "packages-dev": [], "aliases": [], "minimum-stability": "dev", - "stability-flags": { - "drupal/console-core": 20 - }, + "stability-flags": [], "prefer-stable": true, "prefer-lowest": false, "platform": { diff --git a/src/Application.php b/src/Application.php index deb43709c..957e75adf 100644 --- a/src/Application.php +++ b/src/Application.php @@ -25,7 +25,7 @@ class Application extends BaseApplication /** * @var string */ - const VERSION = '1.0.0-rc14'; + const VERSION = '1.0.0-rc15'; public function __construct(ContainerInterface $container) { From c4f338de3b66658fff1e1b750613b15628ca74ba Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 23 Jan 2017 11:34:20 -0800 Subject: [PATCH 146/321] [site:install] Fix DB driver paths. (#3125) --- src/Utils/Site.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Utils/Site.php b/src/Utils/Site.php index b60231c64..58285bfc1 100644 --- a/src/Utils/Site.php +++ b/src/Utils/Site.php @@ -63,10 +63,21 @@ public function getDatabaseTypes() $this->loadLegacyFile('/core/includes/install.inc'); $this->setMinimalContainerPreKernel(); + $driverDirectories = [ + $this->appRoot . '/core/lib/Drupal/Core/Database/Driver', + $this->appRoot . '/drivers/lib/Drupal/Driver/Database' + ]; + + $driverDirectories = array_filter( + $driverDirectories, + function ($directory) { + return is_dir($directory); + } + ); + $finder = new Finder(); $finder->directories() - ->in($this->appRoot . '/core/lib/Drupal/Core/Database/Driver') - ->in($this->appRoot . '/drivers/lib/Drupal/Driver/Database') + ->in($driverDirectories) ->depth('== 0'); $databases = []; From cb6cb698ab79ac82dcb1509043a771d49c235e07 Mon Sep 17 00:00:00 2001 From: Tom Whiston Date: Sat, 28 Jan 2017 19:31:07 +0100 Subject: [PATCH 147/321] allow no module name to trigger cron (#3127) --- src/Command/Cron/ExecuteCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Command/Cron/ExecuteCommand.php b/src/Command/Cron/ExecuteCommand.php index eba3f431d..bc2e6b157 100644 --- a/src/Command/Cron/ExecuteCommand.php +++ b/src/Command/Cron/ExecuteCommand.php @@ -73,7 +73,7 @@ protected function configure() ->setDescription($this->trans('commands.cron.execute.description')) ->addArgument( 'module', - InputArgument::IS_ARRAY | InputArgument::REQUIRED, + InputArgument::IS_ARRAY | InputArgument::OPTIONAL, $this->trans('commands.common.options.module') ); } @@ -92,7 +92,7 @@ protected function execute(InputInterface $input, OutputInterface $output) return 1; } - if (in_array('all', $modules)) { + if ( $modules === NULL || in_array('all', $modules)) { $modules = $this->moduleHandler->getImplementations('cron'); } From 32f7daf6fd274d7033cae086cfaa69f50a0898f7 Mon Sep 17 00:00:00 2001 From: Davvid Date: Mon, 30 Jan 2017 19:06:08 +0100 Subject: [PATCH 148/321] Cannot install modules due to improperly checked requirements. (#3134) --- src/Command/Module/InstallCommand.php | 2 +- src/Command/Shared/ModuleTrait.php | 44 ++++++++++++++++++++------- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/src/Command/Module/InstallCommand.php b/src/Command/Module/InstallCommand.php index 8cb886bb6..969cad245 100644 --- a/src/Command/Module/InstallCommand.php +++ b/src/Command/Module/InstallCommand.php @@ -156,7 +156,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->site->loadLegacyFile('/core/includes/bootstrap.inc'); // check module's requirements - $this->moduleRequirement($module); + $this->moduleRequirement($module, $io); if ($composer) { foreach ($module as $moduleItem) { diff --git a/src/Command/Shared/ModuleTrait.php b/src/Command/Shared/ModuleTrait.php index a8a30eb4d..03d9b1e85 100644 --- a/src/Command/Shared/ModuleTrait.php +++ b/src/Command/Shared/ModuleTrait.php @@ -1,10 +1,5 @@ invoke($module_name, 'requirements', ['install'])) { foreach ($requirements as $requirement) { - throw new \Exception($module_name .' can not be installed: ' . $requirement['description']); + if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_ERROR) { + $io->info("Module '{$module_name}' cannot be installed: " . $requirement['title'] . ' | ' . $requirement['value']); + $fail = TRUE; + } } } } + if ($fail) { + throw new \Exception("Some module install requirements are not met."); + } } } From 546c2d495301f3e736c5263ea954d20514f0de21 Mon Sep 17 00:00:00 2001 From: Rohit Joshi Date: Mon, 30 Jan 2017 23:51:45 +0530 Subject: [PATCH 149/321] Fixing php tag in module creation. (#3135) --- src/Generator/ModuleGenerator.php | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/Generator/ModuleGenerator.php b/src/Generator/ModuleGenerator.php index 744b72cea..ddec4919a 100644 --- a/src/Generator/ModuleGenerator.php +++ b/src/Generator/ModuleGenerator.php @@ -102,11 +102,8 @@ public function generate( } if ($moduleFile) { - $this->renderFile( - 'module/module.twig', - $dir . '/' . $machineName . '.module', - $parameters - ); + // Generate '.module' file. + $this->createModuleFile($dir, $parameters); } if ($composer) { @@ -125,6 +122,11 @@ public function generate( ); } if ($twigtemplate) { + // If module file is not created earlier, create now. + if (!$moduleFile) { + // Generate '.module' file. + $this->createModuleFile($dir, $parameters); + } $this->renderFile( 'module/module-twig-template-append.twig', $dir .'/' . $machineName . '.module', @@ -166,4 +168,20 @@ public function generate( ); } } + + /** + * Generate the '.module' file. + * + * @param string $dir + * The directory name. + * @param array $parameters + * The parameter array. + */ + protected function createModuleFile ($dir, $parameters) { + $this->renderFile( + 'module/module.twig', + $dir . '/' . $parameters['machine_name'] . '.module', + $parameters + ); + } } From bbfa366b2f5de4df53db46c45fcb5a312c64be85 Mon Sep 17 00:00:00 2001 From: David Valdez Date: Tue, 31 Jan 2017 16:41:59 -0600 Subject: [PATCH 150/321] update an old reference to t(). now it uses $this->t() (#3146) --- templates/module/src/Form/form.php.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/module/src/Form/form.php.twig b/templates/module/src/Form/form.php.twig index 1e307cef4..a495d6a9c 100644 --- a/templates/module/src/Form/form.php.twig +++ b/templates/module/src/Form/form.php.twig @@ -83,7 +83,7 @@ class {{ class_name }} extends FormBase {% endblock %} $form['submit'] = [ '#type' => 'submit', - '#value' => t('Submit'), + '#value' => $this->t('Submit'), ]; return $form; From d8c123ceb519f190b0dcd16bf078c9c2df814c85 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Tue, 31 Jan 2017 20:05:49 -0800 Subject: [PATCH 151/321] Add php_tag twig file. (#3142) * Add php_tag twig file. * Pass file_exists to update.php.twig * Relocate Twig fiels. * Add new line. --- src/Command/Generate/UpdateCommand.php | 2 +- src/Generator/HelpGenerator.php | 4 ++-- src/Generator/PostUpdateGenerator.php | 2 +- src/Generator/UpdateGenerator.php | 10 ++++++---- templates/module/{src => }/help.php.twig | 5 ++--- templates/module/php_tag.php.twig | 1 + templates/module/{src => }/post-update.php.twig | 5 ++--- templates/module/{src => }/update.php.twig | 6 ++++-- 8 files changed, 19 insertions(+), 16 deletions(-) rename templates/module/{src => }/help.php.twig (93%) create mode 100644 templates/module/php_tag.php.twig rename templates/module/{src => }/post-update.php.twig (90%) rename templates/module/{src => }/update.php.twig (79%) diff --git a/src/Command/Generate/UpdateCommand.php b/src/Command/Generate/UpdateCommand.php index 9fec18453..028e4e4ed 100644 --- a/src/Command/Generate/UpdateCommand.php +++ b/src/Command/Generate/UpdateCommand.php @@ -57,7 +57,7 @@ class UpdateCommand extends Command * * @param Manager $extensionManager * @param UpdateGenerator $generator - * @param StringConverter $stringConverter + * @param Site $site * @param ChainQueue $chainQueue */ public function __construct( diff --git a/src/Generator/HelpGenerator.php b/src/Generator/HelpGenerator.php index 7c08f6f6b..420240c19 100644 --- a/src/Generator/HelpGenerator.php +++ b/src/Generator/HelpGenerator.php @@ -32,7 +32,7 @@ public function __construct( * Generator Post Update Name function. * * @param $module - * @param $post_update_name + * @param $description */ public function generate($module, $description) { @@ -45,7 +45,7 @@ public function generate($module, $description) ]; $this->renderFile( - 'module/src/help.php.twig', + 'module/help.php.twig', $module_path .'/'.$module.'.module', $parameters, FILE_APPEND diff --git a/src/Generator/PostUpdateGenerator.php b/src/Generator/PostUpdateGenerator.php index 36ea89a8f..c3c10db7b 100644 --- a/src/Generator/PostUpdateGenerator.php +++ b/src/Generator/PostUpdateGenerator.php @@ -45,7 +45,7 @@ public function generate($module, $post_update_name) ]; $this->renderFile( - 'module/src/post-update.php.twig', + 'module/post-update.php.twig', $module_path .'/'.$module.'.post_update.php', $parameters, FILE_APPEND diff --git a/src/Generator/UpdateGenerator.php b/src/Generator/UpdateGenerator.php index 933cab922..55180668d 100644 --- a/src/Generator/UpdateGenerator.php +++ b/src/Generator/UpdateGenerator.php @@ -36,16 +36,18 @@ public function __construct( */ public function generate($module, $update_number) { + $modulePath = $this->extensionManager->getModule($module)->getPath(); + $updateFile = $modulePath .'/'.$module.'.install'; + $parameters = [ 'module' => $module, 'update_number' => $update_number, + 'file_exists' => file_exists($updateFile) ]; - $module_path = $this->extensionManager->getModule($module)->getPath(); - $this->renderFile( - 'module/src/update.php.twig', - $module_path .'/'.$module.'.install', + 'module/update.php.twig', + $updateFile, $parameters, FILE_APPEND ); diff --git a/templates/module/src/help.php.twig b/templates/module/help.php.twig similarity index 93% rename from templates/module/src/help.php.twig rename to templates/module/help.php.twig index d43f632e8..28248c1e5 100644 --- a/templates/module/src/help.php.twig +++ b/templates/module/help.php.twig @@ -1,6 +1,6 @@ {% block file_methods %} {% if not file_exists %} - Date: Sat, 4 Feb 2017 11:14:43 -0800 Subject: [PATCH 152/321] Compile console and extensions services files into one file. (#3155) --- src/Bootstrap/AddServicesCompilerPass.php | 170 +++++++++++++++------- src/Bootstrap/Drupal.php | 12 +- src/Bootstrap/DrupalServiceModifier.php | 24 ++- 3 files changed, 141 insertions(+), 65 deletions(-) diff --git a/src/Bootstrap/AddServicesCompilerPass.php b/src/Bootstrap/AddServicesCompilerPass.php index 585d2c6c2..580d9ba9d 100644 --- a/src/Bootstrap/AddServicesCompilerPass.php +++ b/src/Bootstrap/AddServicesCompilerPass.php @@ -8,6 +8,7 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\Finder\Finder; +use Symfony\Component\Yaml\Yaml; use Drupal\Console\Extension\Manager; use Drupal\Console\Utils\TranslatorManager; @@ -26,16 +27,23 @@ class AddServicesCompilerPass implements CompilerPassInterface */ protected $appRoot; + /** + * @var boolean + */ + protected $rebuild; + /** * AddCommandsCompilerPass constructor. * - * @param string $root - * @param string $appRoot + * @param string $root + * @param string $appRoot + * @param boolean $rebuild */ - public function __construct($root, $appRoot) + public function __construct($root, $appRoot, $rebuild = false) { $this->root = $root; $this->appRoot = $appRoot; + $this->rebuild = $rebuild; } /** @@ -52,63 +60,93 @@ public function process(ContainerBuilder $container) $loader->load($this->root. DRUPAL_CONSOLE . 'services-drupal-install.yml'); $loader->load($this->root. DRUPAL_CONSOLE . 'services.yml'); - $finder = new Finder(); - $finder->files() - ->name('*.yml') - ->in( - sprintf( - '%s/config/services/drupal-console', - $this->root.DRUPAL_CONSOLE - ) - ); - - foreach ($finder as $file) { - $loader->load($file->getPathName()); - } + $consoleServicesFile = $this->root.DRUPAL_CONSOLE.'services-console.yml'; + + if ($this->rebuild || !file_exists($consoleServicesFile)) { + $finder = new Finder(); + $finder->files() + ->name('*.yml') + ->in( + sprintf( + '%s/config/services/drupal-console', + $this->root.DRUPAL_CONSOLE + ) + ); + + $servicesData = []; + foreach ($finder as $file) { + $loader->load($file->getPathName()); + $servicesData = $this->extractServiceData( + $file->getPathName(), + $servicesData + ); + } - /** - * @var Manager $extensionManager - */ - $extensionManager = $container->get('console.extension_manager'); - /** - * @var Extension[] $modules - */ - $modules = $extensionManager->discoverModules() - ->showCore() - ->showNoCore() - ->showInstalled() - ->getList(false); - - foreach ($modules as $module) { - if ($module->origin == 'core') { - $consoleServicesFile = $this->root . DRUPAL_CONSOLE . - 'config/services/drupal-core/'.$module->getName().'.yml'; - if (is_file($consoleServicesFile)) { - $loader->load($consoleServicesFile); + /** + * @var Manager $extensionManager + */ + $extensionManager = $container->get('console.extension_manager'); + /** + * @var Extension[] $modules + */ + $modules = $extensionManager->discoverModules() + ->showCore() + ->showNoCore() + ->showInstalled() + ->getList(false); + + foreach ($modules as $module) { + if ($module->origin == 'core') { + $consoleServicesExtensionFile = $this->root . DRUPAL_CONSOLE . + 'config/services/drupal-core/'.$module->getName().'.yml'; + if (is_file($consoleServicesExtensionFile)) { + $loader->load($consoleServicesExtensionFile); + $servicesData = $this->extractServiceData( + $consoleServicesExtensionFile, + $servicesData + ); + } + } + + $consoleServicesExtensionFile = $this->appRoot . '/' . + $module->getPath() . '/console.services.yml'; + if (is_file($consoleServicesExtensionFile)) { + $loader->load($consoleServicesExtensionFile); + $servicesData = $this->extractServiceData( + $consoleServicesExtensionFile, + $servicesData + ); } } - $consoleServicesFile = $this->appRoot . '/' . - $module->getPath() . '/console.services.yml'; - if (is_file($consoleServicesFile)) { - $loader->load($consoleServicesFile); + /** + * @var Extension[] $themes + */ + $themes = $extensionManager->discoverThemes() + ->showNoCore() + ->showInstalled() + ->getList(false); + + foreach ($themes as $theme) { + $consoleServicesExtensionFile = $this->appRoot . '/' . + $theme->getPath() . '/console.services.yml'; + if (is_file($consoleServicesExtensionFile)) { + $loader->load($consoleServicesExtensionFile); + $servicesData = $this->extractServiceData( + $consoleServicesExtensionFile, + $servicesData + ); + } } - } - /** - * @var Extension[] $themes - */ - $themes = $extensionManager->discoverThemes() - ->showNoCore() - ->showInstalled() - ->getList(false); - - foreach ($themes as $theme) { - $consoleServicesFile = $this->appRoot . '/' . - $theme->getPath() . '/console.services.yml'; - if (is_file($consoleServicesFile)) { - $loader->load($consoleServicesFile); + if ($servicesData) { + file_put_contents( + $consoleServicesFile, + Yaml::dump($servicesData, 4, 2) + ); } + } else { + $loader->load($consoleServicesFile); } $configurationManager = $container->get('console.configuration_manager'); @@ -116,9 +154,9 @@ public function process(ContainerBuilder $container) $autoloadFile = $directory . 'vendor/autoload.php'; if (is_file($autoloadFile)) { include_once $autoloadFile; - $extendService = $directory . 'extend.console.services.yml'; - if (is_file($extendService)) { - $loader->load($extendService); + $extendServicesFile = $directory . 'extend.console.services.yml'; + if (is_file($extendServicesFile)) { + $loader->load($extendServicesFile); } } @@ -130,4 +168,24 @@ public function process(ContainerBuilder $container) $definition = $container->getDefinition('console.translator_manager'); $definition->setClass(TranslatorManager::class); } + + /** + * @param $filePath + * @param $servicesData + * + * @return array + */ + protected function extractServiceData($filePath, $servicesData) + { + $serviceFileData = Yaml::parse( + file_get_contents($filePath) + ); + + $servicesData = array_merge_recursive( + $servicesData, + $serviceFileData + ); + + return $servicesData; + } } diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index 50525785a..edbccfe2b 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -56,8 +56,12 @@ public function boot($debug) $_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR'] = $devDesktopSettingsDir; } } - $argvInputReader = new ArgvInputReader(); + $command = $argvInputReader->get('command'); + $rebuildServicesFile = false; + if ($command=='cache:rebuild' || $command=='cr') { + $rebuildServicesFile = true; + } if ($debug) { $io->writeln('➤ Creating request'); @@ -75,7 +79,7 @@ public function boot($debug) if ($debug) { $io->writeln("\r\033[K\033[1A\r✔"); - $io->writeln('➤ Creating Drupal kernel'); + $io->writeln('➤ Creating Drupal kernel'); } $drupalKernel = DrupalKernel::createFromRequest( $request, @@ -88,12 +92,14 @@ public function boot($debug) $io->writeln("\r\033[K\033[1A\r✔"); $io->writeln('➤ Registering dynamic services'); } + $drupalKernel->addServiceModifier( new DrupalServiceModifier( $this->root, $this->appRoot, 'drupal.command', - 'drupal.generator' + 'drupal.generator', + $rebuildServicesFile ) ); if ($debug) { diff --git a/src/Bootstrap/DrupalServiceModifier.php b/src/Bootstrap/DrupalServiceModifier.php index c3e0ff633..f19310456 100644 --- a/src/Bootstrap/DrupalServiceModifier.php +++ b/src/Bootstrap/DrupalServiceModifier.php @@ -27,24 +27,32 @@ class DrupalServiceModifier implements ServiceModifierInterface */ protected $generatorTag; + /** + * @var boolean + */ + protected $rebuild; + /** * DrupalServiceModifier constructor. * - * @param string $root - * @param string $appRoot - * @param string $serviceTag - * @param string $generatorTag + * @param string $root + * @param string $appRoot + * @param string $serviceTag + * @param string $generatorTag + * @param boolean $rebuild */ public function __construct( $root = null, $appRoot = null, $serviceTag, - $generatorTag + $generatorTag, + $rebuild ) { $this->root = $root; $this->appRoot = $appRoot; $this->commandTag = $serviceTag; $this->generatorTag = $generatorTag; + $this->rebuild = $rebuild; } @@ -54,7 +62,11 @@ public function __construct( public function alter(ContainerBuilder $container) { $container->addCompilerPass( - new AddServicesCompilerPass($this->root, $this->appRoot) + new AddServicesCompilerPass( + $this->root, + $this->appRoot, + $this->rebuild + ) ); $container->addCompilerPass( new FindCommandsCompilerPass($this->commandTag) From 94aba2019515febab98db9309d903ecff604add6 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sat, 4 Feb 2017 11:51:51 -0800 Subject: [PATCH 153/321] [features:*] Add translations. (#3156) --- src/Command/Shared/FeatureTrait.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Command/Shared/FeatureTrait.php b/src/Command/Shared/FeatureTrait.php index 1da568408..378f4c0a6 100644 --- a/src/Command/Shared/FeatureTrait.php +++ b/src/Command/Shared/FeatureTrait.php @@ -8,11 +8,9 @@ namespace Drupal\Console\Command\Shared; use Drupal\Console\Core\Style\DrupalStyle; -use Symfony\Component\Console\Input\ArgvInput; use Drupal\features\FeaturesManagerInterface; use Drupal\features\ConfigurationItem; use Drupal\features\Plugin\FeaturesGeneration\FeaturesGenerationWrite; -use Drupal\Component\Diff\DiffFormatter; use Drupal\config_update\ConfigRevertInterface; /** @@ -27,7 +25,9 @@ public function packageQuestion(DrupalStyle $io) $packages = $this->getPackagesByBundle($bundle); if (empty($packages)) { - throw new \Exception('No packages available'); + throw new \Exception( + $this->trans('commands.features.message.no-packages') + ); } $package = $io->choiceNoList( @@ -68,7 +68,7 @@ protected function getAssigner($bundle_name) * * @param bundle * - * @return features + * @return array */ protected function getFeatureList($bundle) { @@ -101,7 +101,7 @@ protected function getFeatureList($bundle) } - protected function importFeature($io, $packages) + protected function importFeature(DrupalStyle $io, $packages) { $manager = $this->getFeatureManager(); @@ -180,7 +180,6 @@ public function import($io, $components) ) ); } else { - // Revert existing component. $item = $config[$feature]; $type = ConfigurationItem::fromConfigStringToConfigType($item->getType()); From 2ed05069536bbef744ea769129367e9e29c3604c Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 5 Feb 2017 10:32:57 -0800 Subject: [PATCH 154/321] Update compile services file. (#3157) --- bin/drupal.php | 2 + services.yml | 2 + src/Bootstrap/AddServicesCompilerPass.php | 56 +++-- src/Bootstrap/Drupal.php | 22 ++ src/Utils/ExtendExtensionManager.php | 241 ++++++++++++++++++++++ src/Utils/Site.php | 42 ++++ 6 files changed, 353 insertions(+), 12 deletions(-) create mode 100644 src/Utils/ExtendExtensionManager.php diff --git a/bin/drupal.php b/bin/drupal.php index d73c44267..35c172344 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -8,6 +8,8 @@ set_time_limit(0); +$autoloaders = []; + if (file_exists(__DIR__ . '/../autoload.local.php')) { include_once __DIR__ . '/../autoload.local.php'; } else { diff --git a/services.yml b/services.yml index 32e03500b..4d50f0ebc 100644 --- a/services.yml +++ b/services.yml @@ -29,3 +29,5 @@ services: console.annotation_validator: class: Drupal\Console\Utils\AnnotationValidator arguments: ['@console.annotation_command_reader', '@console.extension_manager'] + console.extend_extension_manager: + class: Drupal\Console\Utils\ExtendExtensionManager diff --git a/src/Bootstrap/AddServicesCompilerPass.php b/src/Bootstrap/AddServicesCompilerPass.php index 580d9ba9d..19f7c8b14 100644 --- a/src/Bootstrap/AddServicesCompilerPass.php +++ b/src/Bootstrap/AddServicesCompilerPass.php @@ -2,15 +2,16 @@ namespace Drupal\Console\Bootstrap; -use Drupal\Console\Extension\Extension; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; -use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\Config\FileLocator; use Symfony\Component\Finder\Finder; use Symfony\Component\Yaml\Yaml; -use Drupal\Console\Extension\Manager; +use Drupal\Console\Utils\ExtendExtensionManager; use Drupal\Console\Utils\TranslatorManager; +use Drupal\Console\Extension\Extension; +use Drupal\Console\Extension\Manager; /** * FindCommandsCompilerPass @@ -56,13 +57,21 @@ public function process(ContainerBuilder $container) new FileLocator($this->root) ); - $loader->load($this->root. DRUPAL_CONSOLE_CORE . 'services.yml'); - $loader->load($this->root. DRUPAL_CONSOLE . 'services-drupal-install.yml'); - $loader->load($this->root. DRUPAL_CONSOLE . 'services.yml'); + $loader->load($this->root. DRUPAL_CONSOLE_CORE . 'services.yml'); + $loader->load($this->root. DRUPAL_CONSOLE . 'services-drupal-install.yml'); + $loader->load($this->root. DRUPAL_CONSOLE . 'services.yml'); - $consoleServicesFile = $this->root.DRUPAL_CONSOLE.'services-console.yml'; + $basePath = $container->get('console.site')->getCacheDirectory(); + $consoleServicesFile = $basePath.'/console.services.yml'; + $consoleExtendServicesFile = $basePath.'/extend.console.services.yml'; + $consoleExtendConfigFile = $basePath.'/extend.console.config.yml'; - if ($this->rebuild || !file_exists($consoleServicesFile)) { + if ($basePath && !$this->rebuild && file_exists($consoleServicesFile)) { + $loader->load($consoleServicesFile); + if (file_exists($consoleExtendServicesFile)) { + $loader->load($consoleExtendServicesFile); + } + } else { $finder = new Finder(); $finder->files() ->name('*.yml') @@ -139,14 +148,37 @@ public function process(ContainerBuilder $container) } } - if ($servicesData) { + if ($servicesData && is_writable($basePath)) { file_put_contents( $consoleServicesFile, Yaml::dump($servicesData, 4, 2) ); } - } else { - $loader->load($consoleServicesFile); + + /** + * @var ExtendExtensionManager $extendExtensionManager + */ + $extendExtensionManager = $container->get('console.extend_extension_manager'); + $extendExtensionManager->processProjectPackages($this->root); + $configData = $extendExtensionManager->getConfigData(); + if ($configData && is_writable($basePath)) { + file_put_contents( + $consoleExtendConfigFile, + Yaml::dump($configData, 6, 2) + ); + } + $servicesData = $extendExtensionManager->getServicesData(); + if ($servicesData && is_writable($basePath)) { + file_put_contents( + $consoleExtendServicesFile, + Yaml::dump($servicesData, 4, 2) + ); + } + + $servicesFiles = $extendExtensionManager->getServicesFiles(); + foreach ($servicesFiles as $servicesFile) { + $loader->load($servicesFile); + } } $configurationManager = $container->get('console.configuration_manager'); diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index edbccfe2b..9501e5f39 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -9,6 +9,7 @@ use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Core\Utils\ArgvInputReader; use Drupal\Console\Core\Bootstrap\DrupalConsoleCore; +use Drupal\Console\Utils\ExtendExtensionManager; class Drupal { @@ -129,6 +130,27 @@ public function boot($debug) $this->root ); + $basePath = $container->get('console.site')->getCacheDirectory(); + $consoleExtendConfigFile = $basePath.'/extend.console.config.yml'; + + if ($basePath && file_exists($consoleExtendConfigFile)) { + $container->get('console.configuration_manager') + ->importConfigurationFile($consoleExtendConfigFile); + } else { + /** + * @var ExtendExtensionManager $extendExtensionManager + */ + $extendExtensionManager = $container->get('console.extend_extension_manager'); + if (!$extendExtensionManager->isProcessed()) { + $extendExtensionManager->processProjectPackages($this->root); + } + $configFiles = $extendExtensionManager->getConfigFiles(); + foreach ($configFiles as $configFile) { + $container->get('console.configuration_manager') + ->importConfigurationFile($configFile); + } + } + $container->get('console.renderer') ->setSkeletonDirs( [ diff --git a/src/Utils/ExtendExtensionManager.php b/src/Utils/ExtendExtensionManager.php new file mode 100644 index 000000000..d3f1ee373 --- /dev/null +++ b/src/Utils/ExtendExtensionManager.php @@ -0,0 +1,241 @@ +init(); + } + + /** + * @param string $composerFile + * + * @return bool + */ + public function isValidPackageType($composerFile) + { + if (!is_file($composerFile)) { + return false; + } + + $composerContent = json_decode(file_get_contents($composerFile), true); + if (!$composerContent) { + return false; + } + + if (!array_key_exists('type', $composerContent)) { + return false; + } + + return $composerContent['type'] === 'drupal-console-library'; + } + + /** + * @param string $configFile + */ + public function addConfigFile($configFile) + { + $configData = $this->parseData($configFile); + if ($this->isValidConfigData($configData)) { + $this->configFiles[] = $configFile; + $this->configData = array_merge_recursive( + $configData, + $this->configData + ); + } + } + + /** + * @param string $servicesFile + */ + public function addServicesFile($servicesFile) + { + $servicesData = $this->parseData($servicesFile); + if ($this->isValidServicesData($servicesData)) { + $this->servicesFiles[] = $servicesFile; + $this->servicesData = array_merge_recursive( + $servicesData, + $this->servicesData + ); + } + } + + /** + * init + */ + private function init() + { + $this->configData = []; + $this->servicesData = []; + $this->configFiles = []; + $this->servicesFiles = []; + $this->processed = false; + } + + /** + * @param $file + * @return array|mixed + */ + private function parseData($file) + { + if (!file_exists($file)) { + return []; + } + + $data = Yaml::parse( + file_get_contents($file) + ); + + if (!$data) { + return []; + } + + return $data; + } + + public function processProjectPackages($directory) + { + $finder = new Finder(); + $finder->files() + ->name('composer.json') + ->contains('drupal-console-library') + ->in($directory); + + foreach ($finder as $file) { + $this->processComposerFile($file->getPathName()); + } + + $this->processed = true; + } + + /** + * @param $composerFile + */ + private function processComposerFile($composerFile) + { + $packageDirectory = dirname($composerFile); + + $configFile = $packageDirectory.'/console.config.yml'; + $this->addConfigFile($configFile); + + $servicesFile = $packageDirectory.'/console.services.yml'; + $this->addServicesFile($servicesFile); + } + + /** + * @param array $configData + * + * @return boolean + */ + private function isValidConfigData($configData) + { + if (!$configData) { + return false; + } + + if (!array_key_exists('application', $configData)) { + return false; + } + + if (!array_key_exists('autowire', $configData['application'])) { + return false; + } + + if (!array_key_exists('commands', $configData['application']['autowire'])) { + return false; + } + + return true; + } + + /** + * @param array $servicesData + * + * @return boolean + */ + private function isValidServicesData($servicesData) + { + if (!$servicesData) { + return false; + } + + if (!array_key_exists('services', $servicesData)) { + return false; + } + + return true; + } + + /** + * @return array + */ + public function getConfigData() + { + return $this->configData; + } + + /** + * @return array + */ + public function getServicesData() + { + return $this->servicesData; + } + + /** + * @return array + */ + public function getConfigFiles() + { + return $this->configFiles; + } + + /** + * @return array + */ + public function getServicesFiles() + { + return $this->servicesFiles; + } + + /** + * @return bool + */ + public function isProcessed() + { + return $this->processed; + } +} diff --git a/src/Utils/Site.php b/src/Utils/Site.php index 58285bfc1..dee4d3b91 100644 --- a/src/Utils/Site.php +++ b/src/Utils/Site.php @@ -3,6 +3,7 @@ namespace Drupal\Console\Utils; use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Finder\Finder; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\Logger\LoggerChannelFactory; @@ -183,4 +184,45 @@ public function validMultisite($uri) return false; } + + public function getCacheDirectory() + { + $configFactory = \Drupal::configFactory(); + $basePath = $configFactory->get('system.file') + ->get('path.temporary'); + $siteId = $configFactory->get('system.site') + ->get('uuid'); + $basePath = $this->validateDirectory( + $basePath . '/console/cache/' . $siteId . '/' + ); + + if (!$basePath) { + if (function_exists('posix_getuid')) { + $homeDir = posix_getpwuid(posix_getuid())['dir']; + } else { + $homeDir = realpath(rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/\\')); + } + + $basePath = sprintf('%s/.console/cache/%s/', $homeDir, $siteId); + + $basePath = $this->validateDirectory($basePath); + } + + return $basePath; + } + + private function validateDirectory($path) + { + $fileSystem = new Filesystem(); + if ($fileSystem->exists($path)) { + return $path; + } + try { + $fileSystem->mkdir($path); + + return $path; + } catch (\Exception $e) { + return null; + } + } } From 93efaeb7d83e71656c71a34f392333d7342ba41d Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 5 Feb 2017 11:27:11 -0800 Subject: [PATCH 155/321] [create:terms] Disable command if no taxonomy module. (#3159) --- src/Command/Create/TermsCommand.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Command/Create/TermsCommand.php b/src/Command/Create/TermsCommand.php index 69afca43d..0822c4a74 100644 --- a/src/Command/Create/TermsCommand.php +++ b/src/Command/Create/TermsCommand.php @@ -13,6 +13,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Annotations\DrupalCommand; use Drupal\Console\Utils\Create\TermData; use Drupal\Console\Utils\DrupalApi; use Drupal\Console\Core\Style\DrupalStyle; @@ -21,6 +22,12 @@ * Class TermsCommand * * @package Drupal\Console\Command\Generate + * + * @DrupalCommand( + * extension = "features", + * extensionType = "module", + * dependencies={"taxonomy"} + * ) */ class TermsCommand extends Command { @@ -146,9 +153,9 @@ protected function execute(InputInterface $input, OutputInterface $output) ); $tableHeader = [ - $this->trans('commands.create.terms.messages.term-id'), - $this->trans('commands.create.terms.messages.vocabulary'), - $this->trans('commands.create.terms.messages.name'), + $this->trans('commands.create.terms.messages.term-id'), + $this->trans('commands.create.terms.messages.vocabulary'), + $this->trans('commands.create.terms.messages.name'), ]; $io->table($tableHeader, $terms['success']); From 06a3f719a414deee84728b5941b9ce71bb4b53c5 Mon Sep 17 00:00:00 2001 From: Christoph Burschka Date: Sun, 5 Feb 2017 20:28:39 +0100 Subject: [PATCH 156/321] [update:execute] Errors in update code (#3108, #3137) (#3138) * [update:execute] Fix a missing variable argument (#3108) * [update:execute] Fix updating logic (#3137) Only apply each pending update once. * Cancel update command on bad selection. * Abort update on failure, only run post-update on completion. Post-update functions may rely on any API, which requires all modules to have up-to-date schemas. * Remove update-n code from post-updates. Post-update functions have names instead of numbers; they can't be selected like this. * Make module argument optional, default to 'all'. --- src/Command/Update/ExecuteCommand.php | 146 +++++++++++++------------- 1 file changed, 75 insertions(+), 71 deletions(-) diff --git a/src/Command/Update/ExecuteCommand.php b/src/Command/Update/ExecuteCommand.php index cd36e3560..26f9a206e 100644 --- a/src/Command/Update/ExecuteCommand.php +++ b/src/Command/Update/ExecuteCommand.php @@ -46,8 +46,8 @@ class ExecuteCommand extends Command /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** @@ -102,7 +102,7 @@ protected function configure() ->setDescription($this->trans('commands.update.execute.description')) ->addArgument( 'module', - InputArgument::REQUIRED, + InputArgument::OPTIONAL, $this->trans('commands.common.options.module') ) ->addArgument( @@ -118,7 +118,7 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); - $this->module = $input->getArgument('module'); + $this->module = $input->getArgument('module') ?: 'all'; $this->update_n = $input->getArgument('update-n'); $this->site->loadLegacyFile('/core/includes/install.inc'); @@ -127,7 +127,10 @@ protected function execute(InputInterface $input, OutputInterface $output) drupal_load_updates(); update_fix_compatibility(); $updates = update_get_update_list(); - $this->checkUpdates($io); + if (!$this->checkUpdates($io, $updates)) { + return 1; + } + $maintenance_mode = $this->state->get('system.maintenance_mode', false); if (!$maintenance_mode) { @@ -135,8 +138,18 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->state->set('system.maintenance_mode', true); } - $this->runUpdates($io, $updates); - $this->runPostUpdates($io); + try { + $complete = $this->runUpdates($io, $updates); + + // Post Updates are only safe to run after all schemas have been updated. + if ($complete) { + $this->runPostUpdates($io); + } + } catch (\Exception $e) { + watchdog_exception('update', $e); + $io->error($e->getMessage()); + return 1; + } if (!$maintenance_mode) { $this->state->set('system.maintenance_mode', false); @@ -149,8 +162,11 @@ protected function execute(InputInterface $input, OutputInterface $output) /** * @param \Drupal\Console\Core\Style\DrupalStyle $io + * @param array $updates + * + * @return bool true if the selected module/update number exists. */ - private function checkUpdates(DrupalStyle $io) + private function checkUpdates(DrupalStyle $io, array $updates) { if ($this->module != 'all') { if (!isset($updates[$this->module])) { @@ -160,30 +176,39 @@ private function checkUpdates(DrupalStyle $io) $this->module ) ); - return; + return false; } else { - // filter to execute only a specific module updates - $updates = [$this->module => $updates[$this->module]]; - if ($this->update_n && !isset($updates[$this->module]['pending'][$this->update_n])) { - $io->info( + $io->error( sprintf( $this->trans('commands.update.execute.messages.module-update-function-not-found'), $this->module, $this->update_n ) ); + return false; } } } + return true; } /** * @param \Drupal\Console\Core\Style\DrupalStyle $io - * @param $updates + * @param array $updates + * + * @return bool True if all available updates have been run. */ - private function runUpdates(DrupalStyle $io, $updates) + private function runUpdates(DrupalStyle $io, array $updates) { + if ($this->module != 'all') { + $complete = count($updates) == 1; + $updates = [$this->module => $updates[$this->module]]; + } + else { + $complete = true; + } + foreach ($updates as $module_name => $module_updates) { $extension = $this->extensionManager->getModule($module_name); if (!$extension) { @@ -194,37 +219,31 @@ private function runUpdates(DrupalStyle $io, $updates) ->loadLegacyFile($extension->getPath() . '/'. $module_name . '.install', false); } - foreach ($module_updates['pending'] as $update_number => $update) { - if ($this->module != 'all' && $this->update_n !== null && $this->update_n != $update_number) { - continue; - } + if ($this->update_n > $module_updates['start']) { + $io->info( + $this->trans('commands.update.execute.messages.executing-required-previous-updates') + ); + } - if ($this->update_n > $module_updates['start']) { - $io->info( - $this->trans('commands.update.execute.messages.executing-required-previous-updates') - ); + foreach ($module_updates['pending'] as $update_number => $update) { + if ($this->module != 'all' && $this->update_n !== null && $this->update_n < $update_number) { + return false; } - for ($update_index=$module_updates['start']; $update_index<=$update_number; $update_index++) { - $io->info( - sprintf( - $this->trans('commands.update.execute.messages.executing-update'), - $update_index, - $module_name - ) - ); - - try { - $this->moduleHandler->invoke($module_name, 'update_' . $update_index); - } catch (\Exception $e) { - watchdog_exception('update', $e); - $io->error($e->getMessage()); - } + $io->info( + sprintf( + $this->trans('commands.update.execute.messages.executing-update'), + $update_number, + $module_name + ) + ); - drupal_set_installed_schema_version($module_name, $update_index); - } + $this->moduleHandler->invoke($module_name, 'update_' . $update_number); + drupal_set_installed_schema_version($module_name, $update_number); } } + + return $complete; } /** @@ -234,38 +253,23 @@ private function runPostUpdates(DrupalStyle $io) { $postUpdates = $this->postUpdateRegistry->getPendingUpdateInformation(); foreach ($postUpdates as $module_name => $module_updates) { - foreach ($module_updates['pending'] as $update_number => $update) { - if ($this->module != 'all' && $this->update_n !== null && $this->update_n != $update_number) { - continue; - } - - if ($this->update_n > $module_updates['start']) { - $io->info( - $this->trans('commands.update.execute.messages.executing-required-previous-updates') - ); - } - for ($update_index=$module_updates['start']; $update_index<=$update_number; $update_index++) { - $io->info( - sprintf( - $this->trans('commands.update.execute.messages.executing-update'), - $update_index, - $module_name - ) - ); + foreach ($module_updates['pending'] as $update_name => $update) { + $io->info( + sprintf( + $this->trans('commands.update.execute.messages.executing-update'), + $update_name, + $module_name + ) + ); - try { - $function = sprintf( - '%s_post_update_%s', - $module_name, - $update_index - ); - drupal_flush_all_caches(); - update_invoke_post_update($function); - } catch (\Exception $e) { - watchdog_exception('update', $e); - $io->error($e->getMessage()); - } - } + $function = sprintf( + '%s_post_update_%s', + $module_name, + $update_name + ); + drupal_flush_all_caches(); + $context = []; + update_invoke_post_update($function, $context); } } } From f9a09327126fadfbce5bb438d2ac465ea72afc5c Mon Sep 17 00:00:00 2001 From: Rohit Joshi Date: Mon, 6 Feb 2017 00:59:20 +0530 Subject: [PATCH 157/321] Adding language support to the node:create command. (#3145) --- src/Command/Create/NodesCommand.php | 42 +++++++++++++++++++++++++++-- src/Utils/Create/NodeData.php | 5 ++-- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/src/Command/Create/NodesCommand.php b/src/Command/Create/NodesCommand.php index d0553b953..f0b18a968 100644 --- a/src/Command/Create/NodesCommand.php +++ b/src/Command/Create/NodesCommand.php @@ -17,6 +17,7 @@ use Drupal\Console\Utils\Create\NodeData; use Drupal\Console\Utils\DrupalApi; use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Core\Language\LanguageInterface; /** * Class NodesCommand @@ -82,7 +83,13 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.create.nodes.options.time-range') - ); + ) + ->addOption( + 'language', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.create.nodes.options.language') + ); } /** @@ -142,6 +149,35 @@ function ($contentType) use ($bundles) { $input->setOption('time-range', array_search($timeRange, $timeRanges)); } + + // Language module is enabled or not. + $language_module_enabled = \Drupal::moduleHandler()->moduleExists('language'); + + // If language module is enabled. + if ($language_module_enabled) { + // Get available languages on site. + $available_languages = \Drupal::languageManager()->getLanguages(); + // Holds the available languages. + $language_list = []; + + foreach ($available_languages as $lang) { + $language_list[$lang->getId()] = $lang->getName(); + } + + $language = $input->getOption('language'); + // If no language option or invalid language code in option. + if (!$language || !array_key_exists($language, $language_list)) { + $language = $io->choice( + $this->trans('commands.create.nodes.questions.language'), + $language_list + ); + } + $input->setOption('language', $language); + } + else { + // If 'language' module is not enabled. + $input->setOption('language', LanguageInterface::LANGCODE_NOT_SPECIFIED); + } } /** @@ -156,6 +192,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $titleWords = $input->getOption('title-words')?:5; $timeRange = $input->getOption('time-range')?:31536000; $available_types = array_keys($this->drupalApi->getBundles()); + $language = $input->getOption('language'); foreach ($contentTypes as $type) { if (!in_array($type, $available_types)) { @@ -171,7 +208,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $contentTypes, $limit, $titleWords, - $timeRange + $timeRange, + $language ); $tableHeader = [ diff --git a/src/Utils/Create/NodeData.php b/src/Utils/Create/NodeData.php index 0bd8eda92..da6405112 100644 --- a/src/Utils/Create/NodeData.php +++ b/src/Utils/Create/NodeData.php @@ -56,7 +56,8 @@ public function create( $contentTypes, $limit, $titleWords, - $timeRange + $timeRange, + $language = LanguageInterface::LANGCODE_NOT_SPECIFIED ) { $nodes = []; for ($i=0; $i<$limit; $i++) { @@ -72,7 +73,7 @@ public function create( 'revision' => mt_rand(0, 1), 'status' => true, 'promote' => mt_rand(0, 1), - 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED + 'langcode' => $language ] ); From f5431db714dc88ff96063471c16c0c77840ae064 Mon Sep 17 00:00:00 2001 From: Johannes Haseitl Date: Sun, 5 Feb 2017 20:31:32 +0100 Subject: [PATCH 158/321] Fix revisions tab for generated content entity (#3139) * Fix routes in Entity controller * No create revision_translation_affected for untranslatable entites * Fix routes in entity-content-route provider --- .../module/src/Controller/entity-controller.php.twig | 8 ++++---- templates/module/src/Entity/entity-content.php.twig | 2 ++ .../module/src/entity-content-route-provider.php.twig | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/templates/module/src/Controller/entity-controller.php.twig b/templates/module/src/Controller/entity-controller.php.twig index 3c2fcd829..1244001ab 100644 --- a/templates/module/src/Controller/entity-controller.php.twig +++ b/templates/module/src/Controller/entity-controller.php.twig @@ -139,10 +139,10 @@ class {{ entity_class }}Controller extends ControllerBase implements ContainerIn 'title' => $this->t('Revert'), {% if is_translatable %} 'url' => $has_translations ? - Url::fromRoute('{{ entity_name }}.revision_revert_translation_confirm', ['{{ entity_name }}' => ${{ entity_name }}->id(), '{{ entity_name }}_revision' => $vid, 'langcode' => $langcode]) : - Url::fromRoute('{{ entity_name }}.revision_revert_confirm', ['{{ entity_name }}' => ${{ entity_name }}->id(), '{{ entity_name }}_revision' => $vid]), + Url::fromRoute('entity.{{ entity_name }}.translation_revert', ['{{ entity_name }}' => ${{ entity_name }}->id(), '{{ entity_name }}_revision' => $vid, 'langcode' => $langcode]) : + Url::fromRoute('entity.{{ entity_name }}.revision_revert', ['{{ entity_name }}' => ${{ entity_name }}->id(), '{{ entity_name }}_revision' => $vid]), {% else %} - 'url' => Url::fromRoute('{{ entity_name }}.revision_revert_confirm', ['{{ entity_name }}' => ${{ entity_name }}->id(), '{{ entity_name }}_revision' => $vid]), + 'url' => Url::fromRoute('entity.{{ entity_name }}.revision_revert', ['{{ entity_name }}' => ${{ entity_name }}->id(), '{{ entity_name }}_revision' => $vid]), {% endif %} ]; } @@ -150,7 +150,7 @@ class {{ entity_class }}Controller extends ControllerBase implements ContainerIn if ($delete_permission) { $links['delete'] = [ 'title' => $this->t('Delete'), - 'url' => Url::fromRoute('{{ entity_name }}.revision_delete_confirm', ['{{ entity_name }}' => ${{ entity_name }}->id(), '{{ entity_name }}_revision' => $vid]), + 'url' => Url::fromRoute('entity.{{ entity_name }}.revision_delete', ['{{ entity_name }}' => ${{ entity_name }}->id(), '{{ entity_name }}_revision' => $vid]), ]; } diff --git a/templates/module/src/Entity/entity-content.php.twig b/templates/module/src/Entity/entity-content.php.twig index ae3f34240..72bb9320b 100644 --- a/templates/module/src/Entity/entity-content.php.twig +++ b/templates/module/src/Entity/entity-content.php.twig @@ -351,6 +351,8 @@ class {{ entity_class }} extends {% if revisionable %}RevisionableContentEntityB ->setSetting('target_type', 'user') ->setQueryable(FALSE) ->setRevisionable(TRUE); +{% endif %} +{% if revisionable and is_translatable %} $fields['revision_translation_affected'] = BaseFieldDefinition::create('boolean') ->setLabel(t('Revision translation affected')) diff --git a/templates/module/src/entity-content-route-provider.php.twig b/templates/module/src/entity-content-route-provider.php.twig index ebe0aceea..1772bebdc 100644 --- a/templates/module/src/entity-content-route-provider.php.twig +++ b/templates/module/src/entity-content-route-provider.php.twig @@ -45,11 +45,11 @@ class {{ entity_class }}HtmlRouteProvider extends AdminHtmlRouteProvider {% endb } if ($revert_route = $this->getRevisionRevertRoute($entity_type)) { - $collection->add("{$entity_type_id}.revision_revert_confirm", $revert_route); + $collection->add("entity.{$entity_type_id}.revision_revert", $revert_route); } if ($delete_route = $this->getRevisionDeleteRoute($entity_type)) { - $collection->add("{$entity_type_id}.revision_delete_confirm", $delete_route); + $collection->add("entity.{$entity_type_id}.revision_delete", $delete_route); } {% if is_translatable %} From 310f190b73875db7dfb404ddf064b76638ef6f18 Mon Sep 17 00:00:00 2001 From: Doug Green Date: Sun, 5 Feb 2017 15:22:46 -0500 Subject: [PATCH 159/321] Fix psy/psysh version dependency (#3153) --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a3e0306c7..c9c379fe6 100644 --- a/composer.json +++ b/composer.json @@ -48,7 +48,7 @@ "gabordemooij/redbean": "~4.3", "doctrine/annotations": "1.2.*", "symfony/expression-language": ">=2.7 <3.0", - "psy/psysh": "0.6|0.8" + "psy/psysh": "0.6.* || ~0.8" }, "bin": ["bin/drupal"], "config": { From e03ab42ec61413c2c7a42f8c9e5914bddf9365e5 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 5 Feb 2017 12:33:50 -0800 Subject: [PATCH 160/321] [console] Update composer.lock file. (#3160) --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index da44a7ec4..f7a79f0a5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "ec3fa8fd2544e01fbbbddf1a050df357", + "content-hash": "a57c79051c4e6fd7b5a31473b3fb8bc8", "packages": [ { "name": "alchemy/zippy", @@ -1047,16 +1047,16 @@ }, { "name": "nikic/php-parser", - "version": "v3.0.2", + "version": "v3.0.3", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "adf44419c0fc014a0f191db6f89d3e55d4211744" + "reference": "5b8182cc0abb4b0ff290ba9df6c0e1323286013a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/adf44419c0fc014a0f191db6f89d3e55d4211744", - "reference": "adf44419c0fc014a0f191db6f89d3e55d4211744", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/5b8182cc0abb4b0ff290ba9df6c0e1323286013a", + "reference": "5b8182cc0abb4b0ff290ba9df6c0e1323286013a", "shasum": "" }, "require": { @@ -1094,7 +1094,7 @@ "parser", "php" ], - "time": "2016-12-06T11:30:35+00:00" + "time": "2017-02-03T21:57:31+00:00" }, { "name": "psr/http-message", @@ -1195,16 +1195,16 @@ }, { "name": "psy/psysh", - "version": "v0.8.0", + "version": "v0.8.1", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "4a8860e13aa68a4bbf2476c014f8a1f14f1bf991" + "reference": "701e8a1cc426ee170f1296f5d9f6b8a26ad25c4a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/4a8860e13aa68a4bbf2476c014f8a1f14f1bf991", - "reference": "4a8860e13aa68a4bbf2476c014f8a1f14f1bf991", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/701e8a1cc426ee170f1296f5d9f6b8a26ad25c4a", + "reference": "701e8a1cc426ee170f1296f5d9f6b8a26ad25c4a", "shasum": "" }, "require": { @@ -1234,7 +1234,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-develop": "0.8.x-dev" + "dev-develop": "0.9.x-dev" } }, "autoload": { @@ -1264,7 +1264,7 @@ "interactive", "shell" ], - "time": "2016-12-07T17:15:07+00:00" + "time": "2017-01-15T17:54:13+00:00" }, { "name": "stecman/symfony-console-completion", From 7b1d370b676a7211f1b51ddb1c7a3e3a1e4413f6 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 5 Feb 2017 12:54:01 -0800 Subject: [PATCH 161/321] [console] Apply PSR-2 code style. (#3161) --- src/Command/Config/DeleteCommand.php | 6 +- src/Command/Config/ImportCommand.php | 5 +- src/Command/Create/NodesCommand.php | 19 +- src/Command/Cron/ExecuteCommand.php | 2 +- src/Command/Generate/CacheContextCommand.php | 230 +++++++++--------- .../Generate/PluginMigrateProcessCommand.php | 8 +- src/Command/Generate/UpdateCommand.php | 2 +- src/Command/Migrate/RollBackCommand.php | 58 ++--- src/Command/ServerCommand.php | 10 +- src/Command/Shared/MigrationTrait.php | 3 +- src/Command/Shared/ModuleTrait.php | 9 +- src/Command/Update/ExecuteCommand.php | 7 +- src/Generator/CacheContextGenerator.php | 72 +++--- src/Generator/ModuleGenerator.php | 11 +- 14 files changed, 217 insertions(+), 225 deletions(-) diff --git a/src/Command/Config/DeleteCommand.php b/src/Command/Config/DeleteCommand.php index eb6afdcad..7ab29c664 100644 --- a/src/Command/Config/DeleteCommand.php +++ b/src/Command/Config/DeleteCommand.php @@ -41,9 +41,9 @@ class DeleteCommand extends Command /** * DeleteCommand constructor. * - * @param ConfigFactory $configFactory - * @param CachedStorage $configStorage - * @param StorageInterface $configStorageSync + * @param ConfigFactory $configFactory + * @param CachedStorage $configStorage + * @param StorageInterface $configStorageSync */ public function __construct( ConfigFactory $configFactory, diff --git a/src/Command/Config/ImportCommand.php b/src/Command/Config/ImportCommand.php index 5dc076e31..373b3d587 100644 --- a/src/Command/Config/ImportCommand.php +++ b/src/Command/Config/ImportCommand.php @@ -102,8 +102,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if ($this->configImport($io, $storage_comparer)) { $io->success($this->trans('commands.config.import.messages.imported')); - } - else { + } else { return 1; } } @@ -129,7 +128,7 @@ private function configImport(DrupalStyle $io, StorageComparer $storage_comparer try { $io->info($this->trans('commands.config.import.messages.importing')); $config_importer->import(); - return TRUE; + return true; } catch (ConfigImporterException $e) { $message = 'The import failed due for the following reasons:' . "\n"; $message .= implode("\n", $config_importer->getErrors()); diff --git a/src/Command/Create/NodesCommand.php b/src/Command/Create/NodesCommand.php index f0b18a968..fe8ca08e0 100644 --- a/src/Command/Create/NodesCommand.php +++ b/src/Command/Create/NodesCommand.php @@ -84,12 +84,12 @@ protected function configure() InputOption::VALUE_OPTIONAL, $this->trans('commands.create.nodes.options.time-range') ) - ->addOption( - 'language', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.create.nodes.options.language') - ); + ->addOption( + 'language', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.create.nodes.options.language') + ); } /** @@ -168,13 +168,12 @@ function ($contentType) use ($bundles) { // If no language option or invalid language code in option. if (!$language || !array_key_exists($language, $language_list)) { $language = $io->choice( - $this->trans('commands.create.nodes.questions.language'), - $language_list + $this->trans('commands.create.nodes.questions.language'), + $language_list ); } $input->setOption('language', $language); - } - else { + } else { // If 'language' module is not enabled. $input->setOption('language', LanguageInterface::LANGCODE_NOT_SPECIFIED); } diff --git a/src/Command/Cron/ExecuteCommand.php b/src/Command/Cron/ExecuteCommand.php index bc2e6b157..39181925c 100644 --- a/src/Command/Cron/ExecuteCommand.php +++ b/src/Command/Cron/ExecuteCommand.php @@ -92,7 +92,7 @@ protected function execute(InputInterface $input, OutputInterface $output) return 1; } - if ( $modules === NULL || in_array('all', $modules)) { + if ($modules === null || in_array('all', $modules)) { $modules = $this->moduleHandler->getImplementations('cron'); } diff --git a/src/Command/Generate/CacheContextCommand.php b/src/Command/Generate/CacheContextCommand.php index 7fdc5ed6b..c9be2e877 100644 --- a/src/Command/Generate/CacheContextCommand.php +++ b/src/Command/Generate/CacheContextCommand.php @@ -23,148 +23,148 @@ class CacheContextCommand extends Command { - use ModuleTrait; - use ConfirmationTrait; - use ContainerAwareCommandTrait; - use ServicesTrait; + use ModuleTrait; + use ConfirmationTrait; + use ContainerAwareCommandTrait; + use ServicesTrait; - /** + /** * @var CacheContextGenerator */ - protected $generator; + protected $generator; - /** + /** * @var ChainQueue */ - protected $chainQueue; + protected $chainQueue; - /** + /** * @var Manager */ - protected $extensionManager; + protected $extensionManager; - /** + /** * @var StringConverter */ - protected $stringConverter; + protected $stringConverter; - /** + /** * CacheContextCommand constructor. * - * @param CacheContextGenerator $generator - * @param ChainQueue $chainQueue - * @param Manager $extensionManager - * @param StringConverter $stringConverter + * @param CacheContextGenerator $generator + * @param ChainQueue $chainQueue + * @param Manager $extensionManager + * @param StringConverter $stringConverter */ - public function __construct( - CacheContextGenerator $generator, - ChainQueue $chainQueue, - Manager $extensionManager, - StringConverter $stringConverter - ) { - $this->generator = $generator; - $this->chainQueue = $chainQueue; - $this->extensionManager = $extensionManager; - $this->stringConverter = $stringConverter; - parent::__construct(); - } - - /** + public function __construct( + CacheContextGenerator $generator, + ChainQueue $chainQueue, + Manager $extensionManager, + StringConverter $stringConverter + ) { + $this->generator = $generator; + $this->chainQueue = $chainQueue; + $this->extensionManager = $extensionManager; + $this->stringConverter = $stringConverter; + parent::__construct(); + } + + /** * {@inheritdoc} */ - protected function configure() - { - $this - ->setName('generate:cache:context') - ->setDescription($this->trans('commands.generate.cache.context.description')) - ->setHelp($this->trans('commands.generate.cache.context.description')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) - ->addOption( - 'cache_context', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.cache.context.questions.name') - ) - ->addOption( - 'class', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.cache.context.questions.class') - ) - ->addOption( - 'services', - null, - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.common.options.services') - ); - } - - /** + protected function configure() + { + $this + ->setName('generate:cache:context') + ->setDescription($this->trans('commands.generate.cache.context.description')) + ->setHelp($this->trans('commands.generate.cache.context.description')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'cache_context', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.cache.context.questions.name') + ) + ->addOption( + 'class', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.cache.context.questions.class') + ) + ->addOption( + 'services', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.common.options.services') + ); + } + + /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return; - } + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return; + } - $module = $input->getOption('module'); - $cache_context = $input->getOption('cache_context'); - $class = $input->getOption('class'); - $services = $input->getOption('services'); + $module = $input->getOption('module'); + $cache_context = $input->getOption('cache_context'); + $class = $input->getOption('class'); + $services = $input->getOption('services'); - // @see Drupal\Console\Command\Shared\ServicesTrait::buildServices - $buildServices = $this->buildServices($services); + // @see Drupal\Console\Command\Shared\ServicesTrait::buildServices + $buildServices = $this->buildServices($services); - $this->generator->generate($module, $cache_context, $class, $buildServices); + $this->generator->generate($module, $cache_context, $class, $buildServices); - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); - } + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); + } - /** + /** * {@inheritdoc} */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --cache_context option - $cache_context = $input->getOption('cache_context'); - if (!$cache_context) { - $cache_context = $io->ask( - $this->trans('commands.generate.cache.context.questions.name'), - sprintf('%s', $module) - ); - $input->setOption('cache_context', $cache_context); - } - - // --class option - $class = $input->getOption('class'); - if (!$class) { - $class = $io->ask( - $this->trans('commands.generate.cache.context.questions.class'), - 'DefaultCacheContext' - ); - $input->setOption('class', $class); - } - - // --services option - $services = $input->getOption('services'); - if (!$services) { - // @see Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion - $services = $this->servicesQuestion($io); - $input->setOption('services', $services); + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --cache_context option + $cache_context = $input->getOption('cache_context'); + if (!$cache_context) { + $cache_context = $io->ask( + $this->trans('commands.generate.cache.context.questions.name'), + sprintf('%s', $module) + ); + $input->setOption('cache_context', $cache_context); + } + + // --class option + $class = $input->getOption('class'); + if (!$class) { + $class = $io->ask( + $this->trans('commands.generate.cache.context.questions.class'), + 'DefaultCacheContext' + ); + $input->setOption('class', $class); + } + + // --services option + $services = $input->getOption('services'); + if (!$services) { + // @see Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion + $services = $this->servicesQuestion($io); + $input->setOption('services', $services); + } } - } } diff --git a/src/Command/Generate/PluginMigrateProcessCommand.php b/src/Command/Generate/PluginMigrateProcessCommand.php index cd1b75919..fccd9e35b 100644 --- a/src/Command/Generate/PluginMigrateProcessCommand.php +++ b/src/Command/Generate/PluginMigrateProcessCommand.php @@ -49,10 +49,10 @@ class PluginMigrateProcessCommand extends Command /** * PluginBlockCommand constructor. * - * @param PluginMigrateProcessGenerator $generator - * @param ChainQueue $chainQueue - * @param Manager $extensionManager - * @param StringConverter $stringConverter + * @param PluginMigrateProcessGenerator $generator + * @param ChainQueue $chainQueue + * @param Manager $extensionManager + * @param StringConverter $stringConverter */ public function __construct( PluginMigrateProcessGenerator $generator, diff --git a/src/Command/Generate/UpdateCommand.php b/src/Command/Generate/UpdateCommand.php index 028e4e4ed..dd1f4eea5 100644 --- a/src/Command/Generate/UpdateCommand.php +++ b/src/Command/Generate/UpdateCommand.php @@ -57,7 +57,7 @@ class UpdateCommand extends Command * * @param Manager $extensionManager * @param UpdateGenerator $generator - * @param Site $site + * @param Site $site * @param ChainQueue $chainQueue */ public function __construct( diff --git a/src/Command/Migrate/RollBackCommand.php b/src/Command/Migrate/RollBackCommand.php index aa69bc451..1d0b3a6d9 100644 --- a/src/Command/Migrate/RollBackCommand.php +++ b/src/Command/Migrate/RollBackCommand.php @@ -41,6 +41,7 @@ class RollBackCommand extends Command /** * RollBackCommand constructor. + * * @param MigrationPluginManagerInterface $pluginManagerMigration */ public function __construct(MigrationPluginManagerInterface $pluginManagerMigration) @@ -61,8 +62,6 @@ protected function configure() InputOption::VALUE_OPTIONAL, $this->trans('commands.migrate.setup.options.source-base_path') ); - - } protected function execute(InputInterface $input, OutputInterface $output) @@ -103,34 +102,32 @@ protected function execute(InputInterface $input, OutputInterface $output) $migration_status = $executable->rollback(); switch ($migration_status) { - case MigrationInterface::RESULT_COMPLETED: - $io->info( - sprintf( - $this->trans('commands.migrate.rollback.messages.processing'), - $migration - ) - ); - break; - case MigrationInterface::RESULT_INCOMPLETE: - $io->info( - sprintf( - $this->trans('commands.migrate.execute.messages.importing-incomplete'), - $migration - ) - ); - break; - case MigrationInterface::RESULT_STOPPED: - $io->error( - sprintf( - $this->trans('commands.migrate.execute.messages.import-stopped'), - $migration - ) - ); - break; + case MigrationInterface::RESULT_COMPLETED: + $io->info( + sprintf( + $this->trans('commands.migrate.rollback.messages.processing'), + $migration + ) + ); + break; + case MigrationInterface::RESULT_INCOMPLETE: + $io->info( + sprintf( + $this->trans('commands.migrate.execute.messages.importing-incomplete'), + $migration + ) + ); + break; + case MigrationInterface::RESULT_STOPPED: + $io->error( + sprintf( + $this->trans('commands.migrate.execute.messages.import-stopped'), + $migration + ) + ); + break; } - } - } } @@ -140,7 +137,7 @@ protected function execute(InputInterface $input, OutputInterface $output) protected function interact(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); - // Get migrations + // Get migrations $migrations_list = $this->getMigrations($version_tag); // --migration-id prefix @@ -180,6 +177,5 @@ protected function interact(InputInterface $input, OutputInterface $output) ); $input->setOption('source-base_path', $sourceBasepath); } - } -} \ No newline at end of file +} diff --git a/src/Command/ServerCommand.php b/src/Command/ServerCommand.php index 8d468f59d..1d7fcb5e2 100644 --- a/src/Command/ServerCommand.php +++ b/src/Command/ServerCommand.php @@ -76,15 +76,15 @@ protected function execute(InputInterface $input, OutputInterface $output) $router = $this->getRouterPath(); $processBuilder = new ProcessBuilder([$binary, '-S', $address, $router]); - $processBuilder->setTimeout(NULL); + $processBuilder->setTimeout(null); $processBuilder->setWorkingDirectory($this->appRoot); $process = $processBuilder->getProcess(); $io->success( - sprintf( - $this->trans('commands.server.messages.executing'), - $binary - ) + sprintf( + $this->trans('commands.server.messages.executing'), + $binary + ) ); $io->commentBlock( diff --git a/src/Command/Shared/MigrationTrait.php b/src/Command/Shared/MigrationTrait.php index e020f9ac6..202b5e52a 100644 --- a/src/Command/Shared/MigrationTrait.php +++ b/src/Command/Shared/MigrationTrait.php @@ -12,7 +12,6 @@ use Drupal\Console\Core\Style\DrupalStyle; use Symfony\Component\Console\Input\InputInterface; - /** * Class MigrationTrait * @@ -204,7 +203,7 @@ protected function registerMigrateDB(InputInterface $input, DrupalStyle $io) * @param $dbHost */ protected function addDBConnection(DrupalStyle $io, $key, $target, $dbType, $dbName, $dbUser, $dbPass, $dbPrefix, $dbPort, $dbHost) - { + { $database_type = $this->getDatabaseDrivers(); $reflection = new \ReflectionClass($database_type[$dbType]); $install_namespace = $reflection->getNamespaceName(); diff --git a/src/Command/Shared/ModuleTrait.php b/src/Command/Shared/ModuleTrait.php index 03d9b1e85..88b52c1ab 100644 --- a/src/Command/Shared/ModuleTrait.php +++ b/src/Command/Shared/ModuleTrait.php @@ -16,7 +16,7 @@ trait ModuleTrait * * @param DrupalStyle $io * Console interface. - * @param bool $showProfile + * @param bool $showProfile * If profiles should be discovered. * * @throws \Exception @@ -58,12 +58,11 @@ public function moduleQuestion(DrupalStyle $io, $showProfile = true) /** * Verify that install requirements for a list of modules are met. * - * @param string[] $module + * @param string[] $module * List of modules to verify. * @param DrupalStyle $io * Console interface. * - * * @throws \Exception * When one or more requirements are not met. */ @@ -71,14 +70,14 @@ public function moduleRequirement(array $module, DrupalStyle $io) { // TODO: Module dependencies should also be checked // for unmet requirements recursively. - $fail = FALSE; + $fail = false; foreach ($module as $module_name) { module_load_install($module_name); if ($requirements = \Drupal::moduleHandler()->invoke($module_name, 'requirements', ['install'])) { foreach ($requirements as $requirement) { if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_ERROR) { $io->info("Module '{$module_name}' cannot be installed: " . $requirement['title'] . ' | ' . $requirement['value']); - $fail = TRUE; + $fail = true; } } } diff --git a/src/Command/Update/ExecuteCommand.php b/src/Command/Update/ExecuteCommand.php index 26f9a206e..3387d4280 100644 --- a/src/Command/Update/ExecuteCommand.php +++ b/src/Command/Update/ExecuteCommand.php @@ -162,7 +162,7 @@ protected function execute(InputInterface $input, OutputInterface $output) /** * @param \Drupal\Console\Core\Style\DrupalStyle $io - * @param array $updates + * @param array $updates * * @return bool true if the selected module/update number exists. */ @@ -195,7 +195,7 @@ private function checkUpdates(DrupalStyle $io, array $updates) /** * @param \Drupal\Console\Core\Style\DrupalStyle $io - * @param array $updates + * @param array $updates * * @return bool True if all available updates have been run. */ @@ -204,8 +204,7 @@ private function runUpdates(DrupalStyle $io, array $updates) if ($this->module != 'all') { $complete = count($updates) == 1; $updates = [$this->module => $updates[$this->module]]; - } - else { + } else { $complete = true; } diff --git a/src/Generator/CacheContextGenerator.php b/src/Generator/CacheContextGenerator.php index ea30605be..a4d85f813 100644 --- a/src/Generator/CacheContextGenerator.php +++ b/src/Generator/CacheContextGenerator.php @@ -12,53 +12,53 @@ class CacheContextGenerator extends Generator { - /** + /** * @var Manager */ - protected $extensionManager; + protected $extensionManager; - /** + /** * CacheContextGenerator constructor. * * @param Manager $extensionManager */ - public function __construct( - Manager $extensionManager - ) { - $this->extensionManager = $extensionManager; - } + public function __construct( + Manager $extensionManager + ) { + $this->extensionManager = $extensionManager; + } - /** + /** * Generator Service. * - * @param string $module Module name - * @param string $cache_context Cache context name - * @param string $class Class name - * @param array $services List of services + * @param string $module Module name + * @param string $cache_context Cache context name + * @param string $class Class name + * @param array $services List of services */ - public function generate($module, $cache_context, $class, $services) - { - $parameters = [ - 'module' => $module, - 'name' => 'cache_context.' . $cache_context, - 'class' => $class, - 'services' => $services, - 'class_path' => sprintf('Drupal\%s\CacheContext\%s', $module, $class), - 'tags' => ['name' => 'cache_context'], - 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'), - ]; + public function generate($module, $cache_context, $class, $services) + { + $parameters = [ + 'module' => $module, + 'name' => 'cache_context.' . $cache_context, + 'class' => $class, + 'services' => $services, + 'class_path' => sprintf('Drupal\%s\CacheContext\%s', $module, $class), + 'tags' => ['name' => 'cache_context'], + 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'), + ]; - $this->renderFile( - 'module/src/cache-context.php.twig', - $this->extensionManager->getModule($module)->getSourcePath().'/CacheContext/'.$class.'.php', - $parameters - ); + $this->renderFile( + 'module/src/cache-context.php.twig', + $this->extensionManager->getModule($module)->getSourcePath().'/CacheContext/'.$class.'.php', + $parameters + ); - $this->renderFile( - 'module/services.yml.twig', - $this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml', - $parameters, - FILE_APPEND - ); - } + $this->renderFile( + 'module/services.yml.twig', + $this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml', + $parameters, + FILE_APPEND + ); + } } diff --git a/src/Generator/ModuleGenerator.php b/src/Generator/ModuleGenerator.php index ddec4919a..be4b87c2a 100644 --- a/src/Generator/ModuleGenerator.php +++ b/src/Generator/ModuleGenerator.php @@ -174,14 +174,15 @@ public function generate( * * @param string $dir * The directory name. - * @param array $parameters + * @param array $parameters * The parameter array. */ - protected function createModuleFile ($dir, $parameters) { + protected function createModuleFile($dir, $parameters) + { $this->renderFile( - 'module/module.twig', - $dir . '/' . $parameters['machine_name'] . '.module', - $parameters + 'module/module.twig', + $dir . '/' . $parameters['machine_name'] . '.module', + $parameters ); } } From ca1541293580c63480abfc8e5c85fd4a9258dff9 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 6 Feb 2017 23:02:21 -0800 Subject: [PATCH 162/321] [console] Update extend command discovery. (#3165) * [console] Update extend command discovery. * [console] Remove dead code line. --- services-drupal-install.yml | 2 +- src/Bootstrap/AddServicesCompilerPass.php | 4 ++ src/Bootstrap/Drupal.php | 2 +- src/Utils/Site.php | 70 ++++++++++++++++------- 4 files changed, 56 insertions(+), 22 deletions(-) diff --git a/services-drupal-install.yml b/services-drupal-install.yml index 015cb4b63..269e0189f 100644 --- a/services-drupal-install.yml +++ b/services-drupal-install.yml @@ -1,7 +1,7 @@ services: console.site: class: Drupal\Console\Utils\Site - arguments: ['@app.root'] + arguments: ['@app.root', '@console.configuration_manager'] console.extension_manager: class: Drupal\Console\Extension\Manager arguments: ['@console.site', '@app.root'] diff --git a/src/Bootstrap/AddServicesCompilerPass.php b/src/Bootstrap/AddServicesCompilerPass.php index 19f7c8b14..637539a32 100644 --- a/src/Bootstrap/AddServicesCompilerPass.php +++ b/src/Bootstrap/AddServicesCompilerPass.php @@ -61,6 +61,10 @@ public function process(ContainerBuilder $container) $loader->load($this->root. DRUPAL_CONSOLE . 'services-drupal-install.yml'); $loader->load($this->root. DRUPAL_CONSOLE . 'services.yml'); + $container->get('console.configuration_manager') + ->loadConfiguration($this->root) + ->getConfiguration(); + $basePath = $container->get('console.site')->getCacheDirectory(); $consoleServicesFile = $basePath.'/console.services.yml'; $consoleExtendServicesFile = $basePath.'/extend.console.services.yml'; diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index 9501e5f39..4ad0094f5 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -121,7 +121,6 @@ public function boot($debug) AnnotationRegistry::registerLoader([$this->autoload, "loadClass"]); $configuration = $container->get('console.configuration_manager') - ->loadConfiguration($this->root) ->getConfiguration(); $container->get('console.translator_manager') @@ -145,6 +144,7 @@ public function boot($debug) $extendExtensionManager->processProjectPackages($this->root); } $configFiles = $extendExtensionManager->getConfigFiles(); + foreach ($configFiles as $configFile) { $container->get('console.configuration_manager') ->importConfigurationFile($configFile); diff --git a/src/Utils/Site.php b/src/Utils/Site.php index dee4d3b91..72d1ab52b 100644 --- a/src/Utils/Site.php +++ b/src/Utils/Site.php @@ -10,19 +10,38 @@ use Drupal\Core\Language\LanguageManager; use Drupal\Core\Language\Language; use Drupal\Core\Site\Settings; +use Drupal\Console\Core\Utils\ConfigurationManager; class Site { + /** + * @var string + */ protected $appRoot; + /** + * @var ConfigurationManager + */ + protected $configurationManager; + + /** + * @var string + */ + protected $cacheDirectory; + /** * Site constructor. * - * @param $appRoot + * @param string $appRoot + * @param ConfigurationManager $configurationManager */ - public function __construct($appRoot) + public function __construct( + $appRoot, + ConfigurationManager $configurationManager + ) { $this->appRoot = $appRoot; + $this->configurationManager = $configurationManager; } public function loadLegacyFile($legacyFile, $relative = true) @@ -187,42 +206,53 @@ public function validMultisite($uri) public function getCacheDirectory() { + if ($this->cacheDirectory) { + return $this->cacheDirectory; + } + $configFactory = \Drupal::configFactory(); - $basePath = $configFactory->get('system.file') - ->get('path.temporary'); $siteId = $configFactory->get('system.site') ->get('uuid'); - $basePath = $this->validateDirectory( - $basePath . '/console/cache/' . $siteId . '/' + $pathTemporary = $configFactory->get('system.file') + ->get('path.temporary'); + $configuration = $this->configurationManager->getConfiguration(); + $cacheDirectory = $configuration->get('application.cache.directory')?:''; + if ($cacheDirectory) { + if (strpos($cacheDirectory, '/') != 0) { + $cacheDirectory = $this->configurationManager + ->getApplicationDirectory() . '/' . $cacheDirectory; + } + $cacheDirectories[] = $cacheDirectory . '/' . $siteId . '/'; + } + $cacheDirectories[] = sprintf( + '%s/cache/%s/', + $this->configurationManager->getConsoleDirectory(), + $siteId ); + $cacheDirectories[] = $pathTemporary . '/console/cache/' . $siteId . '/'; - if (!$basePath) { - if (function_exists('posix_getuid')) { - $homeDir = posix_getpwuid(posix_getuid())['dir']; - } else { - $homeDir = realpath(rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/\\')); + foreach ($cacheDirectories as $cacheDirectory) { + if ($this->isValidDirectory($cacheDirectory)) { + $this->cacheDirectory = $cacheDirectory; + break; } - - $basePath = sprintf('%s/.console/cache/%s/', $homeDir, $siteId); - - $basePath = $this->validateDirectory($basePath); } - return $basePath; + return $this->cacheDirectory; } - private function validateDirectory($path) + private function isValidDirectory($path) { $fileSystem = new Filesystem(); if ($fileSystem->exists($path)) { - return $path; + return true; } try { $fileSystem->mkdir($path); - return $path; + return true; } catch (\Exception $e) { - return null; + return false; } } } From c6d9d1769217a602f47f658aea2a76e0c5341b18 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 9 Feb 2017 10:06:53 -0800 Subject: [PATCH 163/321] Add composer extend plugin. (#3167) --- composer.json | 1 + composer.lock | 43 +++- services.yml | 2 - src/Bootstrap/AddServicesCompilerPass.php | 45 +--- src/Bootstrap/Drupal.php | 20 +- src/Utils/ExtendExtensionManager.php | 241 ---------------------- 6 files changed, 56 insertions(+), 296 deletions(-) delete mode 100644 src/Utils/ExtendExtensionManager.php diff --git a/composer.json b/composer.json index c9c379fe6..8182be54e 100644 --- a/composer.json +++ b/composer.json @@ -38,6 +38,7 @@ "require": { "php": "^5.5.9 || ^7.0", "drupal/console-core" : "1.0.0-rc15", + "drupal/console-extend-plugin": "~0", "alchemy/zippy": "0.4.3", "doctrine/collections":"1.3.0", "composer/installers": "~1.0", diff --git a/composer.lock b/composer.lock index f7a79f0a5..a69622998 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "a57c79051c4e6fd7b5a31473b3fb8bc8", + "content-hash": "8f8cfd0dcdd01b614ca047c2c0b0fa38", "packages": [ { "name": "alchemy/zippy", @@ -704,6 +704,47 @@ ], "time": "2017-01-23T14:59:05+00:00" }, + { + "name": "drupal/console-extend-plugin", + "version": "0.2.0", + "source": { + "type": "git", + "url": "https://github.com/hechoendrupal/drupal-console-extend-plugin.git", + "reference": "3c6b873205c6e33f24b33807901d3287a4ff9a02" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-extend-plugin/zipball/3c6b873205c6e33f24b33807901d3287a4ff9a02", + "reference": "3c6b873205c6e33f24b33807901d3287a4ff9a02", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0", + "symfony/finder": ">=2.7 <3.0", + "symfony/yaml": ">=2.7 <3.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Drupal\\Console\\Composer\\Plugin\\Extender" + }, + "autoload": { + "psr-4": { + "Drupal\\Console\\Composer\\Plugin\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0+" + ], + "authors": [ + { + "name": "Jesus Manuel Olivas", + "email": "jesus.olivas@gmail.com" + } + ], + "description": "Drupal Console Extend Plugin", + "time": "2017-02-09T17:09:50+00:00" + }, { "name": "gabordemooij/redbean", "version": "v4.3.3", diff --git a/services.yml b/services.yml index 4d50f0ebc..32e03500b 100644 --- a/services.yml +++ b/services.yml @@ -29,5 +29,3 @@ services: console.annotation_validator: class: Drupal\Console\Utils\AnnotationValidator arguments: ['@console.annotation_command_reader', '@console.extension_manager'] - console.extend_extension_manager: - class: Drupal\Console\Utils\ExtendExtensionManager diff --git a/src/Bootstrap/AddServicesCompilerPass.php b/src/Bootstrap/AddServicesCompilerPass.php index 637539a32..e86f85d27 100644 --- a/src/Bootstrap/AddServicesCompilerPass.php +++ b/src/Bootstrap/AddServicesCompilerPass.php @@ -8,7 +8,6 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\Finder\Finder; use Symfony\Component\Yaml\Yaml; -use Drupal\Console\Utils\ExtendExtensionManager; use Drupal\Console\Utils\TranslatorManager; use Drupal\Console\Extension\Extension; use Drupal\Console\Extension\Manager; @@ -65,17 +64,15 @@ public function process(ContainerBuilder $container) ->loadConfiguration($this->root) ->getConfiguration(); - $basePath = $container->get('console.site')->getCacheDirectory(); - $consoleServicesFile = $basePath.'/console.services.yml'; - $consoleExtendServicesFile = $basePath.'/extend.console.services.yml'; - $consoleExtendConfigFile = $basePath.'/extend.console.config.yml'; + $cacheDirectory = $container->get('console.site')->getCacheDirectory(); + $consoleServicesFile = $cacheDirectory.'/console.services.yml'; - if ($basePath && !$this->rebuild && file_exists($consoleServicesFile)) { + if (!$this->rebuild && file_exists($consoleServicesFile)) { $loader->load($consoleServicesFile); - if (file_exists($consoleExtendServicesFile)) { - $loader->load($consoleExtendServicesFile); - } } else { + if (file_exists($consoleServicesFile)) { + unlink($consoleServicesFile); + } $finder = new Finder(); $finder->files() ->name('*.yml') @@ -152,37 +149,17 @@ public function process(ContainerBuilder $container) } } - if ($servicesData && is_writable($basePath)) { + if ($servicesData && is_writable($cacheDirectory)) { file_put_contents( $consoleServicesFile, Yaml::dump($servicesData, 4, 2) ); } + } - /** - * @var ExtendExtensionManager $extendExtensionManager - */ - $extendExtensionManager = $container->get('console.extend_extension_manager'); - $extendExtensionManager->processProjectPackages($this->root); - $configData = $extendExtensionManager->getConfigData(); - if ($configData && is_writable($basePath)) { - file_put_contents( - $consoleExtendConfigFile, - Yaml::dump($configData, 6, 2) - ); - } - $servicesData = $extendExtensionManager->getServicesData(); - if ($servicesData && is_writable($basePath)) { - file_put_contents( - $consoleExtendServicesFile, - Yaml::dump($servicesData, 4, 2) - ); - } - - $servicesFiles = $extendExtensionManager->getServicesFiles(); - foreach ($servicesFiles as $servicesFile) { - $loader->load($servicesFile); - } + $consoleExtendServicesFile = $this->root. DRUPAL_CONSOLE .'/extend.console.services.yml'; + if (file_exists($consoleExtendServicesFile)) { + $loader->load($consoleExtendServicesFile); } $configurationManager = $container->get('console.configuration_manager'); diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index 4ad0094f5..b17767562 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -129,26 +129,10 @@ public function boot($debug) $this->root ); - $basePath = $container->get('console.site')->getCacheDirectory(); - $consoleExtendConfigFile = $basePath.'/extend.console.config.yml'; - - if ($basePath && file_exists($consoleExtendConfigFile)) { + $consoleExtendConfigFile = $this->root . DRUPAL_CONSOLE .'/extend.console.config.yml'; + if (file_exists($consoleExtendConfigFile)) { $container->get('console.configuration_manager') ->importConfigurationFile($consoleExtendConfigFile); - } else { - /** - * @var ExtendExtensionManager $extendExtensionManager - */ - $extendExtensionManager = $container->get('console.extend_extension_manager'); - if (!$extendExtensionManager->isProcessed()) { - $extendExtensionManager->processProjectPackages($this->root); - } - $configFiles = $extendExtensionManager->getConfigFiles(); - - foreach ($configFiles as $configFile) { - $container->get('console.configuration_manager') - ->importConfigurationFile($configFile); - } } $container->get('console.renderer') diff --git a/src/Utils/ExtendExtensionManager.php b/src/Utils/ExtendExtensionManager.php deleted file mode 100644 index d3f1ee373..000000000 --- a/src/Utils/ExtendExtensionManager.php +++ /dev/null @@ -1,241 +0,0 @@ -init(); - } - - /** - * @param string $composerFile - * - * @return bool - */ - public function isValidPackageType($composerFile) - { - if (!is_file($composerFile)) { - return false; - } - - $composerContent = json_decode(file_get_contents($composerFile), true); - if (!$composerContent) { - return false; - } - - if (!array_key_exists('type', $composerContent)) { - return false; - } - - return $composerContent['type'] === 'drupal-console-library'; - } - - /** - * @param string $configFile - */ - public function addConfigFile($configFile) - { - $configData = $this->parseData($configFile); - if ($this->isValidConfigData($configData)) { - $this->configFiles[] = $configFile; - $this->configData = array_merge_recursive( - $configData, - $this->configData - ); - } - } - - /** - * @param string $servicesFile - */ - public function addServicesFile($servicesFile) - { - $servicesData = $this->parseData($servicesFile); - if ($this->isValidServicesData($servicesData)) { - $this->servicesFiles[] = $servicesFile; - $this->servicesData = array_merge_recursive( - $servicesData, - $this->servicesData - ); - } - } - - /** - * init - */ - private function init() - { - $this->configData = []; - $this->servicesData = []; - $this->configFiles = []; - $this->servicesFiles = []; - $this->processed = false; - } - - /** - * @param $file - * @return array|mixed - */ - private function parseData($file) - { - if (!file_exists($file)) { - return []; - } - - $data = Yaml::parse( - file_get_contents($file) - ); - - if (!$data) { - return []; - } - - return $data; - } - - public function processProjectPackages($directory) - { - $finder = new Finder(); - $finder->files() - ->name('composer.json') - ->contains('drupal-console-library') - ->in($directory); - - foreach ($finder as $file) { - $this->processComposerFile($file->getPathName()); - } - - $this->processed = true; - } - - /** - * @param $composerFile - */ - private function processComposerFile($composerFile) - { - $packageDirectory = dirname($composerFile); - - $configFile = $packageDirectory.'/console.config.yml'; - $this->addConfigFile($configFile); - - $servicesFile = $packageDirectory.'/console.services.yml'; - $this->addServicesFile($servicesFile); - } - - /** - * @param array $configData - * - * @return boolean - */ - private function isValidConfigData($configData) - { - if (!$configData) { - return false; - } - - if (!array_key_exists('application', $configData)) { - return false; - } - - if (!array_key_exists('autowire', $configData['application'])) { - return false; - } - - if (!array_key_exists('commands', $configData['application']['autowire'])) { - return false; - } - - return true; - } - - /** - * @param array $servicesData - * - * @return boolean - */ - private function isValidServicesData($servicesData) - { - if (!$servicesData) { - return false; - } - - if (!array_key_exists('services', $servicesData)) { - return false; - } - - return true; - } - - /** - * @return array - */ - public function getConfigData() - { - return $this->configData; - } - - /** - * @return array - */ - public function getServicesData() - { - return $this->servicesData; - } - - /** - * @return array - */ - public function getConfigFiles() - { - return $this->configFiles; - } - - /** - * @return array - */ - public function getServicesFiles() - { - return $this->servicesFiles; - } - - /** - * @return bool - */ - public function isProcessed() - { - return $this->processed; - } -} From 411bd9b96cdfe7b74423b1ab1f9c728a397d8095 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 9 Feb 2017 10:22:20 -0800 Subject: [PATCH 164/321] Add generated files to gitignore file. (#3168) --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 10262dcc8..940e4f062 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,7 @@ autoload.local.php # Drupal /core /nbproject/ + +# drupal/console-extend-plugin generated files +extend.console.config.yml +extend.console.services.yml From 955b057042635a5dc935799228ec7bbddf2c0cc2 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 9 Feb 2017 10:54:29 -0800 Subject: [PATCH 165/321] [console] Tag 1.0.0-rc16 release. (#3169) --- composer.json | 2 +- composer.lock | 24 ++++++++++++------------ src/Application.php | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index 8182be54e..0e529681c 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ }, "require": { "php": "^5.5.9 || ^7.0", - "drupal/console-core" : "1.0.0-rc15", + "drupal/console-core" : "1.0.0-rc16", "drupal/console-extend-plugin": "~0", "alchemy/zippy": "0.4.3", "doctrine/collections":"1.3.0", diff --git a/composer.lock b/composer.lock index a69622998..61e751184 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "8f8cfd0dcdd01b614ca047c2c0b0fa38", + "content-hash": "a60765f5a4f4065da528f6b28607c785", "packages": [ { "name": "alchemy/zippy", @@ -571,21 +571,21 @@ }, { "name": "drupal/console-core", - "version": "1.0.0-rc15", + "version": "1.0.0-rc16", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "3b82904b14c40877497d34a2901a72cc987a5808" + "reference": "42690f652b3a61d7d15fe9b785b946f3eb9227bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/3b82904b14c40877497d34a2901a72cc987a5808", - "reference": "3b82904b14c40877497d34a2901a72cc987a5808", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/42690f652b3a61d7d15fe9b785b946f3eb9227bf", + "reference": "42690f652b3a61d7d15fe9b785b946f3eb9227bf", "shasum": "" }, "require": { "dflydev/dot-access-configuration": "1.0.1", - "drupal/console-en": "1.0.0-rc15", + "drupal/console-en": "1.0.0-rc16", "php": "^5.5.9 || ^7.0", "stecman/symfony-console-completion": "~0.7", "symfony/config": ">=2.7 <3.0", @@ -648,20 +648,20 @@ "drupal", "symfony" ], - "time": "2017-01-23T18:02:51+00:00" + "time": "2017-02-09T18:22:32+00:00" }, { "name": "drupal/console-en", - "version": "1.0.0-rc15", + "version": "1.0.0-rc16", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", - "reference": "87a886d5084d33f813e0d7c0547534ac43e75da8" + "reference": "32c1e4c31500ba4ccd5e68bd74977fd6258c3e37" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/87a886d5084d33f813e0d7c0547534ac43e75da8", - "reference": "87a886d5084d33f813e0d7c0547534ac43e75da8", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/32c1e4c31500ba4ccd5e68bd74977fd6258c3e37", + "reference": "32c1e4c31500ba4ccd5e68bd74977fd6258c3e37", "shasum": "" }, "type": "drupal-console-language", @@ -702,7 +702,7 @@ "drupal", "symfony" ], - "time": "2017-01-23T14:59:05+00:00" + "time": "2017-02-09T16:02:27+00:00" }, { "name": "drupal/console-extend-plugin", diff --git a/src/Application.php b/src/Application.php index 957e75adf..5085bb5d1 100644 --- a/src/Application.php +++ b/src/Application.php @@ -25,7 +25,7 @@ class Application extends BaseApplication /** * @var string */ - const VERSION = '1.0.0-rc15'; + const VERSION = '1.0.0-rc16'; public function __construct(ContainerInterface $container) { From 6eca86a25b150e628212b85d3e186eff6ec57b2a Mon Sep 17 00:00:00 2001 From: Rohit Joshi Date: Sat, 11 Feb 2017 23:04:27 +0530 Subject: [PATCH 166/321] Correcting cache context service tag name. (#3171) --- src/Generator/CacheContextGenerator.php | 2 +- templates/module/src/cache-context.php.twig | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Generator/CacheContextGenerator.php b/src/Generator/CacheContextGenerator.php index a4d85f813..da87ee974 100644 --- a/src/Generator/CacheContextGenerator.php +++ b/src/Generator/CacheContextGenerator.php @@ -44,7 +44,7 @@ public function generate($module, $cache_context, $class, $services) 'class' => $class, 'services' => $services, 'class_path' => sprintf('Drupal\%s\CacheContext\%s', $module, $class), - 'tags' => ['name' => 'cache_context'], + 'tags' => ['name' => 'cache.context'], 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'), ]; diff --git a/templates/module/src/cache-context.php.twig b/templates/module/src/cache-context.php.twig index 09c3e4b9f..c7dcbf094 100644 --- a/templates/module/src/cache-context.php.twig +++ b/templates/module/src/cache-context.php.twig @@ -9,6 +9,7 @@ namespace Drupal\{{module}}\CacheContext; {% endblock %} {% block use_class %} +use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Cache\Context\CacheContextInterface; {% endblock %} @@ -35,21 +36,21 @@ class {{ class }} implements CacheContextInterface {% endblock %} /** * {@inheritdoc} */ - static function getLabel() { - drupal_set_message('Lable of cache context'); + public static function getLabel() { + drupal_set_message('Lable of cache context'); } /** * {@inheritdoc} */ public function getContext() { - // Actual logic of context variation will lie here. + // Actual logic of context variation will lie here. } /** * {@inheritdoc} */ public function getCacheableMetadata() { - // The buble cache metadata. + return new CacheableMetadata(); } {% endblock %} From 5a916d693fab453e92323859d1deb7dcf47df99b Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Tue, 14 Feb 2017 01:26:55 -0800 Subject: [PATCH 167/321] Load uninstall.services.yml file. (#3178) --- .gitignore | 3 +-- src/Bootstrap/AddServicesCompilerPass.php | 2 +- services-drupal-install.yml => uninstall.services.yml | 0 3 files changed, 2 insertions(+), 3 deletions(-) rename services-drupal-install.yml => uninstall.services.yml (100%) diff --git a/.gitignore b/.gitignore index 940e4f062..fd4f8ab8b 100644 --- a/.gitignore +++ b/.gitignore @@ -30,5 +30,4 @@ autoload.local.php /nbproject/ # drupal/console-extend-plugin generated files -extend.console.config.yml -extend.console.services.yml +extend.console.*.yml diff --git a/src/Bootstrap/AddServicesCompilerPass.php b/src/Bootstrap/AddServicesCompilerPass.php index e86f85d27..a2c057243 100644 --- a/src/Bootstrap/AddServicesCompilerPass.php +++ b/src/Bootstrap/AddServicesCompilerPass.php @@ -57,7 +57,7 @@ public function process(ContainerBuilder $container) ); $loader->load($this->root. DRUPAL_CONSOLE_CORE . 'services.yml'); - $loader->load($this->root. DRUPAL_CONSOLE . 'services-drupal-install.yml'); + $loader->load($this->root. DRUPAL_CONSOLE . 'uninstall.services.yml'); $loader->load($this->root. DRUPAL_CONSOLE . 'services.yml'); $container->get('console.configuration_manager') diff --git a/services-drupal-install.yml b/uninstall.services.yml similarity index 100% rename from services-drupal-install.yml rename to uninstall.services.yml From dd620a84fa981f2faff8e86be64b8cf2a5915010 Mon Sep 17 00:00:00 2001 From: Christoph Burschka Date: Thu, 23 Feb 2017 21:36:22 +0100 Subject: [PATCH 168/321] Grammar fix in error message (#3194) --- src/Bootstrap/Drupal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index b17767562..8f0431c26 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -39,7 +39,7 @@ public function boot($debug) $argvInputReader = new ArgvInputReader(); if (!class_exists('Drupal\Core\DrupalKernel')) { - $io->error('Class Drupal\Core\DrupalKernel do not exists.'); + $io->error('Class Drupal\Core\DrupalKernel does not exist.'); $drupal = new DrupalConsoleCore($this->root, $this->appRoot); return $drupal->boot(); } From 86df4f80f9f4c7ef97f4279cfc6aa95351121c5f Mon Sep 17 00:00:00 2001 From: Niels van Aken Date: Thu, 23 Feb 2017 21:42:31 +0100 Subject: [PATCH 169/321] =?UTF-8?q?Prevent=20special=20characters=20in=20p?= =?UTF-8?q?asswords=20and=20other=20args=20to=20mess=20up=20the=E2=80=A6?= =?UTF-8?q?=20(#3190)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Prevent special characters in passwords and other args to mess up the command This should fix hechoendrupal/drupal-console#3189 * Might as well quote the pgsql driver command Adresses issue hechoendrupal/drupal-console#3189 * Debug should be false by default, fixing issue hechoendrupal/drupal-console#3179 --- src/Bootstrap/Drupal.php | 2 +- src/Command/Database/DumpCommand.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index 8f0431c26..abb4ae8ba 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -31,7 +31,7 @@ public function __construct($autoload, $root, $appRoot) $this->appRoot = $appRoot; } - public function boot($debug) + public function boot($debug = FALSE) { $output = new ConsoleOutput(); $input = new ArrayInput([]); diff --git a/src/Command/Database/DumpCommand.php b/src/Command/Database/DumpCommand.php index cc5888be5..337e51320 100644 --- a/src/Command/Database/DumpCommand.php +++ b/src/Command/Database/DumpCommand.php @@ -101,7 +101,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if ($databaseConnection['driver'] == 'mysql') { $command = sprintf( - 'mysqldump --user=%s --password=%s --host=%s --port=%s %s > %s', + 'mysqldump --user="%s" --password="%s" --host="%s" --port="%s" "%s" > "%s"', $databaseConnection['username'], $databaseConnection['password'], $databaseConnection['host'], @@ -111,7 +111,7 @@ protected function execute(InputInterface $input, OutputInterface $output) ); } elseif ($databaseConnection['driver'] == 'pgsql') { $command = sprintf( - 'PGPASSWORD="%s" pg_dumpall -w -U %s -h %s -p %s -l %s -f %s', + 'PGPASSWORD="%s" pg_dumpall -w -U "%s" -h "%s" -p "%s" -l "%s" -f "%s"', $databaseConnection['password'], $databaseConnection['username'], $databaseConnection['host'], From a04141f7dc5f4a4c3056765e0a1d7e9c473e0d77 Mon Sep 17 00:00:00 2001 From: Patrick Bauer Date: Fri, 10 Mar 2017 07:20:42 +0100 Subject: [PATCH 170/321] Add required argument to ExtensionManager::getList() (#3207) --- src/Command/Shared/ExtensionTrait.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Command/Shared/ExtensionTrait.php b/src/Command/Shared/ExtensionTrait.php index 982c41167..2afec4963 100644 --- a/src/Command/Shared/ExtensionTrait.php +++ b/src/Command/Shared/ExtensionTrait.php @@ -37,7 +37,7 @@ public function extensionQuestion(DrupalStyle $io, $module=true, $theme=false, $ ->showInstalled() ->showUninstalled() ->showNoCore() - ->getList(); + ->getList(false); } if ($theme) { @@ -45,7 +45,7 @@ public function extensionQuestion(DrupalStyle $io, $module=true, $theme=false, $ ->showInstalled() ->showUninstalled() ->showNoCore() - ->getList(); + ->getList(false); } if ($profile) { @@ -54,7 +54,7 @@ public function extensionQuestion(DrupalStyle $io, $module=true, $theme=false, $ ->showUninstalled() ->showNoCore() ->showCore() - ->getList(); + ->getList(false); } $extensions = array_merge( From d4a82bf400dbc2c7946bed021f2b64f5f385d9e4 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Fri, 10 Mar 2017 07:21:11 +0100 Subject: [PATCH 171/321] [generate:profile] add option to specify enabled themes (#3173) * [console] Validator: rename validateModuleDependencies to validateMachineNameList The new name describes better what the function does, and it's also more generic: it can be used to validate any kind of list of extensions names, not just dependencies (i.e. modules) but also a list of machine names of themes. * [console] return $this from ExtensionManager::discoverExtension() This allows to chain-call show* methods after discoverExtension(). * [console] refactor and generalize validating dependencies Some commands like ModuleCommand and ProfileCommand need to validate dependencies and are using the same exact code to do it, replicated per-command; refactor it and share the implementation between the two commands. While at it also make the checkDependencies() function more generic, do not validate "dependencies" (i.e. modules) but rather "extensions", taking a $type argument to restrict validation to certain extension types, for instance the new method can be used to validate themes. The new validating method is Validator::validateExtensions() which checks machine names and then calls the new method ExtensionManager::checkExtensions() which checks that the passed machine names are actually extensions of the given type. NOTE: since Validator::validateExtension() accepts a string argument add a default value as an empty string for the '--dependencies' option in ModuleCommand and ProfileCommand. The default value is the last argument of addOption() as specified on http://api.symfony.com/3.1/Symfony/Component/Console/Command/Command.html#method_addOption * [console] remove some class members which are now unused After the checkDependencies() refactoring, ModuleCommand and ProfileCommand do not need to depend on http_client and console.site anymore, because the code using them is now in ExtensionManager. * [console] adjust indentation for some comments Other instance of wrong indentation could be found with a command like: git grep "^\*\/" * [generate:profile] add a '--themes' option (Fixes #3092) When an installation profile imports configuration which refers to the installed themes it is necessary that the profile refers to these themes in the PROFILE.info.yml file too. Without this the installation can fail with a message like: Drupal\Core\Config\UnmetDependenciesException: ... PROFILE have unmet dependencies in .../web/core/lib/Drupal/Core/Config/UnmetDependenciesException.php:84 So add a '--themes' options to easily specify the enabled themes when generating a profile. --- Test/Generator/ProfileGeneratorTest.php | 2 + config/services/drupal-console/generate.yml | 4 +- src/Command/Generate/ModuleCommand.php | 88 ++----------------- src/Command/Generate/ProfileCommand.php | 97 ++++----------------- src/Extension/Manager.php | 54 ++++++++++++ src/Generator/ProfileGenerator.php | 2 + src/Utils/Validator.php | 45 ++++++++-- templates/profile/info.yml.twig | 7 ++ uninstall.services.yml | 2 +- 9 files changed, 131 insertions(+), 170 deletions(-) diff --git a/Test/Generator/ProfileGeneratorTest.php b/Test/Generator/ProfileGeneratorTest.php index 15735a4b6..c6ea12ddd 100644 --- a/Test/Generator/ProfileGeneratorTest.php +++ b/Test/Generator/ProfileGeneratorTest.php @@ -37,6 +37,7 @@ public function testGenerateProfile( $description, $core, $dependencies, + $themes, $distribution ) { $generator = new ProfileGenerator(); @@ -51,6 +52,7 @@ public function testGenerateProfile( $description, $core, $dependencies, + $themes, $distribution ); diff --git a/config/services/drupal-console/generate.yml b/config/services/drupal-console/generate.yml index f5894a994..9aa66c485 100644 --- a/config/services/drupal-console/generate.yml +++ b/config/services/drupal-console/generate.yml @@ -1,7 +1,7 @@ services: console.generate_module: class: Drupal\Console\Command\Generate\ModuleCommand - arguments: ['@console.module_generator', '@console.validator', '@app.root', '@console.string_converter', '@console.drupal_api', '@http_client', '@console.site'] + arguments: ['@console.module_generator', '@console.validator', '@app.root', '@console.string_converter', '@console.drupal_api'] tags: - { name: drupal.command } console.generate_modulefile: @@ -141,7 +141,7 @@ services: - { name: drupal.command } console.generate_profile: class: Drupal\Console\Command\Generate\ProfileCommand - arguments: ['@console.extension_manager', '@console.profile_generator', '@console.string_converter', '@console.validator', '@app.root', '@console.site', '@http_client'] + arguments: ['@console.extension_manager', '@console.profile_generator', '@console.string_converter', '@console.validator', '@app.root'] tags: - { name: drupal.command } console.generate_route_subscriber: diff --git a/src/Command/Generate/ModuleCommand.php b/src/Command/Generate/ModuleCommand.php index 1127bcefe..fdb2b9cfa 100644 --- a/src/Command/Generate/ModuleCommand.php +++ b/src/Command/Generate/ModuleCommand.php @@ -19,9 +19,6 @@ use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Utils\DrupalApi; -use GuzzleHttp\Client; -use Drupal\Console\Utils\Site; -use GuzzleHttp\Exception\ClientException; class ModuleCommand extends Command { @@ -29,13 +26,13 @@ class ModuleCommand extends Command use CommandTrait; /** - * @var ModuleGenerator -*/ + * @var ModuleGenerator + */ protected $generator; /** - * @var Validator -*/ + * @var Validator + */ protected $validator; /** @@ -53,16 +50,6 @@ class ModuleCommand extends Command */ protected $drupalApi; - /** - * @var Client - */ - protected $httpClient; - - /** - * @var Site - */ - protected $site; - /** * @var string */ @@ -77,8 +64,6 @@ class ModuleCommand extends Command * @param $appRoot * @param StringConverter $stringConverter * @param DrupalApi $drupalApi - * @param Client $httpClient - * @param Site $site * @param $twigtemplate */ public function __construct( @@ -87,8 +72,6 @@ public function __construct( $appRoot, StringConverter $stringConverter, DrupalApi $drupalApi, - Client $httpClient, - Site $site, $twigtemplate = null ) { $this->generator = $generator; @@ -96,8 +79,6 @@ public function __construct( $this->appRoot = $appRoot; $this->stringConverter = $stringConverter; $this->drupalApi = $drupalApi; - $this->httpClient = $httpClient; - $this->site = $site; $this->twigtemplate = $twigtemplate; parent::__construct(); } @@ -169,7 +150,8 @@ protected function configure() 'dependencies', '', InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.module.options.dependencies') + $this->trans('commands.generate.module.options.dependencies'), + '' ) ->addOption( 'test', @@ -210,25 +192,10 @@ protected function execute(InputInterface $input, OutputInterface $output) $moduleFile = $input->getOption('module-file'); $featuresBundle = $input->getOption('features-bundle'); $composer = $input->getOption('composer'); + $dependencies = $this->validator->validateExtensions($input->getOption('dependencies'), 'module', $io); $test = $input->getOption('test'); $twigtemplate = $input->getOption('twigtemplate'); - // Modules Dependencies, re-factor and share with other commands - $dependencies = $this->validator->validateModuleDependencies($input->getOption('dependencies')); - // Check if all module dependencies are available - if ($dependencies) { - $checked_dependencies = $this->checkDependencies($dependencies['success'], $io); - if (!empty($checked_dependencies['no_modules'])) { - $io->warning( - sprintf( - $this->trans('commands.generate.module.warnings.module-unavailable'), - implode(', ', $checked_dependencies['no_modules']) - ) - ); - } - $dependencies = $dependencies['success']; - } - $this->generator->generate( $module, $machineName, @@ -245,47 +212,6 @@ protected function execute(InputInterface $input, OutputInterface $output) ); } - /** - * @param array $dependencies - * @return array - */ - private function checkDependencies(array $dependencies, DrupalStyle $io) - { - $this->site->loadLegacyFile('/core/modules/system/system.module'); - $localModules = []; - - $modules = system_rebuild_module_data(); - foreach ($modules as $module_id => $module) { - array_push($localModules, basename($module->subpath)); - } - - $checkDependencies = [ - 'local_modules' => [], - 'drupal_modules' => [], - 'no_modules' => [], - ]; - - foreach ($dependencies as $module) { - if (in_array($module, $localModules)) { - $checkDependencies['local_modules'][] = $module; - } else { - try { - $response = $this->httpClient->head('https://www.drupal.org/project/' . $module); - $header_link = explode(';', $response->getHeader('link')); - if (empty($header_link[0])) { - $checkDependencies['no_modules'][] = $module; - } else { - $checkDependencies['drupal_modules'][] = $module; - } - } catch (ClientException $e) { - $checkDependencies['no_modules'][] = $module; - } - } - } - - return $checkDependencies; - } - /** * {@inheritdoc} */ diff --git a/src/Command/Generate/ProfileCommand.php b/src/Command/Generate/ProfileCommand.php index f04a3ea09..490a8a7dd 100644 --- a/src/Command/Generate/ProfileCommand.php +++ b/src/Command/Generate/ProfileCommand.php @@ -18,8 +18,6 @@ use Drupal\Console\Extension\Manager; use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Utils\Validator; -use Drupal\Console\Utils\Site; -use GuzzleHttp\Client; /** * Class ProfileCommand @@ -33,13 +31,13 @@ class ProfileCommand extends Command use CommandTrait; /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** - * @var ProfileGenerator -*/ + * @var ProfileGenerator + */ protected $generator; /** @@ -48,19 +46,9 @@ class ProfileCommand extends Command protected $stringConverter; /** - * @var Validator -*/ - protected $validator; - - /** - * @var Site - */ - protected $site; - - /** - * @var Client + * @var Validator */ - protected $httpClient; + protected $validator; /** * ProfileCommand constructor. @@ -70,25 +58,19 @@ class ProfileCommand extends Command * @param StringConverter $stringConverter * @param Validator $validator * @param $appRoot - * @param Site $site - * @param Client $httpClient */ public function __construct( Manager $extensionManager, ProfileGenerator $generator, StringConverter $stringConverter, Validator $validator, - $appRoot, - Site $site, - Client $httpClient + $appRoot ) { $this->extensionManager = $extensionManager; $this->generator = $generator; $this->stringConverter = $stringConverter; $this->validator = $validator; $this->appRoot = $appRoot; - $this->site = $site; - $this->httpClient = $httpClient; parent::__construct(); } @@ -129,7 +111,15 @@ protected function configure() 'dependencies', false, InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.profile.options.dependencies') + $this->trans('commands.generate.profile.options.dependencies'), + '' + ) + ->addOption( + 'themes', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.profile.options.themes'), + '' ) ->addOption( 'distribution', @@ -154,24 +144,11 @@ protected function execute(InputInterface $input, OutputInterface $output) $machine_name = $this->validator->validateMachineName($input->getOption('machine-name')); $description = $input->getOption('description'); $core = $input->getOption('core'); + $dependencies = $this->validator->validateExtensions($input->getOption('dependencies'), 'module', $io); + $themes = $this->validator->validateExtensions($input->getOption('themes'), 'theme', $io); $distribution = $input->getOption('distribution'); $profile_path = $this->appRoot . '/profiles'; - // Check if all module dependencies are available. - $dependencies = $this->validator->validateModuleDependencies($input->getOption('dependencies')); - if ($dependencies) { - $checked_dependencies = $this->checkDependencies($dependencies['success']); - if (!empty($checked_dependencies['no_modules'])) { - $io->info( - sprintf( - $this->trans('commands.generate.profile.warnings.module-unavailable'), - implode(', ', $checked_dependencies['no_modules']) - ) - ); - } - $dependencies = $dependencies['success']; - } - $this->generator->generate( $profile, $machine_name, @@ -179,47 +156,11 @@ protected function execute(InputInterface $input, OutputInterface $output) $description, $core, $dependencies, + $themes, $distribution ); } - /** - * @param array $dependencies - * @return array - */ - private function checkDependencies(array $dependencies) - { - $this->site->loadLegacyFile('/core/modules/system/system.module'); - $local_modules = []; - - $modules = system_rebuild_module_data(); - foreach ($modules as $module_id => $module) { - array_push($local_modules, basename($module->subpath)); - } - - $checked_dependencies = [ - 'local_modules' => [], - 'drupal_modules' => [], - 'no_modules' => [], - ]; - - foreach ($dependencies as $module) { - if (in_array($module, $local_modules)) { - $checked_dependencies['local_modules'][] = $module; - } else { - $response = $this->httpClient->head('https://www.drupal.org/project/' . $module); - $header_link = explode(';', $response->getHeader('link')); - if (empty($header_link[0])) { - $checked_dependencies['no_modules'][] = $module; - } else { - $checked_dependencies['drupal_modules'][] = $module; - } - } - } - - return $checked_dependencies; - } - /** * {@inheritdoc} */ diff --git a/src/Extension/Manager.php b/src/Extension/Manager.php index a1a79a1a0..94f698061 100644 --- a/src/Extension/Manager.php +++ b/src/Extension/Manager.php @@ -3,6 +3,8 @@ namespace Drupal\Console\Extension; use Drupal\Console\Utils\Site; +use GuzzleHttp\Client; +use GuzzleHttp\Exception\ClientException; /** * Class ExtensionManager @@ -15,6 +17,12 @@ class Manager * @var Site */ protected $site; + + /** + * @var Client + */ + protected $httpClient; + /** * @var string */ @@ -39,13 +47,16 @@ class Manager * ExtensionManager constructor. * * @param Site $site + * @param Client $httpClient * @param string $appRoot */ public function __construct( Site $site, + Client $httpClient, $appRoot ) { $this->site = $site; + $this->httpClient = $httpClient; $this->appRoot = $appRoot; $this->initialize(); } @@ -135,6 +146,8 @@ private function discoverExtension($extension) { $this->extension = $extension; $this->extensions[$extension] = $this->discoverExtensions($extension); + + return $this; } /** @@ -347,4 +360,45 @@ public function getDrupalExtension($type, $name) $extension = $this->getExtension($type, $name); return $this->createExtension($extension); } + + /** + * @param array $extensions + * @param string $type + * @return array + */ + public function checkExtensions(array $extensions, $type = 'module') + { + $checkextensions = [ + 'local_extensions' => [], + 'drupal_extensions' => [], + 'no_extensions' => [], + ]; + + $local_extensions = $this->discoverExtension($type) + ->showInstalled() + ->showUninstalled() + ->showCore() + ->showNoCore() + ->getList(TRUE); + + foreach ($extensions as $extension) { + if (in_array($extension, $local_extensions)) { + $checkextensions['local_extensions'][] = $extension; + } else { + try { + $response = $this->httpClient->head('https://www.drupal.org/project/' . $extension); + $header_link = explode(';', $response->getHeader('link')); + if (empty($header_link[0])) { + $checkextensions['no_extensions'][] = $extension; + } else { + $checkextensions['drupal_extensions'][] = $extension; + } + } catch (ClientException $e) { + $checkextensions['no_extensions'][] = $extension; + } + } + } + + return $checkextensions; + } } diff --git a/src/Generator/ProfileGenerator.php b/src/Generator/ProfileGenerator.php index e3431b220..8d0857c1a 100644 --- a/src/Generator/ProfileGenerator.php +++ b/src/Generator/ProfileGenerator.php @@ -18,6 +18,7 @@ public function generate( $description, $core, $dependencies, + $themes, $distribution ) { $dir = $profile_path . '/' . $machine_name; @@ -57,6 +58,7 @@ public function generate( 'core' => $core, 'description' => $description, 'dependencies' => $dependencies, + 'themes' => $themes, 'distribution' => $distribution, ]; diff --git a/src/Utils/Validator.php b/src/Utils/Validator.php index 12b522786..c0efcc342 100644 --- a/src/Utils/Validator.php +++ b/src/Utils/Validator.php @@ -8,6 +8,8 @@ namespace Drupal\Console\Utils; use Drupal\Console\Extension\Manager; +use Drupal\Console\Core\Style\DrupalStyle; + class Validator { @@ -114,29 +116,29 @@ public function validateModulePath($module_path, $create = false) return $module_path; } - public function validateModuleDependencies($dependencies) + public function validateMachineNameList($list) { - $dependencies_checked = [ + $list_checked = [ 'success' => [], 'fail' => [], ]; - if (empty($dependencies)) { + if (empty($list)) { return []; } - $dependencies = explode(',', $this->removeSpaces($dependencies)); - foreach ($dependencies as $key => $module) { + $list = explode(',', $this->removeSpaces($list)); + foreach ($list as $key => $module) { if (!empty($module)) { if (preg_match(self::REGEX_MACHINE_NAME, $module)) { - $dependencies_checked['success'][] = $module; + $list_checked['success'][] = $module; } else { - $dependencies_checked['fail'][] = $module; + $list_checked['fail'][] = $module; } } } - return $dependencies_checked; + return $list_checked; } /** @@ -259,4 +261,31 @@ public function getUninstalledModules($moduleList) return array_diff($moduleList, $modules); } + + /** + * @param string $extensions_list + * @param string $type + * @param array $io + * + * @return array + */ + public function validateExtensions(string $extensions_list, string $type, DrupalStyle $io) + { + $extensions = $this->validateMachineNameList($extensions_list); + // Check if all extensions are available + if ($extensions) { + $checked_extensions = $this->extensionManager->checkExtensions($extensions['success'], $type); + if (!empty($checked_extensions['no_extensions'])) { + $io->warning( + sprintf( + $this->trans('validator.warnings.extension-unavailable'), + implode(', ', $checked_extensions['no_extensions']) + ) + ); + } + $extensions = $extensions['success']; + } + + return $extensions; + } } diff --git a/templates/profile/info.yml.twig b/templates/profile/info.yml.twig index 31d0472e2..385baa630 100644 --- a/templates/profile/info.yml.twig +++ b/templates/profile/info.yml.twig @@ -14,3 +14,10 @@ dependencies: - {{ dependency }} {% endfor %} {% endif %} +{% if themes %} + +themes: +{% for theme in themes %} + - {{ theme }} +{% endfor %} +{% endif %} diff --git a/uninstall.services.yml b/uninstall.services.yml index 269e0189f..055d4d905 100644 --- a/uninstall.services.yml +++ b/uninstall.services.yml @@ -4,7 +4,7 @@ services: arguments: ['@app.root', '@console.configuration_manager'] console.extension_manager: class: Drupal\Console\Extension\Manager - arguments: ['@console.site', '@app.root'] + arguments: ['@console.site', '@http_client', '@app.root'] console.server: class: Drupal\Console\Command\ServerCommand arguments: ['@app.root', '@console.configuration_manager'] From 580b60fdd2b72d2ab15d203c0d0cecda31530c7e Mon Sep 17 00:00:00 2001 From: Christoph Burschka Date: Fri, 10 Mar 2017 07:21:44 +0100 Subject: [PATCH 172/321] [config:export] Export all config collections. (#3185) Export the entire config storage, in the same structure as used by the Drupal web interface. (#3182) --- config/services/drupal-console/config.yml | 2 +- src/Command/Config/ExportCommand.php | 54 ++++++++++++++++------- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/config/services/drupal-console/config.yml b/config/services/drupal-console/config.yml index f0156a685..4fa350077 100644 --- a/config/services/drupal-console/config.yml +++ b/config/services/drupal-console/config.yml @@ -21,7 +21,7 @@ services: - { name: drupal.command } console.config_export: class: Drupal\Console\Command\Config\ExportCommand - arguments: ['@config.manager'] + arguments: ['@config.manager', '@config.storage'] tags: - { name: drupal.command } console.config_export_content_type: diff --git a/src/Command/Config/ExportCommand.php b/src/Command/Config/ExportCommand.php index 8544d6cf6..954caaee4 100644 --- a/src/Command/Config/ExportCommand.php +++ b/src/Command/Config/ExportCommand.php @@ -9,6 +9,8 @@ use Drupal\Core\Archiver\ArchiveTar; use Drupal\Component\Serialization\Yaml; +use Drupal\Core\Config\ConfigManagerInterface; +use Drupal\Core\Config\StorageInterface; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -27,15 +29,22 @@ class ExportCommand extends Command */ protected $configManager; + /** + * @var StorageInterface + */ + protected $storage; + /** * ExportCommand constructor. * - * @param ConfigManager $configManager + * @param ConfigManagerInterface $configManager + * @param StorageInterface $storage */ - public function __construct(ConfigManager $configManager) + public function __construct(ConfigManagerInterface $configManager, StorageInterface $storage) { - $this->configManager = $configManager; parent::__construct(); + $this->configManager = $configManager; + $this->storage = $storage; } /** @@ -112,30 +121,45 @@ protected function execute(InputInterface $input, OutputInterface $output) try { // Get raw configuration data without overrides. foreach ($this->configManager->getConfigFactory()->listAll() as $name) { + $configName = "$name.yml"; $configData = $this->configManager->getConfigFactory()->get($name)->getRawData(); - $configName = sprintf('%s.yml', $name); - if ($removeUuid) { unset($configData['uuid']); } - if ($removeHash) { unset($configData['_core']['default_config_hash']); } - $ymlData = Yaml::encode($configData); if ($tar) { - $archiveTar->addString( - $configName, - $ymlData - ); - continue; + $archiveTar->addString($configName, $ymlData); + } + else { + file_put_contents("$directory/$configName", $ymlData); } - $configFileName = sprintf('%s/%s', $directory, $configName); - - file_put_contents($configFileName, $ymlData); + } + // Get all override data from the remaining collections. + foreach ($this->storage->getAllCollectionNames() as $collection) { + $collection_storage = $this->storage->createCollection($collection); + foreach ($collection_storage->listAll() as $name) { + $configName = str_replace('.', '/', $collection) . "/$name.yml"; + $configData = $collection_storage->read($name); + if ($removeUuid) { + unset($configData['uuid']); + } + if ($removeHash) { + unset($configData['_core']['default_config_hash']); + } + + $ymlData = Yaml::encode($configData); + if ($tar) { + $archiveTar->addString($configName, $ymlData); + } + else { + file_put_contents("$directory/$configName", $ymlData); + } + } } } catch (\Exception $e) { $io->error($e->getMessage()); From 4cc52d2bbd499875669d3f16c122c690e8d12730 Mon Sep 17 00:00:00 2001 From: Miguel Date: Fri, 10 Mar 2017 00:21:56 -0600 Subject: [PATCH 173/321] Add option to create config file on generate:form (#3218) --- src/Command/Generate/FormCommand.php | 20 +++++++++++++++++++- src/Generator/FormGenerator.php | 19 ++++++++++++------- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/Command/Generate/FormCommand.php b/src/Command/Generate/FormCommand.php index 8014462eb..5e7dea5c5 100644 --- a/src/Command/Generate/FormCommand.php +++ b/src/Command/Generate/FormCommand.php @@ -144,6 +144,12 @@ protected function configure() InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.common.options.services') ) + ->addOption( + 'config-file', + '', + InputOption::VALUE_NONE, + $this->trans('commands.generate.form.options.config-file') + ) ->addOption( 'inputs', '', @@ -190,6 +196,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $module = $input->getOption('module'); $services = $input->getOption('services'); $path = $input->getOption('path'); + $config_file = $input->getOption('config-file'); $class_name = $input->getOption('class'); $form_id = $input->getOption('form-id'); $form_type = $this->formType; @@ -204,7 +211,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this ->generator - ->generate($module, $class_name, $form_id, $form_type, $build_services, $inputs, $path, $menu_link_gen, $menu_link_title, $menu_parent, $menu_link_desc); + ->generate($module, $class_name, $form_id, $form_type, $build_services, $config_file, $inputs, $path,$menu_link_gen, $menu_link_title, $menu_parent, $menu_link_desc); $this->chainQueue->addCommand('router:rebuild', []); } @@ -248,6 +255,17 @@ protected function interact(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion $services = $this->servicesQuestion($io); $input->setOption('services', $services); + + // --config_file option + $config_file = $input->getOption('config-file'); + + if (!$config_file) { + $config_file = $io->confirm( + $this->trans('commands.generate.form.questions.config-file'), + true + ); + $input->setOption('config-file', $config_file); + } // --inputs option $inputs = $input->getOption('inputs'); diff --git a/src/Generator/FormGenerator.php b/src/Generator/FormGenerator.php index a05cd1ae9..d1574620a 100644 --- a/src/Generator/FormGenerator.php +++ b/src/Generator/FormGenerator.php @@ -41,6 +41,7 @@ public function __construct( * @param $module * @param $class_name * @param $services + * @param $config_file * @param $inputs * @param $form_id * @param $form_type @@ -50,7 +51,7 @@ public function __construct( * @param $menu_parent * @param $menu_link_desc */ - public function generate($module, $class_name, $form_id, $form_type, $services, $inputs, $path, $menu_link_gen, $menu_link_title, $menu_parent, $menu_link_desc) + public function generate($module, $class_name, $form_id, $form_type, $services, $config_file, $inputs, $path, $menu_link_gen, $menu_link_title, $menu_parent, $menu_link_desc) { $class_name_short = strtolower( $this->stringConverter->removeSuffix($class_name) @@ -59,6 +60,7 @@ public function generate($module, $class_name, $form_id, $form_type, $services, $parameters = [ 'class_name' => $class_name, 'services' => $services, + 'config_file' => $config_file, 'inputs' => $inputs, 'module_name' => $module, 'form_id' => $form_id, @@ -90,13 +92,16 @@ public function generate($module, $class_name, $form_id, $form_type, $services, $this->extensionManager->getModule($module)->getFormPath() .'/'.$class_name.'.php', $parameters ); + + // Render defaults YML file. + if ($config_file == true) { + $this->renderFile( + 'module/config/install/field.default.yml.twig', + $this->extensionManager->getModule($module)->getPath() .'/config/install/'.$module.'.'.$class_name_short.'.yml', + $parameters + ); - // Render defaults YML file. - $this->renderFile( - 'module/config/install/field.default.yml.twig', - $this->extensionManager->getModule($module)->getPath() .'/config/install/'.$module.'.'.$class_name_short.'.yml', - $parameters - ); + } if ($menu_link_gen == true) { $this->renderFile( From fb8e1594d9d0784e7bd18084ce7dd8d55979ff2e Mon Sep 17 00:00:00 2001 From: Francesco Persico Date: Wed, 15 Mar 2017 21:42:13 +0100 Subject: [PATCH 174/321] Added the extensionManager. (#3225) --- config/services/drupal-console/module.yml | 2 +- src/Command/Module/UninstallCommand.php | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/config/services/drupal-console/module.yml b/config/services/drupal-console/module.yml index 574e82970..5ce402bf6 100644 --- a/config/services/drupal-console/module.yml +++ b/config/services/drupal-console/module.yml @@ -27,7 +27,7 @@ services: - { name: drupal.command } module_uninstall: class: Drupal\Console\Command\Module\UninstallCommand - arguments: ['@console.site','@module_installer', '@console.chain_queue', '@config.factory'] + arguments: ['@console.site','@module_installer', '@console.chain_queue', '@config.factory', '@console.extension_manager'] tags: - { name: drupal.command } module_update: diff --git a/src/Command/Module/UninstallCommand.php b/src/Command/Module/UninstallCommand.php index c5d8fac20..3eddf3830 100755 --- a/src/Command/Module/UninstallCommand.php +++ b/src/Command/Module/UninstallCommand.php @@ -8,6 +8,7 @@ namespace Drupal\Console\Command\Module; use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Extension\Manager; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -46,6 +47,11 @@ class UninstallCommand extends Command */ protected $configFactory; + /** + * @var Manager + */ + protected $extensionManager; + /** * InstallCommand constructor. @@ -54,17 +60,20 @@ class UninstallCommand extends Command * @param Validator $validator * @param ChainQueue $chainQueue * @param ConfigFactory $configFactory + * @param Manager $extensionManager */ public function __construct( Site $site, ModuleInstaller $moduleInstaller, ChainQueue $chainQueue, - ConfigFactory $configFactory + ConfigFactory $configFactory, + Manager $extensionManager ) { $this->site = $site; $this->moduleInstaller = $moduleInstaller; $this->chainQueue = $chainQueue; $this->configFactory = $configFactory; + $this->extensionManager = $extensionManager; parent::__construct(); } From 8bffedf054a6194ff672468aecba54af9cc552a6 Mon Sep 17 00:00:00 2001 From: Jelle Sebreghts Date: Wed, 15 Mar 2017 21:43:45 +0100 Subject: [PATCH 175/321] Fixes #2787: Make sure all modules are loaded before executing site:status. (#3219) --- src/Command/Site/StatusCommand.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Command/Site/StatusCommand.php b/src/Command/Site/StatusCommand.php index 776961b06..c07a758dd 100644 --- a/src/Command/Site/StatusCommand.php +++ b/src/Command/Site/StatusCommand.php @@ -116,6 +116,9 @@ protected function configure() */ protected function execute(InputInterface $input, OutputInterface $output) { + // Make sure all modules are loaded. + $this->container->get('module_handler')->loadAll(); + $io = new DrupalStyle($input, $output); $systemData = $this->getSystemData(); From 3e9435be3838d3d7a9b22b677df952785f546b6f Mon Sep 17 00:00:00 2001 From: Isaac Gasi Date: Wed, 15 Mar 2017 15:45:56 -0500 Subject: [PATCH 176/321] Fix 3223 config import single (#3224) * issue #2131 Removed config.factory service extra in generate:form command * #3223 Fixed config:import:single * #3223 Fixed config:import:single - improved validation --- src/Command/Config/ImportSingleCommand.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Command/Config/ImportSingleCommand.php b/src/Command/Config/ImportSingleCommand.php index 6204a3d85..713a1f924 100644 --- a/src/Command/Config/ImportSingleCommand.php +++ b/src/Command/Config/ImportSingleCommand.php @@ -84,6 +84,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $io = new DrupalStyle($input, $output); $name = $input->getOption('name'); + $name = is_array($name) ? $name : [$name]; $directory = $input->getOption('directory'); $file = $input->getOption('file'); @@ -103,10 +104,14 @@ protected function execute(InputInterface $input, OutputInterface $output) $nameItem = substr($nameItem, 0, -4); } - $configFile = $directory.DIRECTORY_SEPARATOR.$nameItem.'.yml'; + $configFile = count($name) == 1 ? + $file : + $directory.DIRECTORY_SEPARATOR.$nameItem.'.yml'; + if (file_exists($configFile)) { $value = $ymlFile->parse(file_get_contents($configFile)); - $source_storage->replaceData($nameItem, $value); + $source_storage->delete($nameItem); + $source_storage->write($nameItem, $value); continue; } @@ -120,6 +125,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->configManager ); + if ($this->configImport($io, $storageComparer)) { $io->success( sprintf( From 5cea2bdd2d8ce86aa92f642e2b0f138b702d250a Mon Sep 17 00:00:00 2001 From: Scott Robertson Date: Thu, 16 Mar 2017 08:54:28 -0700 Subject: [PATCH 177/321] Fix #3229: Use short array syntax in all templates (#3230) --- .../Tests/Controller/controller.php.twig | 4 +-- templates/module/module.views.inc.twig | 14 +++++----- .../src/Controller/entity-controller.php.twig | 10 +++---- .../entity-content-revision-delete.php.twig | 14 +++++----- ...ntent-revision-revert-translation.php.twig | 4 +-- .../entity-content-revision-revert.php.twig | 4 +-- .../src/Entity/Form/entity-content.php.twig | 4 +-- ...ith-bundle.theme_hook_suggestions.php.twig | 2 +- .../module/src/Entity/entity-content.php.twig | 28 +++++++++---------- .../src/Entity/entity-content.theme.php.twig | 4 +-- templates/module/src/entity-storage.php.twig | 8 +++--- .../src/listbuilder-entity-content.php.twig | 4 +-- .../module/src/yaml-plugin-manager.php.twig | 6 ++-- 13 files changed, 53 insertions(+), 53 deletions(-) diff --git a/templates/module/Tests/Controller/controller.php.twig b/templates/module/Tests/Controller/controller.php.twig index a1748f9f5..d963c6652 100644 --- a/templates/module/Tests/Controller/controller.php.twig +++ b/templates/module/Tests/Controller/controller.php.twig @@ -23,11 +23,11 @@ class {{class_name}}Test extends WebTestBase {% endblock %} * {@inheritdoc} */ public static function getInfo() { - return array( + return [ 'name' => "{{module}} {{class_name}}'s controller functionality", 'description' => 'Test Unit for module {{module}} and controller {{class_name}}.', 'group' => 'Other', - ); + ]; } /** diff --git a/templates/module/module.views.inc.twig b/templates/module/module.views.inc.twig index daf921f23..f9fcbd8f6 100644 --- a/templates/module/module.views.inc.twig +++ b/templates/module/module.views.inc.twig @@ -21,19 +21,19 @@ use Drupal\system\ActionConfigEntityInterface; function {{module}}_views_data() { $data['views']['table']['group'] = t('Custom Global'); - $data['views']['table']['join'] = array( + $data['views']['table']['join'] = [ // #global is a special flag which allows a table to appear all the time. - '#global' => array(), - ); + '#global' => array[], + ]; - $data['views']['{{ class_machine_name }}'] = array( + $data['views']['{{ class_machine_name }}'] = [ 'title' => t('{{ title }}'), 'help' => t('{{ description }}'), - 'field' => array( + 'field' => [ 'id' => '{{ class_machine_name }}', - ), - ); + ], + ]; return $data; } diff --git a/templates/module/src/Controller/entity-controller.php.twig b/templates/module/src/Controller/entity-controller.php.twig index 1244001ab..04a6d0f68 100644 --- a/templates/module/src/Controller/entity-controller.php.twig +++ b/templates/module/src/Controller/entity-controller.php.twig @@ -53,7 +53,7 @@ class {{ entity_class }}Controller extends ControllerBase implements ContainerIn */ public function revisionPageTitle(${{ entity_name }}_revision) { ${{ entity_name }} = $this->entityManager()->getStorage('{{ entity_name }}')->loadRevision(${{ entity_name }}_revision); - return $this->t('Revision of %title from %date', array('%title' => ${{ entity_name }}->label(), '%date' => format_date(${{ entity_name }}->getRevisionCreationTime()))); + return $this->t('Revision of %title from %date', ['%title' => ${{ entity_name }}->label(), '%date' => format_date(${{ entity_name }}->getRevisionCreationTime())]); } /** @@ -74,12 +74,12 @@ class {{ entity_class }}Controller extends ControllerBase implements ContainerIn ${{ entity_name }}_storage = $this->entityManager()->getStorage('{{ entity_name }}'); $build['#title'] = $has_translations ? $this->t('@langname revisions for %title', ['@langname' => $langname, '%title' => ${{ entity_name }}->label()]) : $this->t('Revisions for %title', ['%title' => ${{ entity_name }}->label()]); - $header = array($this->t('Revision'), $this->t('Operations')); + $header = [$this->t('Revision'), $this->t('Operations')]; $revert_permission = (($account->hasPermission("revert all {{ label|lower }} revisions") || $account->hasPermission('administer {{ label|lower }} entities'))); $delete_permission = (($account->hasPermission("delete all {{ label|lower }} revisions") || $account->hasPermission('administer {{ label|lower }} entities'))); - $rows = array(); + $rows = []; $vids = ${{ entity_name }}_storage->revisionIds(${{ entity_name }}); @@ -166,11 +166,11 @@ class {{ entity_class }}Controller extends ControllerBase implements ContainerIn } } - $build['{{ entity_name }}_revisions_table'] = array( + $build['{{ entity_name }}_revisions_table'] = [ '#theme' => 'table', '#rows' => $rows, '#header' => $header, - ); + ]; return $build; } diff --git a/templates/module/src/Entity/Form/entity-content-revision-delete.php.twig b/templates/module/src/Entity/Form/entity-content-revision-delete.php.twig index 4d5a13f2e..02674ac11 100644 --- a/templates/module/src/Entity/Form/entity-content-revision-delete.php.twig +++ b/templates/module/src/Entity/Form/entity-content-revision-delete.php.twig @@ -82,14 +82,14 @@ class {{ entity_class }}RevisionDeleteForm extends ConfirmFormBase {% endblock % * {@inheritdoc} */ public function getQuestion() { - return t('Are you sure you want to delete the revision from %revision-date?', array('%revision-date' => format_date($this->revision->getRevisionCreationTime()))); + return t('Are you sure you want to delete the revision from %revision-date?', ['%revision-date' => format_date($this->revision->getRevisionCreationTime())]); } /** * {@inheritdoc} */ public function getCancelUrl() { - return new Url('entity.{{ entity_name }}.version_history', array('{{ entity_name }}' => $this->revision->id())); + return new Url('entity.{{ entity_name }}.version_history', ['{{ entity_name }}' => $this->revision->id()]); } /** @@ -115,16 +115,16 @@ class {{ entity_class }}RevisionDeleteForm extends ConfirmFormBase {% endblock % public function submitForm(array &$form, FormStateInterface $form_state) { $this->{{ entity_class }}Storage->deleteRevision($this->revision->getRevisionId()); - $this->logger('content')->notice('{{ label }}: deleted %title revision %revision.', array('%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId())); - drupal_set_message(t('Revision from %revision-date of {{ label }} %title has been deleted.', array('%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()))); + $this->logger('content')->notice('{{ label }}: deleted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]); + drupal_set_message(t('Revision from %revision-date of {{ label }} %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()])); $form_state->setRedirect( 'entity.{{ entity_name }}.canonical', - array('{{ entity_name }}' => $this->revision->id()) + ['{{ entity_name }}' => $this->revision->id()] ); - if ($this->connection->query('SELECT COUNT(DISTINCT vid) FROM {{ '{'~entity_name~'_field_revision}' }} WHERE id = :id', array(':id' => $this->revision->id()))->fetchField() > 1) { + if ($this->connection->query('SELECT COUNT(DISTINCT vid) FROM {{ '{'~entity_name~'_field_revision}' }} WHERE id = :id', [':id' => $this->revision->id()])->fetchField() > 1) { $form_state->setRedirect( 'entity.{{ entity_name }}.version_history', - array('{{ entity_name }}' => $this->revision->id()) + ['{{ entity_name }}' => $this->revision->id()] ); } } diff --git a/templates/module/src/Entity/Form/entity-content-revision-revert-translation.php.twig b/templates/module/src/Entity/Form/entity-content-revision-revert-translation.php.twig index 6d2f46c2a..0c38ba5b3 100644 --- a/templates/module/src/Entity/Form/entity-content-revision-revert-translation.php.twig +++ b/templates/module/src/Entity/Form/entity-content-revision-revert-translation.php.twig @@ -87,11 +87,11 @@ class {{ entity_class }}RevisionRevertTranslationForm extends {{ entity_class }} $this->langcode = $langcode; $form = parent::buildForm($form, $form_state, ${{ entity_name }}_revision); - $form['revert_untranslated_fields'] = array( + $form['revert_untranslated_fields'] = [ '#type' => 'checkbox', '#title' => $this->t('Revert content shared among translations'), '#default_value' => FALSE, - ); + ]; return $form; } diff --git a/templates/module/src/Entity/Form/entity-content-revision-revert.php.twig b/templates/module/src/Entity/Form/entity-content-revision-revert.php.twig index 42e65979f..4077d9417 100644 --- a/templates/module/src/Entity/Form/entity-content-revision-revert.php.twig +++ b/templates/module/src/Entity/Form/entity-content-revision-revert.php.twig @@ -89,7 +89,7 @@ class {{ entity_class }}RevisionRevertForm extends ConfirmFormBase {% endblock % * {@inheritdoc} */ public function getCancelUrl() { - return new Url('entity.{{ entity_name }}.version_history', array('{{ entity_name }}' => $this->revision->id())); + return new Url('entity.{{ entity_name }}.version_history', ['{{ entity_name }}' => $this->revision->id()]); } /** @@ -132,7 +132,7 @@ class {{ entity_class }}RevisionRevertForm extends ConfirmFormBase {% endblock % drupal_set_message(t('{{ label }} %title has been reverted to the revision from %revision-date.', ['%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)])); $form_state->setRedirect( 'entity.{{ entity_name }}.version_history', - array('{{ entity_name }}' => $this->revision->id()) + ['{{ entity_name }}' => $this->revision->id()] ); } diff --git a/templates/module/src/Entity/Form/entity-content.php.twig b/templates/module/src/Entity/Form/entity-content.php.twig index e703e5f17..63982a485 100644 --- a/templates/module/src/Entity/Form/entity-content.php.twig +++ b/templates/module/src/Entity/Form/entity-content.php.twig @@ -30,12 +30,12 @@ class {{ entity_class }}Form extends ContentEntityForm {% endblock %} {% if revisionable %} if (!$this->entity->isNew()) { - $form['new_revision'] = array( + $form['new_revision'] = [ '#type' => 'checkbox', '#title' => $this->t('Create new revision'), '#default_value' => FALSE, '#weight' => 10, - ); + ]; } {% endif %} diff --git a/templates/module/src/Entity/entity-content-with-bundle.theme_hook_suggestions.php.twig b/templates/module/src/Entity/entity-content-with-bundle.theme_hook_suggestions.php.twig index c14788809..77ea4dfbb 100644 --- a/templates/module/src/Entity/entity-content-with-bundle.theme_hook_suggestions.php.twig +++ b/templates/module/src/Entity/entity-content-with-bundle.theme_hook_suggestions.php.twig @@ -4,7 +4,7 @@ * Implements hook_theme_suggestions_HOOK(). */ function {{ module }}_theme_suggestions_{{ entity_name }}(array $variables) { - $suggestions = array(); + $suggestions = []; $entity = $variables['elements']['#{{ entity_name }}']; $sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_'); diff --git a/templates/module/src/Entity/entity-content.php.twig b/templates/module/src/Entity/entity-content.php.twig index 72bb9320b..570277ccd 100644 --- a/templates/module/src/Entity/entity-content.php.twig +++ b/templates/module/src/Entity/entity-content.php.twig @@ -123,9 +123,9 @@ class {{ entity_class }} extends {% if revisionable %}RevisionableContentEntityB */ public static function preCreate(EntityStorageInterface $storage_controller, array &$values) { parent::preCreate($storage_controller, $values); - $values += array( + $values += [ 'user_id' => \Drupal::currentUser()->id(), - ); + ]; } {% if revisionable %} @@ -281,21 +281,21 @@ class {{ entity_class }} extends {% if revisionable %}RevisionableContentEntityB ->setSetting('target_type', 'user') ->setSetting('handler', 'default') ->setTranslatable(TRUE) - ->setDisplayOptions('view', array( + ->setDisplayOptions('view', [ 'label' => 'hidden', 'type' => 'author', 'weight' => 0, - )) - ->setDisplayOptions('form', array( + ]) + ->setDisplayOptions('form', [ 'type' => 'entity_reference_autocomplete', 'weight' => 5, - 'settings' => array( + 'settings' => [ 'match_operator' => 'CONTAINS', 'size' => '60', 'autocomplete_type' => 'tags', 'placeholder' => '', - ), - )) + ], + ]) ->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('view', TRUE); @@ -305,20 +305,20 @@ class {{ entity_class }} extends {% if revisionable %}RevisionableContentEntityB {% if revisionable %} ->setRevisionable(TRUE) {% endif %} - ->setSettings(array( + ->setSettings([ 'max_length' => 50, 'text_processing' => 0, - )) + ]) ->setDefaultValue('') - ->setDisplayOptions('view', array( + ->setDisplayOptions('view', [ 'label' => 'above', 'type' => 'string', 'weight' => -4, - )) - ->setDisplayOptions('form', array( + ]) + ->setDisplayOptions('form', [ 'type' => 'string_textfield', 'weight' => -4, - )) + ]) ->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('view', TRUE); diff --git a/templates/module/src/Entity/entity-content.theme.php.twig b/templates/module/src/Entity/entity-content.theme.php.twig index 4aab3bdc7..afa9d750c 100644 --- a/templates/module/src/Entity/entity-content.theme.php.twig +++ b/templates/module/src/Entity/entity-content.theme.php.twig @@ -1,7 +1,7 @@ {% block hook_theme %} - $theme['{{ entity_name }}'] = array( + $theme['{{ entity_name }}'] = [ 'render element' => 'elements', 'file' => '{{ entity_name }}.page.inc', 'template' => '{{ entity_name }}', - ); + ]; {% endblock %} diff --git a/templates/module/src/entity-storage.php.twig b/templates/module/src/entity-storage.php.twig index 006f417e4..01aec1cc4 100644 --- a/templates/module/src/entity-storage.php.twig +++ b/templates/module/src/entity-storage.php.twig @@ -33,7 +33,7 @@ class {{ entity_class }}Storage extends SqlContentEntityStorage implements {{ en public function revisionIds({{ entity_class }}Interface $entity) { return $this->database->query( 'SELECT vid FROM {{ '{'~entity_name~'_revision}' }} WHERE id=:id ORDER BY vid', - array(':id' => $entity->id()) + [':id' => $entity->id()] )->fetchCol(); } @@ -43,7 +43,7 @@ class {{ entity_class }}Storage extends SqlContentEntityStorage implements {{ en public function userRevisionIds(AccountInterface $account) { return $this->database->query( 'SELECT vid FROM {{ '{'~entity_name~'_field_revision}' }} WHERE uid = :uid ORDER BY vid', - array(':uid' => $account->id()) + [':uid' => $account->id()] )->fetchCol(); } @@ -51,7 +51,7 @@ class {{ entity_class }}Storage extends SqlContentEntityStorage implements {{ en * {@inheritdoc} */ public function countDefaultLanguageRevisions({{ entity_class }}Interface $entity) { - return $this->database->query('SELECT COUNT(*) FROM {{ '{'~entity_name~'_field_revision}' }} WHERE id = :id AND default_langcode = 1', array(':id' => $entity->id())) + return $this->database->query('SELECT COUNT(*) FROM {{ '{'~entity_name~'_field_revision}' }} WHERE id = :id AND default_langcode = 1', [':id' => $entity->id()]) ->fetchField(); } @@ -60,7 +60,7 @@ class {{ entity_class }}Storage extends SqlContentEntityStorage implements {{ en */ public function clearRevisionsLanguage(LanguageInterface $language) { return $this->database->update('{{ entity_name }}_revision') - ->fields(array('langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED)) + ->fields(['langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED]) ->condition('langcode', $language->getId()) ->execute(); } diff --git a/templates/module/src/listbuilder-entity-content.php.twig b/templates/module/src/listbuilder-entity-content.php.twig index 1615da806..d237e19b3 100644 --- a/templates/module/src/listbuilder-entity-content.php.twig +++ b/templates/module/src/listbuilder-entity-content.php.twig @@ -45,9 +45,9 @@ class {{ entity_class }}ListBuilder extends EntityListBuilder {% endblock %} $row['name'] = $this->l( $entity->label(), new Url( - 'entity.{{ entity_name }}.edit_form', array( + 'entity.{{ entity_name }}.edit_form', [ '{{ entity_name }}' => $entity->id(), - ) + ] ) ); return $row + parent::buildRow($entity); diff --git a/templates/module/src/yaml-plugin-manager.php.twig b/templates/module/src/yaml-plugin-manager.php.twig index 81e6442b7..b7379d3ae 100644 --- a/templates/module/src/yaml-plugin-manager.php.twig +++ b/templates/module/src/yaml-plugin-manager.php.twig @@ -28,11 +28,11 @@ class {{ plugin_class }}Manager extends DefaultPluginManager implements {{ plugi * * @var array */ - protected $defaults = array( + protected $defaults = [ // Add required and optional plugin properties. 'id' => '', 'label' => '', - ); + ]; /** * Constructs a {{ plugin_class }}Manager object. @@ -45,7 +45,7 @@ class {{ plugin_class }}Manager extends DefaultPluginManager implements {{ plugi public function __construct(ModuleHandlerInterface $module_handler, CacheBackendInterface $cache_backend) { // Add more services as required. $this->moduleHandler = $module_handler; - $this->setCacheBackend($cache_backend, '{{ plugin_name }}', array('{{ plugin_name }}')); + $this->setCacheBackend($cache_backend, '{{ plugin_name }}', ['{{ plugin_name }}']); } /** From 78356dc61cf7ecb245dc85e479bbe8647d7c0677 Mon Sep 17 00:00:00 2001 From: Jose Sanchez Date: Thu, 16 Mar 2017 12:57:46 -0300 Subject: [PATCH 178/321] [site:install] Register missing service (#3231) --- uninstall.services.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/uninstall.services.yml b/uninstall.services.yml index 055d4d905..e85c0feb5 100644 --- a/uninstall.services.yml +++ b/uninstall.services.yml @@ -25,3 +25,5 @@ services: arguments: ['@app.root'] tags: - { name: drupal.command } + http_client: + class: GuzzleHttp\Client From 1c481e5b9f95b0d330c7c488851ef4f7c83a0c9e Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Sat, 25 Mar 2017 18:14:28 +0100 Subject: [PATCH 179/321] Remove $entity->getType() in favor of $entity->bundle(). (#3235) --- templates/module/src/Entity/entity-content.php.twig | 9 --------- .../src/Entity/interface-entity-content.php.twig | 10 ---------- 2 files changed, 19 deletions(-) diff --git a/templates/module/src/Entity/entity-content.php.twig b/templates/module/src/Entity/entity-content.php.twig index 570277ccd..21cc5ab01 100644 --- a/templates/module/src/Entity/entity-content.php.twig +++ b/templates/module/src/Entity/entity-content.php.twig @@ -152,15 +152,6 @@ class {{ entity_class }} extends {% if revisionable %}RevisionableContentEntityB } {% endif %} -{% if bundle_entity_type %} - /** - * {@inheritdoc} - */ - public function getType() { - return $this->bundle(); - } - -{% endif %} /** * {@inheritdoc} */ diff --git a/templates/module/src/Entity/interface-entity-content.php.twig b/templates/module/src/Entity/interface-entity-content.php.twig index 9f7d3dad9..414e67fc2 100644 --- a/templates/module/src/Entity/interface-entity-content.php.twig +++ b/templates/module/src/Entity/interface-entity-content.php.twig @@ -31,16 +31,6 @@ interface {{ entity_class }}Interface extends {% if revisionable %}RevisionableI {% block class_methods %} // Add get/set methods for your configuration properties here. -{% if bundle_entity_type %} - /** - * Gets the {{ label }} type. - * - * @return string - * The {{ label }} type. - */ - public function getType(); - -{% endif %} /** * Gets the {{ label }} name. * From 95ae6bcd1c5e729e6643c0ccaee8555bd8d2d606 Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Sat, 25 Mar 2017 18:57:28 +0100 Subject: [PATCH 180/321] Leverage methods and base field definitions from RevisionLogEntityTrait. (#3236) --- .../src/Controller/entity-controller.php.twig | 4 +- .../module/src/Entity/entity-content.php.twig | 47 ------------------- 2 files changed, 2 insertions(+), 49 deletions(-) diff --git a/templates/module/src/Controller/entity-controller.php.twig b/templates/module/src/Controller/entity-controller.php.twig index 04a6d0f68..d2261ff34 100644 --- a/templates/module/src/Controller/entity-controller.php.twig +++ b/templates/module/src/Controller/entity-controller.php.twig @@ -97,7 +97,7 @@ class {{ entity_class }}Controller extends ControllerBase implements ContainerIn ]; // Use revision link to link to revisions that are not active. - $date = \Drupal::service('date.formatter')->format($revision->revision_timestamp->value, 'short'); + $date = \Drupal::service('date.formatter')->format($revision->getRevisionCreationTime(), 'short'); if ($vid != ${{ entity_name }}->getRevisionId()) { $link = $this->l($date, new Url('entity.{{ entity_name }}.revision', ['{{ entity_name }}' => ${{ entity_name }}->id(), '{{ entity_name }}_revision' => $vid])); } @@ -113,7 +113,7 @@ class {{ entity_class }}Controller extends ControllerBase implements ContainerIn '#context' => [ 'date' => $link, 'username' => \Drupal::service('renderer')->renderPlain($username), - 'message' => ['#markup' => $revision->revision_log_message->value, '#allowed_tags' => Xss::getHtmlTagList()], + 'message' => ['#markup' => $revision->getRevisionLogMessage(), '#allowed_tags' => Xss::getHtmlTagList()], ], ], ]; diff --git a/templates/module/src/Entity/entity-content.php.twig b/templates/module/src/Entity/entity-content.php.twig index 21cc5ab01..018d2c0d6 100644 --- a/templates/module/src/Entity/entity-content.php.twig +++ b/templates/module/src/Entity/entity-content.php.twig @@ -226,38 +226,6 @@ class {{ entity_class }} extends {% if revisionable %}RevisionableContentEntityB $this->set('status', $published ? TRUE : FALSE); return $this; } -{% if revisionable %} - - /** - * {@inheritdoc} - */ - public function getRevisionCreationTime() { - return $this->get('revision_timestamp')->value; - } - - /** - * {@inheritdoc} - */ - public function setRevisionCreationTime($timestamp) { - $this->set('revision_timestamp', $timestamp); - return $this; - } - - /** - * {@inheritdoc} - */ - public function getRevisionUser() { - return $this->get('revision_uid')->entity; - } - - /** - * {@inheritdoc} - */ - public function setRevisionUserId($uid) { - $this->set('revision_uid', $uid); - return $this; - } -{% endif %} /** * {@inheritdoc} @@ -328,21 +296,6 @@ class {{ entity_class }} extends {% if revisionable %}RevisionableContentEntityB $fields['changed'] = BaseFieldDefinition::create('changed') ->setLabel(t('Changed')) ->setDescription(t('The time that the entity was last edited.')); -{% if revisionable %} - - $fields['revision_timestamp'] = BaseFieldDefinition::create('created') - ->setLabel(t('Revision timestamp')) - ->setDescription(t('The time that the current revision was created.')) - ->setQueryable(FALSE) - ->setRevisionable(TRUE); - - $fields['revision_uid'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Revision user ID')) - ->setDescription(t('The user ID of the author of the current revision.')) - ->setSetting('target_type', 'user') - ->setQueryable(FALSE) - ->setRevisionable(TRUE); -{% endif %} {% if revisionable and is_translatable %} $fields['revision_translation_affected'] = BaseFieldDefinition::create('boolean') From c38ae931144b2144bf72b071c97f420486c1d9d2 Mon Sep 17 00:00:00 2001 From: michaellenahan Date: Sat, 25 Mar 2017 18:58:25 +0100 Subject: [PATCH 181/321] Fix contents of generated sites.php file (#3197) (#3232) --- src/Command/Multisite/NewCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Command/Multisite/NewCommand.php b/src/Command/Multisite/NewCommand.php index 5f8bcf1b5..04b77b446 100644 --- a/src/Command/Multisite/NewCommand.php +++ b/src/Command/Multisite/NewCommand.php @@ -159,7 +159,7 @@ protected function addToSitesFile(DrupalStyle $output, $uri) throw new FileNotFoundException($this->trans('commands.multisite.new.errors.sites-missing')); } - $sites_file_contents .= "\n\$sites['$uri'] = '$this->directory';"; + $sites_file_contents .= "\n\$sites['$this->directory'] = '$this->directory';"; try { $this->fs->dumpFile($this->appRoot . '/sites/sites.php', $sites_file_contents); From 78b40b19736affc9755d175bf49be54e80667e69 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 27 Mar 2017 00:15:49 -0700 Subject: [PATCH 182/321] Fix feature-trait messages. (#3239) --- src/Command/Shared/FeatureTrait.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Command/Shared/FeatureTrait.php b/src/Command/Shared/FeatureTrait.php index 378f4c0a6..32ab9a8e2 100644 --- a/src/Command/Shared/FeatureTrait.php +++ b/src/Command/Shared/FeatureTrait.php @@ -138,14 +138,13 @@ protected function importFeature(DrupalStyle $io, $packages) } } - // Process only missing or overriden features + // Process only missing or overridden features $components = $overridden; if (empty($components)) { $io->warning( sprintf( - $this->trans('commands.features.import.messages.nothing'), - $components + $this->trans('commands.features.import.messages.nothing') ) ); @@ -168,7 +167,6 @@ public function import($io, $components) foreach ($components as $component) { foreach ($component as $feature) { if (!isset($config[$feature])) { - //Import missing component. $item = $manager->getConfigType($feature); $type = ConfigurationItem::fromConfigStringToConfigType($item['type']); From fbb1c686de862933bc65a5d04a7c25e1377fc678 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Tue, 28 Mar 2017 00:22:33 -0700 Subject: [PATCH 183/321] Fix array typo. (#3240) --- templates/module/module.views.inc.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/module/module.views.inc.twig b/templates/module/module.views.inc.twig index f9fcbd8f6..98e755c13 100644 --- a/templates/module/module.views.inc.twig +++ b/templates/module/module.views.inc.twig @@ -23,7 +23,7 @@ function {{module}}_views_data() { $data['views']['table']['group'] = t('Custom Global'); $data['views']['table']['join'] = [ // #global is a special flag which allows a table to appear all the time. - '#global' => array[], + '#global' => [], ]; From 72da103aa8d19a4df16c26de3dba445894f33e22 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Tue, 28 Mar 2017 00:57:40 -0700 Subject: [PATCH 184/321] [generate:module] use dashes not underscores in TWIG template name Fix #3227. (#3241) --- templates/module/module-twig-template-append.twig | 1 - 1 file changed, 1 deletion(-) diff --git a/templates/module/module-twig-template-append.twig b/templates/module/module-twig-template-append.twig index 42b3d687b..bb516bde8 100644 --- a/templates/module/module-twig-template-append.twig +++ b/templates/module/module-twig-template-append.twig @@ -5,7 +5,6 @@ function {{machine_name}}_theme() { return [ '{{machine_name}}' => [ - 'template' => '{{machine_name}}', 'render element' => 'children', ], ]; From d5828843ce302e61d026869377af1b2d8c33bac3 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Tue, 28 Mar 2017 01:25:19 -0700 Subject: [PATCH 185/321] [generate:module] use dashes not underscores in TWIG template file name. (#3242) --- src/Generator/ModuleGenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator/ModuleGenerator.php b/src/Generator/ModuleGenerator.php index be4b87c2a..5aa280cb3 100644 --- a/src/Generator/ModuleGenerator.php +++ b/src/Generator/ModuleGenerator.php @@ -163,7 +163,7 @@ public function generate( } $this->renderFile( 'module/twig-template-file.twig', - $dir . $machineName . '.html.twig', + $dir . str_replace("_","-", $machineName) . '.html.twig', $parameters ); } From f234c85613f366e3ac288591980eaa7aa0d62b55 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Tue, 28 Mar 2017 01:42:28 -0700 Subject: [PATCH 186/321] Minor fix bin/drupal executable. (#3243) --- bin/drupal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/drupal.php b/bin/drupal.php index 35c172344..e7004d04e 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -35,6 +35,7 @@ $argvInput = new ArgvInput(); $debug = $argvInput->hasParameterOption(['--debug']); +$argvInputReader = new ArgvInputReader(); $drupalFinder = new DrupalFinder(); if (!$drupalFinder->locateRoot(getcwd())) { @@ -59,7 +60,6 @@ $configuration = $container->get('console.configuration_manager') ->getConfiguration(); -$argvInputReader = new ArgvInputReader(); if ($options = $configuration->get('application.options') ?: []) { $argvInputReader->setOptionsFromConfiguration($options); } From 1fdc5201d100ccedb3e1d6d65db4384915e64fff Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 2 Apr 2017 14:19:13 -0500 Subject: [PATCH 187/321] Update links point to docs. (#3252) --- README.md | 65 +++++++++++-------------------------------------------- 1 file changed, 13 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 5851a45c6..d4480197d 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,9 @@ - [Drupal Console](#drupal-console) - [Required PHP version](#required-php-version) - [Drupal Console documentation](#documentation) - - [Download as new dependency](#download-as-new-dependency) - - [Download using DrupalComposer](#download-using-drupalcomposer) - - [Update DrupalConsole](#update-drupalconsole) - - [Install Drupal Console Launcher](#install-drupal-console-launcher) - - [Update DrupalConsole Launcher](#update-drupalconsole-launcher) - - [Run Drupal Console](#running-drupal-console) + - [Download Drupal Console](#download) + - [Run Drupal Console](#run) + - [Contributors](#contributors) - [Supporting organizations](#supporting-organizations) @@ -41,53 +38,15 @@ More information about using this project at the [official documentation](http:/ ## Required PHP Version PHP 5.5.9 or higher is required to use the Drupal Console application. -## Download as new dependency -``` -# Change directory to Drupal site -cd /path/to/drupal8.dev - -# Download DrupalConsole -composer require drupal/console:~1.0 \ ---prefer-dist \ ---optimize-autoloader \ ---sort-packages -``` - -## Download using DrupalComposer -``` -composer create-project \ -drupal-composer/drupal-project:8.x-dev \ -drupal8.dev \ ---prefer-dist \ ---no-progress \ ---no-interaction -``` - -## Update DrupalConsole - -``` -composer update drupal/console --with-dependencies -``` +## Download -## Install Drupal Console Launcher -``` -curl https://drupalconsole.com/installer -L -o drupal.phar -mv drupal.phar /usr/local/bin/drupal -chmod +x /usr/local/bin/drupal -``` -NOTE: If you don't have curl you can try -``` -php -r "readfile('https://drupalconsole.com/installer');" > drupal.phar -``` +[Install Drupal Console Using Composer](https://docs.drupalconsole.com/en/getting/composer.html) +[Install Drupal Console Launcher](https://docs.drupalconsole.com/en/getting/launcher.html) -## Update DrupalConsole Launcher  -``` -drupal self-update -``` -> NOTE: `drupal` is the alias name you used when installed the DrupalConsole Launcher. +[Installing Drupal Console on Windows](https://docs.drupalconsole.com/en/getting/windows.html) -## Run Drupal Console +## Run Using the DrupalConsole Launcher ``` drupal @@ -127,14 +86,16 @@ source "$HOME/.console/console.rc" 2>/dev/null ln -s ~/.console/drupal.fish ~/.config/fish/completions/drupal.fish ``` +## Contributors + +[Full list of contributors](https://drupalconsole.com/contributors) + ## Supporting Organizations [![weKnow](https://www.drupal.org/files/weKnow-logo_5.png)](http://weknowinc.com) [![Anexus](https://www.drupal.org/files/anexus-logo.png)](http://www.anexusit.com/) -[![Indava](https://www.drupal.org/files/indava-logo.png)](http://www.indava.com/) - -[![FFW](https://www.drupal.org/files/ffw-logo.png)](https://ffwagency.com) +[All supporting organizations](https://drupalconsole.com/supporting-organizations) > Drupal is a registered trademark of Dries Buytaert. From 4aa253004623399a88528be9cff603ad26131123 Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Mon, 3 Apr 2017 08:24:47 +0300 Subject: [PATCH 188/321] Improve docblocks for generated constructors. (#3244) --- templates/module/src/Command/command.php.twig | 2 +- templates/module/src/Controller/controller.php.twig | 2 +- templates/module/src/Form/form-config.php.twig | 3 +++ templates/module/src/Form/form.php.twig | 3 +++ templates/module/src/Plugin/Block/block.php.twig | 2 +- templates/module/src/Plugin/Condition/condition.php.twig | 2 +- .../src/Plugin/Field/FieldFormatter/imageformatter.php.twig | 2 +- templates/module/src/Plugin/Mail/mail.php.twig | 2 +- templates/module/src/Plugin/Rest/Resource/rest.php.twig | 2 +- templates/module/src/Plugin/skeleton.php.twig | 2 +- templates/module/src/TwigExtension/twig-extension.php.twig | 2 +- templates/module/src/cache-context.php.twig | 4 ++-- templates/module/src/event-subscriber.php.twig | 2 +- templates/module/src/plugin-type-annotation-manager.php.twig | 2 +- templates/module/src/service.php.twig | 2 +- templates/module/src/yaml-plugin-manager.php.twig | 2 +- 16 files changed, 21 insertions(+), 15 deletions(-) diff --git a/templates/module/src/Command/command.php.twig b/templates/module/src/Command/command.php.twig index 305095753..7e6f264dd 100644 --- a/templates/module/src/Command/command.php.twig +++ b/templates/module/src/Command/command.php.twig @@ -37,7 +37,7 @@ class {{ class_name }} extends Command {% endblock %} {% if services is not empty %} /** - * {@inheritdoc} + * Constructs a new {{ class_name }} object. */ public function __construct({{ servicesAsParameters(services)|join(', ') }}) { {{ serviceClassInitialization(services) }} diff --git a/templates/module/src/Controller/controller.php.twig b/templates/module/src/Controller/controller.php.twig index cf52f16d1..57c1ad137 100644 --- a/templates/module/src/Controller/controller.php.twig +++ b/templates/module/src/Controller/controller.php.twig @@ -25,7 +25,7 @@ class {{ class_name }} extends ControllerBase {% endblock %} {% if services is not empty %} /** - * {@inheritdoc} + * Constructs a new {{ class_name }} object. */ public function __construct({{ servicesAsParameters(services)|join(', ') }}) { {{ serviceClassInitialization(services) }} diff --git a/templates/module/src/Form/form-config.php.twig b/templates/module/src/Form/form-config.php.twig index 52ca88bfa..9dc7a7dcb 100644 --- a/templates/module/src/Form/form-config.php.twig +++ b/templates/module/src/Form/form-config.php.twig @@ -26,6 +26,9 @@ use Symfony\Component\DependencyInjection\ContainerInterface; class {{ class_name }} extends ConfigFormBase {% endblock %} {% block class_construct %} {% if services is not empty %} + /** + * Constructs a new {{ class_name }} object. + */ public function __construct( ConfigFactoryInterface $config_factory, {{ servicesAsParameters(services)|join(',\n ') }} diff --git a/templates/module/src/Form/form.php.twig b/templates/module/src/Form/form.php.twig index a495d6a9c..a5beb3c9c 100644 --- a/templates/module/src/Form/form.php.twig +++ b/templates/module/src/Form/form.php.twig @@ -25,6 +25,9 @@ use Symfony\Component\DependencyInjection\ContainerInterface; class {{ class_name }} extends FormBase {% endblock %} {% block class_construct %} {% if services is not empty %} + /** + * Constructs a new {{ class_name }} object. + */ public function __construct( {{ servicesAsParameters(services)|join(',\n ') }} ) { diff --git a/templates/module/src/Plugin/Block/block.php.twig b/templates/module/src/Plugin/Block/block.php.twig index e223b856f..c7d4cec4f 100644 --- a/templates/module/src/Plugin/Block/block.php.twig +++ b/templates/module/src/Plugin/Block/block.php.twig @@ -32,7 +32,7 @@ class {{class_name}} extends BlockBase {% if services is not empty %}implements {% block class_construct %} {% if services is not empty %} /** - * Construct. + * Constructs a new {{class_name}} object. * * @param array $configuration * A configuration array containing information about the plugin instance. diff --git a/templates/module/src/Plugin/Condition/condition.php.twig b/templates/module/src/Plugin/Condition/condition.php.twig index 569e56298..c782c90f5 100644 --- a/templates/module/src/Plugin/Condition/condition.php.twig +++ b/templates/module/src/Plugin/Condition/condition.php.twig @@ -42,7 +42,7 @@ public static function create(ContainerInterface $container, array $configuratio } /** - * Creates a new ExampleCondition instance. + * Creates a new {{ class_name }} object. * * @param array $configuration * The plugin configuration, i.e. an array with configuration values keyed diff --git a/templates/module/src/Plugin/Field/FieldFormatter/imageformatter.php.twig b/templates/module/src/Plugin/Field/FieldFormatter/imageformatter.php.twig index 83e6b7fcc..92059a4d4 100644 --- a/templates/module/src/Plugin/Field/FieldFormatter/imageformatter.php.twig +++ b/templates/module/src/Plugin/Field/FieldFormatter/imageformatter.php.twig @@ -58,7 +58,7 @@ class {{ class_name }} extends ImageFormatterBase implements ContainerFactoryPlu protected $imageStyleStorage; /** - * Constructs an ImageFormatter object. + * Constructs a new {{ class_name }} object. * * @param string $plugin_id * The plugin_id for the formatter. diff --git a/templates/module/src/Plugin/Mail/mail.php.twig b/templates/module/src/Plugin/Mail/mail.php.twig index d2e466e4c..878b3eea2 100644 --- a/templates/module/src/Plugin/Mail/mail.php.twig +++ b/templates/module/src/Plugin/Mail/mail.php.twig @@ -31,7 +31,7 @@ class {{class_name}} extends PhpMail {% if services is not empty %}implements Co {% block class_construct %} {% if services is not empty %} /** - * Construct. + * Constructs a new {{class_name}} object. * * @param array $configuration * A configuration array containing information about the plugin instance. diff --git a/templates/module/src/Plugin/Rest/Resource/rest.php.twig b/templates/module/src/Plugin/Rest/Resource/rest.php.twig index a5c3bbdce..9145f2e2a 100644 --- a/templates/module/src/Plugin/Rest/Resource/rest.php.twig +++ b/templates/module/src/Plugin/Rest/Resource/rest.php.twig @@ -43,7 +43,7 @@ class {{ class_name }} extends ResourceBase {% endblock %} {% block class_construct %} /** - * Constructs a Drupal\rest\Plugin\ResourceBase object. + * Constructs a new {{ class_name }} object. * * @param array $configuration * A configuration array containing information about the plugin instance. diff --git a/templates/module/src/Plugin/skeleton.php.twig b/templates/module/src/Plugin/skeleton.php.twig index 4354a98f9..ccf2caf2f 100644 --- a/templates/module/src/Plugin/skeleton.php.twig +++ b/templates/module/src/Plugin/skeleton.php.twig @@ -39,7 +39,7 @@ class {{class_name}} implements {% if plugin_interface is not empty %} {{ plugin {% block class_construct %} {% if services is not empty %} /** - * Construct. + * Constructs a new {{class_name}} object. * * @param array $configuration * A configuration array containing information about the plugin instance. diff --git a/templates/module/src/TwigExtension/twig-extension.php.twig b/templates/module/src/TwigExtension/twig-extension.php.twig index 5b6f54758..438965049 100644 --- a/templates/module/src/TwigExtension/twig-extension.php.twig +++ b/templates/module/src/TwigExtension/twig-extension.php.twig @@ -36,7 +36,7 @@ class {{ class }} extends \Twig_Extension {% endblock %} {% if services|length > 1 %} /** - * Constructor. + * Constructs a new {{ class }} object. */ public function __construct({{ servicesAsParameters(services)|join(', ') }}) { parent::__construct($renderer); diff --git a/templates/module/src/cache-context.php.twig b/templates/module/src/cache-context.php.twig index c7dcbf094..5445fb3bf 100644 --- a/templates/module/src/cache-context.php.twig +++ b/templates/module/src/cache-context.php.twig @@ -24,8 +24,8 @@ class {{ class }} implements CacheContextInterface {% endblock %} {% block class_construct %} /** - * Constructor. - */ + * Constructs a new {{ class }} object. + */ public function __construct({{ servicesAsParameters(services)|join(', ') }}) { {{ serviceClassInitialization(services) }} } diff --git a/templates/module/src/event-subscriber.php.twig b/templates/module/src/event-subscriber.php.twig index a8fded0f3..d936b36cf 100644 --- a/templates/module/src/event-subscriber.php.twig +++ b/templates/module/src/event-subscriber.php.twig @@ -24,7 +24,7 @@ class {{ class }} implements EventSubscriberInterface {% endblock %} {% block class_construct %} /** - * Constructor. + * Constructs a new {{ class }} object. */ public function __construct({{ servicesAsParameters(services)|join(', ') }}) { {{ serviceClassInitialization(services) }} diff --git a/templates/module/src/plugin-type-annotation-manager.php.twig b/templates/module/src/plugin-type-annotation-manager.php.twig index f8645554b..2ed39b5df 100644 --- a/templates/module/src/plugin-type-annotation-manager.php.twig +++ b/templates/module/src/plugin-type-annotation-manager.php.twig @@ -22,7 +22,7 @@ class {{ class_name }}Manager extends DefaultPluginManager {% endblock %} {% block class_methods %} /** - * Constructor for {{ class_name }}Manager objects. + * Constructs a new {{ class_name }}Manager object. * * @param \Traversable $namespaces * An object that implements \Traversable which contains the root paths diff --git a/templates/module/src/service.php.twig b/templates/module/src/service.php.twig index 2deb9d3eb..8116f27ce 100644 --- a/templates/module/src/service.php.twig +++ b/templates/module/src/service.php.twig @@ -16,7 +16,7 @@ namespace Drupal\{{module}};{% endblock %} class {{ class }}{% if(interface is defined and interface) %} implements {{ interface }}{% endif %} {% endblock %} {% block class_construct %} /** - * Constructor. + * Constructs a new {{ class }} object. */ public function __construct({{ servicesAsParameters(services)|join(', ') }}) { {{ serviceClassInitialization(services) }} diff --git a/templates/module/src/yaml-plugin-manager.php.twig b/templates/module/src/yaml-plugin-manager.php.twig index b7379d3ae..16d486bc5 100644 --- a/templates/module/src/yaml-plugin-manager.php.twig +++ b/templates/module/src/yaml-plugin-manager.php.twig @@ -35,7 +35,7 @@ class {{ plugin_class }}Manager extends DefaultPluginManager implements {{ plugi ]; /** - * Constructs a {{ plugin_class }}Manager object. + * Constructs a new {{ plugin_class }}Manager object. * * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. From 45a1f546851c7458a64ec729bde15ef49bf2f3fd Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Mon, 3 Apr 2017 08:27:39 +0300 Subject: [PATCH 189/321] Fix whitespace in generated forms. (#3245) --- templates/module/src/Form/form.php.twig | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/templates/module/src/Form/form.php.twig b/templates/module/src/Form/form.php.twig index a5beb3c9c..d45d63135 100644 --- a/templates/module/src/Form/form.php.twig +++ b/templates/module/src/Form/form.php.twig @@ -83,18 +83,17 @@ class {{ class_name }} extends FormBase {% endblock %} {% endif %} ]; {% endfor %} - $form['submit'] = [ - '#type' => 'submit', - '#value' => $this->t('Submit'), + '#type' => 'submit', + '#value' => $this->t('Submit'), ]; return $form; } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function validateForm(array &$form, FormStateInterface $form_state) { parent::validateForm($form, $form_state); } @@ -105,7 +104,7 @@ class {{ class_name }} extends FormBase {% endblock %} public function submitForm(array &$form, FormStateInterface $form_state) { // Display result. foreach ($form_state->getValues() as $key => $value) { - drupal_set_message($key . ': ' . $value); + drupal_set_message($key . ': ' . $value); } } From 2b5a029327fd744d0b64a1e0e3cd54cc92140892 Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Mon, 3 Apr 2017 08:29:02 +0300 Subject: [PATCH 190/321] Use short array syntax for generated options. (#3246) --- src/Command/Shared/FormTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Command/Shared/FormTrait.php b/src/Command/Shared/FormTrait.php index 1f09f5a80..a6e9085d6 100644 --- a/src/Command/Shared/FormTrait.php +++ b/src/Command/Shared/FormTrait.php @@ -126,7 +126,7 @@ public function formQuestion(DrupalStyle $io) $input_options_output[$key] = "'$value' => \$this->t('".$value."')"; } - $input_options = 'array('.implode(', ', $input_options_output).')'; + $input_options = '['.implode(', ', $input_options_output).']'; } // Description for input From 8fd9e83e89ae85d9b6862787b1a58f054efc3555 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Sun, 2 Apr 2017 22:30:23 -0700 Subject: [PATCH 191/321] Typo in import error (#3251) * Typo in import error * Typo in import error --- src/Command/Config/ImportCommand.php | 2 +- src/Command/Config/ImportSingleCommand.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Command/Config/ImportCommand.php b/src/Command/Config/ImportCommand.php index 373b3d587..9b8877909 100644 --- a/src/Command/Config/ImportCommand.php +++ b/src/Command/Config/ImportCommand.php @@ -130,7 +130,7 @@ private function configImport(DrupalStyle $io, StorageComparer $storage_comparer $config_importer->import(); return true; } catch (ConfigImporterException $e) { - $message = 'The import failed due for the following reasons:' . "\n"; + $message = 'The import failed due to the following reasons:' . "\n"; $message .= implode("\n", $config_importer->getErrors()); $io->error( sprintf( diff --git a/src/Command/Config/ImportSingleCommand.php b/src/Command/Config/ImportSingleCommand.php index 713a1f924..747b68cda 100644 --- a/src/Command/Config/ImportSingleCommand.php +++ b/src/Command/Config/ImportSingleCommand.php @@ -174,7 +174,7 @@ private function configImport($io, StorageComparer $storageComparer) return true; } } catch (ConfigImporterException $e) { - $message = 'The import failed due for the following reasons:' . "\n"; + $message = 'The import failed due to the following reasons:' . "\n"; $message .= implode("\n", $configImporter->getErrors()); $io->error( sprintf( From 81f08923be3445b134241e757e99549f0694c6fa Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sat, 8 Apr 2017 11:42:39 -0700 Subject: [PATCH 192/321] Update bin (#3257) * [console] Relocate object instantiation. * [console] Relocate object instantiation. --- bin/drupal.php | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/bin/drupal.php b/bin/drupal.php index e7004d04e..9bbba07bc 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -1,10 +1,10 @@ hasParameterOption(['--debug']); -$argvInputReader = new ArgvInputReader(); - $drupalFinder = new DrupalFinder(); if (!$drupalFinder->locateRoot(getcwd())) { echo ' DrupalConsole must be executed within a Drupal Site.'.PHP_EOL; @@ -48,8 +44,18 @@ $drupalRoot = $drupalFinder->getDrupalRoot(); chdir($drupalRoot); +$configurationManager = new ConfigurationManager(); +$configuration = $configurationManager + ->loadConfigurationFromDirectory($composerRoot); + +$argvInputReader = new ArgvInputReader(); +if ($configuration && $options = $configuration->get('application.options') ?: []) { + $argvInputReader->setOptionsFromConfiguration($options); +} +$argvInputReader->setOptionsAsArgv(); + $drupal = new Drupal($autoload, $composerRoot, $drupalRoot); -$container = $drupal->boot($debug); +$container = $drupal->boot(); if (!$container) { echo ' Something was wrong. Drupal can not be bootstrap.'; @@ -57,13 +63,6 @@ exit(1); } -$configuration = $container->get('console.configuration_manager') - ->getConfiguration(); - -if ($options = $configuration->get('application.options') ?: []) { - $argvInputReader->setOptionsFromConfiguration($options); -} -$argvInputReader->setOptionsAsArgv(); $application = new Application($container); $application->setDefaultCommand('about'); $application->run(); From bd9e5247be7fbb5ef9dd4d3619095946df4a1b60 Mon Sep 17 00:00:00 2001 From: Jose Sanchez Date: Sat, 8 Apr 2017 21:08:58 +0200 Subject: [PATCH 193/321] Refactor Request object creation. Request::createFromGlobals() is not necessary, neither ->appRoot. (#3248) --- src/Bootstrap/Drupal.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index abb4ae8ba..607c52be1 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -68,15 +68,11 @@ public function boot($debug = FALSE) $io->writeln('➤ Creating request'); } $uri = $argvInputReader->get('uri'); - if ($uri && $uri != 'http://default') { - if (substr($uri, -1) != '/') { - $uri .= '/'; - } - $uri .= 'index.php'; - $request = Request::create($uri, 'GET', [], [], [], ['SCRIPT_NAME' => $this->appRoot . '/index.php']); - } else { - $request = Request::createFromGlobals(); + if (substr($uri, -1) != '/') { + $uri .= '/'; } + $uri .= 'index.php'; + $request = Request::create($uri, 'GET', [], [], [], ['SCRIPT_NAME' => '/index.php']); if ($debug) { $io->writeln("\r\033[K\033[1A\r✔"); From 179d414d7263925e538c06433f19b22a1376876f Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sat, 8 Apr 2017 12:20:51 -0700 Subject: [PATCH 194/321] [generate:module] Fix module validator. (#3258) --- src/Command/Generate/ModuleCommand.php | 10 +++++++--- src/Command/Module/InstallCommand.php | 19 ++++++++----------- src/Utils/Validator.php | 4 ++-- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/Command/Generate/ModuleCommand.php b/src/Command/Generate/ModuleCommand.php index fdb2b9cfa..8e4342b76 100644 --- a/src/Command/Generate/ModuleCommand.php +++ b/src/Command/Generate/ModuleCommand.php @@ -192,9 +192,13 @@ protected function execute(InputInterface $input, OutputInterface $output) $moduleFile = $input->getOption('module-file'); $featuresBundle = $input->getOption('features-bundle'); $composer = $input->getOption('composer'); - $dependencies = $this->validator->validateExtensions($input->getOption('dependencies'), 'module', $io); + $dependencies = $this->validator->validateExtensions( + $input->getOption('dependencies'), + 'module', + $io + ); $test = $input->getOption('test'); - $twigtemplate = $input->getOption('twigtemplate'); + $twigTemplate = $input->getOption('twigtemplate'); $this->generator->generate( $module, @@ -208,7 +212,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $composer, $dependencies, $test, - $twigtemplate + $twigTemplate ); } diff --git a/src/Command/Module/InstallCommand.php b/src/Command/Module/InstallCommand.php index 969cad245..218a54853 100644 --- a/src/Command/Module/InstallCommand.php +++ b/src/Command/Module/InstallCommand.php @@ -13,7 +13,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Process\ProcessBuilder; -use Symfony\Component\Process\Exception\ProcessFailedException; use Symfony\Component\Console\Command\Command; use Drupal\Console\Command\Shared\ProjectDownloadTrait; use Drupal\Console\Command\Shared\ModuleTrait; @@ -42,23 +41,23 @@ class InstallCommand extends Command protected $site; /** - * @var Validator -*/ + * @var Validator + */ protected $validator; /** - * @var ModuleInstaller -*/ + * @var ModuleInstaller + */ protected $moduleInstaller; /** - * @var DrupalApi -*/ + * @var DrupalApi + */ protected $drupalApi; /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** @@ -187,8 +186,6 @@ protected function execute(InputInterface $input, OutputInterface $output) ) ); throw new \RuntimeException($process->getErrorOutput()); - - return 0; } } diff --git a/src/Utils/Validator.php b/src/Utils/Validator.php index c0efcc342..7b2101db3 100644 --- a/src/Utils/Validator.php +++ b/src/Utils/Validator.php @@ -265,11 +265,11 @@ public function getUninstalledModules($moduleList) /** * @param string $extensions_list * @param string $type - * @param array $io + * @param DrupalStyle $io * * @return array */ - public function validateExtensions(string $extensions_list, string $type, DrupalStyle $io) + public function validateExtensions($extensions_list, $type, DrupalStyle $io) { $extensions = $this->validateMachineNameList($extensions_list); // Check if all extensions are available From e01dc88a55c989fc3292f56edea64ade9e1baf6f Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sat, 8 Apr 2017 14:32:48 -0700 Subject: [PATCH 195/321] [console] Apply PSR-2 code style. (#3259) --- src/Bootstrap/Drupal.php | 2 +- src/Command/Config/ExportCommand.php | 9 +++------ src/Command/Generate/FormCommand.php | 2 +- src/Command/Module/UninstallCommand.php | 4 ++-- src/Extension/Manager.php | 4 ++-- src/Generator/FormGenerator.php | 5 ++--- src/Generator/ModuleGenerator.php | 2 +- src/Utils/Site.php | 5 ++--- src/Utils/Validator.php | 5 ++--- 9 files changed, 16 insertions(+), 22 deletions(-) diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index 607c52be1..2b62ce97e 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -31,7 +31,7 @@ public function __construct($autoload, $root, $appRoot) $this->appRoot = $appRoot; } - public function boot($debug = FALSE) + public function boot($debug = false) { $output = new ConsoleOutput(); $input = new ArrayInput([]); diff --git a/src/Command/Config/ExportCommand.php b/src/Command/Config/ExportCommand.php index 954caaee4..542bcfa27 100644 --- a/src/Command/Config/ExportCommand.php +++ b/src/Command/Config/ExportCommand.php @@ -38,7 +38,7 @@ class ExportCommand extends Command * ExportCommand constructor. * * @param ConfigManagerInterface $configManager - * @param StorageInterface $storage + * @param StorageInterface $storage */ public function __construct(ConfigManagerInterface $configManager, StorageInterface $storage) { @@ -133,11 +133,9 @@ protected function execute(InputInterface $input, OutputInterface $output) if ($tar) { $archiveTar->addString($configName, $ymlData); - } - else { + } else { file_put_contents("$directory/$configName", $ymlData); } - } // Get all override data from the remaining collections. foreach ($this->storage->getAllCollectionNames() as $collection) { @@ -155,8 +153,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $ymlData = Yaml::encode($configData); if ($tar) { $archiveTar->addString($configName, $ymlData); - } - else { + } else { file_put_contents("$directory/$configName", $ymlData); } } diff --git a/src/Command/Generate/FormCommand.php b/src/Command/Generate/FormCommand.php index 5e7dea5c5..334520b78 100644 --- a/src/Command/Generate/FormCommand.php +++ b/src/Command/Generate/FormCommand.php @@ -211,7 +211,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this ->generator - ->generate($module, $class_name, $form_id, $form_type, $build_services, $config_file, $inputs, $path,$menu_link_gen, $menu_link_title, $menu_parent, $menu_link_desc); + ->generate($module, $class_name, $form_id, $form_type, $build_services, $config_file, $inputs, $path, $menu_link_gen, $menu_link_title, $menu_parent, $menu_link_desc); $this->chainQueue->addCommand('router:rebuild', []); } diff --git a/src/Command/Module/UninstallCommand.php b/src/Command/Module/UninstallCommand.php index 3eddf3830..7fbe45c3a 100755 --- a/src/Command/Module/UninstallCommand.php +++ b/src/Command/Module/UninstallCommand.php @@ -47,10 +47,10 @@ class UninstallCommand extends Command */ protected $configFactory; - /** + /** * @var Manager */ - protected $extensionManager; + protected $extensionManager; /** diff --git a/src/Extension/Manager.php b/src/Extension/Manager.php index 94f698061..b0798f965 100644 --- a/src/Extension/Manager.php +++ b/src/Extension/Manager.php @@ -362,7 +362,7 @@ public function getDrupalExtension($type, $name) } /** - * @param array $extensions + * @param array $extensions * @param string $type * @return array */ @@ -379,7 +379,7 @@ public function checkExtensions(array $extensions, $type = 'module') ->showUninstalled() ->showCore() ->showNoCore() - ->getList(TRUE); + ->getList(true); foreach ($extensions as $extension) { if (in_array($extension, $local_extensions)) { diff --git a/src/Generator/FormGenerator.php b/src/Generator/FormGenerator.php index d1574620a..d19897480 100644 --- a/src/Generator/FormGenerator.php +++ b/src/Generator/FormGenerator.php @@ -93,14 +93,13 @@ public function generate($module, $class_name, $form_id, $form_type, $services, $parameters ); - // Render defaults YML file. - if ($config_file == true) { + // Render defaults YML file. + if ($config_file == true) { $this->renderFile( 'module/config/install/field.default.yml.twig', $this->extensionManager->getModule($module)->getPath() .'/config/install/'.$module.'.'.$class_name_short.'.yml', $parameters ); - } if ($menu_link_gen == true) { diff --git a/src/Generator/ModuleGenerator.php b/src/Generator/ModuleGenerator.php index 5aa280cb3..88fd54517 100644 --- a/src/Generator/ModuleGenerator.php +++ b/src/Generator/ModuleGenerator.php @@ -163,7 +163,7 @@ public function generate( } $this->renderFile( 'module/twig-template-file.twig', - $dir . str_replace("_","-", $machineName) . '.html.twig', + $dir . str_replace("_", "-", $machineName) . '.html.twig', $parameters ); } diff --git a/src/Utils/Site.php b/src/Utils/Site.php index 72d1ab52b..4310421c2 100644 --- a/src/Utils/Site.php +++ b/src/Utils/Site.php @@ -38,8 +38,7 @@ class Site public function __construct( $appRoot, ConfigurationManager $configurationManager - ) - { + ) { $this->appRoot = $appRoot; $this->configurationManager = $configurationManager; } @@ -220,7 +219,7 @@ public function getCacheDirectory() if ($cacheDirectory) { if (strpos($cacheDirectory, '/') != 0) { $cacheDirectory = $this->configurationManager - ->getApplicationDirectory() . '/' . $cacheDirectory; + ->getApplicationDirectory() . '/' . $cacheDirectory; } $cacheDirectories[] = $cacheDirectory . '/' . $siteId . '/'; } diff --git a/src/Utils/Validator.php b/src/Utils/Validator.php index 7b2101db3..3705bc309 100644 --- a/src/Utils/Validator.php +++ b/src/Utils/Validator.php @@ -10,7 +10,6 @@ use Drupal\Console\Extension\Manager; use Drupal\Console\Core\Style\DrupalStyle; - class Validator { const REGEX_CLASS_NAME = '/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]+$/'; @@ -263,8 +262,8 @@ public function getUninstalledModules($moduleList) } /** - * @param string $extensions_list - * @param string $type + * @param string $extensions_list + * @param string $type * @param DrupalStyle $io * * @return array From c6212776d6dedce11d138c50228a3db1febe0e23 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 9 Apr 2017 13:19:39 -0700 Subject: [PATCH 196/321] [server] Add http to url. (#3260) --- src/Command/ServerCommand.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Command/ServerCommand.php b/src/Command/ServerCommand.php index 1d7fcb5e2..c236fd0cb 100644 --- a/src/Command/ServerCommand.php +++ b/src/Command/ServerCommand.php @@ -65,7 +65,6 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); - $learning = $input->hasOption('learning')?$input->getOption('learning'):false; $address = $this->validatePort($input->getArgument('address')); $finder = new PhpExecutableFinder(); @@ -90,7 +89,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $io->commentBlock( sprintf( $this->trans('commands.server.messages.listening'), - $address + 'http://'.$address ) ); @@ -99,7 +98,10 @@ protected function execute(InputInterface $input, OutputInterface $output) if (!$process->isSuccessful()) { $io->error($process->getErrorOutput()); + return 1; } + + return 0; } /** From e1aa44486b7ad05dba89fdd450d60f5789394322 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 9 Apr 2017 14:00:46 -0700 Subject: [PATCH 197/321] [create:nodes] Add default language. (#3261) --- src/Command/Create/NodesCommand.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Command/Create/NodesCommand.php b/src/Command/Create/NodesCommand.php index fe8ca08e0..8fba86359 100644 --- a/src/Command/Create/NodesCommand.php +++ b/src/Command/Create/NodesCommand.php @@ -151,16 +151,17 @@ function ($contentType) use ($bundles) { } // Language module is enabled or not. - $language_module_enabled = \Drupal::moduleHandler()->moduleExists('language'); + $languageModuleEnabled = \Drupal::moduleHandler() + ->moduleExists('language'); // If language module is enabled. - if ($language_module_enabled) { + if ($languageModuleEnabled) { // Get available languages on site. - $available_languages = \Drupal::languageManager()->getLanguages(); + $languages = \Drupal::languageManager()->getLanguages(); // Holds the available languages. $language_list = []; - foreach ($available_languages as $lang) { + foreach ($languages as $lang) { $language_list[$lang->getId()] = $lang->getName(); } @@ -191,7 +192,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $titleWords = $input->getOption('title-words')?:5; $timeRange = $input->getOption('time-range')?:31536000; $available_types = array_keys($this->drupalApi->getBundles()); - $language = $input->getOption('language'); + $language = $input->getOption('language')?:'und'; foreach ($contentTypes as $type) { if (!in_array($type, $available_types)) { From d375bf4537ca19eb9d89890fe6519b104830e656 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 9 Apr 2017 14:27:54 -0700 Subject: [PATCH 198/321] [console] Minor code fixes. (#3262) --- src/Command/Breakpoints/DebugCommand.php | 7 +------ src/Command/Cache/RebuildCommand.php | 2 +- src/Command/Create/TermsCommand.php | 5 ++--- src/Command/Cron/DebugCommand.php | 4 +--- src/Command/Migrate/ExecuteCommand.php | 7 ------- src/Command/Rest/DisableCommand.php | 7 ------- src/Utils/DrupalApi.php | 2 +- 7 files changed, 6 insertions(+), 28 deletions(-) diff --git a/src/Command/Breakpoints/DebugCommand.php b/src/Command/Breakpoints/DebugCommand.php index fd23dd52d..bbdbe86bd 100644 --- a/src/Command/Breakpoints/DebugCommand.php +++ b/src/Command/Breakpoints/DebugCommand.php @@ -106,12 +106,7 @@ private function getBreakpointByName($group) array_values($this->breakpointManager->getGroupProviders($group)) ); - if ($typeExtension == 'theme') { - $projectPath = drupal_get_path('theme', $group); - } - if ($typeExtension == 'module') { - $projectPath = drupal_get_path('module', $group); - } + $projectPath = drupal_get_path($typeExtension, $group); $extensionFile = sprintf( '%s/%s/%s.breakpoints.yml', diff --git a/src/Command/Cache/RebuildCommand.php b/src/Command/Cache/RebuildCommand.php index c3a98ab3d..3ad5f0b98 100644 --- a/src/Command/Cache/RebuildCommand.php +++ b/src/Command/Cache/RebuildCommand.php @@ -84,7 +84,7 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); - $cache = $input->getArgument('cache'); + $cache = $input->getArgument('cache')?:'all'; $this->site->loadLegacyFile('/core/includes/utility.inc'); if ($cache && !$this->drupalApi->isValidCache($cache)) { diff --git a/src/Command/Create/TermsCommand.php b/src/Command/Create/TermsCommand.php index 0822c4a74..a2bd1ab3b 100644 --- a/src/Command/Create/TermsCommand.php +++ b/src/Command/Create/TermsCommand.php @@ -24,9 +24,8 @@ * @package Drupal\Console\Command\Generate * * @DrupalCommand( - * extension = "features", - * extensionType = "module", - * dependencies={"taxonomy"} + * extension = "taxonomy", + * extensionType = "module" * ) */ class TermsCommand extends Command diff --git a/src/Command/Cron/DebugCommand.php b/src/Command/Cron/DebugCommand.php index 7e38a0e30..df06c099a 100644 --- a/src/Command/Cron/DebugCommand.php +++ b/src/Command/Cron/DebugCommand.php @@ -56,9 +56,7 @@ protected function execute(InputInterface $input, OutputInterface $output) ); $io->table( - [ - $this->trans('commands.cron.debug.messages.module') - ], + [ $this->trans('commands.cron.debug.messages.module') ], $this->moduleHandler->getImplementations('cron'), 'compact' ); diff --git a/src/Command/Migrate/ExecuteCommand.php b/src/Command/Migrate/ExecuteCommand.php index 325f85515..946524685 100644 --- a/src/Command/Migrate/ExecuteCommand.php +++ b/src/Command/Migrate/ExecuteCommand.php @@ -47,13 +47,6 @@ public function __construct(MigrationPluginManagerInterface $pluginManagerMigrat parent::__construct(); } - /** - * @DrupalCommand( - * dependencies = { - * "migrate" - * } - * ) - */ protected function configure() { $this diff --git a/src/Command/Rest/DisableCommand.php b/src/Command/Rest/DisableCommand.php index 3ed293f6c..68d95aab8 100644 --- a/src/Command/Rest/DisableCommand.php +++ b/src/Command/Rest/DisableCommand.php @@ -54,13 +54,6 @@ public function __construct( parent::__construct(); } - /** - * @DrupalCommand( - * dependencies = { - * “rest" - * } - * ) - */ protected function configure() { $this diff --git a/src/Utils/DrupalApi.php b/src/Utils/DrupalApi.php index 9295db86a..c382e12eb 100644 --- a/src/Utils/DrupalApi.php +++ b/src/Utils/DrupalApi.php @@ -58,7 +58,7 @@ public function getDrupalVersion() /** * Auxiliary function to get all available drupal caches. * - * @return array The all available drupal caches + * @return \Drupal\Core\Cache\CacheBackendInterface[] The all available drupal caches */ public function getCaches() { From 9d2012b4e09f3099a3fa69dbb3348e9d8b8c8f04 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 9 Apr 2017 16:47:30 -0700 Subject: [PATCH 199/321] [console] Regenerate cached services file. (#3263) --- config/services/drupal-console/generate.yml | 2 +- src/Bootstrap/AddServicesCompilerPass.php | 22 +++++++++--------- src/Command/Generate/CommandCommand.php | 15 ++++++++++++- src/Command/Module/InstallCommand.php | 1 + src/Command/Module/UninstallCommand.php | 25 ++++++++++----------- src/Utils/Site.php | 17 ++++++++++++++ 6 files changed, 57 insertions(+), 25 deletions(-) diff --git a/config/services/drupal-console/generate.yml b/config/services/drupal-console/generate.yml index 9aa66c485..499a63246 100644 --- a/config/services/drupal-console/generate.yml +++ b/config/services/drupal-console/generate.yml @@ -176,7 +176,7 @@ services: - { name: drupal.command } console.generate_command: class: Drupal\Console\Command\Generate\CommandCommand - arguments: ['@console.command_generator', '@console.extension_manager', '@console.validator', '@console.string_converter' ] + arguments: ['@console.command_generator', '@console.extension_manager', '@console.validator', '@console.string_converter', '@console.site'] tags: - { name: drupal.command } console.generate_ckeditorbutton: diff --git a/src/Bootstrap/AddServicesCompilerPass.php b/src/Bootstrap/AddServicesCompilerPass.php index a2c057243..a066a8c59 100644 --- a/src/Bootstrap/AddServicesCompilerPass.php +++ b/src/Bootstrap/AddServicesCompilerPass.php @@ -2,6 +2,7 @@ namespace Drupal\Console\Bootstrap; +use Drupal\Console\Utils\Site; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -64,15 +65,15 @@ public function process(ContainerBuilder $container) ->loadConfiguration($this->root) ->getConfiguration(); - $cacheDirectory = $container->get('console.site')->getCacheDirectory(); - $consoleServicesFile = $cacheDirectory.'/console.services.yml'; + /** + * @var Site $site + */ + $site = $container->get('console.site'); - if (!$this->rebuild && file_exists($consoleServicesFile)) { - $loader->load($consoleServicesFile); + if (!$this->rebuild && $site->cachedServicesFileExists()) { + $loader->load($site->cachedServicesFile()); } else { - if (file_exists($consoleServicesFile)) { - unlink($consoleServicesFile); - } + $site->removeCachedServicesFile(); $finder = new Finder(); $finder->files() ->name('*.yml') @@ -149,15 +150,16 @@ public function process(ContainerBuilder $container) } } - if ($servicesData && is_writable($cacheDirectory)) { + if ($servicesData && is_writable($site->getCacheDirectory())) { file_put_contents( - $consoleServicesFile, + $site->cachedServicesFile(), Yaml::dump($servicesData, 4, 2) ); } } - $consoleExtendServicesFile = $this->root. DRUPAL_CONSOLE .'/extend.console.services.yml'; + $consoleExtendServicesFile = $this->root . DRUPAL_CONSOLE . '/extend.console.services.yml'; + if (file_exists($consoleExtendServicesFile)) { $loader->load($consoleExtendServicesFile); } diff --git a/src/Command/Generate/CommandCommand.php b/src/Command/Generate/CommandCommand.php index 7255609cd..dd684c83a 100644 --- a/src/Command/Generate/CommandCommand.php +++ b/src/Command/Generate/CommandCommand.php @@ -21,6 +21,7 @@ use Drupal\Console\Extension\Manager; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\Validator; +use Drupal\Console\Utils\Site; class CommandCommand extends Command { @@ -50,6 +51,11 @@ class CommandCommand extends Command */ protected $stringConverter; + /** + * @var Site + */ + protected $site; + /** * CommandCommand constructor. * @@ -57,17 +63,20 @@ class CommandCommand extends Command * @param Manager $extensionManager * @param Validator $validator * @param StringConverter $stringConverter + * @param Site $site */ public function __construct( CommandGenerator $generator, Manager $extensionManager, Validator $validator, - StringConverter $stringConverter + StringConverter $stringConverter, + Site $site ) { $this->generator = $generator; $this->extensionManager = $extensionManager; $this->validator = $validator; $this->stringConverter = $stringConverter; + $this->site = $site; parent::__construct(); } @@ -149,6 +158,10 @@ protected function execute(InputInterface $input, OutputInterface $output) $containerAware, $build_services ); + + $this->site->removeCachedServicesFile(); + + return 0; } /** diff --git a/src/Command/Module/InstallCommand.php b/src/Command/Module/InstallCommand.php index 218a54853..4941e5966 100644 --- a/src/Command/Module/InstallCommand.php +++ b/src/Command/Module/InstallCommand.php @@ -238,6 +238,7 @@ protected function execute(InputInterface $input, OutputInterface $output) return 1; } + $this->site->removeCachedServicesFile(); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); } } diff --git a/src/Command/Module/UninstallCommand.php b/src/Command/Module/UninstallCommand.php index 7fbe45c3a..ae68ea8fd 100755 --- a/src/Command/Module/UninstallCommand.php +++ b/src/Command/Module/UninstallCommand.php @@ -17,7 +17,6 @@ use Drupal\Console\Command\Shared\ProjectDownloadTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\Site; -use Drupal\Console\Utils\Validator; use Drupal\Core\ProxyClass\Extension\ModuleInstaller; use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Core\Config\ConfigFactory; @@ -33,8 +32,8 @@ class UninstallCommand extends Command protected $site; /** - * @var ModuleInstaller -*/ + * @var ModuleInstaller + */ protected $moduleInstaller; /** @@ -43,24 +42,23 @@ class UninstallCommand extends Command protected $chainQueue; /** - * @var ConfigFactory -*/ + * @var ConfigFactory + */ protected $configFactory; /** - * @var Manager - */ + * @var Manager + */ protected $extensionManager; - /** * InstallCommand constructor. * - * @param Site $site - * @param Validator $validator - * @param ChainQueue $chainQueue - * @param ConfigFactory $configFactory - * @param Manager $extensionManager + * @param Site $site + * @param ModuleInstaller $moduleInstaller + * @param ChainQueue $chainQueue + * @param ConfigFactory $configFactory + * @param Manager $extensionManager */ public function __construct( Site $site, @@ -218,6 +216,7 @@ protected function execute(InputInterface $input, OutputInterface $output) return 1; } + $this->site->removeCachedServicesFile(); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); } } diff --git a/src/Utils/Site.php b/src/Utils/Site.php index 4310421c2..46fbc86cf 100644 --- a/src/Utils/Site.php +++ b/src/Utils/Site.php @@ -254,4 +254,21 @@ private function isValidDirectory($path) return false; } } + + public function cachedServicesFile() + { + return $this->getCacheDirectory().'/console.services.yml'; + } + + public function cachedServicesFileExists() + { + return file_exists($this->cachedServicesFile()); + } + + public function removeCachedServicesFile() + { + if ($this->cachedServicesFileExists()) { + unlink($this->cachedServicesFile()); + } + } } From 556afb5efcf0eadb0a579face11cee9391c3c6ea Mon Sep 17 00:00:00 2001 From: Greg Anderson Date: Tue, 11 Apr 2017 18:51:28 -0700 Subject: [PATCH 200/321] Annotation @MigrateProcess should be @MigrateProcessPlugin in generate:plugin:migrate:process command. (#3265) --- templates/module/src/Plugin/migrate/process/process.php.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/module/src/Plugin/migrate/process/process.php.twig b/templates/module/src/Plugin/migrate/process/process.php.twig index fe18d3208..148d433f1 100644 --- a/templates/module/src/Plugin/migrate/process/process.php.twig +++ b/templates/module/src/Plugin/migrate/process/process.php.twig @@ -18,7 +18,7 @@ use Drupal\migrate\Row; /** * Provides a '{{class_name}}' migrate process plugin. * - * @MigrateProcess( + * @MigrateProcessPlugin( * id = "{{plugin_id}}" * ) */ From 8d5a8a98c3eda4939f28a44f5bdcf4b597c13727 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 12 Apr 2017 00:39:43 -0700 Subject: [PATCH 201/321] Fix #3264: Drupal::boot method causes 404 errors. (#3267) * Fix #3264: Drupal::boot method causes 404 errors. * Remove debug code. --- src/Bootstrap/Drupal.php | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index 2b62ce97e..f81637428 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -31,12 +31,15 @@ public function __construct($autoload, $root, $appRoot) $this->appRoot = $appRoot; } - public function boot($debug = false) + public function boot() { $output = new ConsoleOutput(); $input = new ArrayInput([]); $io = new DrupalStyle($input, $output); $argvInputReader = new ArgvInputReader(); + $command = $argvInputReader->get('command'); + $uri = $argvInputReader->get('uri'); + $debug = $argvInputReader->get('debug', false); if (!class_exists('Drupal\Core\DrupalKernel')) { $io->error('Class Drupal\Core\DrupalKernel does not exist.'); @@ -57,8 +60,7 @@ public function boot($debug = false) $_SERVER['DEVDESKTOP_DRUPAL_SETTINGS_DIR'] = $devDesktopSettingsDir; } } - $argvInputReader = new ArgvInputReader(); - $command = $argvInputReader->get('command'); + $rebuildServicesFile = false; if ($command=='cache:rebuild' || $command=='cr') { $rebuildServicesFile = true; @@ -67,12 +69,18 @@ public function boot($debug = false) if ($debug) { $io->writeln('➤ Creating request'); } - $uri = $argvInputReader->get('uri'); - if (substr($uri, -1) != '/') { - $uri .= '/'; - } - $uri .= 'index.php'; - $request = Request::create($uri, 'GET', [], [], [], ['SCRIPT_NAME' => '/index.php']); + + $_SERVER['HTTP_HOST'] = parse_url($uri, PHP_URL_HOST); + $_SERVER['SERVER_PORT'] = null; + $_SERVER['REQUEST_URI'] = '/'; + $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; + $_SERVER['REQUEST_METHOD'] = 'GET'; + $_SERVER['SERVER_SOFTWARE'] = null; + $_SERVER['HTTP_USER_AGENT'] = null; + $_SERVER['PHP_SELF'] = $_SERVER['REQUEST_URI'] . 'index.php'; + $_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF']; + $_SERVER['SCRIPT_FILENAME'] = $this->appRoot . '/index.php'; + $request = Request::createFromGlobals(); if ($debug) { $io->writeln("\r\033[K\033[1A\r✔"); @@ -141,7 +149,7 @@ public function boot($debug = false) return $container; } catch (\Exception $e) { - if ($argvInputReader->get('command') == 'list') { + if ($command == 'list') { $io->error($e->getMessage()); } $drupal = new DrupalConsoleCore($this->root, $this->appRoot); From e1766f38023a3007381367195e2884f44f1dfd51 Mon Sep 17 00:00:00 2001 From: Vorapoap L Date: Thu, 20 Apr 2017 03:13:23 +0700 Subject: [PATCH 202/321] New devel:service command (#3247) * Added ServiceCommand (devel:service) * Added ServiceCommand to develop.yml * Changed so method display to sort by function names. * Merge ServiceCommand to ContainerDebugCommand (with improvement) * Improved error message * Try for retest.... * Added checking for hasType and getType (PHP7 only) * Removed ServiceCommand from develop.tml --- src/Command/ContainerDebugCommand.php | 155 +++++++++++++++++++++----- 1 file changed, 130 insertions(+), 25 deletions(-) diff --git a/src/Command/ContainerDebugCommand.php b/src/Command/ContainerDebugCommand.php index db128a41a..4522d66a7 100644 --- a/src/Command/ContainerDebugCommand.php +++ b/src/Command/ContainerDebugCommand.php @@ -43,6 +43,14 @@ protected function configure() 'service', InputArgument::OPTIONAL, $this->trans('commands.container.debug.arguments.service') + )->addArgument( + 'method', + InputArgument::OPTIONAL, + $this->trans('commands.container.debug.arguments.method') + )->addArgument( + 'arguments', + InputArgument::OPTIONAL, + $this->trans('commands.container.debug.arguments.arguments') ); } @@ -54,6 +62,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $io = new DrupalStyle($input, $output); $service = $input->getArgument('service'); $parameters = $input->getOption('parameters'); + $method = $input->getArgument('method'); + $args = $input->getArgument('arguments'); if ($parameters) { $parameterList = $this->getParameterList(); @@ -63,25 +73,76 @@ protected function execute(InputInterface $input, OutputInterface $output) return 0; } - $tableHeader = []; - if ($service) { - $tableRows = $this->getServiceDetail($service); - $io->table($tableHeader, $tableRows, 'compact'); + if ($method) { + $tableHeader = []; + $callbackRow = $this->getCallbackReturnList($service, $method, $args); + $io->table($tableHeader, $callbackRow, 'compact'); return 0; - } + } else { - $tableHeader = [ - $this->trans('commands.container.debug.messages.service_id'), - $this->trans('commands.container.debug.messages.class_name') - ]; + $tableHeader = []; + if ($service) { + $tableRows = $this->getServiceDetail($service); + $io->table($tableHeader, $tableRows, 'compact'); - $tableRows = $this->getServiceList(); - $io->table($tableHeader, $tableRows, 'compact'); + return 0; + } + + $tableHeader = [ + $this->trans('commands.container.debug.messages.service_id'), + $this->trans('commands.container.debug.messages.class_name') + ]; + + $tableRows = $this->getServiceList(); + $io->table($tableHeader, $tableRows, 'compact'); + } return 0; } + private function getCallbackReturnList($service, $method, $args) { + + if ($args != NULL) { + $parsedArgs = json_decode($args, TRUE); + if (!is_array($parsedArgs)) $parsedArgs = explode(",", $args); + } else { + $parsedArgs = NULL; + } + $serviceInstance = \Drupal::service($service); + + if (!method_exists($serviceInstance, $method)) { + throw new \Symfony\Component\DependencyInjection\Exception\BadMethodCallException($this->trans('commands.container.debug.errors.method_not_exists')); + + return $serviceDetail; + } + $serviceDetail[] = [ + ''.$this->trans('commands.container.debug.messages.service').'', + ''.$service.'' + ]; + $serviceDetail[] = [ + ''.$this->trans('commands.container.debug.messages.class').'', + ''.get_class($serviceInstance).'' + ]; + $methods = array($method); + $this->extendArgumentList($serviceInstance, $methods); + $serviceDetail[] = [ + ''.$this->trans('commands.container.debug.messages.method').'', + ''.$methods[0].'' + ]; + if ($parsedArgs) { + $serviceDetail[] = [ + ''.$this->trans('commands.container.debug.messages.arguments').'', + json_encode($parsedArgs, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE ) + ]; + } + $return = call_user_func_array(array($serviceInstance,$method), $parsedArgs); + $serviceDetail[] = [ + ''.$this->trans('commands.container.debug.messages.return').'', + json_encode($return, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) + ]; + return $serviceDetail; + } private function getServiceList() { $services = []; @@ -91,8 +152,12 @@ private function getServiceList() foreach ($serviceDefinitions as $serviceId => $serviceDefinition) { $services[] = [$serviceId, $serviceDefinition->getClass()]; } + usort($services, array($this, 'compareService')); return $services; } + private function compareService($a, $b) { + return strcmp($a[0], $b[0]); + } private function getServiceDetail($service) { @@ -101,39 +166,79 @@ private function getServiceDetail($service) if ($serviceInstance) { $serviceDetail[] = [ - $this->trans('commands.container.debug.messages.service'), - $service - ]; - $serviceDetail[] = [ - $this->trans('commands.container.debug.messages.class'), - get_class($serviceInstance) + ''.$this->trans('commands.container.debug.messages.service').'', + ''.$service.'' ]; $serviceDetail[] = [ - $this->trans('commands.container.debug.messages.interface'), - Yaml::dump(class_implements($serviceInstance)) + ''.$this->trans('commands.container.debug.messages.class').'', + ''.get_class($serviceInstance).'' ]; + $interface = str_replace("{ }", "", Yaml::dump(class_implements($serviceInstance))); + if (!empty($interface)) { + $serviceDetail[] = [ + ''.$this->trans('commands.container.debug.messages.interface').'', + ''.$interface.'' + ]; + } if ($parent = get_parent_class($serviceInstance)) { $serviceDetail[] = [ - $this->trans('commands.container.debug.messages.parent'), - $parent + ''.$this->trans('commands.container.debug.messages.parent').'', + ''.$parent.'' ]; } if ($vars = get_class_vars($serviceInstance)) { $serviceDetail[] = [ - $this->trans('commands.container.debug.messages.variables'), - Yaml::dump($vars) + ''.$this->trans('commands.container.debug.messages.variables').'', + ''.Yaml::dump($vars).'' ]; } if ($methods = get_class_methods($serviceInstance)) { + sort($methods); + $this->extendArgumentList($serviceInstance, $methods); $serviceDetail[] = [ - $this->trans('commands.container.debug.messages.methods'), - Yaml::dump($methods) + ''.$this->trans('commands.container.debug.messages.methods').'', + ''.implode("\n", $methods).'' ]; } + } else { + throw new \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException($service); + + return $serviceDetail; } return $serviceDetail; } + private function extendArgumentList($serviceInstance, &$methods) { + foreach ($methods as $k => $m) { + $reflection = new \ReflectionMethod($serviceInstance, $m); + $params = $reflection->getParameters(); + $p = array(); + + for ($i = 0; $i < count($params) ; $i++) { + if ($params[$i]->isDefaultValueAvailable()) { + $defaultVar = $params[$i]->getDefaultValue(); + $defaultVar = " = ".str_replace(array("\n","array ("), array("", "array("), var_export($def,true)).''; + } else { + $defaultVar = ''; + } + if (method_exists($params[$i], 'hasType') && method_exists($params[$i], 'getType')) { + if ($params[$i]->hasType()) { + $defaultType = ''.strval($params[$i]->getType()).' '; + } else { + $defaultType = ''; + } + } else { + $defaultType = ''; + } + if ($params[$i]->isPassedByReference()) $parameterReference = '&'; + else $parameterReference = ''; + $p[] = $defaultType.$parameterReference.''.'$'.$params[$i]->getName().''.$defaultVar; + } + if ($reflection->isPublic()) { + $methods[$k] = ''.$methods[$k]."(".implode(', ', $p).") "; + } + } + } private function getParameterList() { From d1cb4d0d7daba8d53b074d6514473c117b107d36 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 19 Apr 2017 16:16:19 -0400 Subject: [PATCH 203/321] [console] Remove php-parse & psysh symlinks. Fix #3186. (#3276) --- .gitignore | 2 ++ bin/php-parse | 1 - bin/psysh | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) delete mode 120000 bin/php-parse delete mode 120000 bin/psysh diff --git a/.gitignore b/.gitignore index fd4f8ab8b..850cec01f 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,8 @@ /bin/pdepend /bin/php-cs-fixer /bin/phpmd +/bin/php-parse +/bin/psysh PATCHES.txt # Develop diff --git a/bin/php-parse b/bin/php-parse deleted file mode 120000 index 726f6347e..000000000 --- a/bin/php-parse +++ /dev/null @@ -1 +0,0 @@ -../vendor/nikic/php-parser/bin/php-parse \ No newline at end of file diff --git a/bin/psysh b/bin/psysh deleted file mode 120000 index b732dc399..000000000 --- a/bin/psysh +++ /dev/null @@ -1 +0,0 @@ -../vendor/psy/psysh/bin/psysh \ No newline at end of file From cadb36c290418937b41e4f6d160a9d99355e8840 Mon Sep 17 00:00:00 2001 From: Davvid Date: Wed, 19 Apr 2017 22:17:02 +0200 Subject: [PATCH 204/321] Test PHP 7.1 (#3274) --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b68f71021..c37288a28 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,14 +5,16 @@ language: php php: - 5.5.9 - 5.6 - - 7 + - 7.0 + - 7.1 - hhvm matrix: fast_finish: true allow_failures: - php: hhvm - - php: 7 + - php: 7.0 + - php: 7.1 env: global: From dc324c5ae0cd125389ae5d1aa5ab67e2e13ea3b2 Mon Sep 17 00:00:00 2001 From: Kristof Coomans Date: Wed, 19 Apr 2017 22:32:11 +0200 Subject: [PATCH 205/321] fix hechoendrupal/drupal-console#3272 (#3273) --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0e529681c..d38bb9514 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,7 @@ "drupal/console-core" : "1.0.0-rc16", "drupal/console-extend-plugin": "~0", "alchemy/zippy": "0.4.3", - "doctrine/collections":"1.3.0", + "doctrine/collections":"~1.3", "composer/installers": "~1.0", "symfony/css-selector": ">=2.7 <3.0", "symfony/dom-crawler": ">=2.7 <3.3", From 102a2b6c911493af905e7647a84b27fd5f8094a1 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 23 Apr 2017 18:22:12 -0400 Subject: [PATCH 206/321] [console] Tag 1.0.0-rc17 release. (#3278) * [console] Tag 1.0.0-rc17 release. * [console] Update version. --- composer.json | 2 +- composer.lock | 157 ++++++++++++++++++++------------------- src/Application.php | 2 +- src/Bootstrap/Drupal.php | 2 + 4 files changed, 83 insertions(+), 80 deletions(-) diff --git a/composer.json b/composer.json index d38bb9514..3ba65a60a 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ }, "require": { "php": "^5.5.9 || ^7.0", - "drupal/console-core" : "1.0.0-rc16", + "drupal/console-core" : "1.0.0-rc17", "drupal/console-extend-plugin": "~0", "alchemy/zippy": "0.4.3", "doctrine/collections":"~1.3", diff --git a/composer.lock b/composer.lock index 61e751184..1d94a34dc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "a60765f5a4f4065da528f6b28607c785", + "content-hash": "ed5d131377961ff433170b44710c4c96", "packages": [ { "name": "alchemy/zippy", @@ -571,21 +571,21 @@ }, { "name": "drupal/console-core", - "version": "1.0.0-rc16", + "version": "1.0.0-rc17", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "42690f652b3a61d7d15fe9b785b946f3eb9227bf" + "reference": "d0f45db119ca4234976f2485b765c4dcdac50efa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/42690f652b3a61d7d15fe9b785b946f3eb9227bf", - "reference": "42690f652b3a61d7d15fe9b785b946f3eb9227bf", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/d0f45db119ca4234976f2485b765c4dcdac50efa", + "reference": "d0f45db119ca4234976f2485b765c4dcdac50efa", "shasum": "" }, "require": { "dflydev/dot-access-configuration": "1.0.1", - "drupal/console-en": "1.0.0-rc16", + "drupal/console-en": "1.0.0-rc17", "php": "^5.5.9 || ^7.0", "stecman/symfony-console-completion": "~0.7", "symfony/config": ">=2.7 <3.0", @@ -648,20 +648,20 @@ "drupal", "symfony" ], - "time": "2017-02-09T18:22:32+00:00" + "time": "2017-04-23T22:04:36+00:00" }, { "name": "drupal/console-en", - "version": "1.0.0-rc16", + "version": "1.0.0-rc17", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", - "reference": "32c1e4c31500ba4ccd5e68bd74977fd6258c3e37" + "reference": "117370ecf8e8933adf0350538f9ee2a5804369a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/32c1e4c31500ba4ccd5e68bd74977fd6258c3e37", - "reference": "32c1e4c31500ba4ccd5e68bd74977fd6258c3e37", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/117370ecf8e8933adf0350538f9ee2a5804369a7", + "reference": "117370ecf8e8933adf0350538f9ee2a5804369a7", "shasum": "" }, "type": "drupal-console-language", @@ -702,20 +702,20 @@ "drupal", "symfony" ], - "time": "2017-02-09T16:02:27+00:00" + "time": "2017-04-23T21:55:33+00:00" }, { "name": "drupal/console-extend-plugin", - "version": "0.2.0", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-extend-plugin.git", - "reference": "3c6b873205c6e33f24b33807901d3287a4ff9a02" + "reference": "df2396782960335d18a8e5eb6ab630a37ca5f493" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-extend-plugin/zipball/3c6b873205c6e33f24b33807901d3287a4ff9a02", - "reference": "3c6b873205c6e33f24b33807901d3287a4ff9a02", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-extend-plugin/zipball/df2396782960335d18a8e5eb6ab630a37ca5f493", + "reference": "df2396782960335d18a8e5eb6ab630a37ca5f493", "shasum": "" }, "require": { @@ -743,7 +743,7 @@ } ], "description": "Drupal Console Extend Plugin", - "time": "2017-02-09T17:09:50+00:00" + "time": "2017-02-14T08:38:49+00:00" }, { "name": "gabordemooij/redbean", @@ -1354,16 +1354,16 @@ }, { "name": "symfony/config", - "version": "v2.8.16", + "version": "v2.8.19", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "4537f2413348fe271c2c4b09da219ed615d79f9c" + "reference": "35b7dfa089d7605eb1fdd46281b3070fb9f38750" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/4537f2413348fe271c2c4b09da219ed615d79f9c", - "reference": "4537f2413348fe271c2c4b09da219ed615d79f9c", + "url": "https://api.github.com/repos/symfony/config/zipball/35b7dfa089d7605eb1fdd46281b3070fb9f38750", + "reference": "35b7dfa089d7605eb1fdd46281b3070fb9f38750", "shasum": "" }, "require": { @@ -1406,25 +1406,25 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2017-01-02T20:30:24+00:00" + "time": "2017-04-04T15:24:26+00:00" }, { "name": "symfony/console", - "version": "v2.8.16", + "version": "v2.8.19", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "2e18b8903d9c498ba02e1dfa73f64d4894bb6912" + "reference": "86407ff20855a5eaa2a7219bd815e9c40a88633e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/2e18b8903d9c498ba02e1dfa73f64d4894bb6912", - "reference": "2e18b8903d9c498ba02e1dfa73f64d4894bb6912", + "url": "https://api.github.com/repos/symfony/console/zipball/86407ff20855a5eaa2a7219bd815e9c40a88633e", + "reference": "86407ff20855a5eaa2a7219bd815e9c40a88633e", "shasum": "" }, "require": { "php": ">=5.3.9", - "symfony/debug": "~2.7,>=2.7.2|~3.0.0", + "symfony/debug": "^2.7.2|~3.0.0", "symfony/polyfill-mbstring": "~1.0" }, "require-dev": { @@ -1467,7 +1467,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-01-08T20:43:03+00:00" + "time": "2017-04-03T20:37:06+00:00" }, { "name": "symfony/css-selector", @@ -1524,16 +1524,16 @@ }, { "name": "symfony/debug", - "version": "v2.8.16", + "version": "v2.8.19", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "567681e2c4e5431704e884e4be25a95fd900770f" + "reference": "e90099a2958d4833a02d05b504cc06e1c234abcc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/567681e2c4e5431704e884e4be25a95fd900770f", - "reference": "567681e2c4e5431704e884e4be25a95fd900770f", + "url": "https://api.github.com/repos/symfony/debug/zipball/e90099a2958d4833a02d05b504cc06e1c234abcc", + "reference": "e90099a2958d4833a02d05b504cc06e1c234abcc", "shasum": "" }, "require": { @@ -1545,7 +1545,7 @@ }, "require-dev": { "symfony/class-loader": "~2.2|~3.0.0", - "symfony/http-kernel": "~2.3.24|~2.5.9|~2.6,>=2.6.2|~3.0.0" + "symfony/http-kernel": "~2.3.24|~2.5.9|^2.6.2|~3.0.0" }, "type": "library", "extra": { @@ -1577,20 +1577,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2017-01-02T20:30:24+00:00" + "time": "2017-02-18T19:13:35+00:00" }, { "name": "symfony/dependency-injection", - "version": "v2.8.16", + "version": "v2.8.19", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "b75356611675364607d697f314850d9d870a84aa" + "reference": "14b9d8ae69ac4c74e8f05fee7e0a57039b99c81e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/b75356611675364607d697f314850d9d870a84aa", - "reference": "b75356611675364607d697f314850d9d870a84aa", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/14b9d8ae69ac4c74e8f05fee7e0a57039b99c81e", + "reference": "14b9d8ae69ac4c74e8f05fee7e0a57039b99c81e", "shasum": "" }, "require": { @@ -1640,7 +1640,7 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2017-01-10T14:27:01+00:00" + "time": "2017-04-03T22:14:48+00:00" }, { "name": "symfony/dom-crawler", @@ -1700,16 +1700,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v2.8.16", + "version": "v2.8.19", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "74877977f90fb9c3e46378d5764217c55f32df34" + "reference": "88b65f0ac25355090e524aba4ceb066025df8bd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/74877977f90fb9c3e46378d5764217c55f32df34", - "reference": "74877977f90fb9c3e46378d5764217c55f32df34", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/88b65f0ac25355090e524aba4ceb066025df8bd2", + "reference": "88b65f0ac25355090e524aba4ceb066025df8bd2", "shasum": "" }, "require": { @@ -1717,7 +1717,7 @@ }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.0,>=2.0.5|~3.0.0", + "symfony/config": "^2.0.5|~3.0.0", "symfony/dependency-injection": "~2.6|~3.0.0", "symfony/expression-language": "~2.6|~3.0.0", "symfony/stopwatch": "~2.3|~3.0.0" @@ -1756,7 +1756,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-01-02T20:30:24+00:00" + "time": "2017-04-03T20:37:06+00:00" }, { "name": "symfony/expression-language", @@ -1809,16 +1809,16 @@ }, { "name": "symfony/filesystem", - "version": "v2.8.16", + "version": "v2.8.19", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "5b77d49ab76e5b12743b359ef4b4a712e6f5360d" + "reference": "31ab6827a696244094e6e20d77e7d404f8eb4252" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/5b77d49ab76e5b12743b359ef4b4a712e6f5360d", - "reference": "5b77d49ab76e5b12743b359ef4b4a712e6f5360d", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/31ab6827a696244094e6e20d77e7d404f8eb4252", + "reference": "31ab6827a696244094e6e20d77e7d404f8eb4252", "shasum": "" }, "require": { @@ -1854,20 +1854,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2017-01-08T20:43:03+00:00" + "time": "2017-03-26T15:40:40+00:00" }, { "name": "symfony/finder", - "version": "v2.8.16", + "version": "v2.8.19", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "355fccac526522dc5fca8ecf0e62749a149f3b8b" + "reference": "7131327eb95d86d72039fd1216226c28f36fd02a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/355fccac526522dc5fca8ecf0e62749a149f3b8b", - "reference": "355fccac526522dc5fca8ecf0e62749a149f3b8b", + "url": "https://api.github.com/repos/symfony/finder/zipball/7131327eb95d86d72039fd1216226c28f36fd02a", + "reference": "7131327eb95d86d72039fd1216226c28f36fd02a", "shasum": "" }, "require": { @@ -1903,7 +1903,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-01-02T20:30:24+00:00" + "time": "2017-03-20T08:46:40+00:00" }, { "name": "symfony/http-foundation", @@ -2135,16 +2135,16 @@ }, { "name": "symfony/process", - "version": "v2.8.16", + "version": "v2.8.19", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "ebb3c2abe0940a703f08e0cbe373f62d97d40231" + "reference": "41336b20b52f5fd5b42a227e394e673c8071118f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/ebb3c2abe0940a703f08e0cbe373f62d97d40231", - "reference": "ebb3c2abe0940a703f08e0cbe373f62d97d40231", + "url": "https://api.github.com/repos/symfony/process/zipball/41336b20b52f5fd5b42a227e394e673c8071118f", + "reference": "41336b20b52f5fd5b42a227e394e673c8071118f", "shasum": "" }, "require": { @@ -2180,20 +2180,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-01-02T20:30:24+00:00" + "time": "2017-03-04T12:20:59+00:00" }, { "name": "symfony/translation", - "version": "v2.8.16", + "version": "v2.8.19", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "b4ac4a393f6970cc157fba17be537380de396a86" + "reference": "047e97a64d609778cadfc76e3a09793696bb19f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/b4ac4a393f6970cc157fba17be537380de396a86", - "reference": "b4ac4a393f6970cc157fba17be537380de396a86", + "url": "https://api.github.com/repos/symfony/translation/zipball/047e97a64d609778cadfc76e3a09793696bb19f1", + "reference": "047e97a64d609778cadfc76e3a09793696bb19f1", "shasum": "" }, "require": { @@ -2206,7 +2206,7 @@ "require-dev": { "psr/log": "~1.0", "symfony/config": "~2.8", - "symfony/intl": "~2.4|~3.0.0", + "symfony/intl": "~2.7.25|^2.8.18|~3.2.5", "symfony/yaml": "~2.2|~3.0.0" }, "suggest": { @@ -2244,7 +2244,7 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2017-01-02T20:30:24+00:00" + "time": "2017-03-21T21:39:01+00:00" }, { "name": "symfony/var-dumper", @@ -2311,16 +2311,16 @@ }, { "name": "symfony/yaml", - "version": "v2.8.16", + "version": "v2.8.19", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "dbe61fed9cd4a44c5b1d14e5e7b1a8640cfb2bf2" + "reference": "286d84891690b0e2515874717e49360d1c98a703" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/dbe61fed9cd4a44c5b1d14e5e7b1a8640cfb2bf2", - "reference": "dbe61fed9cd4a44c5b1d14e5e7b1a8640cfb2bf2", + "url": "https://api.github.com/repos/symfony/yaml/zipball/286d84891690b0e2515874717e49360d1c98a703", + "reference": "286d84891690b0e2515874717e49360d1c98a703", "shasum": "" }, "require": { @@ -2356,33 +2356,34 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-01-03T13:49:52+00:00" + "time": "2017-03-20T09:41:44+00:00" }, { "name": "twig/twig", - "version": "v1.31.0", + "version": "v1.33.2", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "ddc9e3e20ee9c0b6908f401ac8353635b750eca7" + "reference": "dd6ca96227917e1e85b41c7c3cc6507b411e0927" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/ddc9e3e20ee9c0b6908f401ac8353635b750eca7", - "reference": "ddc9e3e20ee9c0b6908f401ac8353635b750eca7", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/dd6ca96227917e1e85b41c7c3cc6507b411e0927", + "reference": "dd6ca96227917e1e85b41c7c3cc6507b411e0927", "shasum": "" }, "require": { "php": ">=5.2.7" }, "require-dev": { + "psr/container": "^1.0", "symfony/debug": "~2.7", - "symfony/phpunit-bridge": "~3.2" + "symfony/phpunit-bridge": "~3.3@dev" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.31-dev" + "dev-master": "1.33-dev" } }, "autoload": { @@ -2417,7 +2418,7 @@ "keywords": [ "templating" ], - "time": "2017-01-11T19:36:15+00:00" + "time": "2017-04-20T17:39:48+00:00" }, { "name": "webflo/drupal-finder", diff --git a/src/Application.php b/src/Application.php index 5085bb5d1..ec22efbeb 100644 --- a/src/Application.php +++ b/src/Application.php @@ -25,7 +25,7 @@ class Application extends BaseApplication /** * @var string */ - const VERSION = '1.0.0-rc16'; + const VERSION = '1.0.0-rc17'; public function __construct(ContainerInterface $container) { diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index f81637428..0c3117ce6 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -86,6 +86,7 @@ public function boot() $io->writeln("\r\033[K\033[1A\r✔"); $io->writeln('➤ Creating Drupal kernel'); } + $drupalKernel = DrupalKernel::createFromRequest( $request, $this->autoload, @@ -107,6 +108,7 @@ public function boot() $rebuildServicesFile ) ); + if ($debug) { $io->writeln("\r\033[K\033[1A\r✔"); $io->writeln('➤ Rebuilding container'); From 021cd5d354d487d10094f978c3ae81ff0079b873 Mon Sep 17 00:00:00 2001 From: g3r4 Date: Fri, 28 Apr 2017 14:14:40 -0400 Subject: [PATCH 207/321] Removed files from config export directory, fix #3287 (#3288) --- src/Command/Config/ExportCommand.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Command/Config/ExportCommand.php b/src/Command/Config/ExportCommand.php index 542bcfa27..b4c1443eb 100644 --- a/src/Command/Config/ExportCommand.php +++ b/src/Command/Config/ExportCommand.php @@ -107,6 +107,9 @@ protected function execute(InputInterface $input, OutputInterface $output) ); } + // Remove previous yaml files before creating new ones + array_map('unlink', glob($directory . '/*')); + if ($tar) { $dateTime = new \DateTime(); From 64d2487a0f604cfc541800a8860b4f806880a0c8 Mon Sep 17 00:00:00 2001 From: David Valdez Date: Fri, 28 Apr 2017 15:13:49 -0500 Subject: [PATCH 208/321] Use BTB instead of WTB (#3285) --- src/Generator/ModuleGenerator.php | 2 +- templates/module/src/Tests/load-test.php.twig | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Generator/ModuleGenerator.php b/src/Generator/ModuleGenerator.php index 88fd54517..f7c2ed0a7 100644 --- a/src/Generator/ModuleGenerator.php +++ b/src/Generator/ModuleGenerator.php @@ -117,7 +117,7 @@ public function generate( if ($test) { $this->renderFile( 'module/src/Tests/load-test.php.twig', - $dir . '/src/Tests/' . 'LoadTest.php', + $dir . '/tests/src/Functional/' . 'LoadTest.php', $parameters ); } diff --git a/templates/module/src/Tests/load-test.php.twig b/templates/module/src/Tests/load-test.php.twig index df13935ca..69c2925a7 100644 --- a/templates/module/src/Tests/load-test.php.twig +++ b/templates/module/src/Tests/load-test.php.twig @@ -1,16 +1,16 @@ {% extends "base/class.php.twig" %} {% block file_path %} -\Drupal\{{ machine_name }}\Tests\LoadTest +\Drupal\Tests\{{ machine_name }}\Functional\LoadTest {% endblock %} {% block namespace_class %} -namespace Drupal\{{ machine_name }}\Tests; +namespace Drupal\Tests\{{ machine_name }}\Functional; {% endblock %} {% block use_class %} use Drupal\Core\Url; -use Drupal\simpletest\WebTestBase; +use Drupal\Tests\BrowserTestBase; {% endblock %} {% block class_declaration %} @@ -19,7 +19,7 @@ use Drupal\simpletest\WebTestBase; * * @group {{ machine_name }} */ -class LoadTest extends WebTestBase{% endblock %} +class LoadTest extends BrowserTestBase {% endblock %} {% block class_methods %} /** * Modules to enable. From 482b43b35afcae0dae56e1a387c336875606c23b Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Sat, 29 Apr 2017 03:54:14 +0200 Subject: [PATCH 209/321] [console] Standardize the second argument of Command::addOption(). Fix #3174. (#3286) The second argument of Symfony\Component\Console\Command\Command::addOption() is the shortcut name of the option, and it can be set to null when not used, as reported in the documentation: http://api.symfony.com/3.1/Symfony/Component/Console/Command/Command.html#method_addOption However, currently sometimes false or an empty string are used when the option does not have a shortcut name. This could cause some confusion. Use null everywhere as the second argument when the option does not have a shortcut name. --- src/Command/Config/ExportCommand.php | 6 ++-- .../Config/ExportContentTypeCommand.php | 4 +-- src/Command/Config/ExportSingleCommand.php | 14 ++++----- src/Command/Config/ExportViewCommand.php | 6 ++-- src/Command/Config/ImportCommand.php | 2 +- src/Command/Config/ImportSingleCommand.php | 2 +- src/Command/Database/AddCommand.php | 14 ++++----- src/Command/Database/DatabaseLogBase.php | 6 ++-- src/Command/Database/DumpCommand.php | 2 +- src/Command/Database/LogClearCommand.php | 6 ++-- src/Command/Database/LogDebugCommand.php | 2 +- src/Command/Database/QueryCommand.php | 14 ++++----- src/Command/Database/TableDebugCommand.php | 2 +- .../Develop/TranslationPendingCommand.php | 2 +- .../Develop/TranslationStatsCommand.php | 2 +- .../Develop/TranslationSyncCommand.php | 2 +- src/Command/Features/ImportCommand.php | 2 +- .../AuthenticationProviderCommand.php | 6 ++-- src/Command/Generate/BreakPointCommand.php | 4 +-- src/Command/Generate/CommandCommand.php | 12 ++++---- src/Command/Generate/ControllerCommand.php | 10 +++---- src/Command/Generate/EntityBundleCommand.php | 6 ++-- src/Command/Generate/FormAlterCommand.php | 6 ++-- src/Command/Generate/FormCommand.php | 22 +++++++------- src/Command/Generate/HelpCommand.php | 4 +-- src/Command/Generate/ModuleCommand.php | 24 +++++++-------- src/Command/Generate/ModuleFileCommand.php | 2 +- src/Command/Generate/PermissionCommand.php | 4 +-- src/Command/Generate/PluginBlockCommand.php | 14 ++++----- .../Generate/PluginCKEditorButtonCommand.php | 12 ++++---- .../Generate/PluginConditionCommand.php | 14 ++++----- src/Command/Generate/PluginFieldCommand.php | 28 ++++++++--------- .../Generate/PluginFieldFormatterCommand.php | 10 +++---- .../Generate/PluginFieldTypeCommand.php | 14 ++++----- .../Generate/PluginFieldWidgetCommand.php | 10 +++---- .../Generate/PluginImageEffectCommand.php | 10 +++---- .../Generate/PluginImageFormatterCommand.php | 8 ++--- src/Command/Generate/PluginMailCommand.php | 10 +++---- .../Generate/PluginMigrateProcessCommand.php | 6 ++-- .../Generate/PluginMigrateSourceCommand.php | 14 ++++----- .../Generate/PluginRestResourceCommand.php | 12 ++++---- .../Generate/PluginRulesActionCommand.php | 14 ++++----- .../Generate/PluginSkeletonCommand.php | 8 ++--- .../Generate/PluginTypeAnnotationCommand.php | 8 ++--- .../Generate/PluginTypeYamlCommand.php | 8 ++--- .../Generate/PluginViewsFieldCommand.php | 8 ++--- src/Command/Generate/PostUpdateCommand.php | 4 +-- src/Command/Generate/ProfileCommand.php | 12 ++++---- src/Command/Generate/ServiceCommand.php | 4 +-- src/Command/Generate/ThemeCommand.php | 20 ++++++------- src/Command/Generate/UpdateCommand.php | 4 +-- src/Command/Migrate/ExecuteCommand.php | 20 ++++++------- src/Command/Migrate/RollBackCommand.php | 2 +- src/Command/Migrate/SetupCommand.php | 16 +++++----- src/Command/Module/DownloadCommand.php | 6 ++-- src/Command/Module/InstallCommand.php | 4 +-- src/Command/Module/PathCommand.php | 2 +- src/Command/Module/UninstallCommand.php | 4 +-- src/Command/Module/UpdateCommand.php | 4 +-- src/Command/Multisite/NewCommand.php | 2 +- src/Command/Rest/DebugCommand.php | 2 +- src/Command/Site/InstallCommand.php | 30 +++++++++---------- src/Command/Test/DebugCommand.php | 2 +- src/Command/Test/RunCommand.php | 2 +- src/Command/Theme/DownloadCommand.php | 2 +- src/Command/Theme/InstallCommand.php | 2 +- src/Command/Theme/PathCommand.php | 2 +- src/Command/Views/DebugCommand.php | 4 +-- 68 files changed, 273 insertions(+), 273 deletions(-) diff --git a/src/Command/Config/ExportCommand.php b/src/Command/Config/ExportCommand.php index b4c1443eb..38fbe692e 100644 --- a/src/Command/Config/ExportCommand.php +++ b/src/Command/Config/ExportCommand.php @@ -63,17 +63,17 @@ protected function configure() ) ->addOption( 'tar', - false, + null, InputOption::VALUE_NONE, $this->trans('commands.config.export.arguments.tar') )->addOption( 'remove-uuid', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.config.export.single.options.remove-uuid') )->addOption( 'remove-config-hash', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.config.export.single.options.remove-config-hash') ); diff --git a/src/Command/Config/ExportContentTypeCommand.php b/src/Command/Config/ExportContentTypeCommand.php index 130533f5a..6382238f3 100644 --- a/src/Command/Config/ExportContentTypeCommand.php +++ b/src/Command/Config/ExportContentTypeCommand.php @@ -69,14 +69,14 @@ protected function configure() $this ->setName('config:export:content:type') ->setDescription($this->trans('commands.config.export.content.type.description')) - ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) ->addArgument( 'content-type', InputArgument::REQUIRED, $this->trans('commands.config.export.content.type.arguments.content-type') )->addOption( 'optional-config', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.config.export.content.type.options.optional-config') ); diff --git a/src/Command/Config/ExportSingleCommand.php b/src/Command/Config/ExportSingleCommand.php index a3b728811..9e5284de4 100644 --- a/src/Command/Config/ExportSingleCommand.php +++ b/src/Command/Config/ExportSingleCommand.php @@ -66,37 +66,37 @@ protected function configure() ->setDescription($this->trans('commands.config.export.single.description')) ->addOption( 'name', - '', + null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.config.export.single.options.name') )->addOption( 'directory', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.config.export.arguments.directory') )->addOption( 'module', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.common.options.module') )->addOption( 'include-dependencies', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.config.export.single.options.include-dependencies') )->addOption( 'optional', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.config.export.single.options.optional') )->addOption( 'remove-uuid', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.config.export.single.options.remove-uuid') )->addOption( 'remove-config-hash', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.config.export.single.options.remove-config-hash') ); diff --git a/src/Command/Config/ExportViewCommand.php b/src/Command/Config/ExportViewCommand.php index 246b09e26..f0b0c0e36 100644 --- a/src/Command/Config/ExportViewCommand.php +++ b/src/Command/Config/ExportViewCommand.php @@ -69,7 +69,7 @@ protected function configure() ->setName('config:export:view') ->setDescription($this->trans('commands.config.export.view.description')) ->addOption( - 'module', '', + 'module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module') ) @@ -80,13 +80,13 @@ protected function configure() ) ->addOption( 'optional-config', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.config.export.view.options.optional-config') ) ->addOption( 'include-module-dependencies', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.config.export.view.options.include-module-dependencies') ); diff --git a/src/Command/Config/ImportCommand.php b/src/Command/Config/ImportCommand.php index 9b8877909..8f5ad6010 100644 --- a/src/Command/Config/ImportCommand.php +++ b/src/Command/Config/ImportCommand.php @@ -70,7 +70,7 @@ protected function configure() ) ->addOption( 'remove-files', - false, + null, InputOption::VALUE_NONE, $this->trans('commands.config.import.options.remove-files') ); diff --git a/src/Command/Config/ImportSingleCommand.php b/src/Command/Config/ImportSingleCommand.php index 747b68cda..6b5668f5a 100644 --- a/src/Command/Config/ImportSingleCommand.php +++ b/src/Command/Config/ImportSingleCommand.php @@ -70,7 +70,7 @@ protected function configure() $this->trans('commands.config.import.single.options.file') )->addOption( 'directory', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.config.import.arguments.directory') ); diff --git a/src/Command/Database/AddCommand.php b/src/Command/Database/AddCommand.php index d62c17836..1e2087a10 100644 --- a/src/Command/Database/AddCommand.php +++ b/src/Command/Database/AddCommand.php @@ -50,43 +50,43 @@ protected function configure() ->setDescription($this->trans('commands.database.add.description')) ->addOption( 'database', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.database.add.options.database') ) ->addOption( 'username', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.database.add.options.username') ) ->addOption( 'password', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.database.add.options.password') ) ->addOption( 'prefix', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.database.add.options.prefix') ) ->addOption( 'host', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.database.add.options.host') ) ->addOption( 'port', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.database.add.options.port') ) ->addOption( 'driver', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.database.add.options.driver') ) diff --git a/src/Command/Database/DatabaseLogBase.php b/src/Command/Database/DatabaseLogBase.php index 0feb20934..f0d8e5056 100644 --- a/src/Command/Database/DatabaseLogBase.php +++ b/src/Command/Database/DatabaseLogBase.php @@ -108,19 +108,19 @@ protected function addDefaultLoggingOptions() $this ->addOption( 'type', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.database.log.common.options.type') ) ->addOption( 'severity', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.database.log.common.options.severity') ) ->addOption( 'user-id', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.database.log.common.options.user-id') ); diff --git a/src/Command/Database/DumpCommand.php b/src/Command/Database/DumpCommand.php index 337e51320..b867b517b 100644 --- a/src/Command/Database/DumpCommand.php +++ b/src/Command/Database/DumpCommand.php @@ -66,7 +66,7 @@ protected function configure() ) ->addOption( 'gz', - false, + null, InputOption::VALUE_NONE, $this->trans('commands.database.dump.options.gz') ) diff --git a/src/Command/Database/LogClearCommand.php b/src/Command/Database/LogClearCommand.php index ac87b8036..84a1bb3ee 100644 --- a/src/Command/Database/LogClearCommand.php +++ b/src/Command/Database/LogClearCommand.php @@ -52,19 +52,19 @@ protected function configure() ) ->addOption( 'type', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.database.log.clear.options.type') ) ->addOption( 'severity', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.database.log.clear.options.severity') ) ->addOption( 'user-id', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.database.log.clear.options.user-id') ); diff --git a/src/Command/Database/LogDebugCommand.php b/src/Command/Database/LogDebugCommand.php index b74cc9c5d..de702d860 100644 --- a/src/Command/Database/LogDebugCommand.php +++ b/src/Command/Database/LogDebugCommand.php @@ -65,7 +65,7 @@ protected function configure() ) ->addOption( 'asc', - false, + null, InputOption::VALUE_NONE, $this->trans('commands.database.log.debug.options.asc') ) diff --git a/src/Command/Database/QueryCommand.php b/src/Command/Database/QueryCommand.php index 6e412b788..d5ee1139e 100644 --- a/src/Command/Database/QueryCommand.php +++ b/src/Command/Database/QueryCommand.php @@ -46,13 +46,13 @@ protected function configure() $this->trans('commands.database.query.arguments.database'), 'default' ) - ->addOption('quick', '', InputOption::VALUE_NONE, $this->trans('commands.database.query.options.quick')) - ->addOption('debug', '', InputOption::VALUE_NONE, $this->trans('commands.database.query.options.debug')) - ->addOption('html', '', InputOption::VALUE_NONE, $this->trans('commands.database.query.options.html')) - ->addOption('xml', '', InputOption::VALUE_NONE, $this->trans('commands.database.query.options.xml')) - ->addOption('raw', '', InputOption::VALUE_NONE, $this->trans('commands.database.query.options.raw')) - ->addOption('vertical', '', InputOption::VALUE_NONE, $this->trans('commands.database.query.options.vertical')) - ->addOption('batch', '', InputOption::VALUE_NONE, $this->trans('commands.database.query.options.batch')) + ->addOption('quick', null, InputOption::VALUE_NONE, $this->trans('commands.database.query.options.quick')) + ->addOption('debug', null, InputOption::VALUE_NONE, $this->trans('commands.database.query.options.debug')) + ->addOption('html', null, InputOption::VALUE_NONE, $this->trans('commands.database.query.options.html')) + ->addOption('xml', null, InputOption::VALUE_NONE, $this->trans('commands.database.query.options.xml')) + ->addOption('raw', null, InputOption::VALUE_NONE, $this->trans('commands.database.query.options.raw')) + ->addOption('vertical', null, InputOption::VALUE_NONE, $this->trans('commands.database.query.options.vertical')) + ->addOption('batch', null, InputOption::VALUE_NONE, $this->trans('commands.database.query.options.batch')) ->setHelp($this->trans('commands.database.query.help')); } diff --git a/src/Command/Database/TableDebugCommand.php b/src/Command/Database/TableDebugCommand.php index 3621074d7..b6c9533e0 100644 --- a/src/Command/Database/TableDebugCommand.php +++ b/src/Command/Database/TableDebugCommand.php @@ -63,7 +63,7 @@ protected function configure() ->setDescription($this->trans('commands.database.table.debug.description')) ->addOption( 'database', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.database.table.debug.options.database'), 'default' diff --git a/src/Command/Develop/TranslationPendingCommand.php b/src/Command/Develop/TranslationPendingCommand.php index 3e479bdcd..a7aa68ea0 100644 --- a/src/Command/Develop/TranslationPendingCommand.php +++ b/src/Command/Develop/TranslationPendingCommand.php @@ -77,7 +77,7 @@ protected function configure() ) ->addOption( 'file', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.translation.pending.options.file'), null diff --git a/src/Command/Develop/TranslationStatsCommand.php b/src/Command/Develop/TranslationStatsCommand.php index 723ba787d..9d898aff5 100644 --- a/src/Command/Develop/TranslationStatsCommand.php +++ b/src/Command/Develop/TranslationStatsCommand.php @@ -85,7 +85,7 @@ protected function configure() ) ->addOption( 'format', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.translation.stats.options.format'), 'table' diff --git a/src/Command/Develop/TranslationSyncCommand.php b/src/Command/Develop/TranslationSyncCommand.php index 5d2cd7076..be719800a 100644 --- a/src/Command/Develop/TranslationSyncCommand.php +++ b/src/Command/Develop/TranslationSyncCommand.php @@ -64,7 +64,7 @@ protected function configure() ) ->addOption( 'file', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.translation.stats.options.file'), null diff --git a/src/Command/Features/ImportCommand.php b/src/Command/Features/ImportCommand.php index 31ae21481..275859fb1 100644 --- a/src/Command/Features/ImportCommand.php +++ b/src/Command/Features/ImportCommand.php @@ -41,7 +41,7 @@ protected function configure() ->setDescription($this->trans('commands.features.import.description')) ->addOption( 'bundle', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.features.import.options.bundle') ) diff --git a/src/Command/Generate/AuthenticationProviderCommand.php b/src/Command/Generate/AuthenticationProviderCommand.php index a05aadecb..c1fcfe743 100644 --- a/src/Command/Generate/AuthenticationProviderCommand.php +++ b/src/Command/Generate/AuthenticationProviderCommand.php @@ -69,16 +69,16 @@ protected function configure() ->setName('generate:authentication:provider') ->setDescription($this->trans('commands.generate.authentication.provider.description')) ->setHelp($this->trans('commands.generate.authentication.provider.help')) - ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) ->addOption( 'class', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.authentication.provider.options.class') ) ->addOption( 'provider-id', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.authentication.provider.options.provider-id') ); diff --git a/src/Command/Generate/BreakPointCommand.php b/src/Command/Generate/BreakPointCommand.php index 5ffe47470..b2b868505 100644 --- a/src/Command/Generate/BreakPointCommand.php +++ b/src/Command/Generate/BreakPointCommand.php @@ -97,13 +97,13 @@ protected function configure() ->setHelp($this->trans('commands.generate.breakpoint.help')) ->addOption( 'theme', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.breakpoint.options.theme') ) ->addOption( 'breakpoints', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.breakpoint.options.breakpoints') ); diff --git a/src/Command/Generate/CommandCommand.php b/src/Command/Generate/CommandCommand.php index dd684c83a..24c1e1e4e 100644 --- a/src/Command/Generate/CommandCommand.php +++ b/src/Command/Generate/CommandCommand.php @@ -91,37 +91,37 @@ protected function configure() ->setHelp($this->trans('commands.generate.command.help')) ->addOption( 'extension', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.extension') ) ->addOption( 'extension-type', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.extension-type') ) ->addOption( 'class', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.command.options.class') ) ->addOption( 'name', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.command.options.name') ) ->addOption( 'container-aware', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.generate.command.options.container-aware') ) ->addOption( 'services', - '', + null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.common.options.services') ); diff --git a/src/Command/Generate/ControllerCommand.php b/src/Command/Generate/ControllerCommand.php index 6ab08915a..510a25e05 100644 --- a/src/Command/Generate/ControllerCommand.php +++ b/src/Command/Generate/ControllerCommand.php @@ -97,31 +97,31 @@ protected function configure() ->setHelp($this->trans('commands.generate.controller.help')) ->addOption( 'module', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module') ) ->addOption( 'class', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.controller.options.class') ) ->addOption( 'routes', - '', + null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.generate.controller.options.routes') ) ->addOption( 'services', - '', + null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.common.options.services') ) ->addOption( 'test', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.generate.controller.options.test') ); diff --git a/src/Command/Generate/EntityBundleCommand.php b/src/Command/Generate/EntityBundleCommand.php index 7fc27a58c..93668635f 100644 --- a/src/Command/Generate/EntityBundleCommand.php +++ b/src/Command/Generate/EntityBundleCommand.php @@ -69,16 +69,16 @@ protected function configure() ->setName('generate:entity:bundle') ->setDescription($this->trans('commands.generate.entity.bundle.description')) ->setHelp($this->trans('commands.generate.entity.bundle.help')) - ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) ->addOption( 'bundle-name', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.entity.bundle.options.bundle-name') ) ->addOption( 'bundle-title', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.entity.bundle.options.bundle-title') ); diff --git a/src/Command/Generate/FormAlterCommand.php b/src/Command/Generate/FormAlterCommand.php index f838827f6..d1ffa1dd6 100644 --- a/src/Command/Generate/FormAlterCommand.php +++ b/src/Command/Generate/FormAlterCommand.php @@ -138,19 +138,19 @@ protected function configure() ->setHelp($this->trans('commands.generate.form.alter.help')) ->addOption( 'module', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module') ) ->addOption( 'form-id', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.form.alter.options.form-id') ) ->addOption( 'inputs', - '', + null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.common.options.inputs') ); diff --git a/src/Command/Generate/FormCommand.php b/src/Command/Generate/FormCommand.php index 334520b78..58a2582a1 100644 --- a/src/Command/Generate/FormCommand.php +++ b/src/Command/Generate/FormCommand.php @@ -122,67 +122,67 @@ protected function configure() ) ->addOption( 'module', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module') ) ->addOption( 'class', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.form.options.class') ) ->addOption( 'form-id', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.form.options.form-id') ) ->addOption( 'services', - '', + null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.common.options.services') ) ->addOption( 'config-file', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.generate.form.options.config-file') ) ->addOption( 'inputs', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.common.options.inputs') ) ->addOption( 'path', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.form.options.path') ) ->addOption( 'menu_link_gen', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.form.options.menu_link_gen') ) ->addOption( 'menu_link_title', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.form.options.menu_link_title') ) ->addOption( 'menu_parent', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.form.options.menu_parent') ) ->addOption( 'menu_link_desc', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.form.options.menu_link_desc') ); diff --git a/src/Command/Generate/HelpCommand.php b/src/Command/Generate/HelpCommand.php index afbf98a70..28a96e274 100644 --- a/src/Command/Generate/HelpCommand.php +++ b/src/Command/Generate/HelpCommand.php @@ -76,13 +76,13 @@ protected function configure() ->setHelp($this->trans('commands.generate.help.help')) ->addOption( 'module', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module') ) ->addOption( 'description', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.module.options.description') ); diff --git a/src/Command/Generate/ModuleCommand.php b/src/Command/Generate/ModuleCommand.php index 8e4342b76..39a6f88c2 100644 --- a/src/Command/Generate/ModuleCommand.php +++ b/src/Command/Generate/ModuleCommand.php @@ -94,74 +94,74 @@ protected function configure() ->setHelp($this->trans('commands.generate.module.help')) ->addOption( 'module', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.module.options.module') ) ->addOption( 'machine-name', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.module.options.machine-name') ) ->addOption( 'module-path', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.module.options.module-path') ) ->addOption( 'description', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.module.options.description') ) ->addOption( 'core', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.module.options.core') ) ->addOption( 'package', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.module.options.package') ) ->addOption( 'module-file', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.generate.module.options.module-file') ) ->addOption( 'features-bundle', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.module.options.features-bundle') ) ->addOption( 'composer', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.generate.module.options.composer') ) ->addOption( 'dependencies', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.module.options.dependencies'), '' ) ->addOption( 'test', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.module.options.test') ) ->addOption( 'twigtemplate', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.module.options.twigtemplate') ); diff --git a/src/Command/Generate/ModuleFileCommand.php b/src/Command/Generate/ModuleFileCommand.php index 33bdf7e5f..7dcc76d7a 100644 --- a/src/Command/Generate/ModuleFileCommand.php +++ b/src/Command/Generate/ModuleFileCommand.php @@ -64,7 +64,7 @@ protected function configure() ->setName('generate:module:file') ->setDescription($this->trans('commands.generate.module.file.description')) ->setHelp($this->trans('commands.generate.module.file.help')) - ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')); + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')); } /** diff --git a/src/Command/Generate/PermissionCommand.php b/src/Command/Generate/PermissionCommand.php index 373d347e4..07ef7172f 100644 --- a/src/Command/Generate/PermissionCommand.php +++ b/src/Command/Generate/PermissionCommand.php @@ -70,13 +70,13 @@ protected function configure() ->setHelp($this->trans('commands.generate.permission.help')) ->addOption( 'module', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module') ) ->addOption( 'permissions', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.common.options.permissions') ); diff --git a/src/Command/Generate/PluginBlockCommand.php b/src/Command/Generate/PluginBlockCommand.php index c32e4ea9d..ff35cb3c2 100644 --- a/src/Command/Generate/PluginBlockCommand.php +++ b/src/Command/Generate/PluginBlockCommand.php @@ -113,40 +113,40 @@ protected function configure() ->setName('generate:plugin:block') ->setDescription($this->trans('commands.generate.plugin.block.description')) ->setHelp($this->trans('commands.generate.plugin.block.help')) - ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) ->addOption( 'class', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.block.options.class') ) ->addOption( 'label', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.block.options.label') ) ->addOption( 'plugin-id', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.block.options.plugin-id') ) ->addOption( 'theme-region', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.block.options.theme-region') ) ->addOption( 'inputs', - '', + null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.common.options.inputs') ) ->addOption( 'services', - '', + null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.common.options.services') ); diff --git a/src/Command/Generate/PluginCKEditorButtonCommand.php b/src/Command/Generate/PluginCKEditorButtonCommand.php index e6091fdbe..8b589aaab 100644 --- a/src/Command/Generate/PluginCKEditorButtonCommand.php +++ b/src/Command/Generate/PluginCKEditorButtonCommand.php @@ -78,37 +78,37 @@ protected function configure() ->setHelp($this->trans('commands.generate.plugin.ckeditorbutton.help')) ->addOption( 'module', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module') ) ->addOption( 'class', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.ckeditorbutton.options.class') ) ->addOption( 'label', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.ckeditorbutton.options.label') ) ->addOption( 'plugin-id', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.ckeditorbutton.options.plugin-id') ) ->addOption( 'button-name', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.ckeditorbutton.options.button-name') ) ->addOption( 'button-icon-path', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.ckeditorbutton.options.button-icon-path') ); diff --git a/src/Command/Generate/PluginConditionCommand.php b/src/Command/Generate/PluginConditionCommand.php index 372ee4293..4983e3dd6 100644 --- a/src/Command/Generate/PluginConditionCommand.php +++ b/src/Command/Generate/PluginConditionCommand.php @@ -83,40 +83,40 @@ protected function configure() ->setName('generate:plugin:condition') ->setDescription($this->trans('commands.generate.plugin.condition.description')) ->setHelp($this->trans('commands.generate.plugin.condition.help')) - ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) ->addOption( 'class', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.condition.options.class') ) ->addOption( 'label', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.condition.options.label') ) ->addOption( 'plugin-id', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.condition.options.plugin-id') ) ->addOption( 'context-definition-id', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.condition.options.context-definition-id') ) ->addOption( 'context-definition-label', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.condition.options.context-definition-label') ) ->addOption( 'context-definition-required', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.condition.options.context-definition-required') ); diff --git a/src/Command/Generate/PluginFieldCommand.php b/src/Command/Generate/PluginFieldCommand.php index 3254afed2..daf391a93 100644 --- a/src/Command/Generate/PluginFieldCommand.php +++ b/src/Command/Generate/PluginFieldCommand.php @@ -65,82 +65,82 @@ protected function configure() ->setName('generate:plugin:field') ->setDescription($this->trans('commands.generate.plugin.field.description')) ->setHelp($this->trans('commands.generate.plugin.field.help')) - ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) ->addOption( 'type-class', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.field.options.type-class') ) ->addOption( 'type-label', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.field.options.type-label') ) ->addOption( 'type-plugin-id', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.field.options.type-plugin-id') ) ->addOption( 'type-description', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.field.options.type-type-description') ) ->addOption( 'formatter-class', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.field.options.class') ) ->addOption( 'formatter-label', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.field.options.formatter-label') ) ->addOption( 'formatter-plugin-id', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.field.options.formatter-plugin-id') ) ->addOption( 'widget-class', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.field.options.formatter-class') ) ->addOption( 'widget-label', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.field.options.widget-label') ) ->addOption( 'widget-plugin-id', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.field.options.widget-plugin-id') ) ->addOption( 'field-type', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.field.options.field-type') ) ->addOption( 'default-widget', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.field.options.default-widget') ) ->addOption( 'default-formatter', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.field.options.default-formatter') ); diff --git a/src/Command/Generate/PluginFieldFormatterCommand.php b/src/Command/Generate/PluginFieldFormatterCommand.php index b0e94117c..8258e01ab 100644 --- a/src/Command/Generate/PluginFieldFormatterCommand.php +++ b/src/Command/Generate/PluginFieldFormatterCommand.php @@ -88,28 +88,28 @@ protected function configure() ->setName('generate:plugin:fieldformatter') ->setDescription($this->trans('commands.generate.plugin.fieldformatter.description')) ->setHelp($this->trans('commands.generate.plugin.fieldformatter.help')) - ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) ->addOption( 'class', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.fieldformatter.options.class') ) ->addOption( 'label', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.fieldformatter.options.label') ) ->addOption( 'plugin-id', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.fieldformatter.options.plugin-id') ) ->addOption( 'field-type', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.fieldformatter.options.field-type') ); diff --git a/src/Command/Generate/PluginFieldTypeCommand.php b/src/Command/Generate/PluginFieldTypeCommand.php index d60c4bcb5..0e8bcb893 100644 --- a/src/Command/Generate/PluginFieldTypeCommand.php +++ b/src/Command/Generate/PluginFieldTypeCommand.php @@ -80,40 +80,40 @@ protected function configure() ->setName('generate:plugin:fieldtype') ->setDescription($this->trans('commands.generate.plugin.fieldtype.description')) ->setHelp($this->trans('commands.generate.plugin.fieldtype.help')) - ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) ->addOption( 'class', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.fieldtype.options.class') ) ->addOption( 'label', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.fieldtype.options.label') ) ->addOption( 'plugin-id', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.fieldtype.options.plugin-id') ) ->addOption( 'description', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.fieldtype.options.description') ) ->addOption( 'default-widget', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.fieldtype.options.default-widget') ) ->addOption( 'default-formatter', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.fieldtype.options.default-formatter') ); diff --git a/src/Command/Generate/PluginFieldWidgetCommand.php b/src/Command/Generate/PluginFieldWidgetCommand.php index 89817bcad..8eaea81ba 100644 --- a/src/Command/Generate/PluginFieldWidgetCommand.php +++ b/src/Command/Generate/PluginFieldWidgetCommand.php @@ -93,28 +93,28 @@ protected function configure() ->setName('generate:plugin:fieldwidget') ->setDescription($this->trans('commands.generate.plugin.fieldwidget.description')) ->setHelp($this->trans('commands.generate.plugin.fieldwidget.help')) - ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) ->addOption( 'class', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.fieldwidget.options.class') ) ->addOption( 'label', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.fieldwidget.options.label') ) ->addOption( 'plugin-id', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.fieldwidget.options.plugin-id') ) ->addOption( 'field-type', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.fieldwidget.options.field-type') ); diff --git a/src/Command/Generate/PluginImageEffectCommand.php b/src/Command/Generate/PluginImageEffectCommand.php index d66a90421..efae2443b 100644 --- a/src/Command/Generate/PluginImageEffectCommand.php +++ b/src/Command/Generate/PluginImageEffectCommand.php @@ -79,28 +79,28 @@ protected function configure() ->setName('generate:plugin:imageeffect') ->setDescription($this->trans('commands.generate.plugin.imageeffect.description')) ->setHelp($this->trans('commands.generate.plugin.imageeffect.help')) - ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) ->addOption( 'class', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.imageeffect.options.class') ) ->addOption( 'label', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.imageeffect.options.label') ) ->addOption( 'plugin-id', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.imageeffect.options.plugin-id') ) ->addOption( 'description', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.imageeffect.options.description') ); diff --git a/src/Command/Generate/PluginImageFormatterCommand.php b/src/Command/Generate/PluginImageFormatterCommand.php index 9672a97e1..333942496 100644 --- a/src/Command/Generate/PluginImageFormatterCommand.php +++ b/src/Command/Generate/PluginImageFormatterCommand.php @@ -83,22 +83,22 @@ protected function configure() ->setName('generate:plugin:imageformatter') ->setDescription($this->trans('commands.generate.plugin.imageformatter.description')) ->setHelp($this->trans('commands.generate.plugin.imageformatter.help')) - ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) ->addOption( 'class', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.imageformatter.options.class') ) ->addOption( 'label', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.imageformatter.options.label') ) ->addOption( 'plugin-id', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.imageformatter.options.plugin-id') ); diff --git a/src/Command/Generate/PluginMailCommand.php b/src/Command/Generate/PluginMailCommand.php index 73cd2f75d..48a47d0d6 100644 --- a/src/Command/Generate/PluginMailCommand.php +++ b/src/Command/Generate/PluginMailCommand.php @@ -92,28 +92,28 @@ protected function configure() ->setName('generate:plugin:mail') ->setDescription($this->trans('commands.generate.plugin.mail.description')) ->setHelp($this->trans('commands.generate.plugin.mail.help')) - ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) ->addOption( 'class', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.mail.options.class') ) ->addOption( 'label', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.mail.options.label') ) ->addOption( 'plugin-id', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.mail.options.plugin-id') ) ->addOption( 'services', - '', + null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.common.options.services') ); diff --git a/src/Command/Generate/PluginMigrateProcessCommand.php b/src/Command/Generate/PluginMigrateProcessCommand.php index fccd9e35b..20ba70a60 100644 --- a/src/Command/Generate/PluginMigrateProcessCommand.php +++ b/src/Command/Generate/PluginMigrateProcessCommand.php @@ -73,16 +73,16 @@ protected function configure() ->setName('generate:plugin:migrate:process') ->setDescription($this->trans('commands.generate.plugin.migrate.process.description')) ->setHelp($this->trans('commands.generate.plugin.migrate.process.help')) - ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) ->addOption( 'class', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.migrate.process.options.class') ) ->addOption( 'plugin-id', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.migrate.process.options.plugin-id') ); diff --git a/src/Command/Generate/PluginMigrateSourceCommand.php b/src/Command/Generate/PluginMigrateSourceCommand.php index 0bd731479..5de03cccf 100644 --- a/src/Command/Generate/PluginMigrateSourceCommand.php +++ b/src/Command/Generate/PluginMigrateSourceCommand.php @@ -109,40 +109,40 @@ protected function configure() ->setName('generate:plugin:migrate:source') ->setDescription($this->trans('commands.generate.plugin.migrate.source.description')) ->setHelp($this->trans('commands.generate.plugin.migrate.source.help')) - ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) ->addOption( 'class', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.migrate.source.options.class') ) ->addOption( 'plugin-id', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.migrate.source.options.plugin-id') ) ->addOption( 'table', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.migrate.source.options.table') ) ->addOption( 'alias', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.migrate.source.options.alias') ) ->addOption( 'group-by', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.migrate.source.options.group-by') ) ->addOption( 'fields', - '', + null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.generate.plugin.migrate.source.options.fields') ); diff --git a/src/Command/Generate/PluginRestResourceCommand.php b/src/Command/Generate/PluginRestResourceCommand.php index aa187a23d..410523614 100644 --- a/src/Command/Generate/PluginRestResourceCommand.php +++ b/src/Command/Generate/PluginRestResourceCommand.php @@ -83,10 +83,10 @@ protected function configure() ->setName('generate:plugin:rest:resource') ->setDescription($this->trans('commands.generate.plugin.rest.resource.description')) ->setHelp($this->trans('commands.generate.plugin.rest.resource.help')) - ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) ->addOption( 'class', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.rest.resource.options.class') ) @@ -98,25 +98,25 @@ protected function configure() ) ->addOption( 'plugin-id', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.rest.resource.options.plugin-id') ) ->addOption( 'plugin-label', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.rest.resource.options.plugin-label') ) ->addOption( 'plugin-url', - '', + null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.generate.plugin.rest.resource.options.plugin-url') ) ->addOption( 'plugin-states', - '', + null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.generate.plugin.rest.resource.options.plugin-states') ); diff --git a/src/Command/Generate/PluginRulesActionCommand.php b/src/Command/Generate/PluginRulesActionCommand.php index 4163e51ad..09f4f96ee 100644 --- a/src/Command/Generate/PluginRulesActionCommand.php +++ b/src/Command/Generate/PluginRulesActionCommand.php @@ -83,35 +83,35 @@ protected function configure() ->setName('generate:plugin:rulesaction') ->setDescription($this->trans('commands.generate.plugin.rulesaction.description')) ->setHelp($this->trans('commands.generate.plugin.rulesaction.help')) - ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) ->addOption( 'class', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.rulesaction.options.class') ) ->addOption( 'label', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.rulesaction.options.label') ) ->addOption( 'plugin-id', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.rulesaction.options.plugin-id') ) - ->addOption('type', '', InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.rulesaction.options.type')) + ->addOption('type', null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.rulesaction.options.type')) ->addOption( 'category', - '', + null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.generate.plugin.rulesaction.options.category') ) ->addOption( 'context', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.rulesaction.options.context') ); diff --git a/src/Command/Generate/PluginSkeletonCommand.php b/src/Command/Generate/PluginSkeletonCommand.php index 39494b501..c09432f76 100644 --- a/src/Command/Generate/PluginSkeletonCommand.php +++ b/src/Command/Generate/PluginSkeletonCommand.php @@ -103,25 +103,25 @@ protected function configure() ->setHelp($this->trans('commands.generate.plugin.skeleton.help')) ->addOption( 'module', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module') ) ->addOption( 'plugin-id', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.options.plugin-id') ) ->addOption( 'class', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.block.options.class') ) ->addOption( 'services', - '', + null, InputOption::VALUE_OPTIONAL| InputOption::VALUE_IS_ARRAY, $this->trans('commands.common.options.services') ); diff --git a/src/Command/Generate/PluginTypeAnnotationCommand.php b/src/Command/Generate/PluginTypeAnnotationCommand.php index 5462596de..109cb2103 100644 --- a/src/Command/Generate/PluginTypeAnnotationCommand.php +++ b/src/Command/Generate/PluginTypeAnnotationCommand.php @@ -73,22 +73,22 @@ protected function configure() ->setName('generate:plugin:type:annotation') ->setDescription($this->trans('commands.generate.plugin.type.annotation.description')) ->setHelp($this->trans('commands.generate.plugin.type.annotation.help')) - ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) ->addOption( 'class', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.type.annotation.options.class') ) ->addOption( 'machine-name', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.type.annotation.options.plugin-id') ) ->addOption( 'label', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.type.annotation.options.label') ); diff --git a/src/Command/Generate/PluginTypeYamlCommand.php b/src/Command/Generate/PluginTypeYamlCommand.php index 6295481f9..58e79cdee 100644 --- a/src/Command/Generate/PluginTypeYamlCommand.php +++ b/src/Command/Generate/PluginTypeYamlCommand.php @@ -74,22 +74,22 @@ protected function configure() ->setName('generate:plugin:type:yaml') ->setDescription($this->trans('commands.generate.plugin.type.yaml.description')) ->setHelp($this->trans('commands.generate.plugin.type.yaml.help')) - ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) ->addOption( 'class', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.type.yaml.options.class') ) ->addOption( 'plugin-name', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.type.yaml.options.plugin-name') ) ->addOption( 'plugin-file-name', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.type.yaml.options.plugin-file-name') ); diff --git a/src/Command/Generate/PluginViewsFieldCommand.php b/src/Command/Generate/PluginViewsFieldCommand.php index c0962a2b7..fa65875df 100644 --- a/src/Command/Generate/PluginViewsFieldCommand.php +++ b/src/Command/Generate/PluginViewsFieldCommand.php @@ -88,22 +88,22 @@ protected function configure() ->setName('generate:plugin:views:field') ->setDescription($this->trans('commands.generate.plugin.views.field.description')) ->setHelp($this->trans('commands.generate.plugin.views.field.help')) - ->addOption('module', '', InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) ->addOption( 'class', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.views.field.options.class') ) ->addOption( 'title', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.views.field.options.title') ) ->addOption( 'description', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.views.field.options.description') ); diff --git a/src/Command/Generate/PostUpdateCommand.php b/src/Command/Generate/PostUpdateCommand.php index 0a0fba1ad..8ac9a1692 100644 --- a/src/Command/Generate/PostUpdateCommand.php +++ b/src/Command/Generate/PostUpdateCommand.php @@ -89,13 +89,13 @@ protected function configure() ->setHelp($this->trans('commands.generate.post.update.help')) ->addOption( 'module', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module') ) ->addOption( 'post-update-name', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.post.update.options.post-update-name') ); diff --git a/src/Command/Generate/ProfileCommand.php b/src/Command/Generate/ProfileCommand.php index 490a8a7dd..08672c384 100644 --- a/src/Command/Generate/ProfileCommand.php +++ b/src/Command/Generate/ProfileCommand.php @@ -85,31 +85,31 @@ protected function configure() ->setHelp($this->trans('commands.generate.profile.help')) ->addOption( 'profile', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.profile.options.profile') ) ->addOption( 'machine-name', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.profile.options.machine-name') ) ->addOption( 'description', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.profile.options.description') ) ->addOption( 'core', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.profile.options.core') ) ->addOption( 'dependencies', - false, + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.profile.options.dependencies'), '' @@ -123,7 +123,7 @@ protected function configure() ) ->addOption( 'distribution', - false, + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.profile.options.distribution') ); diff --git a/src/Command/Generate/ServiceCommand.php b/src/Command/Generate/ServiceCommand.php index e71edc113..0e46cdfe6 100644 --- a/src/Command/Generate/ServiceCommand.php +++ b/src/Command/Generate/ServiceCommand.php @@ -104,13 +104,13 @@ protected function configure() ) ->addOption( 'interface', - false, + null, InputOption::VALUE_NONE, $this->trans('commands.common.service.options.interface') ) ->addOption( 'interface_name', - false, + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.common.service.options.interface_name') ) diff --git a/src/Command/Generate/ThemeCommand.php b/src/Command/Generate/ThemeCommand.php index e70143574..f4798b132 100644 --- a/src/Command/Generate/ThemeCommand.php +++ b/src/Command/Generate/ThemeCommand.php @@ -112,56 +112,56 @@ protected function configure() ->setHelp($this->trans('commands.generate.theme.help')) ->addOption( 'theme', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.theme.options.module') ) ->addOption( 'machine-name', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.theme.options.machine-name') ) ->addOption( 'theme-path', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.theme.options.module-path') ) ->addOption( 'description', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.theme.options.description') ) - ->addOption('core', '', InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.theme.options.core')) + ->addOption('core', null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.theme.options.core')) ->addOption( 'package', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.theme.options.package') ) ->addOption( 'global-library', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.theme.options.global-library') ) ->addOption( 'base-theme', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.theme.options.base-theme') ) ->addOption( 'regions', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.theme.options.regions') ) ->addOption( 'breakpoints', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.theme.options.breakpoints') ); diff --git a/src/Command/Generate/UpdateCommand.php b/src/Command/Generate/UpdateCommand.php index dd1f4eea5..8e985c518 100644 --- a/src/Command/Generate/UpdateCommand.php +++ b/src/Command/Generate/UpdateCommand.php @@ -81,13 +81,13 @@ protected function configure() ->setHelp($this->trans('commands.generate.update.help')) ->addOption( 'module', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module') ) ->addOption( 'update-n', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.update.options.update-n') ); diff --git a/src/Command/Migrate/ExecuteCommand.php b/src/Command/Migrate/ExecuteCommand.php index 946524685..75bdea7bd 100644 --- a/src/Command/Migrate/ExecuteCommand.php +++ b/src/Command/Migrate/ExecuteCommand.php @@ -55,62 +55,62 @@ protected function configure() ->addArgument('migration-ids', InputArgument::IS_ARRAY, $this->trans('commands.migrate.execute.arguments.id')) ->addOption( 'site-url', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.migrate.execute.options.site-url') ) ->addOption( 'db-type', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.migrate.setup.migrations.options.db-type') ) ->addOption( 'db-host', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.migrate.execute.options.db-host') ) ->addOption( 'db-name', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.migrate.execute.options.db-name') ) ->addOption( 'db-user', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.migrate.execute.options.db-user') ) ->addOption( 'db-pass', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.migrate.execute.options.db-pass') ) ->addOption( 'db-prefix', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.migrate.execute.options.db-prefix') ) ->addOption( 'db-port', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.migrate.execute.options.db-port') ) ->addOption( 'exclude', - '', + null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.migrate.execute.options.exclude'), [] ) ->addOption( 'source-base_path', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.migrate.execute.options.source-base_path') ); diff --git a/src/Command/Migrate/RollBackCommand.php b/src/Command/Migrate/RollBackCommand.php index 1d0b3a6d9..707634d98 100644 --- a/src/Command/Migrate/RollBackCommand.php +++ b/src/Command/Migrate/RollBackCommand.php @@ -58,7 +58,7 @@ protected function configure() ->addArgument('migration-ids', InputArgument::IS_ARRAY, $this->trans('commands.migrate.rollback.arguments.id')) ->addOption( 'source-base_path', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.migrate.setup.options.source-base_path') ); diff --git a/src/Command/Migrate/SetupCommand.php b/src/Command/Migrate/SetupCommand.php index 738c5eb43..2949638d3 100644 --- a/src/Command/Migrate/SetupCommand.php +++ b/src/Command/Migrate/SetupCommand.php @@ -56,49 +56,49 @@ protected function configure() ->setDescription($this->trans('commands.migrate.setup.description')) ->addOption( 'db-type', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.migrate.setup.options.db-type') ) ->addOption( 'db-host', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.migrate.setup.options.db-host') ) ->addOption( 'db-name', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.migrate.setup.options.db-name') ) ->addOption( 'db-user', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.migrate.setup.options.db-user') ) ->addOption( 'db-pass', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.migrate.setup.options.db-pass') ) ->addOption( 'db-prefix', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.migrate.setup.options.db-prefix') ) ->addOption( 'db-port', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.migrate.setup.options.db-port') ) ->addOption( 'source-base_path', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.migrate.setup.options.source-base_path') ); diff --git a/src/Command/Module/DownloadCommand.php b/src/Command/Module/DownloadCommand.php index 09aa2e1df..cf799cb4b 100644 --- a/src/Command/Module/DownloadCommand.php +++ b/src/Command/Module/DownloadCommand.php @@ -122,19 +122,19 @@ protected function configure() ) ->addOption( 'latest', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.module.download.options.latest') ) ->addOption( 'composer', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.module.install.options.composer') ) ->addOption( 'unstable', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.module.install.options.unstable') ); diff --git a/src/Command/Module/InstallCommand.php b/src/Command/Module/InstallCommand.php index 4941e5966..1d3f6da19 100644 --- a/src/Command/Module/InstallCommand.php +++ b/src/Command/Module/InstallCommand.php @@ -115,13 +115,13 @@ protected function configure() ) ->addOption( 'latest', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.module.install.options.latest') ) ->addOption( 'composer', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.module.uninstall.options.composer') ); diff --git a/src/Command/Module/PathCommand.php b/src/Command/Module/PathCommand.php index a716cde0c..ff1500852 100644 --- a/src/Command/Module/PathCommand.php +++ b/src/Command/Module/PathCommand.php @@ -50,7 +50,7 @@ protected function configure() ) ->addOption( 'absolute', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.module.path.options.absolute') ); diff --git a/src/Command/Module/UninstallCommand.php b/src/Command/Module/UninstallCommand.php index ae68ea8fd..6b8bfae37 100755 --- a/src/Command/Module/UninstallCommand.php +++ b/src/Command/Module/UninstallCommand.php @@ -90,13 +90,13 @@ protected function configure() ) ->addOption( 'force', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.module.uninstall.options.force') ) ->addOption( 'composer', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.module.uninstall.options.composer') ); diff --git a/src/Command/Module/UpdateCommand.php b/src/Command/Module/UpdateCommand.php index 76bcf88e6..a443fa851 100644 --- a/src/Command/Module/UpdateCommand.php +++ b/src/Command/Module/UpdateCommand.php @@ -59,13 +59,13 @@ protected function configure() ) ->addOption( 'composer', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.module.update.options.composer') ) ->addOption( 'simulate', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.module.update.options.simulate') ); diff --git a/src/Command/Multisite/NewCommand.php b/src/Command/Multisite/NewCommand.php index 04b77b446..4f4189766 100644 --- a/src/Command/Multisite/NewCommand.php +++ b/src/Command/Multisite/NewCommand.php @@ -70,7 +70,7 @@ public function configure() ) ->addOption( 'copy-default', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.multisite.new.options.copy-default') ); diff --git a/src/Command/Rest/DebugCommand.php b/src/Command/Rest/DebugCommand.php index 708920d3d..dcd8a764f 100644 --- a/src/Command/Rest/DebugCommand.php +++ b/src/Command/Rest/DebugCommand.php @@ -58,7 +58,7 @@ protected function configure() ) ->addOption( 'authorization', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.rest.debug.options.status') ); diff --git a/src/Command/Site/InstallCommand.php b/src/Command/Site/InstallCommand.php index 408d5955c..d1ddeae6b 100644 --- a/src/Command/Site/InstallCommand.php +++ b/src/Command/Site/InstallCommand.php @@ -84,91 +84,91 @@ protected function configure() ) ->addOption( 'langcode', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.site.install.options.langcode') ) ->addOption( 'db-type', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.site.install.options.db-type') ) ->addOption( 'db-file', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.site.install.options.db-file') ) ->addOption( 'db-host', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.migrate.execute.options.db-host') ) ->addOption( 'db-name', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.migrate.execute.options.db-name') ) ->addOption( 'db-user', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.migrate.execute.options.db-user') ) ->addOption( 'db-pass', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.migrate.execute.options.db-pass') ) ->addOption( 'db-prefix', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.migrate.execute.options.db-prefix') ) ->addOption( 'db-port', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.migrate.execute.options.db-port') ) ->addOption( 'site-name', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.site.install.options.site-name') ) ->addOption( 'site-mail', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.site.install.options.site-mail') ) ->addOption( 'account-name', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.site.install.options.account-name') ) ->addOption( 'account-mail', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.site.install.options.account-mail') ) ->addOption( 'account-pass', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.site.install.options.account-pass') ) ->addOption( 'force', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.site.install.options.force') ); diff --git a/src/Command/Test/DebugCommand.php b/src/Command/Test/DebugCommand.php index e87176ceb..f5a9b2f48 100644 --- a/src/Command/Test/DebugCommand.php +++ b/src/Command/Test/DebugCommand.php @@ -59,7 +59,7 @@ protected function configure() ) ->addOption( 'test-class', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.test.debug.arguments.test-class') ); diff --git a/src/Command/Test/RunCommand.php b/src/Command/Test/RunCommand.php index edeb4c273..f31280105 100644 --- a/src/Command/Test/RunCommand.php +++ b/src/Command/Test/RunCommand.php @@ -91,7 +91,7 @@ protected function configure() ) ->addOption( 'url', - '', + null, InputOption::VALUE_REQUIRED, $this->trans('commands.test.run.arguments.url') ); diff --git a/src/Command/Theme/DownloadCommand.php b/src/Command/Theme/DownloadCommand.php index eec5beb37..c12bd52e4 100644 --- a/src/Command/Theme/DownloadCommand.php +++ b/src/Command/Theme/DownloadCommand.php @@ -71,7 +71,7 @@ protected function configure() ->addArgument('version', InputArgument::OPTIONAL, $this->trans('commands.theme.download.arguments.version')) ->addOption( 'composer', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.theme.download.options.composer') ); diff --git a/src/Command/Theme/InstallCommand.php b/src/Command/Theme/InstallCommand.php index 078307d5d..32344ecf4 100644 --- a/src/Command/Theme/InstallCommand.php +++ b/src/Command/Theme/InstallCommand.php @@ -64,7 +64,7 @@ protected function configure() ->addArgument('theme', InputArgument::IS_ARRAY, $this->trans('commands.theme.install.options.module')) ->addOption( 'set-default', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.theme.install.options.set-default') ); diff --git a/src/Command/Theme/PathCommand.php b/src/Command/Theme/PathCommand.php index 3cb2fba20..68ad53bd7 100644 --- a/src/Command/Theme/PathCommand.php +++ b/src/Command/Theme/PathCommand.php @@ -50,7 +50,7 @@ protected function configure() ) ->addOption( 'absolute', - '', + null, InputOption::VALUE_NONE, $this->trans('commands.theme.path.options.absolute') ); diff --git a/src/Command/Views/DebugCommand.php b/src/Command/Views/DebugCommand.php index 087621a22..9136bb887 100644 --- a/src/Command/Views/DebugCommand.php +++ b/src/Command/Views/DebugCommand.php @@ -57,12 +57,12 @@ protected function configure() ) ->addOption( 'tag', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.views.debug.arguments.view-tag') )->addOption( 'status', - '', + null, InputOption::VALUE_OPTIONAL, $this->trans('commands.views.debug.arguments.view-status') ); From afe141376e656e9f9ae42768df30a07fe11f3be1 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sat, 29 Apr 2017 16:20:47 -0400 Subject: [PATCH 210/321] Fix server command (#3289) * [server] Add docblock to variables. * [server] Load router.php file from proper route. --- src/Command/ServerCommand.php | 44 +++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/src/Command/ServerCommand.php b/src/Command/ServerCommand.php index c236fd0cb..c1161c6fa 100644 --- a/src/Command/ServerCommand.php +++ b/src/Command/ServerCommand.php @@ -15,6 +15,7 @@ use Symfony\Component\Console\Command\Command; use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; +use \Drupal\Console\Core\Utils\ConfigurationManager; /** * Class ServerCommand @@ -25,8 +26,14 @@ class ServerCommand extends Command { use CommandTrait; + /** + * @var string + */ protected $appRoot; + /** + * @var ConfigurationManager + */ protected $configurationManager; /** @@ -107,24 +114,27 @@ protected function execute(InputInterface $input, OutputInterface $output) /** * @return null|string */ - private function getRouterPath() - { - $router = sprintf( - '%s/.console/router.php', - $this->configurationManager->getHomeDirectory() - ); - - if (file_exists($router)) { - return $router; - } - - $router = sprintf( - '%s/config/dist/router.php', - $this->configurationManager->getApplicationDirectory() - ); + private function getRouterPath() { + $routerPath = [ + sprintf( + '%s/.console/router.php', + $this->configurationManager->getHomeDirectory() + ), + sprintf( + '%s/console/router.php', + $this->configurationManager->getApplicationDirectory() + ), + sprintf( + '%s/%s/config/dist/router.php', + $this->configurationManager->getApplicationDirectory(), + DRUPAL_CONSOLE_CORE + ) + ]; - if (file_exists($router)) { - return $router; + foreach ($routerPath as $router) { + if (file_exists($router)) { + return $router; + } } return null; From ab67ec337d06f6c3381300702a305b4063e48cdf Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 30 Apr 2017 12:19:31 -0700 Subject: [PATCH 211/321] [console] Update services name. (#3290) --- config/services/drupal-console/feature.yml | 4 ++-- config/services/drupal-console/locale.yml | 6 +++--- config/services/drupal-console/module.yml | 15 +++++++-------- config/services/drupal-console/router.yml | 2 +- config/services/drupal-console/theme.yml | 10 +++++----- config/services/drupal-core/migrate.yml | 8 ++++---- config/services/drupal-core/rest.yml | 6 +++--- config/services/drupal-core/simpletest.yml | 4 ++-- 8 files changed, 27 insertions(+), 28 deletions(-) diff --git a/config/services/drupal-console/feature.yml b/config/services/drupal-console/feature.yml index 9351c3b5c..b102fbf8a 100644 --- a/config/services/drupal-console/feature.yml +++ b/config/services/drupal-console/feature.yml @@ -1,9 +1,9 @@ services: - feature_debug: + console.feature_debug: class: Drupal\Console\Command\Features\DebugCommand tags: - { name: drupal.command } - feature_import: + console.feature_import: class: Drupal\Console\Command\Features\ImportCommand tags: - { name: drupal.command } diff --git a/config/services/drupal-console/locale.yml b/config/services/drupal-console/locale.yml index c88f66310..a498b84e9 100644 --- a/config/services/drupal-console/locale.yml +++ b/config/services/drupal-console/locale.yml @@ -1,15 +1,15 @@ services: - translation_status: + console.translation_status: class: Drupal\Console\Command\Locale\TranslationStatusCommand arguments: ['@console.site', '@console.extension_manager'] tags: - { name: drupal.command } - language_delete: + console.language_delete: class: Drupal\Console\Command\Locale\LanguageDeleteCommand arguments: ['@console.site', '@entity_type.manager', '@module_handler'] tags: - { name: drupal.command } - language_add: + console.language_add: class: Drupal\Console\Command\Locale\LanguageAddCommand arguments: ['@console.site', '@module_handler'] tags: diff --git a/config/services/drupal-console/module.yml b/config/services/drupal-console/module.yml index 5ce402bf6..8c79ef33c 100644 --- a/config/services/drupal-console/module.yml +++ b/config/services/drupal-console/module.yml @@ -1,36 +1,35 @@ services: - module_debug: + console.module_debug: class: Drupal\Console\Command\Module\DebugCommand arguments: ['@console.configuration_manager', '@console.site', '@http_client'] tags: - { name: drupal.command } - module_dependency_install: + console.module_dependency_install: class: Drupal\Console\Command\Module\InstallDependencyCommand arguments: ['@console.site', '@console.validator', '@module_installer', '@console.chain_queue'] tags: - { name: drupal.command } - - module_download: + console.module_download: class: Drupal\Console\Command\Module\DownloadCommand arguments: ['@console.drupal_api', '@http_client', '@app.root', '@console.extension_manager', '@console.validator', '@console.site', '@console.configuration_manager', '@console.shell_process', '@console.root'] tags: - { name: drupal.command } - module_install: + console.module_install: class: Drupal\Console\Command\Module\InstallCommand arguments: ['@console.site', '@console.validator', '@module_installer', '@console.drupal_api', '@console.extension_manager', '@app.root', '@console.chain_queue'] tags: - { name: drupal.command } - module_path: + console.module_path: class: Drupal\Console\Command\Module\PathCommand arguments: ['@console.extension_manager'] tags: - { name: drupal.command } - module_uninstall: + console.module_uninstall: class: Drupal\Console\Command\Module\UninstallCommand arguments: ['@console.site','@module_installer', '@console.chain_queue', '@config.factory', '@console.extension_manager'] tags: - { name: drupal.command } - module_update: + console.module_update: class: Drupal\Console\Command\Module\UpdateCommand arguments: ['@console.shell_process', '@console.root'] tags: diff --git a/config/services/drupal-console/router.yml b/config/services/drupal-console/router.yml index b79bf43f1..62304e501 100644 --- a/config/services/drupal-console/router.yml +++ b/config/services/drupal-console/router.yml @@ -1,5 +1,5 @@ services: - router_debug: + console.router_debug: class: Drupal\Console\Command\Router\DebugCommand arguments: ['@router.route_provider'] tags: diff --git a/config/services/drupal-console/theme.yml b/config/services/drupal-console/theme.yml index 9306e8844..abe36c413 100644 --- a/config/services/drupal-console/theme.yml +++ b/config/services/drupal-console/theme.yml @@ -1,25 +1,25 @@ services: - theme_debug: + console.theme_debug: class: Drupal\Console\Command\Theme\DebugCommand arguments: ['@config.factory', '@theme_handler'] tags: - { name: drupal.command } - theme_download: + console.theme_download: class: Drupal\Console\Command\Theme\DownloadCommand arguments: ['@console.drupal_api', '@http_client', '@app.root'] tags: - { name: drupal.command } - theme_install: + console.theme_install: class: Drupal\Console\Command\Theme\InstallCommand arguments: ['@config.factory', '@theme_handler', '@console.chain_queue'] tags: - { name: drupal.command } - theme_path: + console.theme_path: class: Drupal\Console\Command\Theme\PathCommand arguments: ['@console.extension_manager'] tags: - { name: drupal.command } - theme_uninstall: + console.theme_uninstall: class: Drupal\Console\Command\Theme\UninstallCommand arguments: ['@config.factory', '@theme_handler', '@console.chain_queue'] tags: diff --git a/config/services/drupal-core/migrate.yml b/config/services/drupal-core/migrate.yml index 42d5746bb..feae3909a 100644 --- a/config/services/drupal-core/migrate.yml +++ b/config/services/drupal-core/migrate.yml @@ -1,20 +1,20 @@ services: - migrate_rollback: + console.migrate_rollback: class: Drupal\Console\Command\Migrate\RollBackCommand arguments: ['@plugin.manager.migration'] tags: - { name: drupal.command } - migrate_execute: + console.migrate_execute: class: Drupal\Console\Command\Migrate\ExecuteCommand arguments: ['@plugin.manager.migration'] tags: - { name: drupal.command } - migrate_debug: + console.migrate_debug: class: Drupal\Console\Command\Migrate\DebugCommand arguments: ['@plugin.manager.migration'] tags: - { name: drupal.command } - migrate_setup: + console.migrate_setup: class: Drupal\Console\Command\Migrate\SetupCommand arguments: ['@state', '@plugin.manager.migration'] tags: diff --git a/config/services/drupal-core/rest.yml b/config/services/drupal-core/rest.yml index a5446b6ac..8a5935470 100644 --- a/config/services/drupal-core/rest.yml +++ b/config/services/drupal-core/rest.yml @@ -1,15 +1,15 @@ services: - rest_debug: + console.rest_debug: class: Drupal\Console\Command\Rest\DebugCommand arguments: ['@plugin.manager.rest'] tags: - { name: drupal.command } - rest_disable: + console.rest_disable: class: Drupal\Console\Command\Rest\DisableCommand arguments: ['@config.factory', '@plugin.manager.rest'] tags: - { name: drupal.command } - rest_enable: + console.rest_enable: class: Drupal\Console\Command\Rest\EnableCommand arguments: ['@plugin.manager.rest', '@authentication_collector', '@config.factory', '%serializer.formats%', '@entity.manager'] tags: diff --git a/config/services/drupal-core/simpletest.yml b/config/services/drupal-core/simpletest.yml index 20d3f34b8..862b856a6 100644 --- a/config/services/drupal-core/simpletest.yml +++ b/config/services/drupal-core/simpletest.yml @@ -1,10 +1,10 @@ services: - test_debug: + console.test_debug: class: Drupal\Console\Command\Test\DebugCommand arguments: ['@test_discovery'] tags: - { name: drupal.command } - test_run: + console.test_run: class: Drupal\Console\Command\Test\RunCommand arguments: ['@app.root', '@test_discovery', '@module_handler', '@date.formatter'] tags: From dac00552345b5ca0ee1bd4d6e98d1d001516b435 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 1 May 2017 23:28:07 -0700 Subject: [PATCH 212/321] [console] Add missing return error codes. (#3291) --- src/Annotations/DrupalCommand.php | 1 - src/Command/Config/EditCommand.php | 8 +++- src/Command/ContainerDebugCommand.php | 42 +++++++++++-------- .../AuthenticationProviderCommand.php | 4 +- src/Command/Generate/BreakPointCommand.php | 4 +- src/Command/Generate/CacheContextCommand.php | 2 +- src/Command/Generate/CommandCommand.php | 2 +- src/Command/Generate/ControllerCommand.php | 5 ++- src/Command/Generate/EntityBundleCommand.php | 9 ++-- .../Generate/EventSubscriberCommand.php | 2 +- src/Command/Generate/FormAlterCommand.php | 4 +- src/Command/Generate/HelpCommand.php | 4 +- src/Command/Generate/ModuleCommand.php | 6 ++- src/Command/Generate/ModuleFileCommand.php | 2 +- .../Generate/PluginCKEditorButtonCommand.php | 4 +- .../Generate/PluginConditionCommand.php | 4 +- src/Command/Generate/PluginFieldCommand.php | 4 +- .../Generate/PluginFieldFormatterCommand.php | 4 +- .../Generate/PluginFieldTypeCommand.php | 4 +- .../Generate/PluginFieldWidgetCommand.php | 4 +- .../Generate/PluginImageEffectCommand.php | 2 +- .../Generate/PluginImageFormatterCommand.php | 2 +- .../Generate/PluginRestResourceCommand.php | 4 +- .../Generate/PluginRulesActionCommand.php | 4 +- .../Generate/PluginSkeletonCommand.php | 4 +- .../Generate/PluginViewsFieldCommand.php | 4 +- src/Command/Generate/PostUpdateCommand.php | 4 +- src/Command/Generate/ProfileCommand.php | 6 +-- .../Generate/RouteSubscriberCommand.php | 4 +- src/Command/Generate/ServiceCommand.php | 4 +- src/Command/Generate/ThemeCommand.php | 8 ++-- src/Command/Generate/TwigExtensionCommand.php | 5 ++- src/Command/Generate/UpdateCommand.php | 4 +- .../Locale/TranslationStatusCommand.php | 11 +++-- src/Command/Migrate/ExecuteCommand.php | 12 ++++-- src/Command/Migrate/RollBackCommand.php | 4 +- src/Command/Migrate/SetupCommand.php | 4 +- src/Command/Multisite/NewCommand.php | 14 ++++--- src/Command/ServerCommand.php | 5 ++- src/Command/Site/InstallCommand.php | 26 ++++++++---- src/Command/Theme/InstallCommand.php | 6 ++- src/Command/Theme/UninstallCommand.php | 8 +++- src/Command/Views/DisableCommand.php | 7 +++- src/Command/Views/EnableCommand.php | 6 ++- 44 files changed, 187 insertions(+), 90 deletions(-) diff --git a/src/Annotations/DrupalCommand.php b/src/Annotations/DrupalCommand.php index 5163c53c3..32d472436 100644 --- a/src/Annotations/DrupalCommand.php +++ b/src/Annotations/DrupalCommand.php @@ -12,7 +12,6 @@ * @Annotation * @Target("CLASS") */ - class DrupalCommand { /** diff --git a/src/Command/Config/EditCommand.php b/src/Command/Config/EditCommand.php index 5f0c1bebe..d142d7111 100644 --- a/src/Command/Config/EditCommand.php +++ b/src/Command/Config/EditCommand.php @@ -97,7 +97,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if (!$configName) { $io->error($this->trans('commands.config.edit.messages.no-config')); - return; + return 1; } try { @@ -106,7 +106,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } catch (IOExceptionInterface $e) { $io->error($this->trans('commands.config.edit.messages.no-directory').' '.$e->getPath()); - return; + return 1; } if (!$editor) { $editor = $this->getEditor(); @@ -122,9 +122,13 @@ protected function execute(InputInterface $input, OutputInterface $output) $config->save(); $fileSystem->remove($configFile); } + if (!$process->isSuccessful()) { $io->error($process->getErrorOutput()); + return 1; } + + return 0; } protected function interact(InputInterface $input, OutputInterface $output) diff --git a/src/Command/ContainerDebugCommand.php b/src/Command/ContainerDebugCommand.php index 4522d66a7..61519abc2 100644 --- a/src/Command/ContainerDebugCommand.php +++ b/src/Command/ContainerDebugCommand.php @@ -80,7 +80,6 @@ protected function execute(InputInterface $input, OutputInterface $output) return 0; } else { - $tableHeader = []; if ($service) { $tableRows = $this->getServiceDetail($service); @@ -101,13 +100,15 @@ protected function execute(InputInterface $input, OutputInterface $output) return 0; } - private function getCallbackReturnList($service, $method, $args) { - - if ($args != NULL) { - $parsedArgs = json_decode($args, TRUE); - if (!is_array($parsedArgs)) $parsedArgs = explode(",", $args); + private function getCallbackReturnList($service, $method, $args) + { + if ($args != null) { + $parsedArgs = json_decode($args, true); + if (!is_array($parsedArgs)) { + $parsedArgs = explode(",", $args); + } } else { - $parsedArgs = NULL; + $parsedArgs = null; } $serviceInstance = \Drupal::service($service); @@ -124,7 +125,7 @@ private function getCallbackReturnList($service, $method, $args) { ''.$this->trans('commands.container.debug.messages.class').'', ''.get_class($serviceInstance).'' ]; - $methods = array($method); + $methods = [$method]; $this->extendArgumentList($serviceInstance, $methods); $serviceDetail[] = [ ''.$this->trans('commands.container.debug.messages.method').'', @@ -133,10 +134,10 @@ private function getCallbackReturnList($service, $method, $args) { if ($parsedArgs) { $serviceDetail[] = [ ''.$this->trans('commands.container.debug.messages.arguments').'', - json_encode($parsedArgs, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE ) + json_encode($parsedArgs, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) ]; } - $return = call_user_func_array(array($serviceInstance,$method), $parsedArgs); + $return = call_user_func_array([$serviceInstance,$method], $parsedArgs); $serviceDetail[] = [ ''.$this->trans('commands.container.debug.messages.return').'', json_encode($return, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) @@ -152,10 +153,11 @@ private function getServiceList() foreach ($serviceDefinitions as $serviceId => $serviceDefinition) { $services[] = [$serviceId, $serviceDefinition->getClass()]; } - usort($services, array($this, 'compareService')); + usort($services, [$this, 'compareService']); return $services; } - private function compareService($a, $b) { + private function compareService($a, $b) + { return strcmp($a[0], $b[0]); } @@ -208,16 +210,17 @@ private function getServiceDetail($service) return $serviceDetail; } - private function extendArgumentList($serviceInstance, &$methods) { + private function extendArgumentList($serviceInstance, &$methods) + { foreach ($methods as $k => $m) { $reflection = new \ReflectionMethod($serviceInstance, $m); $params = $reflection->getParameters(); - $p = array(); + $p = []; - for ($i = 0; $i < count($params) ; $i++) { + for ($i = 0; $i < count($params); $i++) { if ($params[$i]->isDefaultValueAvailable()) { $defaultVar = $params[$i]->getDefaultValue(); - $defaultVar = " = ".str_replace(array("\n","array ("), array("", "array("), var_export($def,true)).''; + $defaultVar = " = ".str_replace(["\n","array ("], ["", "array("], var_export($def, true)).''; } else { $defaultVar = ''; } @@ -230,8 +233,11 @@ private function extendArgumentList($serviceInstance, &$methods) { } else { $defaultType = ''; } - if ($params[$i]->isPassedByReference()) $parameterReference = '&'; - else $parameterReference = ''; + if ($params[$i]->isPassedByReference()) { + $parameterReference = '&'; + } else { + $parameterReference = ''; + } $p[] = $defaultType.$parameterReference.''.'$'.$params[$i]->getName().''.$defaultVar; } if ($reflection->isPublic()) { diff --git a/src/Command/Generate/AuthenticationProviderCommand.php b/src/Command/Generate/AuthenticationProviderCommand.php index c1fcfe743..cb09454a5 100644 --- a/src/Command/Generate/AuthenticationProviderCommand.php +++ b/src/Command/Generate/AuthenticationProviderCommand.php @@ -93,7 +93,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $module = $input->getOption('module'); @@ -101,6 +101,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $provider_id = $input->getOption('provider-id'); $this->generator->generate($module, $class, $provider_id); + + return 0; } protected function interact(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Generate/BreakPointCommand.php b/src/Command/Generate/BreakPointCommand.php index b2b868505..bb53df8ef 100644 --- a/src/Command/Generate/BreakPointCommand.php +++ b/src/Command/Generate/BreakPointCommand.php @@ -118,7 +118,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $validators = $this->validator; @@ -132,6 +132,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $breakpoints, $machine_name ); + + return 0; } /** diff --git a/src/Command/Generate/CacheContextCommand.php b/src/Command/Generate/CacheContextCommand.php index c9be2e877..474082006 100644 --- a/src/Command/Generate/CacheContextCommand.php +++ b/src/Command/Generate/CacheContextCommand.php @@ -108,7 +108,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $module = $input->getOption('module'); diff --git a/src/Command/Generate/CommandCommand.php b/src/Command/Generate/CommandCommand.php index 24c1e1e4e..fc3a914b9 100644 --- a/src/Command/Generate/CommandCommand.php +++ b/src/Command/Generate/CommandCommand.php @@ -144,7 +144,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io, $yes)) { - return; + return 1; } // @see use Drupal\Console\Command\Shared\ServicesTrait::buildServices diff --git a/src/Command/Generate/ControllerCommand.php b/src/Command/Generate/ControllerCommand.php index 510a25e05..02f09391b 100644 --- a/src/Command/Generate/ControllerCommand.php +++ b/src/Command/Generate/ControllerCommand.php @@ -137,10 +137,9 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io, $yes)) { - return; + return 1; } - $learning = $input->hasOption('learning')?$input->getOption('learning'):false; $module = $input->getOption('module'); $class = $input->getOption('class'); $routes = $input->getOption('routes'); @@ -164,6 +163,8 @@ protected function execute(InputInterface $input, OutputInterface $output) // Run cache rebuild to see changes in Web UI $this->chainQueue->addCommand('router:rebuild', []); + + return 0; } /** diff --git a/src/Command/Generate/EntityBundleCommand.php b/src/Command/Generate/EntityBundleCommand.php index 93668635f..b12ef276e 100644 --- a/src/Command/Generate/EntityBundleCommand.php +++ b/src/Command/Generate/EntityBundleCommand.php @@ -15,7 +15,6 @@ use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ServicesTrait; use Drupal\Console\Core\Command\Shared\CommandTrait; -use Drupal\Console\Generator\ContentTypeGenerator; use Drupal\Console\Generator\EntityBundleGenerator; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; @@ -28,7 +27,6 @@ class EntityBundleCommand extends Command use ServicesTrait; use ConfirmationTrait; - /** * @var Validator */ @@ -93,18 +91,19 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $module = $input->getOption('module'); $bundleName = $input->getOption('bundle-name'); $bundleTitle = $input->getOption('bundle-title'); - $learning = $input->hasOption('learning')?$input->getOption('learning'):false; $generator = $this->generator; //TODO: - //$generator->setLearning($learning); + // $generator->setLearning($learning); $generator->generate($module, $bundleName, $bundleTitle); + + return 0; } /** diff --git a/src/Command/Generate/EventSubscriberCommand.php b/src/Command/Generate/EventSubscriberCommand.php index e91ee3439..556e9bb20 100644 --- a/src/Command/Generate/EventSubscriberCommand.php +++ b/src/Command/Generate/EventSubscriberCommand.php @@ -125,7 +125,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $module = $input->getOption('module'); diff --git a/src/Command/Generate/FormAlterCommand.php b/src/Command/Generate/FormAlterCommand.php index d1ffa1dd6..71c5d8cfd 100644 --- a/src/Command/Generate/FormAlterCommand.php +++ b/src/Command/Generate/FormAlterCommand.php @@ -165,7 +165,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $module = $input->getOption('module'); @@ -193,6 +193,8 @@ protected function execute(InputInterface $input, OutputInterface $output) ->generate($module, $formId, $inputs, $this->metadata); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + return 0; } protected function interact(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Generate/HelpCommand.php b/src/Command/Generate/HelpCommand.php index 28a96e274..678ce7143 100644 --- a/src/Command/Generate/HelpCommand.php +++ b/src/Command/Generate/HelpCommand.php @@ -97,7 +97,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $module = $input->getOption('module'); @@ -118,6 +118,8 @@ protected function execute(InputInterface $input, OutputInterface $output) ->generate($module, $description); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + return 0; } protected function interact(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Generate/ModuleCommand.php b/src/Command/Generate/ModuleCommand.php index 39a6f88c2..0330fb564 100644 --- a/src/Command/Generate/ModuleCommand.php +++ b/src/Command/Generate/ModuleCommand.php @@ -177,7 +177,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io, $yes)) { - return; + return 1; } $module = $this->validator->validateModuleName($input->getOption('module')); @@ -214,6 +214,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $test, $twigTemplate ); + + return 0; } /** @@ -233,7 +235,7 @@ protected function interact(InputInterface $input, OutputInterface $output) } catch (\Exception $error) { $io->error($error->getMessage()); - return; + return 1; } if (!$module) { diff --git a/src/Command/Generate/ModuleFileCommand.php b/src/Command/Generate/ModuleFileCommand.php index 7dcc76d7a..3b08b740d 100644 --- a/src/Command/Generate/ModuleFileCommand.php +++ b/src/Command/Generate/ModuleFileCommand.php @@ -76,7 +76,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io, $yes)) { - return; + return 1; } $machine_name = $input->getOption('module'); diff --git a/src/Command/Generate/PluginCKEditorButtonCommand.php b/src/Command/Generate/PluginCKEditorButtonCommand.php index 8b589aaab..2152dbeac 100644 --- a/src/Command/Generate/PluginCKEditorButtonCommand.php +++ b/src/Command/Generate/PluginCKEditorButtonCommand.php @@ -123,7 +123,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $module = $input->getOption('module'); @@ -138,6 +138,8 @@ protected function execute(InputInterface $input, OutputInterface $output) ->generate($module, $class_name, $label, $plugin_id, $button_name, $button_icon_path); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery'], false); + + return 0; } protected function interact(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Generate/PluginConditionCommand.php b/src/Command/Generate/PluginConditionCommand.php index 4983e3dd6..817dff1c1 100644 --- a/src/Command/Generate/PluginConditionCommand.php +++ b/src/Command/Generate/PluginConditionCommand.php @@ -131,7 +131,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $module = $input->getOption('module'); @@ -147,6 +147,8 @@ protected function execute(InputInterface $input, OutputInterface $output) ->generate($module, $class_name, $label, $plugin_id, $context_definition_id, $context_definition_label, $context_definition_required); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + return 0; } protected function interact(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Generate/PluginFieldCommand.php b/src/Command/Generate/PluginFieldCommand.php index daf391a93..664123899 100644 --- a/src/Command/Generate/PluginFieldCommand.php +++ b/src/Command/Generate/PluginFieldCommand.php @@ -155,7 +155,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $this->chainQueue @@ -196,6 +196,8 @@ protected function execute(InputInterface $input, OutputInterface $output) ); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery'], false); + + return 0; } protected function interact(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Generate/PluginFieldFormatterCommand.php b/src/Command/Generate/PluginFieldFormatterCommand.php index 8258e01ab..e930070ef 100644 --- a/src/Command/Generate/PluginFieldFormatterCommand.php +++ b/src/Command/Generate/PluginFieldFormatterCommand.php @@ -124,7 +124,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $module = $input->getOption('module'); @@ -136,6 +136,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->generator->generate($module, $class_name, $label, $plugin_id, $field_type); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + return 0; } protected function interact(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Generate/PluginFieldTypeCommand.php b/src/Command/Generate/PluginFieldTypeCommand.php index 0e8bcb893..5f33c3d7a 100644 --- a/src/Command/Generate/PluginFieldTypeCommand.php +++ b/src/Command/Generate/PluginFieldTypeCommand.php @@ -128,7 +128,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $module = $input->getOption('module'); @@ -143,6 +143,8 @@ protected function execute(InputInterface $input, OutputInterface $output) ->generate($module, $class_name, $label, $plugin_id, $description, $default_widget, $default_formatter); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery'], false); + + return 0; } protected function interact(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Generate/PluginFieldWidgetCommand.php b/src/Command/Generate/PluginFieldWidgetCommand.php index 8eaea81ba..48618defd 100644 --- a/src/Command/Generate/PluginFieldWidgetCommand.php +++ b/src/Command/Generate/PluginFieldWidgetCommand.php @@ -129,7 +129,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $module = $input->getOption('module'); @@ -141,6 +141,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->generator->generate($module, $class_name, $label, $plugin_id, $field_type); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + return 0; } protected function interact(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Generate/PluginImageEffectCommand.php b/src/Command/Generate/PluginImageEffectCommand.php index efae2443b..1a0fc1ce4 100644 --- a/src/Command/Generate/PluginImageEffectCommand.php +++ b/src/Command/Generate/PluginImageEffectCommand.php @@ -115,7 +115,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $module = $input->getOption('module'); diff --git a/src/Command/Generate/PluginImageFormatterCommand.php b/src/Command/Generate/PluginImageFormatterCommand.php index 333942496..8fb340053 100644 --- a/src/Command/Generate/PluginImageFormatterCommand.php +++ b/src/Command/Generate/PluginImageFormatterCommand.php @@ -113,7 +113,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $module = $input->getOption('module'); diff --git a/src/Command/Generate/PluginRestResourceCommand.php b/src/Command/Generate/PluginRestResourceCommand.php index 410523614..dfc7ce1ee 100644 --- a/src/Command/Generate/PluginRestResourceCommand.php +++ b/src/Command/Generate/PluginRestResourceCommand.php @@ -131,7 +131,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $module = $input->getOption('module'); @@ -144,6 +144,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->generator->generate($module, $class_name, $plugin_label, $plugin_id, $plugin_url, $plugin_states); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + return 0; } protected function interact(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Generate/PluginRulesActionCommand.php b/src/Command/Generate/PluginRulesActionCommand.php index 09f4f96ee..43785e3d5 100644 --- a/src/Command/Generate/PluginRulesActionCommand.php +++ b/src/Command/Generate/PluginRulesActionCommand.php @@ -126,7 +126,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $module = $input->getOption('module'); @@ -140,6 +140,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->generator->generate($module, $class_name, $label, $plugin_id, $category, $context, $type); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + return 0; } protected function interact(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Generate/PluginSkeletonCommand.php b/src/Command/Generate/PluginSkeletonCommand.php index c09432f76..f1fb5ee18 100644 --- a/src/Command/Generate/PluginSkeletonCommand.php +++ b/src/Command/Generate/PluginSkeletonCommand.php @@ -137,7 +137,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $module = $input->getOption('module'); @@ -175,6 +175,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->generator->generate($module, $pluginId, $plugin, $className, $pluginMetaData, $buildServices); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + return 0; } protected function interact(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Generate/PluginViewsFieldCommand.php b/src/Command/Generate/PluginViewsFieldCommand.php index fa65875df..0dab88a7a 100644 --- a/src/Command/Generate/PluginViewsFieldCommand.php +++ b/src/Command/Generate/PluginViewsFieldCommand.php @@ -118,7 +118,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $module = $input->getOption('module'); @@ -130,6 +130,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->generator->generate($module, $class_machine_name, $class_name, $title, $description); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + return 0; } protected function interact(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Generate/PostUpdateCommand.php b/src/Command/Generate/PostUpdateCommand.php index 8ac9a1692..180a70c0d 100644 --- a/src/Command/Generate/PostUpdateCommand.php +++ b/src/Command/Generate/PostUpdateCommand.php @@ -110,7 +110,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $module = $input->getOption('module'); @@ -121,6 +121,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->generator->generate($module, $postUpdateName); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + return 0; } protected function interact(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Generate/ProfileCommand.php b/src/Command/Generate/ProfileCommand.php index 08672c384..5dfbe1509 100644 --- a/src/Command/Generate/ProfileCommand.php +++ b/src/Command/Generate/ProfileCommand.php @@ -137,7 +137,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $io = new DrupalStyle($input, $output); if (!$this->confirmGeneration($io)) { - return; + return 1; } $profile = $this->validator->validateModuleName($input->getOption('profile')); @@ -178,7 +178,7 @@ protected function interact(InputInterface $input, OutputInterface $output) } catch (\Exception $error) { $io->error($error->getMessage()); - return; + return 1; } if (!$profile) { @@ -197,7 +197,7 @@ function ($profile) use ($validators) { } catch (\Exception $error) { $io->error($error->getMessage()); - return; + return 1; } if (!$machine_name) { diff --git a/src/Command/Generate/RouteSubscriberCommand.php b/src/Command/Generate/RouteSubscriberCommand.php index 505b64e94..1085ea469 100644 --- a/src/Command/Generate/RouteSubscriberCommand.php +++ b/src/Command/Generate/RouteSubscriberCommand.php @@ -101,7 +101,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($output)) { - return; + return 1; } $module = $input->getOption('module'); @@ -111,6 +111,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->generator->generate($module, $name, $class); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); + + return 0; } /** diff --git a/src/Command/Generate/ServiceCommand.php b/src/Command/Generate/ServiceCommand.php index 0e46cdfe6..8106f1523 100644 --- a/src/Command/Generate/ServiceCommand.php +++ b/src/Command/Generate/ServiceCommand.php @@ -137,7 +137,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $module = $input->getOption('module'); @@ -164,6 +164,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->generator->generate($module, $name, $class, $interface, $interface_name, $build_services, $path_service); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); + + return 0; } /** diff --git a/src/Command/Generate/ThemeCommand.php b/src/Command/Generate/ThemeCommand.php index f4798b132..d9d2d210b 100644 --- a/src/Command/Generate/ThemeCommand.php +++ b/src/Command/Generate/ThemeCommand.php @@ -176,7 +176,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $theme = $this->validator->validateModuleName($input->getOption('theme')); @@ -204,6 +204,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $regions, $breakpoints ); + + return 0; } /** @@ -218,7 +220,7 @@ protected function interact(InputInterface $input, OutputInterface $output) } catch (\Exception $error) { $io->error($error->getMessage()); - return; + return 1; } if (!$theme) { @@ -238,7 +240,7 @@ function ($theme) use ($validators) { } catch (\Exception $error) { $io->error($error->getMessage()); - return; + return 1; } if (!$machine_name) { diff --git a/src/Command/Generate/TwigExtensionCommand.php b/src/Command/Generate/TwigExtensionCommand.php index 843803d4a..182f408b8 100644 --- a/src/Command/Generate/TwigExtensionCommand.php +++ b/src/Command/Generate/TwigExtensionCommand.php @@ -126,7 +126,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $module = $input->getOption('module'); @@ -136,13 +136,14 @@ protected function execute(InputInterface $input, OutputInterface $output) // Add renderer service as first parameter. array_unshift($services, 'renderer'); - // @see Drupal\Console\Command\Shared\ServicesTrait::buildServices $build_services = $this->buildServices($services); $this->generator->generate($module, $name, $class, $build_services); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); + + return 0; } /** diff --git a/src/Command/Generate/UpdateCommand.php b/src/Command/Generate/UpdateCommand.php index 8e985c518..923970a7e 100644 --- a/src/Command/Generate/UpdateCommand.php +++ b/src/Command/Generate/UpdateCommand.php @@ -102,7 +102,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration if (!$this->confirmGeneration($io)) { - return; + return 1; } $module = $input->getOption('module'); @@ -122,6 +122,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->generator->generate($module, $updateNumber); $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + return 0; } protected function interact(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Locale/TranslationStatusCommand.php b/src/Command/Locale/TranslationStatusCommand.php index 2d92e833d..95ed676fd 100644 --- a/src/Command/Locale/TranslationStatusCommand.php +++ b/src/Command/Locale/TranslationStatusCommand.php @@ -86,11 +86,14 @@ protected function execute(InputInterface $input, OutputInterface $output) if (!$languages) { $io->info($this->trans('commands.locale.translation.status.messages.no-languages')); - return; - } elseif (empty($status)) { + return 1; + } + + if (empty($status)) { $io->info($this->trans('commands.locale.translation.status.messages.no-translations')); - return; + return 1; } + if ($languages) { $projectsStatus = $this->projectsStatus(); @@ -109,5 +112,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $io->table($tableHeader, $tableRows, 'compact'); } } + + return 0; } } diff --git a/src/Command/Migrate/ExecuteCommand.php b/src/Command/Migrate/ExecuteCommand.php index 75bdea7bd..1c4fb2587 100644 --- a/src/Command/Migrate/ExecuteCommand.php +++ b/src/Command/Migrate/ExecuteCommand.php @@ -197,7 +197,7 @@ protected function interact(InputInterface $input, OutputInterface $output) if (!$drupal_version = $this->getLegacyDrupalVersion($this->migrateConnection)) { $io->error($this->trans('commands.migrate.setup.migrations.questions.not-drupal')); - return; + return 1; } $database = $this->getDBInfo(); @@ -287,7 +287,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // If migrations weren't provided finish execution if (empty($migration_ids)) { - return; + return 1; } if (!$this->migrateConnection) { @@ -297,7 +297,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if (!$drupal_version = $this->getLegacyDrupalVersion($this->migrateConnection)) { $io->error($this->trans('commands.migrate.setup.migrations.questions.not-drupal')); - return; + return 1; } $version_tag = 'Drupal ' . $drupal_version; @@ -315,7 +315,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if (count($migrations) == 0) { $io->error($this->trans('commands.migrate.execute.messages.no-migrations')); - return; + return 1; } foreach ($migrations as $migration_id) { @@ -379,7 +379,11 @@ protected function execute(InputInterface $input, OutputInterface $output) } } else { $io->error($this->trans('commands.migrate.execute.messages.fail-load')); + + return 1; } } + + return 0; } } diff --git a/src/Command/Migrate/RollBackCommand.php b/src/Command/Migrate/RollBackCommand.php index 707634d98..91a2fe202 100644 --- a/src/Command/Migrate/RollBackCommand.php +++ b/src/Command/Migrate/RollBackCommand.php @@ -75,7 +75,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $migrations_list = array_keys($this->getMigrations($version_tag)); // If migrations weren't provided finish execution if (empty($migration_id)) { - return; + return 1; } @@ -129,6 +129,8 @@ protected function execute(InputInterface $input, OutputInterface $output) } } } + + return 0; } /** diff --git a/src/Command/Migrate/SetupCommand.php b/src/Command/Migrate/SetupCommand.php index 2949638d3..4430d9387 100644 --- a/src/Command/Migrate/SetupCommand.php +++ b/src/Command/Migrate/SetupCommand.php @@ -183,7 +183,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if (!$drupal_version = $this->getLegacyDrupalVersion($this->migrateConnection)) { $io->error($this->trans('commands.migrate.setup.migrations.questions.not-drupal')); - return; + return 1; } $database = $this->getDBInfo(); @@ -202,5 +202,7 @@ protected function execute(InputInterface $input, OutputInterface $output) ) ); } + + return 0; } } diff --git a/src/Command/Multisite/NewCommand.php b/src/Command/Multisite/NewCommand.php index 4f4189766..cabaa4306 100644 --- a/src/Command/Multisite/NewCommand.php +++ b/src/Command/Multisite/NewCommand.php @@ -183,7 +183,7 @@ protected function copyExistingInstall(DrupalStyle $io) 'sites/default/settings.php' ) ); - return; + return 1; } if ($this->fs->exists($this->appRoot . '/sites/default/files')) { @@ -200,7 +200,7 @@ protected function copyExistingInstall(DrupalStyle $io) 'sites/' . $this->directory . '/files' ) ); - return; + return 1; } } else { $io->warning($this->trans('commands.multisite.new.warnings.missing-files')); @@ -221,7 +221,7 @@ protected function copyExistingInstall(DrupalStyle $io) 'sites/' . $this->directory . '/settings.php' ) ); - return; + return 1; } $this->chmodSettings($io); @@ -255,7 +255,7 @@ protected function createFreshSite(DrupalStyle $io) $this->appRoot . '/sites/' . $this->directory . '/settings.php' ) ); - return; + return 1; } } else { $io->error( @@ -264,7 +264,7 @@ protected function createFreshSite(DrupalStyle $io) 'sites/default/default.settings.php' ) ); - return; + return 1; } $this->chmodSettings($io); @@ -275,6 +275,8 @@ protected function createFreshSite(DrupalStyle $io) $this->directory ) ); + + return 0; } /** @@ -297,6 +299,8 @@ protected function chmodSettings(DrupalStyle $io) $this->appRoot . '/sites/' . $this->directory . '/settings.php' ) ); + + return 1; } } } diff --git a/src/Command/ServerCommand.php b/src/Command/ServerCommand.php index c1161c6fa..e306ceeca 100644 --- a/src/Command/ServerCommand.php +++ b/src/Command/ServerCommand.php @@ -77,7 +77,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $finder = new PhpExecutableFinder(); if (false === $binary = $finder->find()) { $io->error($this->trans('commands.server.errors.binary')); - return; + return 1; } $router = $this->getRouterPath(); @@ -114,7 +114,8 @@ protected function execute(InputInterface $input, OutputInterface $output) /** * @return null|string */ - private function getRouterPath() { + private function getRouterPath() + { $routerPath = [ sprintf( '%s/.console/router.php', diff --git a/src/Command/Site/InstallCommand.php b/src/Command/Site/InstallCommand.php index d1ddeae6b..720fd57d9 100644 --- a/src/Command/Site/InstallCommand.php +++ b/src/Command/Site/InstallCommand.php @@ -447,10 +447,12 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->getApplication()->setContainer($container); } catch (Exception $e) { $io->error($e->getMessage()); - return; + return 1; } $this->restoreSitesFile($io); + + return 0; } /** @@ -461,32 +463,40 @@ protected function execute(InputInterface $input, OutputInterface $output) * appropriate subdir when run from a script and a sites.php file exists. * * @param DrupalStyle $output + * + * @return boolean */ protected function backupSitesFile(DrupalStyle $output) { if (!file_exists($this->appRoot . '/sites/sites.php')) { - return; + return true; } - rename($this->appRoot . '/sites/sites.php', $this->appRoot . '/sites/backup.sites.php'); + $renamed = rename($this->appRoot . '/sites/sites.php', $this->appRoot . '/sites/backup.sites.php'); $output->info($this->trans('commands.site.install.messages.sites-backup')); + + return $renamed; } /** * Restores backup.sites.php to sites.php (if needed). * * @param DrupalStyle $output + * + * @return boolean */ protected function restoreSitesFile(DrupalStyle $output) { if (!file_exists($this->appRoot . '/sites/backup.sites.php')) { - return; + return true; } - rename($this->appRoot . '/sites/backup.sites.php', $this->appRoot . '/sites/sites.php'); + $renamed = rename($this->appRoot . '/sites/backup.sites.php', $this->appRoot . '/sites/sites.php'); $output->info($this->trans('commands.site.install.messages.sites-restore')); + + return $renamed; } protected function runInstaller( @@ -543,10 +553,10 @@ protected function runInstaller( install_drupal($autoload, $settings); } catch (AlreadyInstalledException $e) { $io->error($this->trans('commands.site.install.messages.already-installed')); - return; + return 1; } catch (\Exception $e) { $io->error($e->getMessage()); - return; + return 1; } if (!$this->site->multisiteMode($uri)) { @@ -554,5 +564,7 @@ protected function runInstaller( } $io->success($this->trans('commands.site.install.messages.installed')); + + return 0; } } diff --git a/src/Command/Theme/InstallCommand.php b/src/Command/Theme/InstallCommand.php index 32344ecf4..acb4f8817 100644 --- a/src/Command/Theme/InstallCommand.php +++ b/src/Command/Theme/InstallCommand.php @@ -132,7 +132,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if ($default && count($theme) > 1) { $io->error($this->trans('commands.theme.install.messages.invalid-theme-default')); - return; + return 1; } $themes = $this->themeHandler->rebuildThemeData(); @@ -188,6 +188,8 @@ protected function execute(InputInterface $input, OutputInterface $output) ) ); drupal_set_message($e->getTranslatedMessage($this->getStringTranslation(), $theme), 'error'); + + return 1; } } elseif (empty($themesAvailable) && count($themesInstalled) > 0) { if (count($themesInstalled) > 1) { @@ -225,5 +227,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // Run cache rebuild to see changes in Web UI $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); + + return 0; } } diff --git a/src/Command/Theme/UninstallCommand.php b/src/Command/Theme/UninstallCommand.php index 7561aec24..b15930b54 100644 --- a/src/Command/Theme/UninstallCommand.php +++ b/src/Command/Theme/UninstallCommand.php @@ -146,7 +146,7 @@ protected function execute(InputInterface $input, OutputInterface $output) ) ); - return; + return 1; } if ($themeKey === $config->get('admin')) { @@ -156,7 +156,7 @@ protected function execute(InputInterface $input, OutputInterface $output) implode(',', $themesAvailable) ) ); - return; + return 1; } } @@ -185,6 +185,8 @@ protected function execute(InputInterface $input, OutputInterface $output) ) ); drupal_set_message($e->getTranslatedMessage($this->getStringTranslation(), $theme), 'error'); + + return 1; } } elseif (empty($themesAvailable) && count($themesUninstalled) > 0) { if (count($themesUninstalled) > 1) { @@ -222,5 +224,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // Run cache rebuild to see changes in Web UI $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); + + return 0; } } diff --git a/src/Command/Views/DisableCommand.php b/src/Command/Views/DisableCommand.php index c127f649c..146763ec9 100644 --- a/src/Command/Views/DisableCommand.php +++ b/src/Command/Views/DisableCommand.php @@ -98,7 +98,8 @@ protected function execute(InputInterface $input, OutputInterface $output) if (empty($view)) { $io->error(sprintf($this->trans('commands.views.debug.messages.not-found'), $viewId)); - return; + + return 1; } try { @@ -107,6 +108,10 @@ protected function execute(InputInterface $input, OutputInterface $output) $io->success(sprintf($this->trans('commands.views.disable.messages.disabled-successfully'), $view->get('label'))); } catch (\Exception $e) { $io->error($e->getMessage()); + + return 1; } + + return 0; } } diff --git a/src/Command/Views/EnableCommand.php b/src/Command/Views/EnableCommand.php index 3fe9ed651..898d17eea 100644 --- a/src/Command/Views/EnableCommand.php +++ b/src/Command/Views/EnableCommand.php @@ -103,7 +103,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $viewId ) ); - return; + return 1; } try { @@ -116,6 +116,10 @@ protected function execute(InputInterface $input, OutputInterface $output) ); } catch (Exception $e) { $io->error($e->getMessage()); + + return 1; } + + return 0; } } From fb23cb5c6a13043c26288fc92ac6548ce987379f Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Tue, 2 May 2017 12:15:12 -0700 Subject: [PATCH 213/321] [console] Tag 1.0.0-rc18 release. (#3292) --- composer.json | 2 +- composer.lock | 134 ++++++++++++++++++++++---------------------- src/Application.php | 2 +- 3 files changed, 69 insertions(+), 69 deletions(-) diff --git a/composer.json b/composer.json index 3ba65a60a..cb1e21c88 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ }, "require": { "php": "^5.5.9 || ^7.0", - "drupal/console-core" : "1.0.0-rc17", + "drupal/console-core" : "1.0.0-rc18", "drupal/console-extend-plugin": "~0", "alchemy/zippy": "0.4.3", "doctrine/collections":"~1.3", diff --git a/composer.lock b/composer.lock index 1d94a34dc..211996275 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "ed5d131377961ff433170b44710c4c96", + "content-hash": "ac98e23c33776361ff3d1514bdb20138", "packages": [ { "name": "alchemy/zippy", @@ -571,21 +571,21 @@ }, { "name": "drupal/console-core", - "version": "1.0.0-rc17", + "version": "1.0.0-rc18", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "d0f45db119ca4234976f2485b765c4dcdac50efa" + "reference": "fce93515cef0847cbba81617c74a58c57fc30c9a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/d0f45db119ca4234976f2485b765c4dcdac50efa", - "reference": "d0f45db119ca4234976f2485b765c4dcdac50efa", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/fce93515cef0847cbba81617c74a58c57fc30c9a", + "reference": "fce93515cef0847cbba81617c74a58c57fc30c9a", "shasum": "" }, "require": { "dflydev/dot-access-configuration": "1.0.1", - "drupal/console-en": "1.0.0-rc17", + "drupal/console-en": "1.0.0-rc18", "php": "^5.5.9 || ^7.0", "stecman/symfony-console-completion": "~0.7", "symfony/config": ">=2.7 <3.0", @@ -648,20 +648,20 @@ "drupal", "symfony" ], - "time": "2017-04-23T22:04:36+00:00" + "time": "2017-05-02T19:06:38+00:00" }, { "name": "drupal/console-en", - "version": "1.0.0-rc17", + "version": "1.0.0-rc18", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", - "reference": "117370ecf8e8933adf0350538f9ee2a5804369a7" + "reference": "7617bd20baf9ee20db0fd8bcfefaaa4e9878316d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/117370ecf8e8933adf0350538f9ee2a5804369a7", - "reference": "117370ecf8e8933adf0350538f9ee2a5804369a7", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/7617bd20baf9ee20db0fd8bcfefaaa4e9878316d", + "reference": "7617bd20baf9ee20db0fd8bcfefaaa4e9878316d", "shasum": "" }, "type": "drupal-console-language", @@ -702,20 +702,20 @@ "drupal", "symfony" ], - "time": "2017-04-23T21:55:33+00:00" + "time": "2017-04-29T20:32:05+00:00" }, { "name": "drupal/console-extend-plugin", - "version": "0.4.0", + "version": "0.6.0", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-extend-plugin.git", - "reference": "df2396782960335d18a8e5eb6ab630a37ca5f493" + "reference": "4e7f57650eefc53eb02c89360bbc1f675c901a73" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-extend-plugin/zipball/df2396782960335d18a8e5eb6ab630a37ca5f493", - "reference": "df2396782960335d18a8e5eb6ab630a37ca5f493", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-extend-plugin/zipball/4e7f57650eefc53eb02c89360bbc1f675c901a73", + "reference": "4e7f57650eefc53eb02c89360bbc1f675c901a73", "shasum": "" }, "require": { @@ -743,7 +743,7 @@ } ], "description": "Drupal Console Extend Plugin", - "time": "2017-02-14T08:38:49+00:00" + "time": "2017-05-02T14:17:00+00:00" }, { "name": "gabordemooij/redbean", @@ -1354,16 +1354,16 @@ }, { "name": "symfony/config", - "version": "v2.8.19", + "version": "v2.8.20", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "35b7dfa089d7605eb1fdd46281b3070fb9f38750" + "reference": "0b8541d18507d10204a08384640ff6df3c739ebe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/35b7dfa089d7605eb1fdd46281b3070fb9f38750", - "reference": "35b7dfa089d7605eb1fdd46281b3070fb9f38750", + "url": "https://api.github.com/repos/symfony/config/zipball/0b8541d18507d10204a08384640ff6df3c739ebe", + "reference": "0b8541d18507d10204a08384640ff6df3c739ebe", "shasum": "" }, "require": { @@ -1406,20 +1406,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2017-04-04T15:24:26+00:00" + "time": "2017-04-12T14:07:15+00:00" }, { "name": "symfony/console", - "version": "v2.8.19", + "version": "v2.8.20", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "86407ff20855a5eaa2a7219bd815e9c40a88633e" + "reference": "2cfcbced8e39e2313ed4da8896fc8c59a56c0d7e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/86407ff20855a5eaa2a7219bd815e9c40a88633e", - "reference": "86407ff20855a5eaa2a7219bd815e9c40a88633e", + "url": "https://api.github.com/repos/symfony/console/zipball/2cfcbced8e39e2313ed4da8896fc8c59a56c0d7e", + "reference": "2cfcbced8e39e2313ed4da8896fc8c59a56c0d7e", "shasum": "" }, "require": { @@ -1467,7 +1467,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-04-03T20:37:06+00:00" + "time": "2017-04-26T01:38:53+00:00" }, { "name": "symfony/css-selector", @@ -1524,16 +1524,16 @@ }, { "name": "symfony/debug", - "version": "v2.8.19", + "version": "v2.8.20", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "e90099a2958d4833a02d05b504cc06e1c234abcc" + "reference": "344f50ce827413b3640bfcb1e37386a67d06ea1f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/e90099a2958d4833a02d05b504cc06e1c234abcc", - "reference": "e90099a2958d4833a02d05b504cc06e1c234abcc", + "url": "https://api.github.com/repos/symfony/debug/zipball/344f50ce827413b3640bfcb1e37386a67d06ea1f", + "reference": "344f50ce827413b3640bfcb1e37386a67d06ea1f", "shasum": "" }, "require": { @@ -1577,20 +1577,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2017-02-18T19:13:35+00:00" + "time": "2017-04-19T19:56:30+00:00" }, { "name": "symfony/dependency-injection", - "version": "v2.8.19", + "version": "v2.8.20", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "14b9d8ae69ac4c74e8f05fee7e0a57039b99c81e" + "reference": "e1c722dfe4dd04453aeb6b7a6deefb400c878394" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/14b9d8ae69ac4c74e8f05fee7e0a57039b99c81e", - "reference": "14b9d8ae69ac4c74e8f05fee7e0a57039b99c81e", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/e1c722dfe4dd04453aeb6b7a6deefb400c878394", + "reference": "e1c722dfe4dd04453aeb6b7a6deefb400c878394", "shasum": "" }, "require": { @@ -1640,7 +1640,7 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2017-04-03T22:14:48+00:00" + "time": "2017-04-26T01:38:53+00:00" }, { "name": "symfony/dom-crawler", @@ -1700,16 +1700,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v2.8.19", + "version": "v2.8.20", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "88b65f0ac25355090e524aba4ceb066025df8bd2" + "reference": "7fc8e2b4118ff316550596357325dfd92a51f531" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/88b65f0ac25355090e524aba4ceb066025df8bd2", - "reference": "88b65f0ac25355090e524aba4ceb066025df8bd2", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7fc8e2b4118ff316550596357325dfd92a51f531", + "reference": "7fc8e2b4118ff316550596357325dfd92a51f531", "shasum": "" }, "require": { @@ -1756,7 +1756,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-04-03T20:37:06+00:00" + "time": "2017-04-26T16:56:54+00:00" }, { "name": "symfony/expression-language", @@ -1809,16 +1809,16 @@ }, { "name": "symfony/filesystem", - "version": "v2.8.19", + "version": "v2.8.20", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "31ab6827a696244094e6e20d77e7d404f8eb4252" + "reference": "dc40154e26a0116995e4f2f0c71cb9c2fe0775a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/31ab6827a696244094e6e20d77e7d404f8eb4252", - "reference": "31ab6827a696244094e6e20d77e7d404f8eb4252", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/dc40154e26a0116995e4f2f0c71cb9c2fe0775a3", + "reference": "dc40154e26a0116995e4f2f0c71cb9c2fe0775a3", "shasum": "" }, "require": { @@ -1854,20 +1854,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2017-03-26T15:40:40+00:00" + "time": "2017-04-12T14:07:15+00:00" }, { "name": "symfony/finder", - "version": "v2.8.19", + "version": "v2.8.20", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "7131327eb95d86d72039fd1216226c28f36fd02a" + "reference": "16d55394b31547e4a8494551b85c9b9915545347" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/7131327eb95d86d72039fd1216226c28f36fd02a", - "reference": "7131327eb95d86d72039fd1216226c28f36fd02a", + "url": "https://api.github.com/repos/symfony/finder/zipball/16d55394b31547e4a8494551b85c9b9915545347", + "reference": "16d55394b31547e4a8494551b85c9b9915545347", "shasum": "" }, "require": { @@ -1903,7 +1903,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-03-20T08:46:40+00:00" + "time": "2017-04-12T14:07:15+00:00" }, { "name": "symfony/http-foundation", @@ -2135,16 +2135,16 @@ }, { "name": "symfony/process", - "version": "v2.8.19", + "version": "v2.8.20", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "41336b20b52f5fd5b42a227e394e673c8071118f" + "reference": "aff35fb3dee799c84a7313c576b72208b046ef8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/41336b20b52f5fd5b42a227e394e673c8071118f", - "reference": "41336b20b52f5fd5b42a227e394e673c8071118f", + "url": "https://api.github.com/repos/symfony/process/zipball/aff35fb3dee799c84a7313c576b72208b046ef8d", + "reference": "aff35fb3dee799c84a7313c576b72208b046ef8d", "shasum": "" }, "require": { @@ -2180,20 +2180,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-03-04T12:20:59+00:00" + "time": "2017-04-12T14:07:15+00:00" }, { "name": "symfony/translation", - "version": "v2.8.19", + "version": "v2.8.20", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "047e97a64d609778cadfc76e3a09793696bb19f1" + "reference": "32b7c0bffc07772cf1a902e3464ef77117fa07c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/047e97a64d609778cadfc76e3a09793696bb19f1", - "reference": "047e97a64d609778cadfc76e3a09793696bb19f1", + "url": "https://api.github.com/repos/symfony/translation/zipball/32b7c0bffc07772cf1a902e3464ef77117fa07c7", + "reference": "32b7c0bffc07772cf1a902e3464ef77117fa07c7", "shasum": "" }, "require": { @@ -2244,7 +2244,7 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2017-03-21T21:39:01+00:00" + "time": "2017-04-12T14:07:15+00:00" }, { "name": "symfony/var-dumper", @@ -2311,16 +2311,16 @@ }, { "name": "symfony/yaml", - "version": "v2.8.19", + "version": "v2.8.20", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "286d84891690b0e2515874717e49360d1c98a703" + "reference": "93ccdde79f4b079c7558da4656a3cb1c50c68e02" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/286d84891690b0e2515874717e49360d1c98a703", - "reference": "286d84891690b0e2515874717e49360d1c98a703", + "url": "https://api.github.com/repos/symfony/yaml/zipball/93ccdde79f4b079c7558da4656a3cb1c50c68e02", + "reference": "93ccdde79f4b079c7558da4656a3cb1c50c68e02", "shasum": "" }, "require": { @@ -2356,7 +2356,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-03-20T09:41:44+00:00" + "time": "2017-05-01T14:31:55+00:00" }, { "name": "twig/twig", diff --git a/src/Application.php b/src/Application.php index ec22efbeb..8bf741c7c 100644 --- a/src/Application.php +++ b/src/Application.php @@ -25,7 +25,7 @@ class Application extends BaseApplication /** * @var string */ - const VERSION = '1.0.0-rc17'; + const VERSION = '1.0.0-rc18'; public function __construct(ContainerInterface $container) { From ee8fb83fb9ae93a4cc6a716bd59152475d847c71 Mon Sep 17 00:00:00 2001 From: Niels van Aken Date: Fri, 5 May 2017 07:42:54 +0200 Subject: [PATCH 214/321] Print launcher version, addresses hechoendrupal/drupal-console#3164 (#3295) --- bin/drupal.php | 5 ++++- src/Application.php | 45 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/bin/drupal.php b/bin/drupal.php index 9bbba07bc..99b3314d7 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -63,6 +63,9 @@ exit(1); } -$application = new Application($container); +if (!isset($launcherVersion)) + $launcherVersion = FALSE; + +$application = new Application($container, $launcherVersion); $application->setDefaultCommand('about'); $application->run(); diff --git a/src/Application.php b/src/Application.php index 8bf741c7c..4bf664a6a 100644 --- a/src/Application.php +++ b/src/Application.php @@ -27,11 +27,54 @@ class Application extends BaseApplication */ const VERSION = '1.0.0-rc18'; - public function __construct(ContainerInterface $container) + /** + * @var string + */ + private $launcherVersion; + + public function __construct(ContainerInterface $container, $launcherVersion = FALSE) { + $this->setLauncherVersion($launcherVersion); parent::__construct($container, $this::NAME, $this::VERSION); } + /** + * Returns the long version of the application. + * + * @return string The long application version + */ + public function getLongVersion() + { + $output = ''; + + if ($this->launcherVersion) { + $output .= sprintf('%s version %s', $this->getName() . ' Launcher', $this->getLauncherVersion()); + $output .= PHP_EOL; + } + + if ('UNKNOWN' !== $this->getName()) { + if ('UNKNOWN' !== $this->getVersion()) { + $output .= sprintf('%s version %s', $this->getName(), $this->getVersion()); + } + else { + $output .= sprintf('%s', $this->getName()); + } + } + else { + $output .= 'Console Tool'; + } + + return $output; + } + + public function setLauncherVersion ($launcherVersion) { + $this->launcherVersion = $launcherVersion; + } + + public function getLauncherVersion ($launcherVersion) { + return $this->launcherVersion; + } + /** * {@inheritdoc} */ From 7f3bb6023955cea225cee77d35898ce6926100d2 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Fri, 5 May 2017 17:39:03 -0700 Subject: [PATCH 215/321] [console] Refactor show version. (#3296) --- src/Application.php | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/src/Application.php b/src/Application.php index 4bf664a6a..250844f0f 100644 --- a/src/Application.php +++ b/src/Application.php @@ -27,14 +27,8 @@ class Application extends BaseApplication */ const VERSION = '1.0.0-rc18'; - /** - * @var string - */ - private $launcherVersion; - - public function __construct(ContainerInterface $container, $launcherVersion = FALSE) + public function __construct(ContainerInterface $container) { - $this->setLauncherVersion($launcherVersion); parent::__construct($container, $this::NAME, $this::VERSION); } @@ -47,11 +41,6 @@ public function getLongVersion() { $output = ''; - if ($this->launcherVersion) { - $output .= sprintf('%s version %s', $this->getName() . ' Launcher', $this->getLauncherVersion()); - $output .= PHP_EOL; - } - if ('UNKNOWN' !== $this->getName()) { if ('UNKNOWN' !== $this->getVersion()) { $output .= sprintf('%s version %s', $this->getName(), $this->getVersion()); @@ -67,14 +56,6 @@ public function getLongVersion() return $output; } - public function setLauncherVersion ($launcherVersion) { - $this->launcherVersion = $launcherVersion; - } - - public function getLauncherVersion ($launcherVersion) { - return $this->launcherVersion; - } - /** * {@inheritdoc} */ From 18db499b822ffb01ec80f18d0a87ae317ba90cf3 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sat, 6 May 2017 19:54:32 -0700 Subject: [PATCH 216/321] [event:debug] Display event subscriber priority, Fix #3297. (#3298) --- src/Command/EventDebugCommand.php | 44 ++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/src/Command/EventDebugCommand.php b/src/Command/EventDebugCommand.php index 38c05a43e..71107fe4b 100644 --- a/src/Command/EventDebugCommand.php +++ b/src/Command/EventDebugCommand.php @@ -11,6 +11,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Yaml\Yaml; use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; @@ -78,20 +79,55 @@ protected function execute(InputInterface $input, OutputInterface $output) foreach ($dispatcher as $key => $value) { $reflection = new \ReflectionClass(get_class($value[0])); - $listeners[] = [$reflection->getName(), $value[1]]; + $className = $reflection->getName(); + + if (!$reflection->hasMethod('getSubscribedEvents')) { + $reflection = new \ReflectionClass($reflection->getParentClass()); + } + + $eventObject = $reflection->newInstanceWithoutConstructor(); + $reflectionMethod = new \ReflectionMethod( + $reflection->getName(), + 'getSubscribedEvents' + ); + + $subscribedEvents = $reflectionMethod->invoke( + $eventObject + ); + + if (!is_array($subscribedEvents[$event])) { + $subscribedEvents[$event] = [$subscribedEvents[$event]]; + } + + $subscribedEventData = []; + foreach ($subscribedEvents[$event] as $subscribedEvent) { + if (!is_array($subscribedEvent)) { + $subscribedEvent = [$subscribedEvent, 0]; + } + if ($subscribedEvent[0] == $value[1]) { + $subscribedEventData = [ + $subscribedEvent[0] => isset($subscribedEvent[1])?$subscribedEvent[1]:0 + ]; + } + } + + $listeners[] = [ + 'class' => $className, + 'method' => $value[1], + 'events' => Yaml::dump($subscribedEventData, 4, 2) + ]; } $tableHeader = [ $this->trans('commands.event.debug.messages.class'), $this->trans('commands.event.debug.messages.method'), - ]; $tableRows = []; foreach ($listeners as $key => $element) { $tableRows[] = [ - 'class' => $element['0'], - 'method' => $element['1'] + 'class' => $element['class'], + 'events' => $element['events'] ]; } From 0c2385143da3384869973721b0bdbaa3a0946028 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 8 May 2017 09:25:08 -0700 Subject: [PATCH 217/321] [console] Tag 1.0.0-rc19 release. (#3299) --- composer.json | 2 +- composer.lock | 35 +++++++++++++++++------------------ src/Application.php | 2 +- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/composer.json b/composer.json index cb1e21c88..4629b40df 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ }, "require": { "php": "^5.5.9 || ^7.0", - "drupal/console-core" : "1.0.0-rc18", + "drupal/console-core" : "1.0.0-rc19", "drupal/console-extend-plugin": "~0", "alchemy/zippy": "0.4.3", "doctrine/collections":"~1.3", diff --git a/composer.lock b/composer.lock index 211996275..dae62adb0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "ac98e23c33776361ff3d1514bdb20138", + "content-hash": "84fad6a02d63cf1ce4d8a128b65c610a", "packages": [ { "name": "alchemy/zippy", @@ -571,21 +571,21 @@ }, { "name": "drupal/console-core", - "version": "1.0.0-rc18", + "version": "1.0.0-rc19", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "fce93515cef0847cbba81617c74a58c57fc30c9a" + "reference": "c5be69f660727b38ce6c904dcb0e061e03de7aeb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/fce93515cef0847cbba81617c74a58c57fc30c9a", - "reference": "fce93515cef0847cbba81617c74a58c57fc30c9a", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/c5be69f660727b38ce6c904dcb0e061e03de7aeb", + "reference": "c5be69f660727b38ce6c904dcb0e061e03de7aeb", "shasum": "" }, "require": { "dflydev/dot-access-configuration": "1.0.1", - "drupal/console-en": "1.0.0-rc18", + "drupal/console-en": "1.0.0-rc19", "php": "^5.5.9 || ^7.0", "stecman/symfony-console-completion": "~0.7", "symfony/config": ">=2.7 <3.0", @@ -604,7 +604,6 @@ "type": "project", "autoload": { "files": [ - "src/constants.php", "src/functions.php" ], "psr-4": { @@ -648,20 +647,20 @@ "drupal", "symfony" ], - "time": "2017-05-02T19:06:38+00:00" + "time": "2017-05-08T16:08:29+00:00" }, { "name": "drupal/console-en", - "version": "1.0.0-rc18", + "version": "1.0.0-rc19", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", - "reference": "7617bd20baf9ee20db0fd8bcfefaaa4e9878316d" + "reference": "df4da4011500496fc9c1d611cd36343006079915" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/7617bd20baf9ee20db0fd8bcfefaaa4e9878316d", - "reference": "7617bd20baf9ee20db0fd8bcfefaaa4e9878316d", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/df4da4011500496fc9c1d611cd36343006079915", + "reference": "df4da4011500496fc9c1d611cd36343006079915", "shasum": "" }, "type": "drupal-console-language", @@ -702,7 +701,7 @@ "drupal", "symfony" ], - "time": "2017-04-29T20:32:05+00:00" + "time": "2017-05-05T21:51:49+00:00" }, { "name": "drupal/console-extend-plugin", @@ -2422,16 +2421,16 @@ }, { "name": "webflo/drupal-finder", - "version": "0.2.1", + "version": "0.3.0", "source": { "type": "git", "url": "https://github.com/webflo/drupal-finder.git", - "reference": "4bd98f7e7b1d30e284e55f51d5d0c8712f676348" + "reference": "6ef150707aad1755d91f9b0d2108bcc16661e76b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webflo/drupal-finder/zipball/4bd98f7e7b1d30e284e55f51d5d0c8712f676348", - "reference": "4bd98f7e7b1d30e284e55f51d5d0c8712f676348", + "url": "https://api.github.com/repos/webflo/drupal-finder/zipball/6ef150707aad1755d91f9b0d2108bcc16661e76b", + "reference": "6ef150707aad1755d91f9b0d2108bcc16661e76b", "shasum": "" }, "require-dev": { @@ -2455,7 +2454,7 @@ } ], "description": "Helper class to locate a Drupal installation from a given path.", - "time": "2016-11-28T18:50:45+00:00" + "time": "2017-05-04T08:54:02+00:00" } ], "packages-dev": [], diff --git a/src/Application.php b/src/Application.php index 250844f0f..735f27653 100644 --- a/src/Application.php +++ b/src/Application.php @@ -25,7 +25,7 @@ class Application extends BaseApplication /** * @var string */ - const VERSION = '1.0.0-rc18'; + const VERSION = '1.0.0-rc19'; public function __construct(ContainerInterface $container) { From 98ad4c0362146689f3d4f895394ef35a4f95443d Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 8 May 2017 09:49:07 -0700 Subject: [PATCH 218/321] [console] Fix, use eextended DrupalFinder class. (#3300) --- bin/drupal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/drupal.php b/bin/drupal.php index 99b3314d7..84456f5e1 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -1,6 +1,6 @@ Date: Sat, 13 May 2017 18:50:58 +0200 Subject: [PATCH 219/321] Fixes issue hechoendrupal/drupal#3305, adding missing extension_manager (#3306) --- config/services/drupal-console/config.yml | 2 +- src/Command/Config/ExportSingleCommand.php | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/services/drupal-console/config.yml b/config/services/drupal-console/config.yml index 4fa350077..1bd38a653 100644 --- a/config/services/drupal-console/config.yml +++ b/config/services/drupal-console/config.yml @@ -31,7 +31,7 @@ services: - { name: drupal.command } console.config_export_single: class: Drupal\Console\Command\Config\ExportSingleCommand - arguments: ['@entity_type.manager', '@config.storage'] + arguments: ['@entity_type.manager', '@config.storage', '@console.extension_manager'] tags: - { name: drupal.command } console.config_export_view: diff --git a/src/Command/Config/ExportSingleCommand.php b/src/Command/Config/ExportSingleCommand.php index 9e5284de4..4e632eee8 100644 --- a/src/Command/Config/ExportSingleCommand.php +++ b/src/Command/Config/ExportSingleCommand.php @@ -18,6 +18,7 @@ use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Command\Shared\ExportTrait; +use Drupal\Console\Extension\Manager; class ExportSingleCommand extends Command { @@ -46,13 +47,16 @@ class ExportSingleCommand extends Command * * @param EntityTypeManagerInterface $entityTypeManager * @param CachedStorage $configStorage + * @param Manager $extensionManager */ public function __construct( EntityTypeManagerInterface $entityTypeManager, - CachedStorage $configStorage + CachedStorage $configStorage, + Manager $extensionManager ) { $this->entityTypeManager = $entityTypeManager; $this->configStorage = $configStorage; + $this->extensionManager = $extensionManager; parent::__construct(); } From 390763e6c431d66eae80c1036ea049d3ab5333ca Mon Sep 17 00:00:00 2001 From: Miguel Date: Fri, 26 May 2017 02:25:03 -0600 Subject: [PATCH 220/321] Add option to generate libraries for generate:theme command. (#3309) --- src/Command/Generate/ThemeCommand.php | 23 +++++++++++++++ src/Command/Shared/ThemeRegionTrait.php | 39 +++++++++++++++++++++++++ src/Generator/ThemeGenerator.php | 10 +++++++ templates/theme/info.yml.twig | 6 +++- templates/theme/libraries.yml.twig | 16 ++++++++++ 5 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 templates/theme/libraries.yml.twig diff --git a/src/Command/Generate/ThemeCommand.php b/src/Command/Generate/ThemeCommand.php index d9d2d210b..fc014a7c2 100644 --- a/src/Command/Generate/ThemeCommand.php +++ b/src/Command/Generate/ThemeCommand.php @@ -146,6 +146,12 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.theme.options.global-library') + ) + ->addOption( + 'libraries', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.theme.options.libraries') ) ->addOption( 'base-theme', @@ -189,6 +195,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $package = $input->getOption('package'); $base_theme = $input->getOption('base-theme'); $global_library = $input->getOption('global-library'); + $libraries = $input->getOption('libraries'); $regions = $input->getOption('regions'); $breakpoints = $input->getOption('breakpoints'); @@ -201,6 +208,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $package, $base_theme, $global_library, + $libraries, $regions, $breakpoints ); @@ -328,6 +336,21 @@ function ($theme_path) use ($drupalRoot, $machine_name) { $input->setOption('global-library', $global_library); } + + // --libraries option. + $libraries = $input->getOption('libraries'); + if (!$libraries) { + if ($io->confirm( + $this->trans('commands.generate.theme.questions.library-add'), + true + ) + ) { + // @see \Drupal\Console\Command\Shared\ThemeRegionTrait::libraryQuestion + $libraries = $this->libraryQuestion($io); + $input->setOption('libraries', $libraries); + } + } + // --regions option. $regions = $input->getOption('regions'); if (!$regions) { diff --git a/src/Command/Shared/ThemeRegionTrait.php b/src/Command/Shared/ThemeRegionTrait.php index cf0e2480e..c4bb8ac97 100644 --- a/src/Command/Shared/ThemeRegionTrait.php +++ b/src/Command/Shared/ThemeRegionTrait.php @@ -54,4 +54,43 @@ function ($regionMachineName) use ($validators) { return $regions; } + + /** + * @param DrupalStyle $io + * + * @return mixed + */ + public function libraryQuestion(DrupalStyle $io) + { + $validators = $this->validator; + $libraries = []; + while (true) { + $libraryName = $io->ask( + $this->trans('commands.generate.theme.questions.library-name') + ); + + $libraryVersion = $io->ask( + $this->trans('commands.generate.theme.questions.library-version'), + '1.0' + ); + + array_push( + $libraries, + [ + 'library_name' => $libraryName, + 'library_version'=> $libraryVersion, + ] + ); + + if (!$io->confirm( + $this->trans('commands.generate.theme.questions.library-add'), + true + ) + ) { + break; + } + } + + return $libraries; + } } diff --git a/src/Generator/ThemeGenerator.php b/src/Generator/ThemeGenerator.php index e9f15173c..78342bf98 100644 --- a/src/Generator/ThemeGenerator.php +++ b/src/Generator/ThemeGenerator.php @@ -40,6 +40,7 @@ public function generate( $package, $base_theme, $global_library, + $libraries, $regions, $breakpoints ) { @@ -81,6 +82,7 @@ public function generate( 'package' => $package, 'base_theme' => $base_theme, 'global_library' => $global_library, + 'libraries' => $libraries, 'regions' => $regions, 'breakpoints' => $breakpoints, ]; @@ -97,6 +99,14 @@ public function generate( $parameters ); + if ($libraries) { + $this->renderFile( + 'theme/libraries.yml.twig', + $dir . '/' . $machine_name . '.libraries.yml', + $parameters + ); + } + if ($breakpoints) { $this->renderFile( 'theme/breakpoints.yml.twig', diff --git a/templates/theme/info.yml.twig b/templates/theme/info.yml.twig index e711e06cf..f68e9fb7e 100644 --- a/templates/theme/info.yml.twig +++ b/templates/theme/info.yml.twig @@ -5,7 +5,11 @@ package: {{ package }} core: {{ core }} libraries: - {{ machine_name }}/{{ global_library }} - +{% if libraries %} +{% for library in libraries %} + - {{ machine_name }}/{{ library.library_name }} +{% endfor %} +{% endif %} base theme: {{ base_theme }} {% if base_theme == 'classy' %} #Using Classy as a base theme https://www.drupal.org/theme-guide/8/classy diff --git a/templates/theme/libraries.yml.twig b/templates/theme/libraries.yml.twig new file mode 100644 index 000000000..8d2379ea6 --- /dev/null +++ b/templates/theme/libraries.yml.twig @@ -0,0 +1,16 @@ +{{ global_library }}: + version: 1.0 + css: + theme: + #css/your_style_sheet.css : {} + js: + #js/your_js.js : {} +{% for library in libraries %} +{{ library.library_name }}: + version: {{ library.library_version }} + css: + theme: + #js/your_js.js : {} + js: + #js/your_js.js : {} +{% endfor %} \ No newline at end of file From 2d8eff2d951f1b822ef3a989285ec684dc9a53a3 Mon Sep 17 00:00:00 2001 From: Miguel Date: Fri, 26 May 2017 02:25:33 -0600 Subject: [PATCH 221/321] Minor update for creates:nodes command. (#3310) --- src/Command/Create/NodesCommand.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Command/Create/NodesCommand.php b/src/Command/Create/NodesCommand.php index 8fba86359..91fa883d0 100644 --- a/src/Command/Create/NodesCommand.php +++ b/src/Command/Create/NodesCommand.php @@ -211,6 +211,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $timeRange, $language ); + + $nodes = is_array($nodes) ? $nodes : [$nodes]; $tableHeader = [ $this->trans('commands.create.nodes.messages.node-id'), From 2499a1c004165b8929831c375f974629cb0c74dd Mon Sep 17 00:00:00 2001 From: Jon Hall Date: Fri, 26 May 2017 09:26:16 +0100 Subject: [PATCH 222/321] Add 'view_builder' to config entity annotation template (#3311) [generate:entity:content] Add 'view_builder' to config entity annotation template. Fix #3129. --- templates/module/src/Entity/entity.php.twig | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/module/src/Entity/entity.php.twig b/templates/module/src/Entity/entity.php.twig index 07d85f294..03efd8791 100644 --- a/templates/module/src/Entity/entity.php.twig +++ b/templates/module/src/Entity/entity.php.twig @@ -24,6 +24,7 @@ use Drupal\Core\Config\Entity\ConfigEntityBase; * id = "{{ entity_name }}", * label = @Translation("{{ label }}"), * handlers = { + * "view_builder" = "Drupal\Core\Entity\EntityViewBuilder", * "list_builder" = "Drupal\{{ module }}\{{ entity_class }}ListBuilder", * "form" = { * "add" = "Drupal\{{ module }}\Form\{{ entity_class }}Form", From 19467150d4b5393463bfaec6cbf5cc66c6a0f26a Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Fri, 26 May 2017 10:26:41 +0200 Subject: [PATCH 223/321] NodesCommand depends on the node module. Fixes #3318 (#3319) --- src/Command/Create/NodesCommand.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Command/Create/NodesCommand.php b/src/Command/Create/NodesCommand.php index 91fa883d0..36f3d98a4 100644 --- a/src/Command/Create/NodesCommand.php +++ b/src/Command/Create/NodesCommand.php @@ -12,6 +12,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; +use Drupal\Console\Annotations\DrupalCommand; use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Command\Shared\CreateTrait; use Drupal\Console\Utils\Create\NodeData; @@ -23,6 +24,11 @@ * Class NodesCommand * * @package Drupal\Console\Command\Generate + * + * @DrupalCommand( + * extension = "node", + * extensionType = "module" + * ) */ class NodesCommand extends Command { From 558ae5209232c7a5d236c5fab77f20703cb0b048 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Fri, 26 May 2017 01:49:45 -0700 Subject: [PATCH 224/321] [console] Tag 1.0.0-rc20 release. (#3322) --- composer.json | 2 +- composer.lock | 26 +++++++++++++------------- src/Application.php | 12 +++++------- src/Command/Generate/ThemeCommand.php | 4 ++-- 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/composer.json b/composer.json index 4629b40df..10fbb4693 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ }, "require": { "php": "^5.5.9 || ^7.0", - "drupal/console-core" : "1.0.0-rc19", + "drupal/console-core" : "1.0.0-rc20", "drupal/console-extend-plugin": "~0", "alchemy/zippy": "0.4.3", "doctrine/collections":"~1.3", diff --git a/composer.lock b/composer.lock index dae62adb0..407722d21 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "84fad6a02d63cf1ce4d8a128b65c610a", + "content-hash": "1718b3e16b129d9d4ef34551230d2d1e", "packages": [ { "name": "alchemy/zippy", @@ -571,21 +571,21 @@ }, { "name": "drupal/console-core", - "version": "1.0.0-rc19", + "version": "1.0.0-rc20", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "c5be69f660727b38ce6c904dcb0e061e03de7aeb" + "reference": "4b93841301a88db2ae210186e74e0e2529369c17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/c5be69f660727b38ce6c904dcb0e061e03de7aeb", - "reference": "c5be69f660727b38ce6c904dcb0e061e03de7aeb", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/4b93841301a88db2ae210186e74e0e2529369c17", + "reference": "4b93841301a88db2ae210186e74e0e2529369c17", "shasum": "" }, "require": { "dflydev/dot-access-configuration": "1.0.1", - "drupal/console-en": "1.0.0-rc19", + "drupal/console-en": "1.0.0-rc20", "php": "^5.5.9 || ^7.0", "stecman/symfony-console-completion": "~0.7", "symfony/config": ">=2.7 <3.0", @@ -599,7 +599,7 @@ "symfony/translation": ">=2.7 <3.0", "symfony/yaml": ">=2.7 <3.0", "twig/twig": "^1.23.1", - "webflo/drupal-finder": "0.*" + "webflo/drupal-finder": "^0.3.0" }, "type": "project", "autoload": { @@ -647,20 +647,20 @@ "drupal", "symfony" ], - "time": "2017-05-08T16:08:29+00:00" + "time": "2017-05-26T08:40:17+00:00" }, { "name": "drupal/console-en", - "version": "1.0.0-rc19", + "version": "1.0.0-rc20", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", - "reference": "df4da4011500496fc9c1d611cd36343006079915" + "reference": "b6f563b8760c3b19aad22dd213a9cfba2f2c75d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/df4da4011500496fc9c1d611cd36343006079915", - "reference": "df4da4011500496fc9c1d611cd36343006079915", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/b6f563b8760c3b19aad22dd213a9cfba2f2c75d0", + "reference": "b6f563b8760c3b19aad22dd213a9cfba2f2c75d0", "shasum": "" }, "type": "drupal-console-language", @@ -701,7 +701,7 @@ "drupal", "symfony" ], - "time": "2017-05-05T21:51:49+00:00" + "time": "2017-05-20T23:29:05+00:00" }, { "name": "drupal/console-extend-plugin", diff --git a/src/Application.php b/src/Application.php index 735f27653..4cc228460 100644 --- a/src/Application.php +++ b/src/Application.php @@ -25,7 +25,7 @@ class Application extends BaseApplication /** * @var string */ - const VERSION = '1.0.0-rc19'; + const VERSION = '1.0.0-rc20'; public function __construct(ContainerInterface $container) { @@ -44,13 +44,11 @@ public function getLongVersion() if ('UNKNOWN' !== $this->getName()) { if ('UNKNOWN' !== $this->getVersion()) { $output .= sprintf('%s version %s', $this->getName(), $this->getVersion()); + } else { + $output .= sprintf('%s', $this->getName()); } - else { - $output .= sprintf('%s', $this->getName()); - } - } - else { - $output .= 'Console Tool'; + } else { + $output .= 'Console Tool'; } return $output; diff --git a/src/Command/Generate/ThemeCommand.php b/src/Command/Generate/ThemeCommand.php index fc014a7c2..4ec9a7509 100644 --- a/src/Command/Generate/ThemeCommand.php +++ b/src/Command/Generate/ThemeCommand.php @@ -147,7 +147,7 @@ protected function configure() InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.theme.options.global-library') ) - ->addOption( + ->addOption( 'libraries', null, InputOption::VALUE_OPTIONAL, @@ -195,7 +195,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $package = $input->getOption('package'); $base_theme = $input->getOption('base-theme'); $global_library = $input->getOption('global-library'); - $libraries = $input->getOption('libraries'); + $libraries = $input->getOption('libraries'); $regions = $input->getOption('regions'); $breakpoints = $input->getOption('breakpoints'); From 78ae027227bd2632d1421ab0eeb9d3db3d31eafb Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Fri, 26 May 2017 16:50:58 -0700 Subject: [PATCH 225/321] [site:mode] Rollback command. (#3323) --- config/services/drupal-console/site.yml | 10 +- src/Command/Site/ModeCommand.php | 173 ++++-------------------- 2 files changed, 29 insertions(+), 154 deletions(-) diff --git a/config/services/drupal-console/site.yml b/config/services/drupal-console/site.yml index fa790d922..17ad4e7a6 100644 --- a/config/services/drupal-console/site.yml +++ b/config/services/drupal-console/site.yml @@ -9,11 +9,11 @@ services: arguments: ['@state', '@console.chain_queue'] tags: - { name: drupal.command } -# console.site_mode: -# class: Drupal\Console\Command\Site\ModeCommand -# arguments: ['@config.factory', '@console.configuration_manager', '@app.root', '@console.chain_queue'] -# tags: -# - { name: drupal.command } + console.site_mode: + class: Drupal\Console\Command\Site\ModeCommand + arguments: ['@config.factory', '@console.configuration_manager', '@app.root', '@console.chain_queue'] + tags: + - { name: drupal.command } console.site_statistics: class: Drupal\Console\Command\Site\StatisticsCommand arguments: ['@console.drupal_api', '@entity.query', '@console.extension_manager', '@module_handler'] diff --git a/src/Command/Site/ModeCommand.php b/src/Command/Site/ModeCommand.php index c791f51c9..a362340df 100644 --- a/src/Command/Site/ModeCommand.php +++ b/src/Command/Site/ModeCommand.php @@ -4,17 +4,14 @@ * @file * Contains \Drupal\Console\Command\Site\ModeCommand. */ + namespace Drupal\Console\Command\Site; use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Filesystem\Exception\IOExceptionInterface; use Symfony\Component\Yaml\Yaml; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Filesystem\Filesystem; -use Novia713\Maginot\Maginot; use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Core\Utils\ConfigurationManager; @@ -50,7 +47,7 @@ class ModeCommand extends Command * * @param ConfigFactory $configFactory * @param ConfigurationManager $configurationManager - * @param $appRoot + * @param $appRoot, * @param ChainQueue $chainQueue, */ public function __construct( @@ -63,30 +60,6 @@ public function __construct( $this->configurationManager = $configurationManager; $this->appRoot = $appRoot; $this->chainQueue = $chainQueue; - - $this->local = null; - - $this->services_file = - $this->appRoot.'/sites/default/services.yml'; - - $this->local_services_file = - $this->appRoot.'/sites/development.services.yml'; - - $this->settings_file = - $this->appRoot.'/sites/default/settings.php'; - - $this->local_settings_file = - $this->appRoot.'/sites/default/settings.local.php'; - - $this->local_settings_file_original = - $this->appRoot.'/sites/example.settings.local.php'; - - $this->fs = new Filesystem(); - $this->maginot = new Maginot(); - $this->yaml = new Yaml(); - - $this->environment = null; - parent::__construct(); } @@ -99,12 +72,6 @@ protected function configure() 'environment', InputArgument::REQUIRED, $this->trans('commands.site.mode.arguments.environment') - ) - ->addOption( - 'local', - null, - InputOption::VALUE_NONE, - $this->trans('commands.site.mode.options.local') ); } @@ -112,24 +79,22 @@ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); - $this->environment = $input->getArgument('environment'); - $this->local = $input->getOption('local'); + $environment = $input->getArgument('environment'); - $loadedConfigurations = []; - if (in_array($this->environment, ['dev', 'prod'])) { - $loadedConfigurations = $this->loadConfigurations($this->environment); - } else { + if (!in_array($environment, ['dev', 'prod'])) { $io->error($this->trans('commands.site.mode.messages.invalid-env')); + return 1; } + $loadedConfigurations = $this->loadConfigurations($environment); + $configurationOverrideResult = $this->overrideConfigurations( - $loadedConfigurations['configurations'], - $io + $loadedConfigurations['configurations'] ); foreach ($configurationOverrideResult as $configName => $result) { $io->info( - $this->trans('commands.site.mode.messages.configuration').':', + $this->trans('commands.site.mode.messages.configuration') . ':', false ); $io->comment($configName); @@ -143,7 +108,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $io->table($tableHeader, $result); } - $servicesOverrideResult = $this->overrideServices( + $servicesOverrideResult = $this->processServicesFile( + $environment, $loadedConfigurations['services'], $io ); @@ -165,7 +131,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); } - protected function overrideConfigurations($configurations, $io) + protected function overrideConfigurations($configurations) { $result = []; foreach ($configurations as $configName => $options) { @@ -173,11 +139,11 @@ protected function overrideConfigurations($configurations, $io) foreach ($options as $key => $value) { $original = $config->get($key); if (is_bool($original)) { - $original = $original ? 'true' : 'false'; + $original = $original? 'true' : 'false'; } $updated = $value; if (is_bool($updated)) { - $updated = $updated ? 'true' : 'false'; + $updated = $updated? 'true' : 'false'; } $result[$configName][] = [ @@ -190,103 +156,10 @@ protected function overrideConfigurations($configurations, $io) $config->save(); } - $line_include_settings = - ''; - - if ($this->environment == 'dev') { - - // copy sites/example.settings.local.php sites/default/settings.local.php - $this->fs->copy($this->local_settings_file_original, $this->local_settings_file, true); - - // uncomment cache bins in settings.local.php - $this->maginot->unCommentLine( - '# $settings[\'cache\'][\'bins\'][\'render\'] = \'cache.backend.null\';', - $this->local_settings_file - ); - - $this->maginot->unCommentLine( - '// $settings[\'cache\'][\'bins\'][\'render\'] = \'cache.backend.null\';', - $this->local_settings_file - ); - - $this->maginot->unCommentLine( - '# $settings[\'cache\'][\'bins\'][\'dynamic_page_cache\'] = \'cache.backend.null\';', - $this->local_settings_file - ); - - $this->maginot->unCommentLine( - '// $settings[\'cache\'][\'bins\'][\'dynamic_page_cache\'] = \'cache.backend.null\';', - $this->local_settings_file - ); - - // include settings.local.php in settings.php - // -- check first line if it is already this - if ($this->maginot->getFirstLine($this->settings_file)!= $line_include_settings - ) { - chmod($this->settings_file, (int)0775); - $this->maginot->setFirstLine( - $line_include_settings, - $this->settings_file - ); - } - - $io->commentBlock( - sprintf( - '%s', - $this->trans('commands.site.mode.messages.cachebins') - ) - ); - } - if ($this->environment == 'prod') { - if (!$this->local) { - - // comment local.settings.php in settings.php - if ($this->maginot->getFirstLine($this->settings_file)==$line_include_settings - ) { - $this->maginot->deleteFirstLine( - $this->settings_file - ); - } - - - try { - $this->fs->remove( - $this->local_settings_file - ); - //@TODO: msg user "local.settings.php deleted" - } catch (IOExceptionInterface $e) { - echo $e->getMessage(); - } - } else { - - // comment cache bins in local.settings.php, - // we still use local.settings.php for testing PROD - // settings in local - - $this->maginot->CommentLine( - ' $settings[\'cache\'][\'bins\'][\'render\'] = \'cache.backend.null\';', - $this->local_settings_file - ); - - $this->maginot->CommentLine( - ' $settings[\'cache\'][\'bins\'][\'dynamic_page_cache\'] = \'cache.backend.null\';', - $this->local_settings_file - ); - } - } - - /** - * would be better if this were replaced by $config->save? - */ - //@TODO: 0444 should be a better permission for settings.php - chmod($this->settings_file, (int)0644); - //@TODO: 0555 should be a better permission for sites/default - chmod($this->appRoot.'/sites/default/', (int)0755); - return $result; } - protected function overrideServices($servicesSettings, DrupalStyle $io) + protected function processServicesFile($environment, $servicesSettings, DrupalStyle $io) { $directory = sprintf( '%s/%s', @@ -294,10 +167,11 @@ protected function overrideServices($servicesSettings, DrupalStyle $io) \Drupal::service('site.path') ); - $settingsServicesFile = $directory.'/services.yml'; + $settingsServicesFile = $directory . '/services.yml'; + if (!file_exists($settingsServicesFile)) { // Copying default services - $defaultServicesFile = $this->appRoot.'/sites/default/default.services.yml'; + $defaultServicesFile = $this->appRoot . '/sites/default/default.services.yml'; if (!copy($defaultServicesFile, $settingsServicesFile)) { $io->error( sprintf( @@ -311,7 +185,9 @@ protected function overrideServices($servicesSettings, DrupalStyle $io) } } - $services = $this->yaml->parse(file_get_contents($settingsServicesFile)); + $yaml = new Yaml(); + + $services = $yaml->parse(file_get_contents($settingsServicesFile)); $result = []; foreach ($servicesSettings as $service => $parameters) { @@ -338,7 +214,7 @@ protected function overrideServices($servicesSettings, DrupalStyle $io) } } - if (file_put_contents($settingsServicesFile, $this->yaml->dump($services))) { + if (file_put_contents($settingsServicesFile, $yaml->dump($services))) { $io->commentBlock( sprintf( $this->trans('commands.site.mode.messages.services-file-overwritten'), @@ -358,7 +234,6 @@ protected function overrideServices($servicesSettings, DrupalStyle $io) } sort($result); - return $result; } @@ -372,11 +247,11 @@ protected function loadConfigurations($env) if (!file_exists($configFile)) { $configFile = sprintf( '%s/config/dist/site.mode.yml', - $this->configurationManager->getApplicationDirectory().DRUPAL_CONSOLE_CORE + $this->configurationManager->getApplicationDirectory() . DRUPAL_CONSOLE_CORE ); } - $siteModeConfiguration = $this->yaml->parse(file_get_contents($configFile)); + $siteModeConfiguration = Yaml::parse(file_get_contents($configFile)); $configKeys = array_keys($siteModeConfiguration); $configurationSettings = []; From 31a7e5444bc967768ee50adc1703292671387945 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Fri, 26 May 2017 17:08:40 -0700 Subject: [PATCH 226/321] [config:settings:debug] Improve output. (#3324) --- src/Command/Config/SettingsDebugCommand.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Command/Config/SettingsDebugCommand.php b/src/Command/Config/SettingsDebugCommand.php index 15c7b5e8a..57367e80b 100644 --- a/src/Command/Config/SettingsDebugCommand.php +++ b/src/Command/Config/SettingsDebugCommand.php @@ -65,8 +65,9 @@ protected function execute(InputInterface $input, OutputInterface $output) $io->newLine(); foreach ($settingKeys as $settingKey) { - $io->comment($settingKey, false); - $io->simple(Yaml::encode($this->settings->get($settingKey))); + $settingValue = $this->settings->get($settingKey); + $io->comment($settingKey . ': ', is_array($settingValue)); + $io->write(Yaml::encode($settingValue)); } $io->newLine(); } From 963dd3ddc31918fc622fff13c58160fd0ecbe324 Mon Sep 17 00:00:00 2001 From: David Valdez Date: Mon, 29 May 2017 13:58:38 -0500 Subject: [PATCH 227/321] Fix #3176 and also remove unused libraries. (#3325) In the interfrace-entity-content.php.twig file --- .../src/Entity/interface-entity-content.php.twig | 2 -- .../src/listbuilder-entity-content.php.twig | 15 ++++----------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/templates/module/src/Entity/interface-entity-content.php.twig b/templates/module/src/Entity/interface-entity-content.php.twig index 414e67fc2..981b81bc2 100644 --- a/templates/module/src/Entity/interface-entity-content.php.twig +++ b/templates/module/src/Entity/interface-entity-content.php.twig @@ -12,8 +12,6 @@ namespace Drupal\{{module}}\Entity; {% if revisionable %} use Drupal\Core\Entity\RevisionLogInterface; use Drupal\Core\Entity\RevisionableInterface; -use Drupal\Component\Utility\Xss; -use Drupal\Core\Url; {% else %} use Drupal\Core\Entity\ContentEntityInterface; {% endif %} diff --git a/templates/module/src/listbuilder-entity-content.php.twig b/templates/module/src/listbuilder-entity-content.php.twig index d237e19b3..46af6648c 100644 --- a/templates/module/src/listbuilder-entity-content.php.twig +++ b/templates/module/src/listbuilder-entity-content.php.twig @@ -11,8 +11,7 @@ namespace Drupal\{{module}}; {% block use_class %} use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityListBuilder; -use Drupal\Core\Routing\LinkGeneratorTrait; -use Drupal\Core\Url; +use Drupal\Core\Link; {% endblock %} {% block class_declaration %} @@ -22,9 +21,6 @@ use Drupal\Core\Url; * @ingroup {{ module }} */ class {{ entity_class }}ListBuilder extends EntityListBuilder {% endblock %} -{% block use_trait %} - use LinkGeneratorTrait; -{% endblock %} {% block class_methods %} /** @@ -42,13 +38,10 @@ class {{ entity_class }}ListBuilder extends EntityListBuilder {% endblock %} public function buildRow(EntityInterface $entity) { /* @var $entity \Drupal\{{module}}\Entity\{{ entity_class }} */ $row['id'] = $entity->id(); - $row['name'] = $this->l( + $row['name'] = Link::createFromRoute( $entity->label(), - new Url( - 'entity.{{ entity_name }}.edit_form', [ - '{{ entity_name }}' => $entity->id(), - ] - ) + 'entity.{{ entity_name }}.edit_form', + ['{{ entity_name }}' => $entity->id()] ); return $row + parent::buildRow($entity); } From 0f0c8fc5041cdd83feabead25285d5a5b91d0ad3 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 4 Jun 2017 16:36:54 -0700 Subject: [PATCH 228/321] [console] Refactor Drupal class. (#3329) --- bin/drupal.php | 13 +++------- src/Bootstrap/Drupal.php | 55 +++++++++++++++++++++++++++------------- 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/bin/drupal.php b/bin/drupal.php index 84456f5e1..6c5b26be9 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -40,13 +40,11 @@ exit(1); } -$composerRoot = $drupalFinder->getComposerRoot(); -$drupalRoot = $drupalFinder->getDrupalRoot(); -chdir($drupalRoot); +chdir($drupalFinder->getDrupalRoot()); $configurationManager = new ConfigurationManager(); $configuration = $configurationManager - ->loadConfigurationFromDirectory($composerRoot); + ->loadConfigurationFromDirectory($drupalFinder->getComposerRoot()); $argvInputReader = new ArgvInputReader(); if ($configuration && $options = $configuration->get('application.options') ?: []) { @@ -54,7 +52,7 @@ } $argvInputReader->setOptionsAsArgv(); -$drupal = new Drupal($autoload, $composerRoot, $drupalRoot); +$drupal = new Drupal($autoload, $drupalFinder); $container = $drupal->boot(); if (!$container) { @@ -63,9 +61,6 @@ exit(1); } -if (!isset($launcherVersion)) - $launcherVersion = FALSE; - -$application = new Application($container, $launcherVersion); +$application = new Application($container); $application->setDefaultCommand('about'); $application->run(); diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index 0c3117ce6..48ba2fe58 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -10,25 +10,27 @@ use Drupal\Console\Core\Utils\ArgvInputReader; use Drupal\Console\Core\Bootstrap\DrupalConsoleCore; use Drupal\Console\Utils\ExtendExtensionManager; +use Drupal\Console\Core\Utils\DrupalFinder; class Drupal { protected $autoload; - protected $root; - protected $appRoot; + + /** + * @var DrupalFinder + */ + protected $drupalFinder; /** * Drupal constructor. * * @param $autoload - * @param $root - * @param $appRoot + * @param $drupalFinder */ - public function __construct($autoload, $root, $appRoot) + public function __construct($autoload, DrupalFinder $drupalFinder) { $this->autoload = $autoload; - $this->root = $root; - $this->appRoot = $appRoot; + $this->drupalFinder = $drupalFinder; } public function boot() @@ -41,9 +43,19 @@ public function boot() $uri = $argvInputReader->get('uri'); $debug = $argvInputReader->get('debug', false); + if ($debug) { + $binaryPath = $this->drupalFinder->getVendorDir() . + '/drupal/console/bin/drupal'; + $io->writeln("Per-Site path: $binaryPath"); + $io->newLine(); + } + if (!class_exists('Drupal\Core\DrupalKernel')) { $io->error('Class Drupal\Core\DrupalKernel does not exist.'); - $drupal = new DrupalConsoleCore($this->root, $this->appRoot); + $drupal = new DrupalConsoleCore( + $this->drupalFinder->getComposerRoot(), + $this->drupalFinder->getDrupalRoot() + ); return $drupal->boot(); } @@ -79,7 +91,7 @@ public function boot() $_SERVER['HTTP_USER_AGENT'] = null; $_SERVER['PHP_SELF'] = $_SERVER['REQUEST_URI'] . 'index.php'; $_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF']; - $_SERVER['SCRIPT_FILENAME'] = $this->appRoot . '/index.php'; + $_SERVER['SCRIPT_FILENAME'] = $this->drupalFinder->getDrupalRoot() . '/index.php'; $request = Request::createFromGlobals(); if ($debug) { @@ -92,7 +104,7 @@ public function boot() $this->autoload, 'prod', false, - $this->appRoot + $this->drupalFinder->getDrupalRoot() ); if ($debug) { $io->writeln("\r\033[K\033[1A\r✔"); @@ -101,8 +113,8 @@ public function boot() $drupalKernel->addServiceModifier( new DrupalServiceModifier( - $this->root, - $this->appRoot, + $this->drupalFinder->getComposerRoot(), + $this->drupalFinder->getDrupalRoot(), 'drupal.command', 'drupal.generator', $rebuildServicesFile @@ -122,7 +134,10 @@ public function boot() } $container = $drupalKernel->getContainer(); - $container->set('console.root', $this->root); + $container->set( + 'console.root', + $this->drupalFinder->getComposerRoot() + ); AnnotationRegistry::registerLoader([$this->autoload, "loadClass"]); @@ -132,10 +147,10 @@ public function boot() $container->get('console.translator_manager') ->loadCoreLanguage( $configuration->get('application.language'), - $this->root + $this->drupalFinder->getComposerRoot() ); - $consoleExtendConfigFile = $this->root . DRUPAL_CONSOLE .'/extend.console.config.yml'; + $consoleExtendConfigFile = $this->drupalFinder->getComposerRoot() . DRUPAL_CONSOLE .'/extend.console.config.yml'; if (file_exists($consoleExtendConfigFile)) { $container->get('console.configuration_manager') ->importConfigurationFile($consoleExtendConfigFile); @@ -144,8 +159,8 @@ public function boot() $container->get('console.renderer') ->setSkeletonDirs( [ - $this->root.DRUPAL_CONSOLE.'/templates/', - $this->root.DRUPAL_CONSOLE_CORE.'/templates/' + $this->drupalFinder->getComposerRoot().DRUPAL_CONSOLE.'/templates/', + $this->drupalFinder->getComposerRoot().DRUPAL_CONSOLE_CORE.'/templates/' ] ); @@ -154,9 +169,13 @@ public function boot() if ($command == 'list') { $io->error($e->getMessage()); } - $drupal = new DrupalConsoleCore($this->root, $this->appRoot); + $drupal = new DrupalConsoleCore( + $this->drupalFinder->getComposerRoot(), + $this->drupalFinder->getDrupalRoot() + ); $container = $drupal->boot(); $container->set('class_loader', $this->autoload); + return $container; } } From b45770a9163f16c74c3d57118e869fd052b60186 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Tue, 6 Jun 2017 21:35:45 -0700 Subject: [PATCH 229/321] [generate:module] Validator::trans error, fix #3320 (#3334) --- services.yml | 2 +- src/Utils/Validator.php | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/services.yml b/services.yml index 32e03500b..e71584db1 100644 --- a/services.yml +++ b/services.yml @@ -5,7 +5,7 @@ services: class: RedBeanPHP\R console.validator: class: Drupal\Console\Utils\Validator - arguments: ['@console.extension_manager'] + arguments: ['@console.extension_manager', '@console.translator_manager'] console.drupal_api: class: Drupal\Console\Utils\DrupalApi arguments: ['@app.root', '@entity_type.manager', '@http_client'] diff --git a/src/Utils/Validator.php b/src/Utils/Validator.php index 3705bc309..b81c0ed65 100644 --- a/src/Utils/Validator.php +++ b/src/Utils/Validator.php @@ -20,14 +20,23 @@ class Validator protected $appRoot; + /* + * TranslatorManager + */ + protected $translatorManager; + /** * Site constructor. * - * @param Manager $extensionManager + * @param Manager $extensionManager + * @param TranslatorManager $translatorManager */ - public function __construct(Manager $extensionManager) - { + public function __construct( + Manager $extensionManager, + TranslatorManager $translatorManager + ) { $this->extensionManager = $extensionManager; + $this->translatorManager = $translatorManager; } public function validateModuleName($module) @@ -277,7 +286,7 @@ public function validateExtensions($extensions_list, $type, DrupalStyle $io) if (!empty($checked_extensions['no_extensions'])) { $io->warning( sprintf( - $this->trans('validator.warnings.extension-unavailable'), + $this->translatorManager->trans('validator.warnings.extension-unavailable'), implode(', ', $checked_extensions['no_extensions']) ) ); From 843315c3c4732efefdb06f8ee62a1ec695e3f88b Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Tue, 6 Jun 2017 23:23:35 -0700 Subject: [PATCH 230/321] [update:execute] Display messages during update execute. (#3335) * [update:execute] Display messages during update execute. * [update:execute] Display messages during update execute. --- src/Command/Update/ExecuteCommand.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Command/Update/ExecuteCommand.php b/src/Command/Update/ExecuteCommand.php index 3387d4280..51d3ad4ac 100644 --- a/src/Command/Update/ExecuteCommand.php +++ b/src/Command/Update/ExecuteCommand.php @@ -229,7 +229,7 @@ private function runUpdates(DrupalStyle $io, array $updates) return false; } - $io->info( + $io->comment( sprintf( $this->trans('commands.update.execute.messages.executing-update'), $update_number, @@ -237,6 +237,12 @@ private function runUpdates(DrupalStyle $io, array $updates) ) ); + $updateExploded = explode(" - ", $update); + $updateExploded = count($updateExploded)>0?$updateExploded[1]:$updateExploded[0]; + + $io->comment(trim($updateExploded)); + $io->newLine(); + $this->moduleHandler->invoke($module_name, 'update_' . $update_number); drupal_set_installed_schema_version($module_name, $update_number); } From e01db040db734b2f8b30921ababc53ce51d01896 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 7 Jun 2017 09:21:12 -0700 Subject: [PATCH 231/321] [console] Tag 1.0.0-rc21 release. (#3337) --- composer.json | 19 ++++++++++--------- composer.lock | 16 ++++++++-------- src/Application.php | 2 +- src/Bootstrap/AddServicesCompilerPass.php | 15 ++++++++++++--- 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/composer.json b/composer.json index 10fbb4693..1179f47a8 100644 --- a/composer.json +++ b/composer.json @@ -37,23 +37,24 @@ }, "require": { "php": "^5.5.9 || ^7.0", - "drupal/console-core" : "1.0.0-rc20", - "drupal/console-extend-plugin": "~0", "alchemy/zippy": "0.4.3", - "doctrine/collections":"~1.3", "composer/installers": "~1.0", + "doctrine/annotations": "1.2.*", + "doctrine/collections": "~1.3", + "drupal/console-core": "1.0.0-rc21", + "drupal/console-extend-plugin": "~0", + "gabordemooij/redbean": "~4.3", + "guzzlehttp/guzzle": "~6.1", + "psy/psysh": "0.6.* || ~0.8", "symfony/css-selector": ">=2.7 <3.0", "symfony/dom-crawler": ">=2.7 <3.3", - "symfony/http-foundation": ">=2.7 <3.0", - "guzzlehttp/guzzle": "~6.1", - "gabordemooij/redbean": "~4.3", - "doctrine/annotations": "1.2.*", "symfony/expression-language": ">=2.7 <3.0", - "psy/psysh": "0.6.* || ~0.8" + "symfony/http-foundation": ">=2.7 <3.0" }, "bin": ["bin/drupal"], "config": { - "bin-dir": "bin/" + "bin-dir": "bin/", + "sort-packages": true }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/composer.lock b/composer.lock index 407722d21..2b1c2ae56 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "1718b3e16b129d9d4ef34551230d2d1e", + "content-hash": "119866a8bfb1f845f07e1e4d5de4dd03", "packages": [ { "name": "alchemy/zippy", @@ -571,21 +571,21 @@ }, { "name": "drupal/console-core", - "version": "1.0.0-rc20", + "version": "1.0.0-rc21", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "4b93841301a88db2ae210186e74e0e2529369c17" + "reference": "a473a27292110e5f50e0ae8df36d38449ce55903" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/4b93841301a88db2ae210186e74e0e2529369c17", - "reference": "4b93841301a88db2ae210186e74e0e2529369c17", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/a473a27292110e5f50e0ae8df36d38449ce55903", + "reference": "a473a27292110e5f50e0ae8df36d38449ce55903", "shasum": "" }, "require": { "dflydev/dot-access-configuration": "1.0.1", - "drupal/console-en": "1.0.0-rc20", + "drupal/console-en": "1.0.0-rc21", "php": "^5.5.9 || ^7.0", "stecman/symfony-console-completion": "~0.7", "symfony/config": ">=2.7 <3.0", @@ -647,11 +647,11 @@ "drupal", "symfony" ], - "time": "2017-05-26T08:40:17+00:00" + "time": "2017-06-07T15:57:23+00:00" }, { "name": "drupal/console-en", - "version": "1.0.0-rc20", + "version": "1.0.0-rc21", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", diff --git a/src/Application.php b/src/Application.php index 4cc228460..fb22aa39a 100644 --- a/src/Application.php +++ b/src/Application.php @@ -25,7 +25,7 @@ class Application extends BaseApplication /** * @var string */ - const VERSION = '1.0.0-rc20'; + const VERSION = '1.0.0-rc21'; public function __construct(ContainerInterface $container) { diff --git a/src/Bootstrap/AddServicesCompilerPass.php b/src/Bootstrap/AddServicesCompilerPass.php index a066a8c59..1cc60db48 100644 --- a/src/Bootstrap/AddServicesCompilerPass.php +++ b/src/Bootstrap/AddServicesCompilerPass.php @@ -57,9 +57,18 @@ public function process(ContainerBuilder $container) new FileLocator($this->root) ); - $loader->load($this->root. DRUPAL_CONSOLE_CORE . 'services.yml'); - $loader->load($this->root. DRUPAL_CONSOLE . 'uninstall.services.yml'); - $loader->load($this->root. DRUPAL_CONSOLE . 'services.yml'); + $servicesFiles = [ + $this->root. DRUPAL_CONSOLE_CORE . 'services.yml', + $this->root. DRUPAL_CONSOLE . 'uninstall.services.yml', + $this->root. DRUPAL_CONSOLE . 'services.yml', +// $this->root. DRUPAL_CONSOLE . 'extend.console.uninstall.services.yml', + ]; + + foreach ($servicesFiles as $servicesFile) { + if (file_exists($servicesFile)) { + $loader->load($servicesFile); + } + } $container->get('console.configuration_manager') ->loadConfiguration($this->root) From 8b0c5f55ef58fa640ce878f3bc9c9e32d4590322 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 8 Jun 2017 00:23:33 -0700 Subject: [PATCH 232/321] [console] Load extend uninstall services. (#3338) --- src/Bootstrap/AddServicesCompilerPass.php | 27 ++++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/Bootstrap/AddServicesCompilerPass.php b/src/Bootstrap/AddServicesCompilerPass.php index 1cc60db48..9e29c83e2 100644 --- a/src/Bootstrap/AddServicesCompilerPass.php +++ b/src/Bootstrap/AddServicesCompilerPass.php @@ -60,8 +60,7 @@ public function process(ContainerBuilder $container) $servicesFiles = [ $this->root. DRUPAL_CONSOLE_CORE . 'services.yml', $this->root. DRUPAL_CONSOLE . 'uninstall.services.yml', - $this->root. DRUPAL_CONSOLE . 'services.yml', -// $this->root. DRUPAL_CONSOLE . 'extend.console.uninstall.services.yml', + $this->root. DRUPAL_CONSOLE . 'services.yml' ]; foreach ($servicesFiles as $servicesFile) { @@ -167,10 +166,15 @@ public function process(ContainerBuilder $container) } } - $consoleExtendServicesFile = $this->root . DRUPAL_CONSOLE . '/extend.console.services.yml'; + $extendServicesFiles = [ + $this->root . DRUPAL_CONSOLE . 'extend.console.services.yml', + $this->root . DRUPAL_CONSOLE . 'extend.console.uninstall.services.yml', + ]; - if (file_exists($consoleExtendServicesFile)) { - $loader->load($consoleExtendServicesFile); + foreach ($extendServicesFiles as $extendServicesFile) { + if (file_exists($extendServicesFile)) { + $loader->load($extendServicesFile); + } } $configurationManager = $container->get('console.configuration_manager'); @@ -178,9 +182,16 @@ public function process(ContainerBuilder $container) $autoloadFile = $directory . 'vendor/autoload.php'; if (is_file($autoloadFile)) { include_once $autoloadFile; - $extendServicesFile = $directory . 'extend.console.services.yml'; - if (is_file($extendServicesFile)) { - $loader->load($extendServicesFile); + + $extendServicesFiles = [ + $directory . 'extend.console.services.yml', + $directory . 'extend.console.uninstall.services.yml', + ]; + + foreach ($extendServicesFiles as $extendServicesFile) { + if (file_exists($extendServicesFile)) { + $loader->load($extendServicesFile); + } } } From e0c705d3a86719295e0a74a3374887ecb72ee5aa Mon Sep 17 00:00:00 2001 From: Kevin Porras Date: Thu, 8 Jun 2017 20:29:08 -0600 Subject: [PATCH 233/321] Generate theme command should use right machine name question string. (#3339) --- src/Command/Generate/ThemeCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Command/Generate/ThemeCommand.php b/src/Command/Generate/ThemeCommand.php index 4ec9a7509..dac1d4d51 100644 --- a/src/Command/Generate/ThemeCommand.php +++ b/src/Command/Generate/ThemeCommand.php @@ -253,7 +253,7 @@ function ($theme) use ($validators) { if (!$machine_name) { $machine_name = $io->ask( - $this->trans('commands.generate.module.questions.machine-name'), + $this->trans('commands.generate.theme.questions.machine-name'), $this->stringConverter->createMachineName($theme), function ($machine_name) use ($validators) { return $validators->validateMachineName($machine_name); From bbfe1e8318ed78f130da7aac230a1a1a57952c99 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sat, 10 Jun 2017 13:55:25 -0700 Subject: [PATCH 234/321] [generate:controller] Update default path value. (#3343) --- src/Command/Generate/ControllerCommand.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Command/Generate/ControllerCommand.php b/src/Command/Generate/ControllerCommand.php index 02f09391b..3973361b0 100644 --- a/src/Command/Generate/ControllerCommand.php +++ b/src/Command/Generate/ControllerCommand.php @@ -33,13 +33,13 @@ class ControllerCommand extends Command use ContainerAwareCommandTrait; /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** - * @var ControllerGenerator -*/ + * @var ControllerGenerator + */ protected $generator; /** @@ -48,13 +48,13 @@ class ControllerCommand extends Command protected $stringConverter; /** - * @var Validator -*/ + * @var Validator + */ protected $validator; /** - * @var RouteProviderInterface -*/ + * @var RouteProviderInterface + */ protected $routeProvider; /** @@ -253,7 +253,10 @@ function ($method) use ($routes) { $path = $io->ask( $this->trans('commands.generate.controller.questions.path'), - sprintf('/%s/hello/{name}', $module), + sprintf( + '/%s/'.($method!='hello'?$method:'hello/{name}'), + $module + ), function ($path) use ($routes) { if (count($this->routeProvider->getRoutesByPattern($path)) > 0 || in_array($path, array_column($routes, 'path')) From 03cb470b0a2ce69038b1ccef89d978a075017f43 Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Sat, 10 Jun 2017 22:55:49 +0200 Subject: [PATCH 235/321] Use fully qualified namespace for @use statements (#3341) `@use` statements are part of documentation and are shown in rendered documentation. They should use fully qualified namespaces. This also ensures that the developer can navigate to the classes in their IDE. --- templates/module/src/entity-content-route-provider.php.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/module/src/entity-content-route-provider.php.twig b/templates/module/src/entity-content-route-provider.php.twig index 1772bebdc..b5274ec9d 100644 --- a/templates/module/src/entity-content-route-provider.php.twig +++ b/templates/module/src/entity-content-route-provider.php.twig @@ -18,8 +18,8 @@ use Symfony\Component\Routing\Route; /** * Provides routes for {{ label }} entities. * - * @see Drupal\Core\Entity\Routing\AdminHtmlRouteProvider - * @see Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider + * @see \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider + * @see \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider */ class {{ entity_class }}HtmlRouteProvider extends AdminHtmlRouteProvider {% endblock %} {% block class_methods %} From dcf768c2e488a0b2b190f22a29edae934125edfd Mon Sep 17 00:00:00 2001 From: Francine Bray Date: Sat, 10 Jun 2017 16:03:01 -0500 Subject: [PATCH 236/321] Add missing arguments to empty method call. (#3342) --- src/Utils/Create/TermData.php | 2 +- src/Utils/Create/VocabularyData.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Utils/Create/TermData.php b/src/Utils/Create/TermData.php index 3521bc728..51868ae25 100644 --- a/src/Utils/Create/TermData.php +++ b/src/Utils/Create/TermData.php @@ -66,7 +66,7 @@ public function create( 'vid' => $vocabulary, 'name' => $this->getRandom()->sentences(mt_rand(1, $nameWords), true), 'description' => [ - 'value' => $this->getRandom()->sentences(), + 'value' => $this->getRandom()->sentences(mt_rand(1, $nameWords)), 'format' => 'full_html', ], 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, diff --git a/src/Utils/Create/VocabularyData.php b/src/Utils/Create/VocabularyData.php index 9b0cca4af..a0b853d55 100644 --- a/src/Utils/Create/VocabularyData.php +++ b/src/Utils/Create/VocabularyData.php @@ -58,7 +58,7 @@ public function create( $vocabulary = $this->entityTypeManager->getStorage('taxonomy_vocabulary')->create( [ 'name' => $this->getRandom()->sentences(mt_rand(1, $nameWords), true), - 'description' => $this->getRandom()->sentences(), + 'description' => $this->getRandom()->sentences(mt_rand(1, $nameWords)), 'vid' => Unicode::strtolower($this->getRandom()->name()), 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'weight' => mt_rand(0, 10), From 403d2bb7df80ea34a0aa5ddb6eb7d5820df36eb5 Mon Sep 17 00:00:00 2001 From: Brad Jones Date: Tue, 20 Jun 2017 13:52:58 +1000 Subject: [PATCH 237/321] Use Console's DrupalFinder for cosntructing Drupal object in installer command (#3345) --- src/Command/Site/InstallCommand.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Command/Site/InstallCommand.php b/src/Command/Site/InstallCommand.php index 720fd57d9..ea4b81519 100644 --- a/src/Command/Site/InstallCommand.php +++ b/src/Command/Site/InstallCommand.php @@ -9,7 +9,6 @@ use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Config\Definition\Exception\Exception; -use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; @@ -24,7 +23,7 @@ use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Bootstrap\Drupal; use Drupal\Console\Utils\Site; -use DrupalFinder\DrupalFinder; +use Drupal\Console\Core\Utils\DrupalFinder; class InstallCommand extends Command { @@ -436,13 +435,10 @@ protected function execute(InputInterface $input, OutputInterface $output) try { $drupalFinder = new DrupalFinder(); $drupalFinder->locateRoot(getcwd()); - $composerRoot = $drupalFinder->getComposerRoot(); - $drupalRoot = $drupalFinder->getDrupalRoot(); - $this->runInstaller($io, $input, $database, $uri); $autoload = $this->container->get('class_loader'); - $drupal = new Drupal($autoload, $composerRoot, $drupalRoot); + $drupal = new Drupal($autoload, $drupalFinder); $container = $drupal->boot(); $this->getApplication()->setContainer($container); } catch (Exception $e) { From 6ff75b0a76e1d0295db1772a0c9fcca32180dfe8 Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Tue, 20 Jun 2017 08:24:32 +0200 Subject: [PATCH 238/321] Collection routes are provided by core. (#3344) --- .../entity-content-route-provider.php.twig | 29 ---------------- .../module/src/entity-route-provider.php.twig | 33 +------------------ 2 files changed, 1 insertion(+), 61 deletions(-) diff --git a/templates/module/src/entity-content-route-provider.php.twig b/templates/module/src/entity-content-route-provider.php.twig index b5274ec9d..afaa8908a 100644 --- a/templates/module/src/entity-content-route-provider.php.twig +++ b/templates/module/src/entity-content-route-provider.php.twig @@ -30,10 +30,6 @@ class {{ entity_class }}HtmlRouteProvider extends AdminHtmlRouteProvider {% endb $collection = parent::getRoutes($entity_type); $entity_type_id = $entity_type->id(); - - if ($collection_route = $this->getCollectionRoute($entity_type)) { - $collection->add("entity.{$entity_type_id}.collection", $collection_route); - } {% if revisionable %} if ($history_route = $this->getHistoryRoute($entity_type)) { @@ -65,31 +61,6 @@ class {{ entity_class }}HtmlRouteProvider extends AdminHtmlRouteProvider {% endb return $collection; } - - /** - * Gets the collection route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getCollectionRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('collection') && $entity_type->hasListBuilderClass()) { - $entity_type_id = $entity_type->id(); - $route = new Route($entity_type->getLinkTemplate('collection')); - $route - ->setDefaults([ - '_entity_list' => $entity_type_id, - '_title' => "{$entity_type->getLabel()} list", - ]) - ->setRequirement('_permission', 'access {{ label|lower }} overview') - ->setOption('_admin_route', TRUE); - - return $route; - } - } {% if revisionable %} /** diff --git a/templates/module/src/entity-route-provider.php.twig b/templates/module/src/entity-route-provider.php.twig index b7ef81652..860d7b307 100644 --- a/templates/module/src/entity-route-provider.php.twig +++ b/templates/module/src/entity-route-provider.php.twig @@ -29,39 +29,8 @@ class {{ entity_class }}HtmlRouteProvider extends AdminHtmlRouteProvider {% endb public function getRoutes(EntityTypeInterface $entity_type) { $collection = parent::getRoutes($entity_type); - $entity_type_id = $entity_type->id(); - - if ($collection_route = $this->getCollectionRoute($entity_type)) { - $collection->add("entity.{$entity_type_id}.collection", $collection_route); - } + // Provide your custom entity routes here. return $collection; } - - /** - * Gets the collection route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getCollectionRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('collection') && $entity_type->hasListBuilderClass()) { - $entity_type_id = $entity_type->id(); - $route = new Route($entity_type->getLinkTemplate('collection')); - $route - ->setDefaults([ - '_entity_list' => $entity_type_id, - // Make sure this is not a TranslatableMarkup object as the - // TitleResolver translates this string again. - '_title' => (string) $entity_type->getLabel(), - ]) - ->setRequirement('_permission', $entity_type->getAdminPermission()) - ->setOption('_admin_route', TRUE); - - return $route; - } - } {% endblock %} From 1f31679b5c85c794db6387c07630c8c2f228314a Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Tue, 20 Jun 2017 08:25:01 +0200 Subject: [PATCH 239/321] Remove @package declarations from generated code. (#3350) This is not defined in the Drupal coding standards. --- .../Authentication/Provider/authentication-provider.php.twig | 2 -- templates/module/src/Command/command.php.twig | 2 -- templates/module/src/Controller/controller.php.twig | 2 -- templates/module/src/Controller/entity-controller.php.twig | 2 -- templates/module/src/Entity/Form/entity-settings.php.twig | 2 -- templates/module/src/Form/entity.php.twig | 2 -- templates/module/src/Form/form-config.php.twig | 2 -- templates/module/src/Form/form.php.twig | 2 -- templates/module/src/Routing/route-subscriber.php.twig | 1 - templates/module/src/TwigExtension/twig-extension.php.twig | 2 -- templates/module/src/cache-context.php.twig | 2 -- templates/module/src/event-subscriber.php.twig | 2 -- templates/module/src/service-interface.php.twig | 2 -- templates/module/src/service.php.twig | 2 -- 14 files changed, 27 deletions(-) diff --git a/templates/module/src/Authentication/Provider/authentication-provider.php.twig b/templates/module/src/Authentication/Provider/authentication-provider.php.twig index 4be10111b..c516d0511 100644 --- a/templates/module/src/Authentication/Provider/authentication-provider.php.twig +++ b/templates/module/src/Authentication/Provider/authentication-provider.php.twig @@ -21,8 +21,6 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; {% block class_declaration %} /** * Class {{ class }}. - * - * @package Drupal\{{module}}\Authentication\Provider */ class {{ class }} implements AuthenticationProviderInterface {% endblock %} {% block class_variables %} diff --git a/templates/module/src/Command/command.php.twig b/templates/module/src/Command/command.php.twig index 7e6f264dd..bbe779678 100644 --- a/templates/module/src/Command/command.php.twig +++ b/templates/module/src/Command/command.php.twig @@ -25,8 +25,6 @@ use Drupal\Console\Annotations\DrupalCommand; /** * Class {{ class_name }}. * - * @package Drupal\{{extension}} - * * @DrupalCommand ( * extension="{{extension}}", * extensionType="{{ extensionType }}" diff --git a/templates/module/src/Controller/controller.php.twig b/templates/module/src/Controller/controller.php.twig index 57c1ad137..568f3b450 100644 --- a/templates/module/src/Controller/controller.php.twig +++ b/templates/module/src/Controller/controller.php.twig @@ -17,8 +17,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface; {% block class_declaration %} /** * Class {{ class_name }}. - * - * @package Drupal\{{ module }}\Controller */ class {{ class_name }} extends ControllerBase {% endblock %} {% block class_construct %} diff --git a/templates/module/src/Controller/entity-controller.php.twig b/templates/module/src/Controller/entity-controller.php.twig index d2261ff34..7e340e0e3 100644 --- a/templates/module/src/Controller/entity-controller.php.twig +++ b/templates/module/src/Controller/entity-controller.php.twig @@ -20,8 +20,6 @@ use Drupal\{{ module }}\Entity\{{ entity_class }}Interface; * Class {{ entity_class }}Controller. * * Returns responses for {{ label }} routes. - * - * @package Drupal\{{ module }}\Controller */ class {{ entity_class }}Controller extends ControllerBase implements ContainerInjectionInterface {% endblock %} diff --git a/templates/module/src/Entity/Form/entity-settings.php.twig b/templates/module/src/Entity/Form/entity-settings.php.twig index df0a3aebe..3af48671f 100644 --- a/templates/module/src/Entity/Form/entity-settings.php.twig +++ b/templates/module/src/Entity/Form/entity-settings.php.twig @@ -17,8 +17,6 @@ use Drupal\Core\Form\FormStateInterface; /** * Class {{ entity_class }}SettingsForm. * - * @package Drupal\{{module}}\Form - * * @ingroup {{module}} */ class {{ entity_class }}SettingsForm extends FormBase {% endblock %} diff --git a/templates/module/src/Form/entity.php.twig b/templates/module/src/Form/entity.php.twig index 892e9411f..0ce40406a 100644 --- a/templates/module/src/Form/entity.php.twig +++ b/templates/module/src/Form/entity.php.twig @@ -16,8 +16,6 @@ use Drupal\Core\Form\FormStateInterface; {% block class_declaration %} /** * Class {{ entity_class }}Form. - * - * @package Drupal\{{ module }}\Form */ class {{ entity_class }}Form extends EntityForm {% endblock %} {% block class_methods %} diff --git a/templates/module/src/Form/form-config.php.twig b/templates/module/src/Form/form-config.php.twig index 9dc7a7dcb..a4cc85a4f 100644 --- a/templates/module/src/Form/form-config.php.twig +++ b/templates/module/src/Form/form-config.php.twig @@ -20,8 +20,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface; {% block class_declaration %} /** * Class {{ class_name }}. - * - * @package Drupal\{{module_name}}\Form */ class {{ class_name }} extends ConfigFormBase {% endblock %} {% block class_construct %} diff --git a/templates/module/src/Form/form.php.twig b/templates/module/src/Form/form.php.twig index d45d63135..6548f0283 100644 --- a/templates/module/src/Form/form.php.twig +++ b/templates/module/src/Form/form.php.twig @@ -19,8 +19,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface; {% block class_declaration %} /** * Class {{ class_name }}. - * - * @package Drupal\{{module_name}}\Form */ class {{ class_name }} extends FormBase {% endblock %} {% block class_construct %} diff --git a/templates/module/src/Routing/route-subscriber.php.twig b/templates/module/src/Routing/route-subscriber.php.twig index f7c52b53c..83cb44946 100644 --- a/templates/module/src/Routing/route-subscriber.php.twig +++ b/templates/module/src/Routing/route-subscriber.php.twig @@ -17,7 +17,6 @@ use Symfony\Component\Routing\RouteCollection; /** * Class {{ class }}. * - * @package Drupal\{{module}}\Routing * Listens to the dynamic route events. */ class {{ class }} extends RouteSubscriberBase {% endblock %} diff --git a/templates/module/src/TwigExtension/twig-extension.php.twig b/templates/module/src/TwigExtension/twig-extension.php.twig index 438965049..362e65d5f 100644 --- a/templates/module/src/TwigExtension/twig-extension.php.twig +++ b/templates/module/src/TwigExtension/twig-extension.php.twig @@ -14,8 +14,6 @@ namespace Drupal\{{module}}\TwigExtension; {% block class_declaration %} /** * Class {{ class }}. - * - * @package Drupal\{{module}} */ class {{ class }} extends \Twig_Extension {% endblock %} diff --git a/templates/module/src/cache-context.php.twig b/templates/module/src/cache-context.php.twig index 5445fb3bf..87a7b4c19 100644 --- a/templates/module/src/cache-context.php.twig +++ b/templates/module/src/cache-context.php.twig @@ -16,8 +16,6 @@ use Drupal\Core\Cache\Context\CacheContextInterface; {% block class_declaration %} /** * Class {{ class }}. -* -* @package Drupal\{{module}} */ class {{ class }} implements CacheContextInterface {% endblock %} diff --git a/templates/module/src/event-subscriber.php.twig b/templates/module/src/event-subscriber.php.twig index d936b36cf..e79389234 100644 --- a/templates/module/src/event-subscriber.php.twig +++ b/templates/module/src/event-subscriber.php.twig @@ -16,8 +16,6 @@ use Symfony\Component\EventDispatcher\Event; {% block class_declaration %} /** * Class {{ class }}. - * - * @package Drupal\{{module}} */ class {{ class }} implements EventSubscriberInterface {% endblock %} diff --git a/templates/module/src/service-interface.php.twig b/templates/module/src/service-interface.php.twig index 6177ec8da..9989f83e4 100644 --- a/templates/module/src/service-interface.php.twig +++ b/templates/module/src/service-interface.php.twig @@ -11,7 +11,5 @@ namespace Drupal\{{module}}; {% block interface_declaration %} /** * Interface {{ interface }}. - * - * @package Drupal\{{module}} */ interface {{ interface }} {% endblock %} diff --git a/templates/module/src/service.php.twig b/templates/module/src/service.php.twig index 8116f27ce..1347bfa56 100644 --- a/templates/module/src/service.php.twig +++ b/templates/module/src/service.php.twig @@ -10,8 +10,6 @@ namespace Drupal\{{module}};{% endblock %} {% block class_declaration %} /** * Class {{ class }}. - * - * @package Drupal\{{module}} */ class {{ class }}{% if(interface is defined and interface) %} implements {{ interface }}{% endif %} {% endblock %} {% block class_construct %} From 1a453fe94125262b6e94d756ba4182310a586391 Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Tue, 20 Jun 2017 08:28:30 +0200 Subject: [PATCH 240/321] Quoting route names is not necessary. (#3351) --- templates/module/links.action-entity-content.yml.twig | 2 +- templates/module/links.action-entity.yml.twig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/module/links.action-entity-content.yml.twig b/templates/module/links.action-entity-content.yml.twig index 610dd11b0..4422abc38 100644 --- a/templates/module/links.action-entity-content.yml.twig +++ b/templates/module/links.action-entity-content.yml.twig @@ -3,7 +3,7 @@ entity.{{ entity_name }}.add_form: {% if not bundle_entity_type %} route_name: entity.{{ entity_name }}.add_form {% else %} - route_name: 'entity.{{ entity_name }}.add_page' + route_name: entity.{{ entity_name }}.add_page {% endif %} title: 'Add {{ label }}' appears_on: diff --git a/templates/module/links.action-entity.yml.twig b/templates/module/links.action-entity.yml.twig index a86c8dcf0..2be50635c 100644 --- a/templates/module/links.action-entity.yml.twig +++ b/templates/module/links.action-entity.yml.twig @@ -1,5 +1,5 @@ entity.{{ entity_name }}.add_form: - route_name: 'entity.{{ entity_name }}.add_form' + route_name: entity.{{ entity_name }}.add_form title: 'Add {{ label }}' appears_on: - entity.{{ entity_name }}.collection From 20b64d54a1d20ad2acfe84bb6d3d37d0062d9f26 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 19 Jun 2017 23:49:07 -0700 Subject: [PATCH 241/321] [site:install] Validate connection before drop tables. (#3355) --- src/Command/Site/InstallCommand.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Command/Site/InstallCommand.php b/src/Command/Site/InstallCommand.php index ea4b81519..df993ef92 100644 --- a/src/Command/Site/InstallCommand.php +++ b/src/Command/Site/InstallCommand.php @@ -371,6 +371,7 @@ function ($profile) { protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); + $uri = parse_url($input->getParameterOption(['--uri', '-l'], 'default'), PHP_URL_HOST); if ($this->site->multisiteMode($uri)) { @@ -423,7 +424,7 @@ protected function execute(InputInterface $input, OutputInterface $output) 'driver' => $dbType, ]; - if ($force && Database::getConnectionInfo()) { + if ($force && Database::isActiveConnection()) { $schema = Database::getConnection()->schema(); $tables = $schema->findTables('%'); foreach ($tables as $table) { From 302ebe03d3897a0fdcc2b4e0ed5b0600d1729623 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 22 Jun 2017 08:46:08 -0700 Subject: [PATCH 242/321] [config:settings:debug] Improve output add new line. (#3356) --- src/Command/Config/SettingsDebugCommand.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Command/Config/SettingsDebugCommand.php b/src/Command/Config/SettingsDebugCommand.php index 57367e80b..38b3c8d60 100644 --- a/src/Command/Config/SettingsDebugCommand.php +++ b/src/Command/Config/SettingsDebugCommand.php @@ -68,6 +68,9 @@ protected function execute(InputInterface $input, OutputInterface $output) $settingValue = $this->settings->get($settingKey); $io->comment($settingKey . ': ', is_array($settingValue)); $io->write(Yaml::encode($settingValue)); + if (!is_array($settingValue)) { + $io->newLine(); + } } $io->newLine(); } From 2c64b3cf1a3ebd1a239565afb34a9557a2972fcb Mon Sep 17 00:00:00 2001 From: harold20 Date: Mon, 26 Jun 2017 21:01:30 -0600 Subject: [PATCH 243/321] Fix show themes on theme:install command (#3357) * Fix show themes on theme:install command * Fix theme:uninstall command --- src/Command/Theme/InstallCommand.php | 4 +++- src/Command/Theme/UninstallCommand.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Command/Theme/InstallCommand.php b/src/Command/Theme/InstallCommand.php index acb4f8817..96bc47a95 100644 --- a/src/Command/Theme/InstallCommand.php +++ b/src/Command/Theme/InstallCommand.php @@ -101,7 +101,9 @@ protected function interact(InputInterface $input, OutputInterface $output) while (true) { $theme_name = $io->choiceNoList( $this->trans('commands.theme.install.questions.theme'), - array_keys($theme_list) + array_keys($theme_list), + null, + true ); if (empty($theme_name)) { diff --git a/src/Command/Theme/UninstallCommand.php b/src/Command/Theme/UninstallCommand.php index b15930b54..c31b69c16 100644 --- a/src/Command/Theme/UninstallCommand.php +++ b/src/Command/Theme/UninstallCommand.php @@ -93,7 +93,9 @@ protected function interact(InputInterface $input, OutputInterface $output) while (true) { $theme_name = $io->choiceNoList( $this->trans('commands.theme.uninstall.questions.theme'), - array_keys($theme_list) + array_keys($theme_list), + null, + true ); if (empty($theme_name)) { From 1501cf90b27913b4eb231c217fba2e992f188e77 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 26 Jun 2017 20:24:24 -0700 Subject: [PATCH 244/321] [console] Show version and execution path. (#3358) --- bin/drupal.php | 26 ++++++++++++++++++++++---- src/Application.php | 2 +- src/Bootstrap/Drupal.php | 1 - 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/bin/drupal.php b/bin/drupal.php index 6c5b26be9..f513a62ed 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -1,10 +1,13 @@ locateRoot(getcwd())) { - echo ' DrupalConsole must be executed within a Drupal Site.'.PHP_EOL; + $io->error('DrupalConsole must be executed within a Drupal Site.'); exit(1); } @@ -47,16 +54,27 @@ ->loadConfigurationFromDirectory($drupalFinder->getComposerRoot()); $argvInputReader = new ArgvInputReader(); +$debug = $argvInputReader->get('debug', false); if ($configuration && $options = $configuration->get('application.options') ?: []) { $argvInputReader->setOptionsFromConfiguration($options); } $argvInputReader->setOptionsAsArgv(); +if ($debug){ + $io->writeln( + sprintf( + '%s version %s', + Application::NAME, + Application::VERSION + ) + ); +} + $drupal = new Drupal($autoload, $drupalFinder); $container = $drupal->boot(); if (!$container) { - echo ' Something was wrong. Drupal can not be bootstrap.'; + $io->error('Something was wrong. Drupal can not be bootstrap.'); exit(1); } diff --git a/src/Application.php b/src/Application.php index fb22aa39a..a24610d02 100644 --- a/src/Application.php +++ b/src/Application.php @@ -48,7 +48,7 @@ public function getLongVersion() $output .= sprintf('%s', $this->getName()); } } else { - $output .= 'Console Tool'; + $output .= 'Drupal Console'; } return $output; diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index 48ba2fe58..2aefeafe4 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -9,7 +9,6 @@ use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Core\Utils\ArgvInputReader; use Drupal\Console\Core\Bootstrap\DrupalConsoleCore; -use Drupal\Console\Utils\ExtendExtensionManager; use Drupal\Console\Core\Utils\DrupalFinder; class Drupal From 369c1b23828e2f318fae65478f8bec5b5ca03ada Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Tue, 27 Jun 2017 00:00:58 -0700 Subject: [PATCH 245/321] [console] Tag 1.0.0-rc22 release. (#3359) --- composer.json | 11 +- composer.lock | 556 ++++++++++++++++++++++++++++++-------------- src/Application.php | 2 +- 3 files changed, 391 insertions(+), 178 deletions(-) diff --git a/composer.json b/composer.json index 1179f47a8..c502794fc 100644 --- a/composer.json +++ b/composer.json @@ -41,15 +41,16 @@ "composer/installers": "~1.0", "doctrine/annotations": "1.2.*", "doctrine/collections": "~1.3", - "drupal/console-core": "1.0.0-rc21", + "drupal/console-core": "1.0.0-rc22", + "drupal/console-dotenv": "^0.1.0", "drupal/console-extend-plugin": "~0", "gabordemooij/redbean": "~4.3", "guzzlehttp/guzzle": "~6.1", "psy/psysh": "0.6.* || ~0.8", - "symfony/css-selector": ">=2.7 <3.0", - "symfony/dom-crawler": ">=2.7 <3.3", - "symfony/expression-language": ">=2.7 <3.0", - "symfony/http-foundation": ">=2.7 <3.0" + "symfony/css-selector": "~2.8|~3.0", + "symfony/dom-crawler": "~2.8|~3.0", + "symfony/expression-language": "~2.8", + "symfony/http-foundation": "~2.8" }, "bin": ["bin/drupal"], "config": { diff --git a/composer.lock b/composer.lock index 2b1c2ae56..3e9e5ec04 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "119866a8bfb1f845f07e1e4d5de4dd03", + "content-hash": "f28260b9fc87136866b49bc2610e1c1b", "packages": [ { "name": "alchemy/zippy", @@ -72,16 +72,16 @@ }, { "name": "composer/installers", - "version": "v1.2.0", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/composer/installers.git", - "reference": "d78064c68299743e0161004f2de3a0204e33b804" + "reference": "79ad876c7498c0bbfe7eed065b8651c93bfd6045" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/installers/zipball/d78064c68299743e0161004f2de3a0204e33b804", - "reference": "d78064c68299743e0161004f2de3a0204e33b804", + "url": "https://api.github.com/repos/composer/installers/zipball/79ad876c7498c0bbfe7eed065b8651c93bfd6045", + "reference": "79ad876c7498c0bbfe7eed065b8651c93bfd6045", "shasum": "" }, "require": { @@ -123,12 +123,16 @@ "keywords": [ "Craft", "Dolibarr", + "Eliasis", "Hurad", "ImageCMS", + "Kanboard", "MODX Evo", "Mautic", + "Maya", "OXID", "Plentymarkets", + "Porto", "RadPHP", "SMF", "Thelia", @@ -151,9 +155,11 @@ "fuelphp", "grav", "installer", + "itop", "joomla", "kohana", "laravel", + "lavalite", "lithium", "magento", "mako", @@ -168,6 +174,7 @@ "roundcube", "shopware", "silverstripe", + "sydes", "symfony", "typo3", "wordpress", @@ -175,7 +182,7 @@ "zend", "zikula" ], - "time": "2016-08-13T20:53:52+00:00" + "time": "2017-04-24T06:37:16+00:00" }, { "name": "dflydev/dot-access-configuration", @@ -451,28 +458,29 @@ }, { "name": "doctrine/collections", - "version": "v1.3.0", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/doctrine/collections.git", - "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a" + "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/collections/zipball/6c1e4eef75f310ea1b3e30945e9f06e652128b8a", - "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a", + "url": "https://api.github.com/repos/doctrine/collections/zipball/1a4fb7e902202c33cce8c55989b945612943c2ba", + "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": "^5.6 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "doctrine/coding-standard": "~0.1@dev", + "phpunit/phpunit": "^5.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -513,7 +521,7 @@ "collections", "iterator" ], - "time": "2015-04-14T22:21:58+00:00" + "time": "2017-01-03T10:49:41+00:00" }, { "name": "doctrine/lexer", @@ -571,35 +579,36 @@ }, { "name": "drupal/console-core", - "version": "1.0.0-rc21", + "version": "1.0.0-rc22", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "a473a27292110e5f50e0ae8df36d38449ce55903" + "reference": "e67dbb4d1fe98d3f44ba915316c689e1bdeb4cb3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/a473a27292110e5f50e0ae8df36d38449ce55903", - "reference": "a473a27292110e5f50e0ae8df36d38449ce55903", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/e67dbb4d1fe98d3f44ba915316c689e1bdeb4cb3", + "reference": "e67dbb4d1fe98d3f44ba915316c689e1bdeb4cb3", "shasum": "" }, "require": { "dflydev/dot-access-configuration": "1.0.1", - "drupal/console-en": "1.0.0-rc21", + "drupal/console-en": "1.0.0-rc22", "php": "^5.5.9 || ^7.0", "stecman/symfony-console-completion": "~0.7", - "symfony/config": ">=2.7 <3.0", - "symfony/console": ">=2.7 <3.0", - "symfony/debug": ">=2.6 <3.0", - "symfony/dependency-injection": ">=2.7 <3.0", - "symfony/event-dispatcher": ">=2.7 <3.0", - "symfony/filesystem": ">=2.7 <3.0", - "symfony/finder": ">=2.7 <3.0", - "symfony/process": ">=2.7 <3.0", - "symfony/translation": ">=2.7 <3.0", - "symfony/yaml": ">=2.7 <3.0", + "symfony/config": "~2.8", + "symfony/console": "~2.8", + "symfony/debug": "~2.8", + "symfony/dependency-injection": "~2.8", + "symfony/event-dispatcher": "~2.8", + "symfony/filesystem": "~2.8", + "symfony/finder": "~2.8", + "symfony/process": "~2.8", + "symfony/translation": "~2.8", + "symfony/yaml": "~2.8", "twig/twig": "^1.23.1", - "webflo/drupal-finder": "^0.3.0" + "webflo/drupal-finder": "^0.3.0", + "webmozart/path-util": "^2.3" }, "type": "project", "autoload": { @@ -647,20 +656,59 @@ "drupal", "symfony" ], - "time": "2017-06-07T15:57:23+00:00" + "time": "2017-06-27T05:56:52+00:00" + }, + { + "name": "drupal/console-dotenv", + "version": "0.1.0", + "source": { + "type": "git", + "url": "https://github.com/weknowinc/drupal-console-dotenv.git", + "reference": "48bb017993ab3e10217a63fd5b099f5be432706e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/weknowinc/drupal-console-dotenv/zipball/48bb017993ab3e10217a63fd5b099f5be432706e", + "reference": "48bb017993ab3e10217a63fd5b099f5be432706e", + "shasum": "" + }, + "require": { + "vlucas/phpdotenv": "^2.3" + }, + "require-dev": { + "drupal/console-core": "~1.0" + }, + "type": "drupal-console-library", + "autoload": { + "psr-4": { + "Drupal\\Console\\Dotenv\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0+" + ], + "authors": [ + { + "name": "Jesus Manuel Olivas", + "email": "jesus.olivas@gmail.com" + } + ], + "description": "Drupal Console dotenv", + "time": "2017-06-20T19:02:39+00:00" }, { "name": "drupal/console-en", - "version": "1.0.0-rc21", + "version": "1.0.0-rc22", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", - "reference": "b6f563b8760c3b19aad22dd213a9cfba2f2c75d0" + "reference": "e2461a8cf8bb29aacae0cf0f8a0a2c8d36ed4220" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/b6f563b8760c3b19aad22dd213a9cfba2f2c75d0", - "reference": "b6f563b8760c3b19aad22dd213a9cfba2f2c75d0", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/e2461a8cf8bb29aacae0cf0f8a0a2c8d36ed4220", + "reference": "e2461a8cf8bb29aacae0cf0f8a0a2c8d36ed4220", "shasum": "" }, "type": "drupal-console-language", @@ -701,20 +749,20 @@ "drupal", "symfony" ], - "time": "2017-05-20T23:29:05+00:00" + "time": "2017-06-22T19:05:23+00:00" }, { "name": "drupal/console-extend-plugin", - "version": "0.6.0", + "version": "0.8.0", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-extend-plugin.git", - "reference": "4e7f57650eefc53eb02c89360bbc1f675c901a73" + "reference": "d69ffe413259781c4257ab42bd79c9da9042e87e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-extend-plugin/zipball/4e7f57650eefc53eb02c89360bbc1f675c901a73", - "reference": "4e7f57650eefc53eb02c89360bbc1f675c901a73", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-extend-plugin/zipball/d69ffe413259781c4257ab42bd79c9da9042e87e", + "reference": "d69ffe413259781c4257ab42bd79c9da9042e87e", "shasum": "" }, "require": { @@ -742,20 +790,20 @@ } ], "description": "Drupal Console Extend Plugin", - "time": "2017-05-02T14:17:00+00:00" + "time": "2017-06-08T16:06:59+00:00" }, { "name": "gabordemooij/redbean", - "version": "v4.3.3", + "version": "v4.3.4", "source": { "type": "git", "url": "https://github.com/gabordemooij/redbean.git", - "reference": "1c7ec69850e9f7966ff7feb87b01d8f43a9753d3" + "reference": "d0944d7f966d7f45a0d973981fe3f64aff0050f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/gabordemooij/redbean/zipball/1c7ec69850e9f7966ff7feb87b01d8f43a9753d3", - "reference": "1c7ec69850e9f7966ff7feb87b01d8f43a9753d3", + "url": "https://api.github.com/repos/gabordemooij/redbean/zipball/d0944d7f966d7f45a0d973981fe3f64aff0050f0", + "reference": "d0944d7f966d7f45a0d973981fe3f64aff0050f0", "shasum": "" }, "require": { @@ -783,32 +831,35 @@ "keywords": [ "orm" ], - "time": "2016-10-03T21:25:17+00:00" + "time": "2017-03-07T22:26:54+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "6.2.2", + "version": "6.3.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60" + "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ebf29dee597f02f09f4d5bbecc68230ea9b08f60", - "reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699", + "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699", "shasum": "" }, "require": { "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.3.1", + "guzzlehttp/psr7": "^1.4", "php": ">=5.5" }, "require-dev": { "ext-curl": "*", - "phpunit/phpunit": "^4.0", + "phpunit/phpunit": "^4.0 || ^5.0", "psr/log": "^1.0" }, + "suggest": { + "psr/log": "Required for using the Log middleware" + }, "type": "library", "extra": { "branch-alias": { @@ -845,7 +896,7 @@ "rest", "web service" ], - "time": "2016-10-08T15:01:37+00:00" + "time": "2017-06-22T18:50:49+00:00" }, { "name": "guzzlehttp/promises", @@ -900,16 +951,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.3.1", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b" + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", - "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", "shasum": "" }, "require": { @@ -945,16 +996,23 @@ "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" } ], - "description": "PSR-7 message implementation", + "description": "PSR-7 message implementation that also provides common utility methods", "keywords": [ "http", "message", + "request", + "response", "stream", - "uri" + "uri", + "url" ], - "time": "2016-06-24T23:00:38+00:00" + "time": "2017-03-20T17:10:46+00:00" }, { "name": "ircmaxell/password-compat", @@ -1087,16 +1145,16 @@ }, { "name": "nikic/php-parser", - "version": "v3.0.3", + "version": "v3.0.5", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "5b8182cc0abb4b0ff290ba9df6c0e1323286013a" + "reference": "2b9e2f71b722f7c53918ab0c25f7646c2013f17d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/5b8182cc0abb4b0ff290ba9df6c0e1323286013a", - "reference": "5b8182cc0abb4b0ff290ba9df6c0e1323286013a", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/2b9e2f71b722f7c53918ab0c25f7646c2013f17d", + "reference": "2b9e2f71b722f7c53918ab0c25f7646c2013f17d", "shasum": "" }, "require": { @@ -1134,7 +1192,7 @@ "parser", "php" ], - "time": "2017-02-03T21:57:31+00:00" + "time": "2017-03-05T18:23:57+00:00" }, { "name": "psr/http-message", @@ -1235,16 +1293,16 @@ }, { "name": "psy/psysh", - "version": "v0.8.1", + "version": "v0.8.8", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "701e8a1cc426ee170f1296f5d9f6b8a26ad25c4a" + "reference": "fe65c30cbc55c71e61ba3a38b5a581149be31b8e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/701e8a1cc426ee170f1296f5d9f6b8a26ad25c4a", - "reference": "701e8a1cc426ee170f1296f5d9f6b8a26ad25c4a", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/fe65c30cbc55c71e61ba3a38b5a581149be31b8e", + "reference": "fe65c30cbc55c71e61ba3a38b5a581149be31b8e", "shasum": "" }, "require": { @@ -1274,7 +1332,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-develop": "0.9.x-dev" + "dev-develop": "0.8.x-dev" } }, "autoload": { @@ -1304,7 +1362,7 @@ "interactive", "shell" ], - "time": "2017-01-15T17:54:13+00:00" + "time": "2017-06-24T06:16:19+00:00" }, { "name": "stecman/symfony-console-completion", @@ -1353,7 +1411,7 @@ }, { "name": "symfony/config", - "version": "v2.8.20", + "version": "v2.8.22", "source": { "type": "git", "url": "https://github.com/symfony/config.git", @@ -1409,16 +1467,16 @@ }, { "name": "symfony/console", - "version": "v2.8.20", + "version": "v2.8.22", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "2cfcbced8e39e2313ed4da8896fc8c59a56c0d7e" + "reference": "3ef6ef64abecd566d551d9e7f6393ac6e93b2462" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/2cfcbced8e39e2313ed4da8896fc8c59a56c0d7e", - "reference": "2cfcbced8e39e2313ed4da8896fc8c59a56c0d7e", + "url": "https://api.github.com/repos/symfony/console/zipball/3ef6ef64abecd566d551d9e7f6393ac6e93b2462", + "reference": "3ef6ef64abecd566d551d9e7f6393ac6e93b2462", "shasum": "" }, "require": { @@ -1466,29 +1524,29 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-04-26T01:38:53+00:00" + "time": "2017-06-02T14:36:56+00:00" }, { "name": "symfony/css-selector", - "version": "v2.8.16", + "version": "v3.3.2", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "f45daea42232d9ca5cf561ec64f0d4aea820877f" + "reference": "4d882dced7b995d5274293039370148e291808f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/f45daea42232d9ca5cf561ec64f0d4aea820877f", - "reference": "f45daea42232d9ca5cf561ec64f0d4aea820877f", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/4d882dced7b995d5274293039370148e291808f2", + "reference": "4d882dced7b995d5274293039370148e291808f2", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": ">=5.5.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -1519,20 +1577,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2017-01-02T20:30:24+00:00" + "time": "2017-05-01T15:01:29+00:00" }, { "name": "symfony/debug", - "version": "v2.8.20", + "version": "v2.8.22", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "344f50ce827413b3640bfcb1e37386a67d06ea1f" + "reference": "8470d7701177a88edeb0cec59b44d50ef4477e9b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/344f50ce827413b3640bfcb1e37386a67d06ea1f", - "reference": "344f50ce827413b3640bfcb1e37386a67d06ea1f", + "url": "https://api.github.com/repos/symfony/debug/zipball/8470d7701177a88edeb0cec59b44d50ef4477e9b", + "reference": "8470d7701177a88edeb0cec59b44d50ef4477e9b", "shasum": "" }, "require": { @@ -1576,20 +1634,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2017-04-19T19:56:30+00:00" + "time": "2017-06-01T20:52:29+00:00" }, { "name": "symfony/dependency-injection", - "version": "v2.8.20", + "version": "v2.8.22", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "e1c722dfe4dd04453aeb6b7a6deefb400c878394" + "reference": "b4a4b8f6ae1d69a6b2c0c31623bbc474121ee075" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/e1c722dfe4dd04453aeb6b7a6deefb400c878394", - "reference": "e1c722dfe4dd04453aeb6b7a6deefb400c878394", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/b4a4b8f6ae1d69a6b2c0c31623bbc474121ee075", + "reference": "b4a4b8f6ae1d69a6b2c0c31623bbc474121ee075", "shasum": "" }, "require": { @@ -1639,20 +1697,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2017-04-26T01:38:53+00:00" + "time": "2017-06-02T14:36:56+00:00" }, { "name": "symfony/dom-crawler", - "version": "v3.2.2", + "version": "v3.3.2", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "27d9790840a4efd3b7bb8f5f4f9efc27b36b7024" + "reference": "fc2c588ce376e9fe04a7b8c79e3ec62fe32d95b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/27d9790840a4efd3b7bb8f5f4f9efc27b36b7024", - "reference": "27d9790840a4efd3b7bb8f5f4f9efc27b36b7024", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/fc2c588ce376e9fe04a7b8c79e3ec62fe32d95b1", + "reference": "fc2c588ce376e9fe04a7b8c79e3ec62fe32d95b1", "shasum": "" }, "require": { @@ -1668,7 +1726,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -1695,20 +1753,20 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2017-01-02T20:32:22+00:00" + "time": "2017-05-25T23:10:31+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v2.8.20", + "version": "v2.8.22", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "7fc8e2b4118ff316550596357325dfd92a51f531" + "reference": "1377400fd641d7d1935981546aaef780ecd5bf6d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7fc8e2b4118ff316550596357325dfd92a51f531", - "reference": "7fc8e2b4118ff316550596357325dfd92a51f531", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/1377400fd641d7d1935981546aaef780ecd5bf6d", + "reference": "1377400fd641d7d1935981546aaef780ecd5bf6d", "shasum": "" }, "require": { @@ -1755,20 +1813,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-04-26T16:56:54+00:00" + "time": "2017-06-02T07:47:27+00:00" }, { "name": "symfony/expression-language", - "version": "v2.8.16", + "version": "v2.8.22", "source": { "type": "git", "url": "https://github.com/symfony/expression-language.git", - "reference": "44b85c40c4982f45ef88bbde107463e912fb7a04" + "reference": "2b8394d92f012fe3410e55e28c24fd90c9864a01" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/expression-language/zipball/44b85c40c4982f45ef88bbde107463e912fb7a04", - "reference": "44b85c40c4982f45ef88bbde107463e912fb7a04", + "url": "https://api.github.com/repos/symfony/expression-language/zipball/2b8394d92f012fe3410e55e28c24fd90c9864a01", + "reference": "2b8394d92f012fe3410e55e28c24fd90c9864a01", "shasum": "" }, "require": { @@ -1804,20 +1862,20 @@ ], "description": "Symfony ExpressionLanguage Component", "homepage": "https://symfony.com", - "time": "2017-01-02T20:30:24+00:00" + "time": "2017-06-01T20:52:29+00:00" }, { "name": "symfony/filesystem", - "version": "v2.8.20", + "version": "v2.8.22", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "dc40154e26a0116995e4f2f0c71cb9c2fe0775a3" + "reference": "19c11158da8d110cc5289c063bf2ec4cc1ce9e7c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/dc40154e26a0116995e4f2f0c71cb9c2fe0775a3", - "reference": "dc40154e26a0116995e4f2f0c71cb9c2fe0775a3", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/19c11158da8d110cc5289c063bf2ec4cc1ce9e7c", + "reference": "19c11158da8d110cc5289c063bf2ec4cc1ce9e7c", "shasum": "" }, "require": { @@ -1853,20 +1911,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2017-04-12T14:07:15+00:00" + "time": "2017-05-28T14:07:33+00:00" }, { "name": "symfony/finder", - "version": "v2.8.20", + "version": "v2.8.22", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "16d55394b31547e4a8494551b85c9b9915545347" + "reference": "4f4e84811004e065a3bb5ceeb1d9aa592630f9ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/16d55394b31547e4a8494551b85c9b9915545347", - "reference": "16d55394b31547e4a8494551b85c9b9915545347", + "url": "https://api.github.com/repos/symfony/finder/zipball/4f4e84811004e065a3bb5ceeb1d9aa592630f9ad", + "reference": "4f4e84811004e065a3bb5ceeb1d9aa592630f9ad", "shasum": "" }, "require": { @@ -1902,20 +1960,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-04-12T14:07:15+00:00" + "time": "2017-06-01T20:52:29+00:00" }, { "name": "symfony/http-foundation", - "version": "v2.8.16", + "version": "v2.8.22", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "464cdde6757a40701d758112cc7ff2c6adf6e82f" + "reference": "de8d8e83b9ec898e14ef8db84cee5919753b2ae5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/464cdde6757a40701d758112cc7ff2c6adf6e82f", - "reference": "464cdde6757a40701d758112cc7ff2c6adf6e82f", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/de8d8e83b9ec898e14ef8db84cee5919753b2ae5", + "reference": "de8d8e83b9ec898e14ef8db84cee5919753b2ae5", "shasum": "" }, "require": { @@ -1957,20 +2015,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2017-01-08T20:43:03+00:00" + "time": "2017-06-01T20:52:29+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.3.0", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" + "reference": "f29dca382a6485c3cbe6379f0c61230167681937" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", - "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f29dca382a6485c3cbe6379f0c61230167681937", + "reference": "f29dca382a6485c3cbe6379f0c61230167681937", "shasum": "" }, "require": { @@ -1982,7 +2040,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -2016,20 +2074,20 @@ "portable", "shim" ], - "time": "2016-11-14T01:06:16+00:00" + "time": "2017-06-09T14:24:12+00:00" }, { "name": "symfony/polyfill-php54", - "version": "v1.3.0", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php54.git", - "reference": "90e085822963fdcc9d1c5b73deb3d2e5783b16a0" + "reference": "7dd1a8b9f0442273fdfeb1c4f5eaff6890a82789" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/90e085822963fdcc9d1c5b73deb3d2e5783b16a0", - "reference": "90e085822963fdcc9d1c5b73deb3d2e5783b16a0", + "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/7dd1a8b9f0442273fdfeb1c4f5eaff6890a82789", + "reference": "7dd1a8b9f0442273fdfeb1c4f5eaff6890a82789", "shasum": "" }, "require": { @@ -2038,7 +2096,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -2074,20 +2132,20 @@ "portable", "shim" ], - "time": "2016-11-14T01:06:16+00:00" + "time": "2017-06-09T08:25:21+00:00" }, { "name": "symfony/polyfill-php55", - "version": "v1.3.0", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php55.git", - "reference": "03e3f0350bca2220e3623a0e340eef194405fc67" + "reference": "94566239a7720cde0820f15f0cc348ddb51ba51d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/03e3f0350bca2220e3623a0e340eef194405fc67", - "reference": "03e3f0350bca2220e3623a0e340eef194405fc67", + "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/94566239a7720cde0820f15f0cc348ddb51ba51d", + "reference": "94566239a7720cde0820f15f0cc348ddb51ba51d", "shasum": "" }, "require": { @@ -2097,7 +2155,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -2130,20 +2188,20 @@ "portable", "shim" ], - "time": "2016-11-14T01:06:16+00:00" + "time": "2017-06-09T08:25:21+00:00" }, { "name": "symfony/process", - "version": "v2.8.20", + "version": "v2.8.22", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "aff35fb3dee799c84a7313c576b72208b046ef8d" + "reference": "d54232f5682fda2f8bbebff7c81b864646867ab9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/aff35fb3dee799c84a7313c576b72208b046ef8d", - "reference": "aff35fb3dee799c84a7313c576b72208b046ef8d", + "url": "https://api.github.com/repos/symfony/process/zipball/d54232f5682fda2f8bbebff7c81b864646867ab9", + "reference": "d54232f5682fda2f8bbebff7c81b864646867ab9", "shasum": "" }, "require": { @@ -2179,20 +2237,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-04-12T14:07:15+00:00" + "time": "2017-05-08T01:19:21+00:00" }, { "name": "symfony/translation", - "version": "v2.8.20", + "version": "v2.8.22", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "32b7c0bffc07772cf1a902e3464ef77117fa07c7" + "reference": "14db4cc1172a722aaa3b558bfa8eff593b43cd46" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/32b7c0bffc07772cf1a902e3464ef77117fa07c7", - "reference": "32b7c0bffc07772cf1a902e3464ef77117fa07c7", + "url": "https://api.github.com/repos/symfony/translation/zipball/14db4cc1172a722aaa3b558bfa8eff593b43cd46", + "reference": "14db4cc1172a722aaa3b558bfa8eff593b43cd46", "shasum": "" }, "require": { @@ -2243,36 +2301,41 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2017-04-12T14:07:15+00:00" + "time": "2017-06-01T20:52:29+00:00" }, { "name": "symfony/var-dumper", - "version": "v3.2.2", + "version": "v3.3.2", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "b54b23f9a19b465e76fdaac0f6732410467c83b2" + "reference": "347c4247a3e40018810b476fcd5dec36d46d08dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/b54b23f9a19b465e76fdaac0f6732410467c83b2", - "reference": "b54b23f9a19b465e76fdaac0f6732410467c83b2", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/347c4247a3e40018810b476fcd5dec36d46d08dc", + "reference": "347c4247a3e40018810b476fcd5dec36d46d08dc", "shasum": "" }, "require": { "php": ">=5.5.9", "symfony/polyfill-mbstring": "~1.0" }, + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" + }, "require-dev": { - "twig/twig": "~1.20|~2.0" + "ext-iconv": "*", + "twig/twig": "~1.34|~2.4" }, "suggest": { + "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", "ext-symfony_debug": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -2306,20 +2369,20 @@ "debug", "dump" ], - "time": "2017-01-03T08:53:57+00:00" + "time": "2017-06-02T09:10:29+00:00" }, { "name": "symfony/yaml", - "version": "v2.8.20", + "version": "v2.8.22", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "93ccdde79f4b079c7558da4656a3cb1c50c68e02" + "reference": "4c29dec8d489c4e37cf87ccd7166cd0b0e6a45c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/93ccdde79f4b079c7558da4656a3cb1c50c68e02", - "reference": "93ccdde79f4b079c7558da4656a3cb1c50c68e02", + "url": "https://api.github.com/repos/symfony/yaml/zipball/4c29dec8d489c4e37cf87ccd7166cd0b0e6a45c5", + "reference": "4c29dec8d489c4e37cf87ccd7166cd0b0e6a45c5", "shasum": "" }, "require": { @@ -2355,24 +2418,24 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-05-01T14:31:55+00:00" + "time": "2017-06-01T20:52:29+00:00" }, { "name": "twig/twig", - "version": "v1.33.2", + "version": "v1.34.3", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "dd6ca96227917e1e85b41c7c3cc6507b411e0927" + "reference": "451c6f4197e113e24c1c85bc3fc8c2d77adeff2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/dd6ca96227917e1e85b41c7c3cc6507b411e0927", - "reference": "dd6ca96227917e1e85b41c7c3cc6507b411e0927", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/451c6f4197e113e24c1c85bc3fc8c2d77adeff2e", + "reference": "451c6f4197e113e24c1c85bc3fc8c2d77adeff2e", "shasum": "" }, "require": { - "php": ">=5.2.7" + "php": ">=5.3.3" }, "require-dev": { "psr/container": "^1.0", @@ -2382,12 +2445,15 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.33-dev" + "dev-master": "1.34-dev" } }, "autoload": { "psr-0": { "Twig_": "lib/" + }, + "psr-4": { + "Twig\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -2417,7 +2483,57 @@ "keywords": [ "templating" ], - "time": "2017-04-20T17:39:48+00:00" + "time": "2017-06-07T18:45:17+00:00" + }, + { + "name": "vlucas/phpdotenv", + "version": "v2.4.0", + "source": { + "type": "git", + "url": "https://github.com/vlucas/phpdotenv.git", + "reference": "3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c", + "reference": "3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "phpunit/phpunit": "^4.8 || ^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "psr-4": { + "Dotenv\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause-Attribution" + ], + "authors": [ + { + "name": "Vance Lucas", + "email": "vance@vancelucas.com", + "homepage": "http://www.vancelucas.com" + } + ], + "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", + "keywords": [ + "dotenv", + "env", + "environment" + ], + "time": "2016-09-01T10:05:43+00:00" }, { "name": "webflo/drupal-finder", @@ -2455,6 +2571,102 @@ ], "description": "Helper class to locate a Drupal installation from a given path.", "time": "2017-05-04T08:54:02+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2016-11-23T20:04:58+00:00" + }, + { + "name": "webmozart/path-util", + "version": "2.3.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/path-util.git", + "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/path-util/zipball/d939f7edc24c9a1bb9c0dee5cb05d8e859490725", + "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "webmozart/assert": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\PathUtil\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.", + "time": "2015-12-17T08:42:14+00:00" } ], "packages-dev": [], diff --git a/src/Application.php b/src/Application.php index a24610d02..4ae5f74af 100644 --- a/src/Application.php +++ b/src/Application.php @@ -25,7 +25,7 @@ class Application extends BaseApplication /** * @var string */ - const VERSION = '1.0.0-rc21'; + const VERSION = '1.0.0-rc22'; public function __construct(ContainerInterface $container) { From ad48c2a3160fdc52c553e91e12794ed518bc09af Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Tue, 27 Jun 2017 00:15:51 -0700 Subject: [PATCH 246/321] [dotenv] Fix Dotenv dependency. (#3360) --- composer.json | 2 +- composer.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index c502794fc..ab0a3a70c 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ "doctrine/annotations": "1.2.*", "doctrine/collections": "~1.3", "drupal/console-core": "1.0.0-rc22", - "drupal/console-dotenv": "^0.1.0", + "drupal/console-dotenv": "~0", "drupal/console-extend-plugin": "~0", "gabordemooij/redbean": "~4.3", "guzzlehttp/guzzle": "~6.1", diff --git a/composer.lock b/composer.lock index 3e9e5ec04..9c1d9f98b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "f28260b9fc87136866b49bc2610e1c1b", + "content-hash": "7b8c1cb292732c83a5f30aa17c035eb6", "packages": [ { "name": "alchemy/zippy", From dd684a94a92ce602947ca53929f09be5fa5fc7e1 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Tue, 27 Jun 2017 02:10:35 -0700 Subject: [PATCH 247/321] [console] Fix doctrine/collections dependency. (#3362) --- composer.json | 2 +- composer.lock | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index ab0a3a70c..90bb2a301 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,7 @@ "alchemy/zippy": "0.4.3", "composer/installers": "~1.0", "doctrine/annotations": "1.2.*", - "doctrine/collections": "~1.3", + "doctrine/collections": "1.3.*", "drupal/console-core": "1.0.0-rc22", "drupal/console-dotenv": "~0", "drupal/console-extend-plugin": "~0", diff --git a/composer.lock b/composer.lock index 9c1d9f98b..35db4105b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "7b8c1cb292732c83a5f30aa17c035eb6", + "content-hash": "2859ecead2988e6a9495b733cb703db6", "packages": [ { "name": "alchemy/zippy", @@ -458,29 +458,28 @@ }, { "name": "doctrine/collections", - "version": "v1.4.0", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/doctrine/collections.git", - "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba" + "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/collections/zipball/1a4fb7e902202c33cce8c55989b945612943c2ba", - "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba", + "url": "https://api.github.com/repos/doctrine/collections/zipball/6c1e4eef75f310ea1b3e30945e9f06e652128b8a", + "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": ">=5.3.2" }, "require-dev": { - "doctrine/coding-standard": "~0.1@dev", - "phpunit/phpunit": "^5.7" + "phpunit/phpunit": "~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -521,7 +520,7 @@ "collections", "iterator" ], - "time": "2017-01-03T10:49:41+00:00" + "time": "2015-04-14T22:21:58+00:00" }, { "name": "doctrine/lexer", From 2bac21223573f5fd8c4d7b725baf5d404e406b0b Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Tue, 27 Jun 2017 02:27:00 -0700 Subject: [PATCH 248/321] [console] Tag 1.0.0-rc23 release. (#3363) --- composer.json | 2 +- composer.lock | 16 ++++++++-------- src/Application.php | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index 90bb2a301..c825cee0c 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,7 @@ "composer/installers": "~1.0", "doctrine/annotations": "1.2.*", "doctrine/collections": "1.3.*", - "drupal/console-core": "1.0.0-rc22", + "drupal/console-core": "1.0.0-rc23", "drupal/console-dotenv": "~0", "drupal/console-extend-plugin": "~0", "gabordemooij/redbean": "~4.3", diff --git a/composer.lock b/composer.lock index 35db4105b..193c280ff 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "2859ecead2988e6a9495b733cb703db6", + "content-hash": "b5375a537301f3ae536a38eb17ace817", "packages": [ { "name": "alchemy/zippy", @@ -578,21 +578,21 @@ }, { "name": "drupal/console-core", - "version": "1.0.0-rc22", + "version": "1.0.0-rc23", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "e67dbb4d1fe98d3f44ba915316c689e1bdeb4cb3" + "reference": "b1f3680ae19a4d00f8b701b060521bab2cccd6b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/e67dbb4d1fe98d3f44ba915316c689e1bdeb4cb3", - "reference": "e67dbb4d1fe98d3f44ba915316c689e1bdeb4cb3", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/b1f3680ae19a4d00f8b701b060521bab2cccd6b1", + "reference": "b1f3680ae19a4d00f8b701b060521bab2cccd6b1", "shasum": "" }, "require": { "dflydev/dot-access-configuration": "1.0.1", - "drupal/console-en": "1.0.0-rc22", + "drupal/console-en": "1.0.0-rc23", "php": "^5.5.9 || ^7.0", "stecman/symfony-console-completion": "~0.7", "symfony/config": "~2.8", @@ -655,7 +655,7 @@ "drupal", "symfony" ], - "time": "2017-06-27T05:56:52+00:00" + "time": "2017-06-27T09:16:56+00:00" }, { "name": "drupal/console-dotenv", @@ -698,7 +698,7 @@ }, { "name": "drupal/console-en", - "version": "1.0.0-rc22", + "version": "1.0.0-rc23", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", diff --git a/src/Application.php b/src/Application.php index 4ae5f74af..cad7ac634 100644 --- a/src/Application.php +++ b/src/Application.php @@ -25,7 +25,7 @@ class Application extends BaseApplication /** * @var string */ - const VERSION = '1.0.0-rc22'; + const VERSION = '1.0.0-rc23'; public function __construct(ContainerInterface $container) { From 0bc0abb906cc9e2b15bf47f54dee889f31e80a03 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sat, 1 Jul 2017 13:55:03 -0700 Subject: [PATCH 249/321] [config:export:single] Set name as array on interactive mode. (#3368) --- src/Command/Config/ExportSingleCommand.php | 30 +++++++++++++++------- src/Command/Shared/ExportTrait.php | 7 ++--- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/Command/Config/ExportSingleCommand.php b/src/Command/Config/ExportSingleCommand.php index 4e632eee8..eda602bf6 100644 --- a/src/Command/Config/ExportSingleCommand.php +++ b/src/Command/Config/ExportSingleCommand.php @@ -19,6 +19,7 @@ use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Command\Shared\ExportTrait; use Drupal\Console\Extension\Manager; +use Webmozart\PathUtil\Path; class ExportSingleCommand extends Command { @@ -40,6 +41,11 @@ class ExportSingleCommand extends Command */ protected $configStorage; + /** + * @var Manager + */ + protected $extensionManager; + protected $configExport; /** @@ -124,8 +130,8 @@ function ($definition) { uasort($entity_types, 'strnatcasecmp'); $config_types = [ - 'system.simple' => $this->trans('commands.config.export.single.options.simple-configuration'), - ] + $entity_types; + 'system.simple' => $this->trans('commands.config.export.single.options.simple-configuration'), + ] + $entity_types; return $config_types; } @@ -196,7 +202,8 @@ protected function interact(InputInterface $input, OutputInterface $output) $definition = $this->entityTypeManager->getDefinition($type); $name = $definition->getConfigPrefix() . '.' . $name; } - $input->setOption('name', $name); + + $input->setOption('name', [$name]); } $module = $input->getOption('module'); @@ -227,7 +234,6 @@ protected function interact(InputInterface $input, OutputInterface $output) } } - /** * {@inheritdoc} */ @@ -237,25 +243,26 @@ protected function execute(InputInterface $input, OutputInterface $output) $directory = $input->getOption('directory'); $module = $input->getOption('module'); - $ame = $input->getOption('name'); + $name = $input->getOption('name'); $optional = $input->getOption('optional'); $removeUuid = $input->getOption('remove-uuid'); $removeHash = $input->getOption('remove-config-hash'); + $includeDependencies = $input->getOption('include-dependencies'); - foreach ($ame as $nameItem) { + foreach ($name as $nameItem) { $config = $this->getConfiguration( $nameItem, $removeUuid, $removeHash ); - + if ($config) { $this->configExport[$nameItem] = [ 'data' => $config, 'optional' => $optional ]; - if ($input->getOption('include-dependencies')) { + if ($includeDependencies) { // Include config dependencies in export files if ($dependencies = $this->fetchDependencies($config, 'config')) { $this->resolveDependencies($dependencies, $optional); @@ -278,8 +285,13 @@ protected function execute(InputInterface $input, OutputInterface $output) return 0; } - if (!$directory) { + if (!is_dir($directory)) { $directory = config_get_config_directory(CONFIG_SYNC_DIRECTORY); + } else { + $directory = Path::canonicalize($directory); + if (!file_exists($directory)) { + mkdir($directory, 0755, true); + } } $this->exportConfig( diff --git a/src/Command/Shared/ExportTrait.php b/src/Command/Shared/ExportTrait.php index 051f79857..8c68f650e 100644 --- a/src/Command/Shared/ExportTrait.php +++ b/src/Command/Shared/ExportTrait.php @@ -30,12 +30,12 @@ protected function getConfiguration($configName, $uuid = false, $hash = false) if ($uuid) { unset($config['uuid']); } - + // Exclude default_config_hash inside _core is site-specific. if ($hash) { unset($config['_core']['default_config_hash']); } - + return $config; } @@ -45,6 +45,7 @@ protected function getConfiguration($configName, $uuid = false, $hash = false) */ protected function exportConfig($directory, DrupalStyle $io, $message) { + $directory = realpath($directory); $io->info($message); foreach ($this->configExport as $fileName => $config) { @@ -56,7 +57,7 @@ protected function exportConfig($directory, DrupalStyle $io, $message) $fileName ); - $io->info('- ' . $configFile); + $io->writeln('- ' . $configFile); // Create directory if doesn't exist if (!file_exists($directory)) { From 0e22bcb91d5b6ff1a3555b3bacc0ffa4316d95d1 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 2 Jul 2017 01:11:23 -0700 Subject: [PATCH 250/321] [config:import:single] Remove name option. Fix #3223. (#3369) --- src/Command/Config/ImportSingleCommand.php | 73 +++++++++------------- 1 file changed, 31 insertions(+), 42 deletions(-) diff --git a/src/Command/Config/ImportSingleCommand.php b/src/Command/Config/ImportSingleCommand.php index 6b5668f5a..193729f5e 100644 --- a/src/Command/Config/ImportSingleCommand.php +++ b/src/Command/Config/ImportSingleCommand.php @@ -15,11 +15,11 @@ use Drupal\Core\Config\ConfigManager; use Drupal\Core\Config\StorageComparer; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Yaml\Parser; +use Webmozart\PathUtil\Path; class ImportSingleCommand extends Command { @@ -59,14 +59,9 @@ protected function configure() ->setName('config:import:single') ->setDescription($this->trans('commands.config.import.single.description')) ->addOption( - 'name', - null, - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.config.import.single.options.name') - )->addOption( 'file', null, - InputOption::VALUE_OPTIONAL, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.config.import.single.options.file') )->addOption( 'directory', @@ -83,35 +78,38 @@ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); - $name = $input->getOption('name'); - $name = is_array($name) ? $name : [$name]; - $directory = $input->getOption('directory'); $file = $input->getOption('file'); + $directory = $input->getOption('directory'); + + if (!$file) { + $io->error('File option is missing.'); + + return 1; + } - if (!$file && !$directory) { - $directory = config_get_config_directory(CONFIG_SYNC_DIRECTORY); + if ($directory) { + $directory = Path::canonicalize($directory); } - $ymlFile = new Parser(); + $names = []; try { $source_storage = new StorageReplaceDataWrapper( $this->configStorage ); - foreach ($name as $nameItem) { - // Allow for accidental .yml extension. - if (substr($nameItem, -4) === '.yml') { - $nameItem = substr($nameItem, 0, -4); + foreach ($file as $fileItem) { + $configFile = $fileItem; + if ($directory) { + $configFile = Path::canonicalize($directory) . '/' . $fileItem; } - $configFile = count($name) == 1 ? - $file : - $directory.DIRECTORY_SEPARATOR.$nameItem.'.yml'; - if (file_exists($configFile)) { + $name = Path::getFilenameWithoutExtension($configFile); + $ymlFile = new Parser(); $value = $ymlFile->parse(file_get_contents($configFile)); - $source_storage->delete($nameItem); - $source_storage->write($nameItem, $value); + $source_storage->delete($name); + $source_storage->write($name, $value); + $names[] = $name; continue; } @@ -125,14 +123,13 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->configManager ); - if ($this->configImport($io, $storageComparer)) { $io->success( sprintf( $this->trans( 'commands.config.import.single.messages.success' ), - implode(", ", $name) + implode(',', $names) ) ); } @@ -199,30 +196,22 @@ private function configImport($io, StorageComparer $storageComparer) protected function interact(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); - $name = $input->getOption('name'); $file = $input->getOption('file'); $directory = $input->getOption('directory'); - if (!$name) { - $name = $io->ask( - $this->trans('commands.config.import.single.questions.name') - ); - $input->setOption('name', $name); - } - - if (!$directory && !$file) { - $file = $io->askEmpty( + if (!$file) { + $file = $io->ask( $this->trans('commands.config.import.single.questions.file') ); - $input->setOption('file', $file); - } + $input->setOption('file', [$file]); + if (!$directory && !Path::isAbsolute($file)) { + $directory = $io->ask( + $this->trans('commands.config.import.single.questions.directory') + ); - if (!$file && !$directory) { - $directory = $io->askEmpty( - $this->trans('commands.config.import.single.questions.directory') - ); - $input->setOption('directory', $directory); + $input->setOption('directory', $directory); + } } } } From 9f42a0fd3656035e9fae35f3ce904ad50a90da78 Mon Sep 17 00:00:00 2001 From: Miguel Date: Mon, 3 Jul 2017 07:12:43 -0600 Subject: [PATCH 251/321] Updated generate:entity command. (#3370) --- templates/module/src/Entity/Form/entity-settings.php.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/module/src/Entity/Form/entity-settings.php.twig b/templates/module/src/Entity/Form/entity-settings.php.twig index 3af48671f..aa71845e4 100644 --- a/templates/module/src/Entity/Form/entity-settings.php.twig +++ b/templates/module/src/Entity/Form/entity-settings.php.twig @@ -28,7 +28,7 @@ class {{ entity_class }}SettingsForm extends FormBase {% endblock %} * The unique string identifying the form. */ public function getFormId() { - return '{{ entity_class }}_settings'; + return '{{ entity_class|lower }}_settings'; } /** @@ -55,7 +55,7 @@ class {{ entity_class }}SettingsForm extends FormBase {% endblock %} * Form definition array. */ public function buildForm(array $form, FormStateInterface $form_state) { - $form['{{ entity_class }}_settings']['#markup'] = 'Settings form for {{ label }} entities. Manage field settings here.'; + $form['{{ entity_class|lower }}_settings']['#markup'] = 'Settings form for {{ label }} entities. Manage field settings here.'; return $form; } {% endblock %} From bd9f2cead8128804f3b7a22c946ccbb8e8e95b72 Mon Sep 17 00:00:00 2001 From: CoyoteRulea Date: Mon, 3 Jul 2017 16:33:06 -0500 Subject: [PATCH 252/321] Parameter cache-context fixed (#3374) * Parameter cache-context fixed * Module option properly indented --- src/Command/Generate/CacheContextCommand.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Command/Generate/CacheContextCommand.php b/src/Command/Generate/CacheContextCommand.php index 474082006..5ca9c0137 100644 --- a/src/Command/Generate/CacheContextCommand.php +++ b/src/Command/Generate/CacheContextCommand.php @@ -78,9 +78,13 @@ protected function configure() ->setName('generate:cache:context') ->setDescription($this->trans('commands.generate.cache.context.description')) ->setHelp($this->trans('commands.generate.cache.context.description')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) ->addOption( - 'cache_context', + 'module', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.common.options.module')) + ->addOption( + 'cache-context', null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.cache.context.questions.name') @@ -112,7 +116,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } $module = $input->getOption('module'); - $cache_context = $input->getOption('cache_context'); + $cache_context = $input->getOption('cache-context'); $class = $input->getOption('class'); $services = $input->getOption('services'); @@ -140,13 +144,13 @@ protected function interact(InputInterface $input, OutputInterface $output) } // --cache_context option - $cache_context = $input->getOption('cache_context'); + $cache_context = $input->getOption('cache-context'); if (!$cache_context) { $cache_context = $io->ask( $this->trans('commands.generate.cache.context.questions.name'), sprintf('%s', $module) ); - $input->setOption('cache_context', $cache_context); + $input->setOption('cache-context', $cache_context); } // --class option From bc4b3ce02062863959c01c9daa47b754d80adbce Mon Sep 17 00:00:00 2001 From: CoyoteRulea Date: Mon, 3 Jul 2017 16:50:00 -0500 Subject: [PATCH 253/321] Override Command properly indented (#3375) --- src/Command/Config/OverrideCommand.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Command/Config/OverrideCommand.php b/src/Command/Config/OverrideCommand.php index 2f690ef44..f0be3386e 100644 --- a/src/Command/Config/OverrideCommand.php +++ b/src/Command/Config/OverrideCommand.php @@ -55,8 +55,15 @@ protected function configure() InputArgument::REQUIRED, $this->trans('commands.config.override.arguments.name') ) - ->addArgument('key', InputArgument::REQUIRED, $this->trans('commands.config.override.arguments.key')) - ->addArgument('value', InputArgument::REQUIRED, $this->trans('commands.config.override.arguments.value')); + ->addArgument( + 'key', + InputArgument::REQUIRED, + $this->trans('commands.config.override.arguments.key')) + ->addArgument( + 'value', + InputArgument::REQUIRED, + $this->trans('commands.config.override.arguments.value') + ); } /** From 3cbeed25bd9cc9fcc3261a9f94446f9bc39afe3e Mon Sep 17 00:00:00 2001 From: Jose Angel Bonfil Date: Mon, 3 Jul 2017 17:00:01 -0500 Subject: [PATCH 254/321] adding translation by library methods to the console (#3376) --- src/Utils/TranslatorManager.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/Utils/TranslatorManager.php b/src/Utils/TranslatorManager.php index b6e31ea1f..38954d16a 100644 --- a/src/Utils/TranslatorManager.php +++ b/src/Utils/TranslatorManager.php @@ -18,6 +18,8 @@ */ class TranslatorManager extends TranslatorManagerBase { + protected $extensions = []; + /** * @param $extensionPath */ @@ -73,12 +75,27 @@ private function addResourceTranslationsByTheme($theme) ); } + /** + * @param $library + */ + private function addResourceTranslationsByLibrary($library) + { + $path = \Drupal::service('console.root') . '/vendor/drupal/' . $library; + $this->addResourceTranslationsByExtensionPath( + $path + ); + } + /** * @param $extension * @param $type */ public function addResourceTranslationsByExtension($extension, $type) { + if (array_search($extension, $this->extensions) !== false) { + return; + } + $this->extensions[] = $extension; if ($type == 'module') { $this->addResourceTranslationsByModule($extension); return; @@ -87,5 +104,9 @@ public function addResourceTranslationsByExtension($extension, $type) $this->addResourceTranslationsByTheme($extension); return; } + if ($type == 'library') { + $this->addResourceTranslationsByLibrary($extension); + return; + } } } From e974fbcdad881bfb80151b883c486a8c59a3fd63 Mon Sep 17 00:00:00 2001 From: CoyoteRulea Date: Mon, 3 Jul 2017 18:10:04 -0500 Subject: [PATCH 255/321] Validate command (#3377) * Override Command properly indented * Validate Command and Validate Command debug arguments correctly named --- src/Command/Config/ValidateCommand.php | 7 +++++-- src/Command/Config/ValidateDebugCommand.php | 20 +++++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/Command/Config/ValidateCommand.php b/src/Command/Config/ValidateCommand.php index 3c8934558..f15a202ac 100644 --- a/src/Command/Config/ValidateCommand.php +++ b/src/Command/Config/ValidateCommand.php @@ -35,7 +35,10 @@ protected function configure() $this ->setName('config:validate') ->setDescription($this->trans('commands.config.validate.description')) - ->addArgument('config.name', InputArgument::REQUIRED); + ->addArgument( + 'name', + InputArgument::REQUIRED + ); } /** @@ -52,7 +55,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $io = new DrupalStyle($input, $output); //Test the config name and see if a schema exists, if not it will fail - $name = $input->getArgument('config.name'); + $name = $input->getArgument('name'); if (!$typedConfigManager->hasConfigSchema($name)) { $io->warning($this->trans('commands.config.validate.messages.no-conf')); return 1; diff --git a/src/Command/Config/ValidateDebugCommand.php b/src/Command/Config/ValidateDebugCommand.php index 8ee48d0f8..ec193d7bd 100644 --- a/src/Command/Config/ValidateDebugCommand.php +++ b/src/Command/Config/ValidateDebugCommand.php @@ -37,9 +37,19 @@ protected function configure() $this ->setName('config:validate:debug') ->setDescription($this->trans('commands.config.validate.debug.description')) - ->addArgument('config.filepath', InputArgument::REQUIRED) - ->addArgument('config.schema.filepath', InputArgument::REQUIRED) - ->addOption('schema-name', 'sch', InputOption::VALUE_REQUIRED); + ->addArgument( + 'filepath', + InputArgument::REQUIRED + ) + ->addArgument( + 'schema-filepath', + InputArgument::REQUIRED + ) + ->addOption( + 'schema-name', + 'sch', + InputOption::VALUE_REQUIRED + ); } /** @@ -56,14 +66,14 @@ protected function execute(InputInterface $input, OutputInterface $output) $io = new DrupalStyle($input, $output); //Validate config file path - $configFilePath = $input->getArgument('config.filepath'); + $configFilePath = $input->getArgument('filepath'); if (!file_exists($configFilePath)) { $io->info($this->trans('commands.config.validate.debug.messages.noConfFile')); return 1; } //Validate schema path - $configSchemaFilePath = $input->getArgument('config.schema.filepath'); + $configSchemaFilePath = $input->getArgument('schema-filepath'); if (!file_exists($configSchemaFilePath)) { $io->info($this->trans('commands.config.validate.debug.messages.noConfSchema')); return 1; From b7a1303c98d2dbac4fc9566363714d770559bfbb Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 3 Jul 2017 23:32:08 -0700 Subject: [PATCH 256/321] [cache:rebuild] Add command alias. (#3379) --- src/Command/Cache/RebuildCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Command/Cache/RebuildCommand.php b/src/Command/Cache/RebuildCommand.php index 3ad5f0b98..36bd3c6e9 100644 --- a/src/Command/Cache/RebuildCommand.php +++ b/src/Command/Cache/RebuildCommand.php @@ -75,7 +75,7 @@ protected function configure() 'cache', InputArgument::OPTIONAL, $this->trans('commands.cache.rebuild.options.cache') - ); + )->setAliases(['cr']); } /** From 8ab4907f6bc34355c5158abd14a7a2442294a22a Mon Sep 17 00:00:00 2001 From: Jose Angel Bonfil Date: Tue, 4 Jul 2017 11:53:49 -0500 Subject: [PATCH 257/321] Read translation library (#3383) * adding translation by library methods to the console * modification on the function extractDependencies, to enable libraries support as extensions * cleaning code tabs use and replacing them with spaces as per code standard * phpqa fix on indentation --- src/Utils/AnnotationValidator.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Utils/AnnotationValidator.php b/src/Utils/AnnotationValidator.php index 9f9689cfb..9e46c4c42 100644 --- a/src/Utils/AnnotationValidator.php +++ b/src/Utils/AnnotationValidator.php @@ -107,7 +107,9 @@ protected function isExtensionInstalled($extension) protected function extractDependencies($annotation) { $dependencies = []; - if (array_key_exists('extension', $annotation)) { + $extension = array_key_exists('extension', $annotation) ? $annotation['extension'] : null; + $extensionType = array_key_exists('extensionType', $annotation) ? $annotation['extensionType'] : null; + if ($extension && $extensionType != 'library') { $dependencies[] = $annotation['extension']; } if (array_key_exists('dependencies', $annotation)) { From 2532b145afc39da0c028dc0ae580292184fed38c Mon Sep 17 00:00:00 2001 From: Jose Angel Bonfil Date: Tue, 4 Jul 2017 13:12:59 -0500 Subject: [PATCH 258/321] library path change (#3384) --- src/Utils/TranslatorManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Utils/TranslatorManager.php b/src/Utils/TranslatorManager.php index 38954d16a..b5c3b9d6e 100644 --- a/src/Utils/TranslatorManager.php +++ b/src/Utils/TranslatorManager.php @@ -80,7 +80,7 @@ private function addResourceTranslationsByTheme($theme) */ private function addResourceTranslationsByLibrary($library) { - $path = \Drupal::service('console.root') . '/vendor/drupal/' . $library; + $path = \Drupal::service('console.root') . '/vendor/' . $library; $this->addResourceTranslationsByExtensionPath( $path ); From d28e6afb04087fd63cfbdd645b807a9c7dfc8698 Mon Sep 17 00:00:00 2001 From: CoyoteRulea Date: Tue, 4 Jul 2017 14:48:14 -0500 Subject: [PATCH 259/321] Generate form (#3382) * Override Command properly indented * Validate Command and Validate Command debug arguments correctly named * Generate Form fixed to correct parameter name * Changes to translations for generate form --- src/Command/Generate/FormCommand.php | 40 ++++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Command/Generate/FormCommand.php b/src/Command/Generate/FormCommand.php index 58a2582a1..6b84175c8 100644 --- a/src/Command/Generate/FormCommand.php +++ b/src/Command/Generate/FormCommand.php @@ -163,28 +163,28 @@ protected function configure() $this->trans('commands.generate.form.options.path') ) ->addOption( - 'menu_link_gen', + 'menu-link-gen', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.form.options.menu_link_gen') + $this->trans('commands.generate.form.options.menu-link-gen') ) ->addOption( - 'menu_link_title', + 'menu-link-title', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.form.options.menu_link_title') + $this->trans('commands.generate.form.options.menu-link-title') ) ->addOption( - 'menu_parent', + 'menu-parent', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.form.options.menu_parent') + $this->trans('commands.generate.form.options.menu-parent') ) ->addOption( - 'menu_link_desc', + 'menu-link-desc', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.form.options.menu_link_desc') + $this->trans('commands.generate.form.options.menu-link-desc') ); } @@ -200,10 +200,10 @@ protected function execute(InputInterface $input, OutputInterface $output) $class_name = $input->getOption('class'); $form_id = $input->getOption('form-id'); $form_type = $this->formType; - $menu_link_gen = $input->getOption('menu_link_gen'); - $menu_parent = $input->getOption('menu_parent'); - $menu_link_title = $input->getOption('menu_link_title'); - $menu_link_desc = $input->getOption('menu_link_desc'); + $menu_link_gen = $input->getOption('menu-link-gen'); + $menu_parent = $input->getOption('menu-parent'); + $menu_link_title = $input->getOption('menu-link-title'); + $menu_link_desc = $input->getOption('menu-link-desc'); // if exist form generate config file $inputs = $input->getOption('inputs'); @@ -315,15 +315,15 @@ function ($path) { // --link option for links.menu if ($this->formType == 'ConfigFormBase') { $menu_options = $this->menuQuestion($io, $className); - $menu_link_gen = $input->getOption('menu_link_gen'); - $menu_link_title = $input->getOption('menu_link_title'); - $menu_parent = $input->getOption('menu_parent'); - $menu_link_desc = $input->getOption('menu_link_desc'); + $menu_link_gen = $input->getOption('menu-link-gen'); + $menu_link_title = $input->getOption('menu-link-title'); + $menu_parent = $input->getOption('menu-parent'); + $menu_link_desc = $input->getOption('menu-link-desc'); if (!$menu_link_gen || !$menu_link_title || !$menu_parent || !$menu_link_desc) { - $input->setOption('menu_link_gen', $menu_options['menu_link_gen']); - $input->setOption('menu_link_title', $menu_options['menu_link_title']); - $input->setOption('menu_parent', $menu_options['menu_parent']); - $input->setOption('menu_link_desc', $menu_options['menu_link_desc']); + $input->setOption('menu-link-gen', $menu_options['menu_link_gen']); + $input->setOption('menu-link-title', $menu_options['menu_link_title']); + $input->setOption('menu-parent', $menu_options['menu_parent']); + $input->setOption('menu-link-desc', $menu_options['menu_link_desc']); } } } From 93ddb2b8b8754b18dd9876f73e4885d7f7e2ad29 Mon Sep 17 00:00:00 2001 From: CoyoteRulea Date: Tue, 4 Jul 2017 14:48:54 -0500 Subject: [PATCH 260/321] Generate service command parameters changes to standard (#3385) --- src/Command/Generate/ServiceCommand.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Command/Generate/ServiceCommand.php b/src/Command/Generate/ServiceCommand.php index 8106f1523..fcf9a5b36 100644 --- a/src/Command/Generate/ServiceCommand.php +++ b/src/Command/Generate/ServiceCommand.php @@ -109,10 +109,10 @@ protected function configure() $this->trans('commands.common.service.options.interface') ) ->addOption( - 'interface_name', + 'interface-name', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.common.service.options.interface_name') + $this->trans('commands.common.service.options.interface-name') ) ->addOption( 'services', @@ -121,7 +121,7 @@ protected function configure() $this->trans('commands.common.options.services') ) ->addOption( - 'path_service', + 'path-service', null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.service.options.path') @@ -144,9 +144,9 @@ protected function execute(InputInterface $input, OutputInterface $output) $name = $input->getOption('name'); $class = $input->getOption('class'); $interface = $input->getOption('interface'); - $interface_name = $input->getOption('interface_name'); + $interface_name = $input->getOption('interface-name'); $services = $input->getOption('services'); - $path_service = $input->getOption('path_service'); + $path_service = $input->getOption('path-service'); $available_services = $this->container->getServiceIds(); @@ -214,12 +214,12 @@ protected function interact(InputInterface $input, OutputInterface $output) } // --interface_name option - $interface_name = $input->getOption('interface_name'); + $interface_name = $input->getOption('interface-name'); if ($interface && !$interface_name) { $interface_name = $io->askEmpty( - $this->trans('commands.generate.service.questions.interface_name') + $this->trans('commands.generate.service.questions.interface-name') ); - $input->setOption('interface_name', $interface_name); + $input->setOption('interface-name', $interface_name); } // --services option @@ -231,13 +231,13 @@ protected function interact(InputInterface $input, OutputInterface $output) } // --path_service option - $path_service = $input->getOption('path_service'); + $path_service = $input->getOption('path-service'); if (!$path_service) { $path_service = $io->ask( $this->trans('commands.generate.service.questions.path'), '/modules/custom/' . $module . '/src/' ); - $input->setOption('path_service', $path_service); + $input->setOption('path-service', $path_service); } } } From e11c9f68a139fae13ffd0b97786ff30f2fa6d320 Mon Sep 17 00:00:00 2001 From: Jose Angel Bonfil Date: Tue, 4 Jul 2017 15:43:47 -0500 Subject: [PATCH 261/321] adding aliases to the commands as per requirements (#3386) --- src/Command/Config/DebugCommand.php | 3 ++- src/Command/Config/EditCommand.php | 3 ++- src/Command/Config/ExportCommand.php | 3 ++- src/Command/Config/ExportContentTypeCommand.php | 3 ++- src/Command/Config/ExportSingleCommand.php | 3 ++- src/Command/Config/ExportViewCommand.php | 3 ++- src/Command/Config/ImportCommand.php | 3 ++- src/Command/Config/ImportSingleCommand.php | 3 ++- src/Command/Config/OverrideCommand.php | 3 ++- src/Command/ContainerDebugCommand.php | 3 ++- src/Command/Cron/ExecuteCommand.php | 3 ++- src/Command/Cron/ReleaseCommand.php | 3 ++- src/Command/Database/LogClearCommand.php | 3 ++- src/Command/Database/LogDebugCommand.php | 3 ++- src/Command/Develop/GenerateDocCheatsheetCommand.php | 3 ++- src/Command/Develop/GenerateDocDashCommand.php | 3 ++- src/Command/Develop/GenerateDocGitbookCommand.php | 3 ++- src/Command/Generate/AuthenticationProviderCommand.php | 3 ++- src/Command/Generate/CommandCommand.php | 3 ++- src/Command/Generate/ConfigFormBaseCommand.php | 1 + src/Command/Generate/ControllerCommand.php | 3 ++- src/Command/Generate/EntityBundleCommand.php | 3 ++- src/Command/Generate/EntityConfigCommand.php | 3 ++- src/Command/Generate/EntityContentCommand.php | 3 ++- src/Command/Generate/EventSubscriberCommand.php | 3 ++- src/Command/Generate/FormAlterCommand.php | 3 ++- src/Command/Generate/ModuleCommand.php | 3 ++- src/Command/Generate/PermissionCommand.php | 3 ++- src/Command/Generate/PluginBlockCommand.php | 3 ++- src/Command/Generate/PluginConditionCommand.php | 3 ++- src/Command/Generate/PluginFieldCommand.php | 3 ++- src/Command/Generate/PluginFieldFormatterCommand.php | 3 ++- src/Command/Generate/PluginFieldTypeCommand.php | 3 ++- src/Command/Generate/PluginFieldWidgetCommand.php | 3 ++- src/Command/Generate/PluginImageEffectCommand.php | 3 ++- src/Command/Generate/PluginImageFormatterCommand.php | 3 ++- src/Command/Generate/PluginRestResourceCommand.php | 3 ++- src/Command/Generate/PluginRulesActionCommand.php | 3 ++- src/Command/Generate/PluginTypeAnnotationCommand.php | 3 ++- src/Command/Generate/PluginTypeYamlCommand.php | 3 ++- src/Command/Generate/PluginViewsFieldCommand.php | 3 ++- src/Command/Generate/ServiceCommand.php | 3 ++- src/Command/Generate/ThemeCommand.php | 3 ++- src/Command/Migrate/DebugCommand.php | 3 ++- src/Command/Migrate/ExecuteCommand.php | 3 ++- src/Command/Module/DebugCommand.php | 3 ++- src/Command/Module/DownloadCommand.php | 3 ++- src/Command/Module/InstallCommand.php | 3 ++- src/Command/Module/UninstallCommand.php | 3 ++- src/Command/Multisite/DebugCommand.php | 3 ++- src/Command/Multisite/NewCommand.php | 3 ++- src/Command/Rest/DebugCommand.php | 3 ++- src/Command/Rest/DisableCommand.php | 3 ++- src/Command/Rest/EnableCommand.php | 3 ++- src/Command/Router/DebugCommand.php | 3 ++- src/Command/Router/RebuildCommand.php | 3 ++- src/Command/Site/InstallCommand.php | 3 ++- src/Command/Site/MaintenanceCommand.php | 3 ++- src/Command/Site/ModeCommand.php | 3 ++- src/Command/Site/StatusCommand.php | 3 ++- src/Command/Test/DebugCommand.php | 3 ++- src/Command/Test/RunCommand.php | 3 ++- src/Command/Theme/DebugCommand.php | 3 ++- src/Command/Theme/DownloadCommand.php | 2 +- src/Command/Theme/InstallCommand.php | 2 +- src/Command/Theme/UninstallCommand.php | 3 ++- src/Command/Update/DebugCommand.php | 3 ++- src/Command/Update/ExecuteCommand.php | 3 ++- src/Command/User/LoginCleanAttemptsCommand.php | 3 ++- src/Command/User/LoginUrlCommand.php | 3 ++- src/Command/User/PasswordHashCommand.php | 3 ++- src/Command/User/PasswordResetCommand.php | 3 ++- src/Command/Views/DebugCommand.php | 3 ++- src/Command/Views/DisableCommand.php | 3 ++- src/Command/Views/EnableCommand.php | 3 ++- 75 files changed, 147 insertions(+), 74 deletions(-) diff --git a/src/Command/Config/DebugCommand.php b/src/Command/Config/DebugCommand.php index ab0545626..fc7406a42 100644 --- a/src/Command/Config/DebugCommand.php +++ b/src/Command/Config/DebugCommand.php @@ -58,7 +58,8 @@ protected function configure() 'name', InputArgument::OPTIONAL, $this->trans('commands.config.debug.arguments.name') - ); + ) + ->setAliases(['cde']); } /** diff --git a/src/Command/Config/EditCommand.php b/src/Command/Config/EditCommand.php index d142d7111..ad218e358 100644 --- a/src/Command/Config/EditCommand.php +++ b/src/Command/Config/EditCommand.php @@ -75,7 +75,8 @@ protected function configure() 'editor', InputArgument::OPTIONAL, $this->trans('commands.config.edit.arguments.editor') - ); + ) + ->setAliases(['cdit']); } /** diff --git a/src/Command/Config/ExportCommand.php b/src/Command/Config/ExportCommand.php index 38fbe692e..9be8e7d61 100644 --- a/src/Command/Config/ExportCommand.php +++ b/src/Command/Config/ExportCommand.php @@ -76,7 +76,8 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.config.export.single.options.remove-config-hash') - ); + ) + ->setAliases(['ce']); } /** diff --git a/src/Command/Config/ExportContentTypeCommand.php b/src/Command/Config/ExportContentTypeCommand.php index 6382238f3..e33e8b9d3 100644 --- a/src/Command/Config/ExportContentTypeCommand.php +++ b/src/Command/Config/ExportContentTypeCommand.php @@ -79,7 +79,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.config.export.content.type.options.optional-config') - ); + ) + ->setAliases(['cect']); $this->configExport = []; } diff --git a/src/Command/Config/ExportSingleCommand.php b/src/Command/Config/ExportSingleCommand.php index eda602bf6..28014a19c 100644 --- a/src/Command/Config/ExportSingleCommand.php +++ b/src/Command/Config/ExportSingleCommand.php @@ -109,7 +109,8 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.config.export.single.options.remove-config-hash') - ); + ) + ->setAliases(['ces']); } /* diff --git a/src/Command/Config/ExportViewCommand.php b/src/Command/Config/ExportViewCommand.php index f0b0c0e36..d474738f6 100644 --- a/src/Command/Config/ExportViewCommand.php +++ b/src/Command/Config/ExportViewCommand.php @@ -89,7 +89,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.config.export.view.options.include-module-dependencies') - ); + ) + ->setAliases(['cev']); } /** diff --git a/src/Command/Config/ImportCommand.php b/src/Command/Config/ImportCommand.php index 8f5ad6010..b0f690cff 100644 --- a/src/Command/Config/ImportCommand.php +++ b/src/Command/Config/ImportCommand.php @@ -73,7 +73,8 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.config.import.options.remove-files') - ); + ) + ->setAliases(['ci']); } /** diff --git a/src/Command/Config/ImportSingleCommand.php b/src/Command/Config/ImportSingleCommand.php index 193729f5e..5d26583b9 100644 --- a/src/Command/Config/ImportSingleCommand.php +++ b/src/Command/Config/ImportSingleCommand.php @@ -68,7 +68,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.config.import.arguments.directory') - ); + ) + ->setAliases(['cis']); } /** diff --git a/src/Command/Config/OverrideCommand.php b/src/Command/Config/OverrideCommand.php index f0be3386e..7d2ad9cc2 100644 --- a/src/Command/Config/OverrideCommand.php +++ b/src/Command/Config/OverrideCommand.php @@ -63,7 +63,8 @@ protected function configure() 'value', InputArgument::REQUIRED, $this->trans('commands.config.override.arguments.value') - ); + ) + ->setAliases(['co']); } /** diff --git a/src/Command/ContainerDebugCommand.php b/src/Command/ContainerDebugCommand.php index 61519abc2..6dff3778e 100644 --- a/src/Command/ContainerDebugCommand.php +++ b/src/Command/ContainerDebugCommand.php @@ -51,7 +51,8 @@ protected function configure() 'arguments', InputArgument::OPTIONAL, $this->trans('commands.container.debug.arguments.arguments') - ); + ) + ->setAliases(['cod']); } /** diff --git a/src/Command/Cron/ExecuteCommand.php b/src/Command/Cron/ExecuteCommand.php index 39181925c..6fdb3caac 100644 --- a/src/Command/Cron/ExecuteCommand.php +++ b/src/Command/Cron/ExecuteCommand.php @@ -75,7 +75,8 @@ protected function configure() 'module', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, $this->trans('commands.common.options.module') - ); + ) + ->setAliases(['cre']); } /** diff --git a/src/Command/Cron/ReleaseCommand.php b/src/Command/Cron/ReleaseCommand.php index 2fa9541ad..0d54a5c8f 100644 --- a/src/Command/Cron/ReleaseCommand.php +++ b/src/Command/Cron/ReleaseCommand.php @@ -52,7 +52,8 @@ protected function configure() { $this ->setName('cron:release') - ->setDescription($this->trans('commands.cron.release.description')); + ->setDescription($this->trans('commands.cron.release.description')) + ->setAliases(['crr']); } /** diff --git a/src/Command/Database/LogClearCommand.php b/src/Command/Database/LogClearCommand.php index 84a1bb3ee..c8e96eb36 100644 --- a/src/Command/Database/LogClearCommand.php +++ b/src/Command/Database/LogClearCommand.php @@ -67,7 +67,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.database.log.clear.options.user-id') - ); + ) + ->setAliases(['dbc']); } /** diff --git a/src/Command/Database/LogDebugCommand.php b/src/Command/Database/LogDebugCommand.php index de702d860..3579613ab 100644 --- a/src/Command/Database/LogDebugCommand.php +++ b/src/Command/Database/LogDebugCommand.php @@ -88,7 +88,8 @@ protected function configure() InputOption::VALUE_NONE, $this->trans('commands.database.log.debug.options.yml'), null - ); + ) + ->setAliases(['dbb']); } /** diff --git a/src/Command/Develop/GenerateDocCheatsheetCommand.php b/src/Command/Develop/GenerateDocCheatsheetCommand.php index 474ab6e0c..c904ef35a 100644 --- a/src/Command/Develop/GenerateDocCheatsheetCommand.php +++ b/src/Command/Develop/GenerateDocCheatsheetCommand.php @@ -86,7 +86,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.doc.cheatsheet.options.wkhtmltopdf') - ); + ) + ->setAliases(['gdc']); ; } diff --git a/src/Command/Develop/GenerateDocDashCommand.php b/src/Command/Develop/GenerateDocDashCommand.php index 82f7f581b..ba8492b50 100644 --- a/src/Command/Develop/GenerateDocDashCommand.php +++ b/src/Command/Develop/GenerateDocDashCommand.php @@ -97,7 +97,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.doc.dash.options.path') - ); + ) + ->setAliases(['gdd']); ; } diff --git a/src/Command/Develop/GenerateDocGitbookCommand.php b/src/Command/Develop/GenerateDocGitbookCommand.php index 18bb4c1fc..939c0a899 100644 --- a/src/Command/Develop/GenerateDocGitbookCommand.php +++ b/src/Command/Develop/GenerateDocGitbookCommand.php @@ -48,7 +48,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.doc.gitbook.options.path') - ); + ) + ->setAliases(['gdg']); ; } diff --git a/src/Command/Generate/AuthenticationProviderCommand.php b/src/Command/Generate/AuthenticationProviderCommand.php index cb09454a5..8e6e2a027 100644 --- a/src/Command/Generate/AuthenticationProviderCommand.php +++ b/src/Command/Generate/AuthenticationProviderCommand.php @@ -81,7 +81,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.authentication.provider.options.provider-id') - ); + ) + ->setAliases(['gap']); } /** diff --git a/src/Command/Generate/CommandCommand.php b/src/Command/Generate/CommandCommand.php index fc3a914b9..3b1901329 100644 --- a/src/Command/Generate/CommandCommand.php +++ b/src/Command/Generate/CommandCommand.php @@ -124,7 +124,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.common.options.services') - ); + ) + ->setAliases(['gcm']); } /** diff --git a/src/Command/Generate/ConfigFormBaseCommand.php b/src/Command/Generate/ConfigFormBaseCommand.php index 3496b1cc6..736180c1c 100644 --- a/src/Command/Generate/ConfigFormBaseCommand.php +++ b/src/Command/Generate/ConfigFormBaseCommand.php @@ -85,6 +85,7 @@ protected function configure() { $this->setFormType('ConfigFormBase'); $this->setCommandName('generate:form:config'); + $this->setAliases(['gfc']); parent::configure(); } } diff --git a/src/Command/Generate/ControllerCommand.php b/src/Command/Generate/ControllerCommand.php index 3973361b0..0a0a08f14 100644 --- a/src/Command/Generate/ControllerCommand.php +++ b/src/Command/Generate/ControllerCommand.php @@ -124,7 +124,8 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.generate.controller.options.test') - ); + ) + ->setAliases(['gcn']); } /** diff --git a/src/Command/Generate/EntityBundleCommand.php b/src/Command/Generate/EntityBundleCommand.php index b12ef276e..2a9ef6897 100644 --- a/src/Command/Generate/EntityBundleCommand.php +++ b/src/Command/Generate/EntityBundleCommand.php @@ -79,7 +79,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.entity.bundle.options.bundle-title') - ); + ) + ->setAliases(['geb']); } /** diff --git a/src/Command/Generate/EntityConfigCommand.php b/src/Command/Generate/EntityConfigCommand.php index 5af38622c..0f77e100a 100644 --- a/src/Command/Generate/EntityConfigCommand.php +++ b/src/Command/Generate/EntityConfigCommand.php @@ -70,7 +70,8 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.generate.entity.config.options.bundle-of') - ); + ) + ->setAliases(['gecg']); } /** diff --git a/src/Command/Generate/EntityContentCommand.php b/src/Command/Generate/EntityContentCommand.php index 187cd3737..b664450e2 100644 --- a/src/Command/Generate/EntityContentCommand.php +++ b/src/Command/Generate/EntityContentCommand.php @@ -97,7 +97,8 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.generate.entity.content.options.revisionable') - ); + ) + ->setAliases(['gect']); } /** diff --git a/src/Command/Generate/EventSubscriberCommand.php b/src/Command/Generate/EventSubscriberCommand.php index 556e9bb20..b4f8b29fb 100644 --- a/src/Command/Generate/EventSubscriberCommand.php +++ b/src/Command/Generate/EventSubscriberCommand.php @@ -113,7 +113,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.common.options.services') - ); + ) + ->setAliases(['ges']); } /** diff --git a/src/Command/Generate/FormAlterCommand.php b/src/Command/Generate/FormAlterCommand.php index 71c5d8cfd..4c3d876f7 100644 --- a/src/Command/Generate/FormAlterCommand.php +++ b/src/Command/Generate/FormAlterCommand.php @@ -153,7 +153,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.common.options.inputs') - ); + ) + ->setAliases(['gfa']); } /** diff --git a/src/Command/Generate/ModuleCommand.php b/src/Command/Generate/ModuleCommand.php index 0330fb564..1382b08b3 100644 --- a/src/Command/Generate/ModuleCommand.php +++ b/src/Command/Generate/ModuleCommand.php @@ -164,7 +164,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.module.options.twigtemplate') - ); + ) + ->setAliases(['gm']); } /** diff --git a/src/Command/Generate/PermissionCommand.php b/src/Command/Generate/PermissionCommand.php index 07ef7172f..a7aee3778 100644 --- a/src/Command/Generate/PermissionCommand.php +++ b/src/Command/Generate/PermissionCommand.php @@ -79,7 +79,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.common.options.permissions') - ); + ) + ->setAliases(['gp']); } /** diff --git a/src/Command/Generate/PluginBlockCommand.php b/src/Command/Generate/PluginBlockCommand.php index ff35cb3c2..21679d997 100644 --- a/src/Command/Generate/PluginBlockCommand.php +++ b/src/Command/Generate/PluginBlockCommand.php @@ -149,7 +149,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.common.options.services') - ); + ) + ->setAliases(['gpb']); } /** diff --git a/src/Command/Generate/PluginConditionCommand.php b/src/Command/Generate/PluginConditionCommand.php index 817dff1c1..24bc6da17 100644 --- a/src/Command/Generate/PluginConditionCommand.php +++ b/src/Command/Generate/PluginConditionCommand.php @@ -119,7 +119,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.condition.options.context-definition-required') - ); + ) + ->setAliases(['gpc']); } /** diff --git a/src/Command/Generate/PluginFieldCommand.php b/src/Command/Generate/PluginFieldCommand.php index 664123899..35577216a 100644 --- a/src/Command/Generate/PluginFieldCommand.php +++ b/src/Command/Generate/PluginFieldCommand.php @@ -143,7 +143,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.field.options.default-formatter') - ); + ) + ->setAliases(['gpf']); } /** diff --git a/src/Command/Generate/PluginFieldFormatterCommand.php b/src/Command/Generate/PluginFieldFormatterCommand.php index e930070ef..627ae163e 100644 --- a/src/Command/Generate/PluginFieldFormatterCommand.php +++ b/src/Command/Generate/PluginFieldFormatterCommand.php @@ -112,7 +112,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.fieldformatter.options.field-type') - ); + ) + ->setAliases(['gpff']); } /** diff --git a/src/Command/Generate/PluginFieldTypeCommand.php b/src/Command/Generate/PluginFieldTypeCommand.php index 5f33c3d7a..49f6b6eef 100644 --- a/src/Command/Generate/PluginFieldTypeCommand.php +++ b/src/Command/Generate/PluginFieldTypeCommand.php @@ -116,7 +116,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.fieldtype.options.default-formatter') - ); + ) + ->setAliases(['gpft']); } /** diff --git a/src/Command/Generate/PluginFieldWidgetCommand.php b/src/Command/Generate/PluginFieldWidgetCommand.php index 48618defd..a56213756 100644 --- a/src/Command/Generate/PluginFieldWidgetCommand.php +++ b/src/Command/Generate/PluginFieldWidgetCommand.php @@ -117,7 +117,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.fieldwidget.options.field-type') - ); + ) + ->setAliases(['gpfw']); } /** diff --git a/src/Command/Generate/PluginImageEffectCommand.php b/src/Command/Generate/PluginImageEffectCommand.php index 1a0fc1ce4..cf516e813 100644 --- a/src/Command/Generate/PluginImageEffectCommand.php +++ b/src/Command/Generate/PluginImageEffectCommand.php @@ -103,7 +103,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.imageeffect.options.description') - ); + ) + ->setAliases(['gpie']); } /** diff --git a/src/Command/Generate/PluginImageFormatterCommand.php b/src/Command/Generate/PluginImageFormatterCommand.php index 8fb340053..5a3cb696f 100644 --- a/src/Command/Generate/PluginImageFormatterCommand.php +++ b/src/Command/Generate/PluginImageFormatterCommand.php @@ -101,7 +101,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.imageformatter.options.plugin-id') - ); + ) + ->setAliases(['gpif']); } /** diff --git a/src/Command/Generate/PluginRestResourceCommand.php b/src/Command/Generate/PluginRestResourceCommand.php index dfc7ce1ee..c11e9685d 100644 --- a/src/Command/Generate/PluginRestResourceCommand.php +++ b/src/Command/Generate/PluginRestResourceCommand.php @@ -119,7 +119,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.generate.plugin.rest.resource.options.plugin-states') - ); + ) + ->setAliases(['gprr']); } /** diff --git a/src/Command/Generate/PluginRulesActionCommand.php b/src/Command/Generate/PluginRulesActionCommand.php index 43785e3d5..6a063f2b7 100644 --- a/src/Command/Generate/PluginRulesActionCommand.php +++ b/src/Command/Generate/PluginRulesActionCommand.php @@ -114,7 +114,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.rulesaction.options.context') - ); + ) + ->setAliases(['gpra']); } /** diff --git a/src/Command/Generate/PluginTypeAnnotationCommand.php b/src/Command/Generate/PluginTypeAnnotationCommand.php index 109cb2103..93bd76d82 100644 --- a/src/Command/Generate/PluginTypeAnnotationCommand.php +++ b/src/Command/Generate/PluginTypeAnnotationCommand.php @@ -91,7 +91,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.type.annotation.options.label') - ); + ) + ->setAliases(['gpta']); } /** diff --git a/src/Command/Generate/PluginTypeYamlCommand.php b/src/Command/Generate/PluginTypeYamlCommand.php index 58e79cdee..3674b6ec4 100644 --- a/src/Command/Generate/PluginTypeYamlCommand.php +++ b/src/Command/Generate/PluginTypeYamlCommand.php @@ -92,7 +92,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.type.yaml.options.plugin-file-name') - ); + ) + ->setAliases(['gpty']); } /** diff --git a/src/Command/Generate/PluginViewsFieldCommand.php b/src/Command/Generate/PluginViewsFieldCommand.php index 0dab88a7a..b91b08ad8 100644 --- a/src/Command/Generate/PluginViewsFieldCommand.php +++ b/src/Command/Generate/PluginViewsFieldCommand.php @@ -106,7 +106,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.views.field.options.description') - ); + ) + ->setAliases(['gpvf']); } /** diff --git a/src/Command/Generate/ServiceCommand.php b/src/Command/Generate/ServiceCommand.php index fcf9a5b36..859bcfe1b 100644 --- a/src/Command/Generate/ServiceCommand.php +++ b/src/Command/Generate/ServiceCommand.php @@ -125,7 +125,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.service.options.path') - ); + ) + ->setAliases(['gs']); } /** diff --git a/src/Command/Generate/ThemeCommand.php b/src/Command/Generate/ThemeCommand.php index dac1d4d51..8c598baf2 100644 --- a/src/Command/Generate/ThemeCommand.php +++ b/src/Command/Generate/ThemeCommand.php @@ -170,7 +170,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.theme.options.breakpoints') - ); + ) + ->setAliases(['gt']); } /** diff --git a/src/Command/Migrate/DebugCommand.php b/src/Command/Migrate/DebugCommand.php index bcb95d3c5..85a3f75ea 100644 --- a/src/Command/Migrate/DebugCommand.php +++ b/src/Command/Migrate/DebugCommand.php @@ -54,7 +54,8 @@ protected function configure() 'tag', InputArgument::OPTIONAL, $this->trans('commands.migrate.debug.arguments.tag') - ); + ) + ->setAliases(['mid']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Migrate/ExecuteCommand.php b/src/Command/Migrate/ExecuteCommand.php index 1c4fb2587..d5ca9ed38 100644 --- a/src/Command/Migrate/ExecuteCommand.php +++ b/src/Command/Migrate/ExecuteCommand.php @@ -113,7 +113,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.migrate.execute.options.source-base_path') - ); + ) + ->setAliases(['mie']); ; } diff --git a/src/Command/Module/DebugCommand.php b/src/Command/Module/DebugCommand.php index 8864c8c05..0a48170b1 100644 --- a/src/Command/Module/DebugCommand.php +++ b/src/Command/Module/DebugCommand.php @@ -78,7 +78,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.module.debug.options.type') - ); + ) + ->setAliases(['mod']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Module/DownloadCommand.php b/src/Command/Module/DownloadCommand.php index cf799cb4b..c6ebf70f2 100644 --- a/src/Command/Module/DownloadCommand.php +++ b/src/Command/Module/DownloadCommand.php @@ -137,7 +137,8 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.module.install.options.unstable') - ); + ) + ->setAliases(['md']); } /** diff --git a/src/Command/Module/InstallCommand.php b/src/Command/Module/InstallCommand.php index 1d3f6da19..8373d8c1b 100644 --- a/src/Command/Module/InstallCommand.php +++ b/src/Command/Module/InstallCommand.php @@ -124,7 +124,8 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.module.uninstall.options.composer') - ); + ) + ->setAliases(['moi']); } /** diff --git a/src/Command/Module/UninstallCommand.php b/src/Command/Module/UninstallCommand.php index 6b8bfae37..f73500ebe 100755 --- a/src/Command/Module/UninstallCommand.php +++ b/src/Command/Module/UninstallCommand.php @@ -99,7 +99,8 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.module.uninstall.options.composer') - ); + ) + ->setAliases(['mou']); } /** * {@inheritdoc} diff --git a/src/Command/Multisite/DebugCommand.php b/src/Command/Multisite/DebugCommand.php index 00b155511..541eebd69 100644 --- a/src/Command/Multisite/DebugCommand.php +++ b/src/Command/Multisite/DebugCommand.php @@ -43,7 +43,8 @@ public function configure() $this ->setName('multisite:debug') ->setDescription($this->trans('commands.multisite.debug.description')) - ->setHelp($this->trans('commands.multisite.debug.help')); + ->setHelp($this->trans('commands.multisite.debug.help')) + ->setAliases(['sd']); ; } diff --git a/src/Command/Multisite/NewCommand.php b/src/Command/Multisite/NewCommand.php index cabaa4306..e783d4b5c 100644 --- a/src/Command/Multisite/NewCommand.php +++ b/src/Command/Multisite/NewCommand.php @@ -73,7 +73,8 @@ public function configure() null, InputOption::VALUE_NONE, $this->trans('commands.multisite.new.options.copy-default') - ); + ) + ->setAliases(['sn']); } /** diff --git a/src/Command/Rest/DebugCommand.php b/src/Command/Rest/DebugCommand.php index dcd8a764f..2a20e5d26 100644 --- a/src/Command/Rest/DebugCommand.php +++ b/src/Command/Rest/DebugCommand.php @@ -61,7 +61,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.rest.debug.options.status') - ); + ) + ->setAliases(['rede']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Rest/DisableCommand.php b/src/Command/Rest/DisableCommand.php index 68d95aab8..a13477167 100644 --- a/src/Command/Rest/DisableCommand.php +++ b/src/Command/Rest/DisableCommand.php @@ -63,7 +63,8 @@ protected function configure() 'resource-id', InputArgument::OPTIONAL, $this->trans('commands.rest.debug.arguments.resource-id') - ); + ) + ->setAliases(['redi']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Rest/EnableCommand.php b/src/Command/Rest/EnableCommand.php index 0b21d5040..121c7903a 100644 --- a/src/Command/Rest/EnableCommand.php +++ b/src/Command/Rest/EnableCommand.php @@ -96,7 +96,8 @@ protected function configure() 'resource-id', InputArgument::OPTIONAL, $this->trans('commands.rest.debug.arguments.resource-id') - ); + ) + ->setAliases(['ree']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Router/DebugCommand.php b/src/Command/Router/DebugCommand.php index 0c0f902f4..f73e44ad3 100644 --- a/src/Command/Router/DebugCommand.php +++ b/src/Command/Router/DebugCommand.php @@ -45,7 +45,8 @@ protected function configure() 'route-name', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, $this->trans('commands.router.debug.arguments.route-name') - ); + ) + ->setAliases(['rod']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Router/RebuildCommand.php b/src/Command/Router/RebuildCommand.php index 1bbf20268..1faca8cad 100644 --- a/src/Command/Router/RebuildCommand.php +++ b/src/Command/Router/RebuildCommand.php @@ -38,7 +38,8 @@ protected function configure() { $this ->setName('router:rebuild') - ->setDescription($this->trans('commands.router.rebuild.description')); + ->setDescription($this->trans('commands.router.rebuild.description')) + ->setAliases(['ror']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Site/InstallCommand.php b/src/Command/Site/InstallCommand.php index df993ef92..3781fa598 100644 --- a/src/Command/Site/InstallCommand.php +++ b/src/Command/Site/InstallCommand.php @@ -170,7 +170,8 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.site.install.options.force') - ); + ) + ->setAliases(['si']); } /** diff --git a/src/Command/Site/MaintenanceCommand.php b/src/Command/Site/MaintenanceCommand.php index 3088e9c39..8614abc28 100644 --- a/src/Command/Site/MaintenanceCommand.php +++ b/src/Command/Site/MaintenanceCommand.php @@ -56,7 +56,8 @@ protected function configure() 'mode', InputArgument::REQUIRED, $this->trans('commands.site.maintenance.arguments.mode').'[on/off]' - ); + ) + ->setAliases(['sma']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Site/ModeCommand.php b/src/Command/Site/ModeCommand.php index a362340df..e9f2cbae3 100644 --- a/src/Command/Site/ModeCommand.php +++ b/src/Command/Site/ModeCommand.php @@ -72,7 +72,8 @@ protected function configure() 'environment', InputArgument::REQUIRED, $this->trans('commands.site.mode.arguments.environment') - ); + ) + ->setAliases(['smo']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Site/StatusCommand.php b/src/Command/Site/StatusCommand.php index c07a758dd..61f62cf65 100644 --- a/src/Command/Site/StatusCommand.php +++ b/src/Command/Site/StatusCommand.php @@ -108,7 +108,8 @@ protected function configure() InputOption::VALUE_OPTIONAL, $this->trans('commands.site.status.options.format'), 'table' - ); + ) + ->setAliases(['ss']); } /** diff --git a/src/Command/Test/DebugCommand.php b/src/Command/Test/DebugCommand.php index f5a9b2f48..9f3c5e53a 100644 --- a/src/Command/Test/DebugCommand.php +++ b/src/Command/Test/DebugCommand.php @@ -62,7 +62,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.test.debug.arguments.test-class') - ); + ) + ->setAliases(['td']); } /** diff --git a/src/Command/Test/RunCommand.php b/src/Command/Test/RunCommand.php index f31280105..be4c4d408 100644 --- a/src/Command/Test/RunCommand.php +++ b/src/Command/Test/RunCommand.php @@ -94,7 +94,8 @@ protected function configure() null, InputOption::VALUE_REQUIRED, $this->trans('commands.test.run.arguments.url') - ); + ) + ->setAliases(['tr']); } /* diff --git a/src/Command/Theme/DebugCommand.php b/src/Command/Theme/DebugCommand.php index 4ed696e4d..88d094f84 100644 --- a/src/Command/Theme/DebugCommand.php +++ b/src/Command/Theme/DebugCommand.php @@ -50,7 +50,8 @@ protected function configure() $this ->setName('theme:debug') ->setDescription($this->trans('commands.theme.debug.description')) - ->addArgument('theme', InputArgument::OPTIONAL, $this->trans('commands.theme.debug.arguments.theme')); + ->addArgument('theme', InputArgument::OPTIONAL, $this->trans('commands.theme.debug.arguments.theme')) + ->setAliases(['tde']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Theme/DownloadCommand.php b/src/Command/Theme/DownloadCommand.php index c12bd52e4..8710da998 100644 --- a/src/Command/Theme/DownloadCommand.php +++ b/src/Command/Theme/DownloadCommand.php @@ -74,7 +74,7 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.theme.download.options.composer') - ); + )->setAliases(['td']); } /** diff --git a/src/Command/Theme/InstallCommand.php b/src/Command/Theme/InstallCommand.php index 96bc47a95..19aee7fc1 100644 --- a/src/Command/Theme/InstallCommand.php +++ b/src/Command/Theme/InstallCommand.php @@ -67,7 +67,7 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.theme.install.options.set-default') - ); + )->setAliases(['ti']); } /** diff --git a/src/Command/Theme/UninstallCommand.php b/src/Command/Theme/UninstallCommand.php index c31b69c16..4d8aba773 100644 --- a/src/Command/Theme/UninstallCommand.php +++ b/src/Command/Theme/UninstallCommand.php @@ -60,7 +60,8 @@ protected function configure() $this ->setName('theme:uninstall') ->setDescription($this->trans('commands.theme.uninstall.description')) - ->addArgument('theme', InputArgument::IS_ARRAY, $this->trans('commands.theme.uninstall.options.module')); + ->addArgument('theme', InputArgument::IS_ARRAY, $this->trans('commands.theme.uninstall.options.module')) + ->setAliases(['tu']); } /** diff --git a/src/Command/Update/DebugCommand.php b/src/Command/Update/DebugCommand.php index a33d136f8..a727ab11f 100644 --- a/src/Command/Update/DebugCommand.php +++ b/src/Command/Update/DebugCommand.php @@ -51,7 +51,8 @@ protected function configure() { $this ->setName('update:debug') - ->setDescription($this->trans('commands.update.debug.description')); + ->setDescription($this->trans('commands.update.debug.description')) + ->setAliases(['upd']); } /** diff --git a/src/Command/Update/ExecuteCommand.php b/src/Command/Update/ExecuteCommand.php index 51d3ad4ac..7181012ac 100644 --- a/src/Command/Update/ExecuteCommand.php +++ b/src/Command/Update/ExecuteCommand.php @@ -109,7 +109,8 @@ protected function configure() 'update-n', InputArgument::OPTIONAL, $this->trans('commands.update.execute.options.update-n') - ); + ) + ->setAliases(['upe']); } /** diff --git a/src/Command/User/LoginCleanAttemptsCommand.php b/src/Command/User/LoginCleanAttemptsCommand.php index 94fd669f4..0995a2629 100644 --- a/src/Command/User/LoginCleanAttemptsCommand.php +++ b/src/Command/User/LoginCleanAttemptsCommand.php @@ -47,7 +47,8 @@ protected function configure() setName('user:login:clear:attempts') ->setDescription($this->trans('commands.user.login.clear.attempts.description')) ->setHelp($this->trans('commands.user.login.clear.attempts.help')) - ->addArgument('uid', InputArgument::REQUIRED, $this->trans('commands.user.login.clear.attempts.options.user-id')); + ->addArgument('uid', InputArgument::REQUIRED, $this->trans('commands.user.login.clear.attempts.options.user-id')) + ->setAliases(['uslca']); } /** diff --git a/src/Command/User/LoginUrlCommand.php b/src/Command/User/LoginUrlCommand.php index 0b7db7716..c164db46a 100644 --- a/src/Command/User/LoginUrlCommand.php +++ b/src/Command/User/LoginUrlCommand.php @@ -53,7 +53,8 @@ protected function configure() InputArgument::REQUIRED, $this->trans('commands.user.login.url.options.user-id'), null - ); + ) + ->setAliases(['uslu']); } /** diff --git a/src/Command/User/PasswordHashCommand.php b/src/Command/User/PasswordHashCommand.php index 208fe98ae..9d3a48823 100644 --- a/src/Command/User/PasswordHashCommand.php +++ b/src/Command/User/PasswordHashCommand.php @@ -46,7 +46,8 @@ protected function configure() ->setName('user:password:hash') ->setDescription($this->trans('commands.user.password.hash.description')) ->setHelp($this->trans('commands.user.password.hash.help')) - ->addArgument('password', InputArgument::IS_ARRAY, $this->trans('commands.user.password.hash.options.password')); + ->addArgument('password', InputArgument::IS_ARRAY, $this->trans('commands.user.password.hash.options.password')) + ->setAliases(['usph']); } /** diff --git a/src/Command/User/PasswordResetCommand.php b/src/Command/User/PasswordResetCommand.php index 9f413992b..00529458e 100644 --- a/src/Command/User/PasswordResetCommand.php +++ b/src/Command/User/PasswordResetCommand.php @@ -57,7 +57,8 @@ protected function configure() ->setDescription($this->trans('commands.user.password.reset.description')) ->setHelp($this->trans('commands.user.password.reset.help')) ->addArgument('user', InputArgument::REQUIRED, $this->trans('commands.user.password.reset.options.user-id')) - ->addArgument('password', InputArgument::REQUIRED, $this->trans('commands.user.password.reset.options.password')); + ->addArgument('password', InputArgument::REQUIRED, $this->trans('commands.user.password.reset.options.password')) + ->setAliases(['uspr']); } /** diff --git a/src/Command/Views/DebugCommand.php b/src/Command/Views/DebugCommand.php index 9136bb887..ed83cf0e3 100644 --- a/src/Command/Views/DebugCommand.php +++ b/src/Command/Views/DebugCommand.php @@ -65,7 +65,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.views.debug.arguments.view-status') - ); + ) + ->setAliases(['vde']); } /** diff --git a/src/Command/Views/DisableCommand.php b/src/Command/Views/DisableCommand.php index 146763ec9..85a386e88 100644 --- a/src/Command/Views/DisableCommand.php +++ b/src/Command/Views/DisableCommand.php @@ -62,7 +62,8 @@ protected function configure() 'view-id', InputArgument::OPTIONAL, $this->trans('commands.views.debug.arguments.view-id') - ); + ) + ->setAliases(['vdi']); } /** diff --git a/src/Command/Views/EnableCommand.php b/src/Command/Views/EnableCommand.php index 898d17eea..7e3a56aa0 100644 --- a/src/Command/Views/EnableCommand.php +++ b/src/Command/Views/EnableCommand.php @@ -63,7 +63,8 @@ protected function configure() 'view-id', InputArgument::OPTIONAL, $this->trans('commands.views.debug.arguments.view-id') - ); + ) + ->setAliases(['ve']); } /** From acec1b261955a38620554b3750d8f4cb4659eebd Mon Sep 17 00:00:00 2001 From: Mauricio Hernandez Date: Tue, 4 Jul 2017 15:35:55 -0600 Subject: [PATCH 262/321] [3380] relocate debug commands (#3387) * 3380 Move ContainerDebug to debug namespace * 3380 Move ContainerDebug to debug namespace remove old file * 3380 remove old local test file * Move debug commands from the root to debug namespace --- config/services/drupal-console/debug.yml | 18 +++++++ config/services/drupal-console/misc.yml | 17 ------- .../ContainerCommand.php} | 48 +++++++++---------- .../EventCommand.php} | 36 +++++++------- .../PermissionCommand.php} | 26 +++++----- .../PluginCommand.php} | 30 ++++++------ 6 files changed, 88 insertions(+), 87 deletions(-) create mode 100644 config/services/drupal-console/debug.yml rename src/Command/{ContainerDebugCommand.php => Debug/ContainerCommand.php} (82%) rename src/Command/{EventDebugCommand.php => Debug/EventCommand.php} (83%) rename src/Command/{PermissionDebugCommand.php => Debug/PermissionCommand.php} (79%) rename src/Command/{PluginDebugCommand.php => Debug/PluginCommand.php} (80%) diff --git a/config/services/drupal-console/debug.yml b/config/services/drupal-console/debug.yml new file mode 100644 index 000000000..c7b019172 --- /dev/null +++ b/config/services/drupal-console/debug.yml @@ -0,0 +1,18 @@ +services: + console.container_debug: + class: Drupal\Console\Command\Debug\ContainerCommand + tags: + - { name: drupal.command } + console.event_debug: + class: Drupal\Console\Command\Debug\EventCommand + arguments: ['@event_dispatcher'] + tags: + - { name: drupal.command } + console.permission_debug: + class: Drupal\Console\Command\Debug\PermissionCommand + tags: + - { name: drupal.command } + console.plugin_debug: + class: Drupal\Console\Command\Debug\PluginCommand + tags: + - { name: drupal.command } diff --git a/config/services/drupal-console/misc.yml b/config/services/drupal-console/misc.yml index 5dd1d6bc7..9fad17087 100644 --- a/config/services/drupal-console/misc.yml +++ b/config/services/drupal-console/misc.yml @@ -1,21 +1,4 @@ services: - console.container_debug: - class: Drupal\Console\Command\ContainerDebugCommand - tags: - - { name: drupal.command } - console.plugin_debug: - class: Drupal\Console\Command\PluginDebugCommand - tags: - - { name: drupal.command } - console.permission_debug: - class: Drupal\Console\Command\PermissionDebugCommand - tags: - - { name: drupal.command } - console.event_debug: - class: Drupal\Console\Command\EventDebugCommand - arguments: ['@event_dispatcher'] - tags: - - { name: drupal.command } console.devel_dumper: class: Drupal\Console\Command\DevelDumperCommand arguments: ['@?plugin.manager.devel_dumper'] diff --git a/src/Command/ContainerDebugCommand.php b/src/Command/Debug/ContainerCommand.php similarity index 82% rename from src/Command/ContainerDebugCommand.php rename to src/Command/Debug/ContainerCommand.php index 6dff3778e..5dc1d5637 100644 --- a/src/Command/ContainerDebugCommand.php +++ b/src/Command/Debug/ContainerCommand.php @@ -5,7 +5,7 @@ * Contains \Drupal\Console\Command\ContainerDebugCommand. */ -namespace Drupal\Console\Command; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -17,11 +17,11 @@ use Drupal\Console\Core\Style\DrupalStyle; /** - * Class ContainerDebugCommand + * Class ContainerCommand * - * @package Drupal\Console\Command + * @package Drupal\Console\Command\Debug */ -class ContainerDebugCommand extends Command +class ContainerCommand extends Command { use ContainerAwareCommandTrait; @@ -31,26 +31,26 @@ class ContainerDebugCommand extends Command protected function configure() { $this - ->setName('container:debug') - ->setDescription($this->trans('commands.container.debug.description')) + ->setName('debug:container') + ->setDescription($this->trans('commands.debug.container.description')) ->addOption( 'parameters', null, InputOption::VALUE_NONE, - $this->trans('commands.container.debug.arguments.service') + $this->trans('commands.debug.container.arguments.service') ) ->addArgument( 'service', InputArgument::OPTIONAL, - $this->trans('commands.container.debug.arguments.service') + $this->trans('commands.debug.container.arguments.service') )->addArgument( 'method', InputArgument::OPTIONAL, - $this->trans('commands.container.debug.arguments.method') + $this->trans('commands.debug.container.arguments.method') )->addArgument( 'arguments', InputArgument::OPTIONAL, - $this->trans('commands.container.debug.arguments.arguments') + $this->trans('commands.debug.container.arguments.arguments') ) ->setAliases(['cod']); } @@ -90,8 +90,8 @@ protected function execute(InputInterface $input, OutputInterface $output) } $tableHeader = [ - $this->trans('commands.container.debug.messages.service_id'), - $this->trans('commands.container.debug.messages.class_name') + $this->trans('commands.debug.container.messages.service_id'), + $this->trans('commands.debug.container.messages.class_name') ]; $tableRows = $this->getServiceList(); @@ -114,33 +114,33 @@ private function getCallbackReturnList($service, $method, $args) $serviceInstance = \Drupal::service($service); if (!method_exists($serviceInstance, $method)) { - throw new \Symfony\Component\DependencyInjection\Exception\BadMethodCallException($this->trans('commands.container.debug.errors.method_not_exists')); + throw new \Symfony\Component\DependencyInjection\Exception\BadMethodCallException($this->trans('commands.debug.container.errors.method_not_exists')); return $serviceDetail; } $serviceDetail[] = [ - ''.$this->trans('commands.container.debug.messages.service').'', + ''.$this->trans('commands.debug.container.messages.service').'', ''.$service.'' ]; $serviceDetail[] = [ - ''.$this->trans('commands.container.debug.messages.class').'', + ''.$this->trans('commands.debug.container.messages.class').'', ''.get_class($serviceInstance).'' ]; $methods = [$method]; $this->extendArgumentList($serviceInstance, $methods); $serviceDetail[] = [ - ''.$this->trans('commands.container.debug.messages.method').'', + ''.$this->trans('commands.debug.container.messages.method').'', ''.$methods[0].'' ]; if ($parsedArgs) { $serviceDetail[] = [ - ''.$this->trans('commands.container.debug.messages.arguments').'', + ''.$this->trans('commands.debug.container.messages.arguments').'', json_encode($parsedArgs, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) ]; } $return = call_user_func_array([$serviceInstance,$method], $parsedArgs); $serviceDetail[] = [ - ''.$this->trans('commands.container.debug.messages.return').'', + ''.$this->trans('commands.debug.container.messages.return').'', json_encode($return, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) ]; return $serviceDetail; @@ -169,29 +169,29 @@ private function getServiceDetail($service) if ($serviceInstance) { $serviceDetail[] = [ - ''.$this->trans('commands.container.debug.messages.service').'', + ''.$this->trans('commands.debug.container.messages.service').'', ''.$service.'' ]; $serviceDetail[] = [ - ''.$this->trans('commands.container.debug.messages.class').'', + ''.$this->trans('commands.debug.container.messages.class').'', ''.get_class($serviceInstance).'' ]; $interface = str_replace("{ }", "", Yaml::dump(class_implements($serviceInstance))); if (!empty($interface)) { $serviceDetail[] = [ - ''.$this->trans('commands.container.debug.messages.interface').'', + ''.$this->trans('commands.debug.container.messages.interface').'', ''.$interface.'' ]; } if ($parent = get_parent_class($serviceInstance)) { $serviceDetail[] = [ - ''.$this->trans('commands.container.debug.messages.parent').'', + ''.$this->trans('commands.debug.container.messages.parent').'', ''.$parent.'' ]; } if ($vars = get_class_vars($serviceInstance)) { $serviceDetail[] = [ - ''.$this->trans('commands.container.debug.messages.variables').'', + ''.$this->trans('commands.debug.container.messages.variables').'', ''.Yaml::dump($vars).'' ]; } @@ -199,7 +199,7 @@ private function getServiceDetail($service) sort($methods); $this->extendArgumentList($serviceInstance, $methods); $serviceDetail[] = [ - ''.$this->trans('commands.container.debug.messages.methods').'', + ''.$this->trans('commands.debug.container.messages.methods').'', ''.implode("\n", $methods).'' ]; } diff --git a/src/Command/EventDebugCommand.php b/src/Command/Debug/EventCommand.php similarity index 83% rename from src/Command/EventDebugCommand.php rename to src/Command/Debug/EventCommand.php index 71107fe4b..f3584a909 100644 --- a/src/Command/EventDebugCommand.php +++ b/src/Command/Debug/EventCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\EventDebugCommand. + * Contains \Drupal\Console\Command\EventCommand. */ -namespace Drupal\Console\Command; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -16,11 +16,11 @@ use Drupal\Console\Core\Style\DrupalStyle; /** - * Class EventDebugCommand + * Class EventCommand * - * @package Drupal\Console\Command + * @package Drupal\Console\Command\Debug */ -class EventDebugCommand extends Command +class EventCommand extends Command { use CommandTrait; @@ -43,15 +43,15 @@ public function __construct($eventDispatcher) protected function configure() { $this - ->setName('event:debug') - ->setDescription($this->trans('commands.event.debug.description')) + ->setName('debug:event') + ->setDescription($this->trans('commands.debug.event.description')) ->addArgument( 'event', InputArgument::OPTIONAL, - $this->trans('commands.event.debug.arguments.event'), + $this->trans('commands.debug.event.arguments.event'), null ) - ->setHelp($this->trans('commands.event.debug.help')); + ->setHelp($this->trans('commands.debug.event.blerp')); } /** @@ -63,20 +63,20 @@ protected function execute(InputInterface $input, OutputInterface $output) $events = array_keys($this->eventDispatcher->getListeners()); $event = $input->getArgument('event'); - + if ($event) { if (!in_array($event, $events)) { throw new \Exception( sprintf( - $this->trans('commands.event.debug.messages.no-events'), + $this->trans('commands.debug.event.messages.no-events'), $event ) ); } - + $dispatcher = $this->eventDispatcher->getListeners($event); $listeners = []; - + foreach ($dispatcher as $key => $value) { $reflection = new \ReflectionClass(get_class($value[0])); $className = $reflection->getName(); @@ -117,10 +117,10 @@ protected function execute(InputInterface $input, OutputInterface $output) 'events' => Yaml::dump($subscribedEventData, 4, 2) ]; } - + $tableHeader = [ - $this->trans('commands.event.debug.messages.class'), - $this->trans('commands.event.debug.messages.method'), + $this->trans('commands.debug.event.messages.class'), + $this->trans('commands.debug.event.messages.method'), ]; $tableRows = []; @@ -135,9 +135,9 @@ protected function execute(InputInterface $input, OutputInterface $output) return 0; } - + $io->table( - [$this->trans('commands.event.debug.messages.event')], + [$this->trans('commands.debug.event.messages.event')], $events ); } diff --git a/src/Command/PermissionDebugCommand.php b/src/Command/Debug/PermissionCommand.php similarity index 79% rename from src/Command/PermissionDebugCommand.php rename to src/Command/Debug/PermissionCommand.php index f32eb504f..d94fe62e5 100644 --- a/src/Command/PermissionDebugCommand.php +++ b/src/Command/Debug/PermissionCommand.php @@ -5,7 +5,7 @@ * Contains \Drupal\Console\Command\PermissionDebugCommand. */ -namespace Drupal\Console\Command; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -17,9 +17,9 @@ /** * Class DebugCommand * - * @package Drupal\Console\Command + * @package Drupal\Console\Command\Debug */ -class PermissionDebugCommand extends Command +class PermissionCommand extends Command { use ContainerAwareCommandTrait; /** @@ -27,13 +27,13 @@ class PermissionDebugCommand extends Command */ protected function configure() { - $this->setName('permission:debug') - ->setDescription($this->trans('commands.permission.debug.description')) - ->setHelp($this->trans('commands.permission.debug.help')) + $this->setName('debug:permission') + ->setDescription($this->trans('commands.debug.permission.description')) + ->setHelp($this->trans('commands.debug.permission.help')) ->addArgument( 'role', InputArgument::OPTIONAL, - $this->trans('commands.permission.debug.arguments.role') + $this->trans('commands.debug.permission.arguments.role') ); } @@ -48,9 +48,9 @@ protected function execute(InputInterface $input, OutputInterface $output) // No role specified, show a list of ALL permissions. if (!$role) { $tableHeader = [ - $this->trans('commands.permission.debug.table-headers.permission-name'), - $this->trans('commands.permission.debug.table-headers.permission-label'), - $this->trans('commands.permission.debug.table-headers.permission-role') + $this->trans('commands.debug.permission.table-headers.permission-name'), + $this->trans('commands.debug.permission.table-headers.permission-label'), + $this->trans('commands.debug.permission.table-headers.permission-role') ]; $tableRows = []; $permissions = \Drupal::service('user.permissions')->getPermissions(); @@ -68,14 +68,14 @@ protected function execute(InputInterface $input, OutputInterface $output) return true; } else { $tableHeader = [ - $this->trans('commands.permission.debug.table-headers.permission-name'), - $this->trans('commands.permission.debug.table-headers.permission-label') + $this->trans('commands.debug.permission.table-headers.permission-name'), + $this->trans('commands.debug.permission.table-headers.permission-label') ]; $tableRows = []; $permissions = \Drupal::service('user.permissions')->getPermissions(); $roles = user_roles(); if (empty($roles[$role])) { - $message = sprintf($this->trans('commands.permission.debug.messages.role-error'), $role); + $message = sprintf($this->trans('commands.debug.permission.messages.role-error'), $role); $io->error($message); return true; } diff --git a/src/Command/PluginDebugCommand.php b/src/Command/Debug/PluginCommand.php similarity index 80% rename from src/Command/PluginDebugCommand.php rename to src/Command/Debug/PluginCommand.php index 3f3ebe9b1..58240874e 100644 --- a/src/Command/PluginDebugCommand.php +++ b/src/Command/Debug/PluginCommand.php @@ -5,7 +5,7 @@ * Contains \Drupal\Console\Command\PluginDebugCommand. */ -namespace Drupal\Console\Command; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -18,9 +18,9 @@ /** * Class DebugCommand * - * @package Drupal\Console\Command + * @package Drupal\Console\Command\Debug */ -class PluginDebugCommand extends Command +class PluginCommand extends Command { use ContainerAwareCommandTrait; /** @@ -28,18 +28,18 @@ class PluginDebugCommand extends Command */ protected function configure() { - $this->setName('plugin:debug') - ->setDescription($this->trans('commands.plugin.debug.description')) - ->setHelp($this->trans('commands.plugin.debug.help')) + $this->setName('debug:plugin') + ->setDescription($this->trans('commands.debug.plugin.description')) + ->setHelp($this->trans('commands.debug.plugin.help')) ->addArgument( 'type', InputArgument::OPTIONAL, - $this->trans('commands.plugin.debug.arguments.type') + $this->trans('commands.debug.plugin.arguments.type') ) ->addArgument( 'id', InputArgument::OPTIONAL, - $this->trans('commands.plugin.debug.arguments.id') + $this->trans('commands.debug.plugin.arguments.id') ); } @@ -56,8 +56,8 @@ protected function execute(InputInterface $input, OutputInterface $output) // No plugin type specified, show a list of plugin types. if (!$pluginType) { $tableHeader = [ - $this->trans('commands.plugin.debug.table-headers.plugin-type-name'), - $this->trans('commands.plugin.debug.table-headers.plugin-type-class') + $this->trans('commands.debug.plugin.table-headers.plugin-type-name'), + $this->trans('commands.debug.plugin.table-headers.plugin-type-class') ]; $tableRows = []; $serviceDefinitions = $this->container @@ -83,7 +83,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if (!$service) { $io->error( sprintf( - $this->trans('commands.plugin.debug.errors.plugin-type-not-found'), + $this->trans('commands.debug.plugin.errors.plugin-type-not-found'), $pluginType ) ); @@ -93,8 +93,8 @@ protected function execute(InputInterface $input, OutputInterface $output) // Valid plugin type specified, no ID specified, show list of instances. if (!$pluginId) { $tableHeader = [ - $this->trans('commands.plugin.debug.table-headers.plugin-id'), - $this->trans('commands.plugin.debug.table-headers.plugin-class') + $this->trans('commands.debug.plugin.table-headers.plugin-id'), + $this->trans('commands.debug.plugin.table-headers.plugin-class') ]; $tableRows = []; foreach ($service->getDefinitions() as $definition) { @@ -110,8 +110,8 @@ protected function execute(InputInterface $input, OutputInterface $output) // Valid plugin type specified, ID specified, show the definition. $definition = $service->getDefinition($pluginId); $tableHeader = [ - $this->trans('commands.plugin.debug.table-headers.definition-key'), - $this->trans('commands.plugin.debug.table-headers.definition-value') + $this->trans('commands.debug.plugin.table-headers.definition-key'), + $this->trans('commands.debug.plugin.table-headers.definition-value') ]; $tableRows = []; foreach ($definition as $key => $value) { From 7149fdb75ebf2d0e6eb311f2dbe46fc607cc91d7 Mon Sep 17 00:00:00 2001 From: Johannes Haseitl Date: Wed, 5 Jul 2017 17:09:31 +0200 Subject: [PATCH 263/321] Fix revision revert path for untranslatable content (#3372) --- templates/module/src/Entity/entity-content.php.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/module/src/Entity/entity-content.php.twig b/templates/module/src/Entity/entity-content.php.twig index 018d2c0d6..f1088f3f8 100644 --- a/templates/module/src/Entity/entity-content.php.twig +++ b/templates/module/src/Entity/entity-content.php.twig @@ -94,11 +94,11 @@ use Drupal\user\UserInterface; {% if revisionable %} * "version-history" = "{{ base_path }}/{{ entity_name }}/{{ '{'~entity_name~'}' }}/revisions", * "revision" = "{{ base_path }}/{{ entity_name }}/{{ '{'~entity_name~'}' }}/revisions/{{ '{'~entity_name~'_revision}' }}/view", -{% if is_translatable %} * "revision_revert" = "{{ base_path }}/{{ entity_name }}/{{ '{'~entity_name~'}' }}/revisions/{{ '{'~entity_name~'_revision}' }}/revert", + * "revision_delete" = "{{ base_path }}/{{ entity_name }}/{{ '{'~entity_name~'}' }}/revisions/{{ '{'~entity_name~'_revision}' }}/delete", +{% if is_translatable %} * "translation_revert" = "{{ base_path }}/{{ entity_name }}/{{ '{'~entity_name~'}' }}/revisions/{{ '{'~entity_name~'_revision}' }}/revert/{langcode}", {% endif %} - * "revision_delete" = "{{ base_path }}/{{ entity_name }}/{{ '{'~entity_name~'}' }}/revisions/{{ '{'~entity_name~'_revision}' }}/delete", {% endif %} * "collection" = "{{ base_path }}/{{ entity_name }}", * }, From 8d467602872c0a43aa8d1f51679caa1c5b9c5d35 Mon Sep 17 00:00:00 2001 From: GDrupal Date: Wed, 5 Jul 2017 12:19:26 -0300 Subject: [PATCH 264/321] [config:diff]:fix bug with directory parameter. (#3373) (#3388) --- src/Command/Config/DiffCommand.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Command/Config/DiffCommand.php b/src/Command/Config/DiffCommand.php index 83470488e..c8afc9705 100644 --- a/src/Command/Config/DiffCommand.php +++ b/src/Command/Config/DiffCommand.php @@ -94,7 +94,7 @@ protected function interact(InputInterface $input, OutputInterface $output) if (!$directory) { $directory = $io->choice( $this->trans('commands.config.diff.questions.directories'), - array_keys($config_directories), + $config_directories, CONFIG_SYNC_DIRECTORY ); @@ -107,8 +107,12 @@ protected function interact(InputInterface $input, OutputInterface $output) */ protected function execute(InputInterface $input, OutputInterface $output) { + global $config_directories; $io = new DrupalStyle($input, $output); - $directory = $input->getArgument('directory'); + $directory = $input->getArgument('directory') ?: CONFIG_SYNC_DIRECTORY; + if (array_key_exists($directory, $config_directories)) { + $directory = $config_directories[$directory]; + } $source_storage = new FileStorage($directory); if ($input->getOption('reverse')) { From ad2b98d62e5c67cff17104fc35022d7776404c87 Mon Sep 17 00:00:00 2001 From: CoyoteRulea Date: Wed, 5 Jul 2017 10:22:19 -0500 Subject: [PATCH 265/321] [console] Indent commands options. (#3389) * Indentation for Module File Command * DeleteTermCommand properly indexed * Debug command properly indexed * Downlowd command arguments properly indexed * Install command arguments properly indexed * unistall command arguments, porperly indexed * Create command parameters properly indexed * Login clean attemps command properly indexed * Password hash command properly indexed * Password reset command properly indexed --- src/Command/Generate/ModuleFileCommand.php | 7 +++- src/Command/Taxonomy/DeleteTermCommand.php | 5 ++- src/Command/Theme/DebugCommand.php | 6 +++- src/Command/Theme/DownloadCommand.php | 12 +++++-- src/Command/Theme/InstallCommand.php | 6 +++- src/Command/Theme/UninstallCommand.php | 6 +++- src/Command/User/CreateCommand.php | 33 ++++++++++++++++--- .../User/LoginCleanAttemptsCommand.php | 6 +++- src/Command/User/PasswordHashCommand.php | 6 +++- src/Command/User/PasswordResetCommand.php | 12 +++++-- 10 files changed, 83 insertions(+), 16 deletions(-) diff --git a/src/Command/Generate/ModuleFileCommand.php b/src/Command/Generate/ModuleFileCommand.php index 3b08b740d..e28c8ac33 100644 --- a/src/Command/Generate/ModuleFileCommand.php +++ b/src/Command/Generate/ModuleFileCommand.php @@ -64,7 +64,12 @@ protected function configure() ->setName('generate:module:file') ->setDescription($this->trans('commands.generate.module.file.description')) ->setHelp($this->trans('commands.generate.module.file.help')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')); + ->addOption( + 'module', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.common.options.module') + ); } /** diff --git a/src/Command/Taxonomy/DeleteTermCommand.php b/src/Command/Taxonomy/DeleteTermCommand.php index 097535d09..62e2ff955 100644 --- a/src/Command/Taxonomy/DeleteTermCommand.php +++ b/src/Command/Taxonomy/DeleteTermCommand.php @@ -47,7 +47,10 @@ protected function configure() $this ->setName('taxonomy:term:delete') ->setDescription($this->trans('commands.taxonomy.term.delete.description')) - ->addArgument('vid', InputArgument::REQUIRED); + ->addArgument( + 'vid', + InputArgument::REQUIRED + ); } /** diff --git a/src/Command/Theme/DebugCommand.php b/src/Command/Theme/DebugCommand.php index 88d094f84..bbdc531b5 100644 --- a/src/Command/Theme/DebugCommand.php +++ b/src/Command/Theme/DebugCommand.php @@ -50,7 +50,11 @@ protected function configure() $this ->setName('theme:debug') ->setDescription($this->trans('commands.theme.debug.description')) - ->addArgument('theme', InputArgument::OPTIONAL, $this->trans('commands.theme.debug.arguments.theme')) + ->addArgument( + 'theme', + InputArgument::OPTIONAL, + $this->trans('commands.theme.debug.arguments.theme') + ) ->setAliases(['tde']); } diff --git a/src/Command/Theme/DownloadCommand.php b/src/Command/Theme/DownloadCommand.php index 8710da998..315602701 100644 --- a/src/Command/Theme/DownloadCommand.php +++ b/src/Command/Theme/DownloadCommand.php @@ -67,8 +67,16 @@ protected function configure() $this ->setName('theme:download') ->setDescription($this->trans('commands.theme.download.description')) - ->addArgument('theme', InputArgument::REQUIRED, $this->trans('commands.theme.download.arguments.theme')) - ->addArgument('version', InputArgument::OPTIONAL, $this->trans('commands.theme.download.arguments.version')) + ->addArgument( + 'theme', + InputArgument::REQUIRED, + $this->trans('commands.theme.download.arguments.theme') + ) + ->addArgument( + 'version', + InputArgument::OPTIONAL, + $this->trans('commands.theme.download.arguments.version') + ) ->addOption( 'composer', null, diff --git a/src/Command/Theme/InstallCommand.php b/src/Command/Theme/InstallCommand.php index 19aee7fc1..61d348ae6 100644 --- a/src/Command/Theme/InstallCommand.php +++ b/src/Command/Theme/InstallCommand.php @@ -61,7 +61,11 @@ protected function configure() $this ->setName('theme:install') ->setDescription($this->trans('commands.theme.install.description')) - ->addArgument('theme', InputArgument::IS_ARRAY, $this->trans('commands.theme.install.options.module')) + ->addArgument( + 'theme', + InputArgument::IS_ARRAY, + $this->trans('commands.theme.install.options.module') + ) ->addOption( 'set-default', null, diff --git a/src/Command/Theme/UninstallCommand.php b/src/Command/Theme/UninstallCommand.php index 4d8aba773..fdadd2cb8 100644 --- a/src/Command/Theme/UninstallCommand.php +++ b/src/Command/Theme/UninstallCommand.php @@ -60,7 +60,11 @@ protected function configure() $this ->setName('theme:uninstall') ->setDescription($this->trans('commands.theme.uninstall.description')) - ->addArgument('theme', InputArgument::IS_ARRAY, $this->trans('commands.theme.uninstall.options.module')) + ->addArgument( + 'theme', + InputArgument::IS_ARRAY, + $this->trans('commands.theme.uninstall.options.module') + ) ->setAliases(['tu']); } diff --git a/src/Command/User/CreateCommand.php b/src/Command/User/CreateCommand.php index aece1e29a..0a5480e28 100644 --- a/src/Command/User/CreateCommand.php +++ b/src/Command/User/CreateCommand.php @@ -76,11 +76,34 @@ protected function configure() ->setName('user:create') ->setDescription($this->trans('commands.user.create.description')) ->setHelp($this->trans('commands.user.create.help')) - ->addArgument('username', InputArgument::OPTIONAL, $this->trans('commands.user.create.options.username')) - ->addArgument('password', InputArgument::OPTIONAL, $this->trans('commands.user.create.options.password')) - ->addOption('roles', null, InputOption::VALUE_OPTIONAL, $this->trans('commands.user.create.options.roles')) - ->addOption('email', null, InputOption::VALUE_OPTIONAL, $this->trans('commands.user.create.options.email')) - ->addOption('status', null, InputOption::VALUE_OPTIONAL, $this->trans('commands.user.create.options.status')); + ->addArgument( + 'username', + InputArgument::OPTIONAL, + $this->trans('commands.user.create.options.username') + ) + ->addArgument( + 'password', + InputArgument::OPTIONAL, + $this->trans('commands.user.create.options.password') + ) + ->addOption( + 'roles', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.user.create.options.roles') + ) + ->addOption( + 'email', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.user.create.options.email') + ) + ->addOption( + 'status', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.user.create.options.status') + ); } /** diff --git a/src/Command/User/LoginCleanAttemptsCommand.php b/src/Command/User/LoginCleanAttemptsCommand.php index 0995a2629..3acf20e5e 100644 --- a/src/Command/User/LoginCleanAttemptsCommand.php +++ b/src/Command/User/LoginCleanAttemptsCommand.php @@ -47,7 +47,11 @@ protected function configure() setName('user:login:clear:attempts') ->setDescription($this->trans('commands.user.login.clear.attempts.description')) ->setHelp($this->trans('commands.user.login.clear.attempts.help')) - ->addArgument('uid', InputArgument::REQUIRED, $this->trans('commands.user.login.clear.attempts.options.user-id')) + ->addArgument( + 'uid', + InputArgument::REQUIRED, + $this->trans('commands.user.login.clear.attempts.options.user-id') + ) ->setAliases(['uslca']); } diff --git a/src/Command/User/PasswordHashCommand.php b/src/Command/User/PasswordHashCommand.php index 9d3a48823..386b54ad5 100644 --- a/src/Command/User/PasswordHashCommand.php +++ b/src/Command/User/PasswordHashCommand.php @@ -46,7 +46,11 @@ protected function configure() ->setName('user:password:hash') ->setDescription($this->trans('commands.user.password.hash.description')) ->setHelp($this->trans('commands.user.password.hash.help')) - ->addArgument('password', InputArgument::IS_ARRAY, $this->trans('commands.user.password.hash.options.password')) + ->addArgument( + 'password', + InputArgument::IS_ARRAY, + $this->trans('commands.user.password.hash.options.password') + ) ->setAliases(['usph']); } diff --git a/src/Command/User/PasswordResetCommand.php b/src/Command/User/PasswordResetCommand.php index 00529458e..4ef5d620c 100644 --- a/src/Command/User/PasswordResetCommand.php +++ b/src/Command/User/PasswordResetCommand.php @@ -56,8 +56,16 @@ protected function configure() ->setName('user:password:reset') ->setDescription($this->trans('commands.user.password.reset.description')) ->setHelp($this->trans('commands.user.password.reset.help')) - ->addArgument('user', InputArgument::REQUIRED, $this->trans('commands.user.password.reset.options.user-id')) - ->addArgument('password', InputArgument::REQUIRED, $this->trans('commands.user.password.reset.options.password')) + ->addArgument( + 'user', + InputArgument::REQUIRED, + $this->trans('commands.user.password.reset.options.user-id') + ) + ->addArgument( + 'password', + InputArgument::REQUIRED, + $this->trans('commands.user.password.reset.options.password') + ) ->setAliases(['uspr']); } From 5eda387e98db1eba1eebf5fb257904280055b4d7 Mon Sep 17 00:00:00 2001 From: CoyoteRulea Date: Wed, 5 Jul 2017 10:23:21 -0500 Subject: [PATCH 266/321] Translations changed to the same in form command (#3391) --- src/Command/Shared/MenuTrait.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Command/Shared/MenuTrait.php b/src/Command/Shared/MenuTrait.php index ecb510e48..faa083c85 100644 --- a/src/Command/Shared/MenuTrait.php +++ b/src/Command/Shared/MenuTrait.php @@ -26,7 +26,7 @@ trait MenuTrait public function menuQuestion(DrupalStyle $io, $className) { if ($io->confirm( - $this->trans('commands.generate.form.questions.menu_link_gen'), + $this->trans('commands.generate.form.options.menu-link-gen'), true ) ) { @@ -36,7 +36,7 @@ public function menuQuestion(DrupalStyle $io, $className) 'menu_link_gen' => true, ]; $menu_link_title = $io->ask( - $menu_link_title = $this->trans('commands.generate.form.questions.menu_link_title'), + $menu_link_title = $this->trans('commands.generate.form.options.menu-link-title'), $className ); $menuLinkFile = sprintf( @@ -49,13 +49,13 @@ public function menuQuestion(DrupalStyle $io, $className) $menu_parent = $io->choiceNoList( - $menu_parent = $this->trans('commands.generate.form.questions.menu_parent'), + $menu_parent = $this->trans('commands.generate.form.options.menu-parent'), array_keys($menuLinkContent), 'system.admin_config_system' ); $menu_link_desc = $io->ask( - $menu_link_desc = $this->trans('commands.generate.form.questions.menu_link_desc'), + $menu_link_desc = $this->trans('commands.generate.form.options.menu-link-desc'), 'A description for the menu entry' ); $menu_options['menu_link_title'] = $menu_link_title; From 5da2344b734c9ef0227040801848fb19d4826222 Mon Sep 17 00:00:00 2001 From: Mauricio Hernandez Date: Wed, 5 Jul 2017 09:25:45 -0600 Subject: [PATCH 267/321] Move views:plugins:debug to debug:views:plugins (#3390) --- config/services/drupal-console/debug.yml | 4 ++++ config/services/drupal-console/views.yml | 4 ---- .../ViewsPluginsCommand.php} | 24 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) rename src/Command/{Views/PluginsDebugCommand.php => Debug/ViewsPluginsCommand.php} (72%) diff --git a/config/services/drupal-console/debug.yml b/config/services/drupal-console/debug.yml index c7b019172..6a796a0d6 100644 --- a/config/services/drupal-console/debug.yml +++ b/config/services/drupal-console/debug.yml @@ -16,3 +16,7 @@ services: class: Drupal\Console\Command\Debug\PluginCommand tags: - { name: drupal.command } + console.views_plugins_debug: + class: Drupal\Console\Command\Debug\ViewsPluginsCommand + tags: + - { name: drupal.command } diff --git a/config/services/drupal-console/views.yml b/config/services/drupal-console/views.yml index 97f856b7a..d5ad8ea1b 100644 --- a/config/services/drupal-console/views.yml +++ b/config/services/drupal-console/views.yml @@ -14,7 +14,3 @@ services: arguments: ['@entity_type.manager'] tags: - { name: drupal.command } - console.views_plugins_debug: - class: Drupal\Console\Command\Views\PluginsDebugCommand - tags: - - { name: drupal.command } diff --git a/src/Command/Views/PluginsDebugCommand.php b/src/Command/Debug/ViewsPluginsCommand.php similarity index 72% rename from src/Command/Views/PluginsDebugCommand.php rename to src/Command/Debug/ViewsPluginsCommand.php index 8e24ef24c..7a3e9884c 100644 --- a/src/Command/Views/PluginsDebugCommand.php +++ b/src/Command/Debug/ViewsPluginsCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Views\PluginsDebugCommand. + * Contains \Drupal\Console\Command\Debug\ViewsPluginsCommand. */ -namespace Drupal\Console\Command\Views; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -16,11 +16,11 @@ use Drupal\views\Views; /** - * Class PluginsDebugCommand + * Class ViewsPluginsCommand * - * @package Drupal\Console\Command\Views + * @package Drupal\Console\Command\Debug */ -class PluginsDebugCommand extends Command +class ViewsPluginsCommand extends Command { use ContainerAwareCommandTrait; /** @@ -29,12 +29,12 @@ class PluginsDebugCommand extends Command protected function configure() { $this - ->setName('views:plugins:debug') - ->setDescription($this->trans('commands.views.plugins.debug.description')) + ->setName('debug:views:plugins') + ->setDescription($this->trans('commands.debug.views.plugins.description')) ->addArgument( 'type', InputArgument::OPTIONAL, - $this->trans('commands.views.plugins.debug.arguments.type') + $this->trans('commands.debug.views.plugins.arguments.type') ); } @@ -76,10 +76,10 @@ protected function pluginList(DrupalStyle $io, $type) $tableHeader = [ - $this->trans('commands.views.plugins.debug.messages.type'), - $this->trans('commands.views.plugins.debug.messages.name'), - $this->trans('commands.views.plugins.debug.messages.provider'), - $this->trans('commands.views.plugins.debug.messages.views'), + $this->trans('commands.debug.views.plugins.messages.type'), + $this->trans('commands.debug.views.plugins.messages.name'), + $this->trans('commands.debug.views.plugins.messages.provider'), + $this->trans('commands.debug.views.plugins.messages.views'), ]; $io->table($tableHeader, $rows, 'compact'); From 7f997db0ee0f62f91f6bc71963cca2a779235246 Mon Sep 17 00:00:00 2001 From: Mauricio Hernandez Date: Wed, 5 Jul 2017 09:57:28 -0600 Subject: [PATCH 268/321] Move views:debug to debug:views (#3393) --- config/services/drupal-console/debug.yml | 5 ++ config/services/drupal-console/views.yml | 4 +- .../ViewsCommand.php} | 52 +++++++++---------- 3 files changed, 33 insertions(+), 28 deletions(-) rename src/Command/{Views/DebugCommand.php => Debug/ViewsCommand.php} (79%) diff --git a/config/services/drupal-console/debug.yml b/config/services/drupal-console/debug.yml index 6a796a0d6..597bfa4c1 100644 --- a/config/services/drupal-console/debug.yml +++ b/config/services/drupal-console/debug.yml @@ -16,6 +16,11 @@ services: class: Drupal\Console\Command\Debug\PluginCommand tags: - { name: drupal.command } + console.views_debug: + class: Drupal\Console\Command\Debug\ViewsCommand + arguments: ['@entity_type.manager'] + tags: + - { name: drupal.command } console.views_plugins_debug: class: Drupal\Console\Command\Debug\ViewsPluginsCommand tags: diff --git a/config/services/drupal-console/views.yml b/config/services/drupal-console/views.yml index d5ad8ea1b..823603ee1 100644 --- a/config/services/drupal-console/views.yml +++ b/config/services/drupal-console/views.yml @@ -9,8 +9,8 @@ services: arguments: ['@entity_type.manager', '@entity.query'] tags: - { name: drupal.command } - console.views_debug: - class: Drupal\Console\Command\Views\DebugCommand + console.views_plugins_debug: + class: Drupal\Console\Command\Views\PluginsDebugCommand arguments: ['@entity_type.manager'] tags: - { name: drupal.command } diff --git a/src/Command/Views/DebugCommand.php b/src/Command/Debug/ViewsCommand.php similarity index 79% rename from src/Command/Views/DebugCommand.php rename to src/Command/Debug/ViewsCommand.php index ed83cf0e3..b11e98c83 100644 --- a/src/Command/Views/DebugCommand.php +++ b/src/Command/Debug/ViewsCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Views\DebugCommand. + * Contains \Drupal\Console\Command\Debug\ViewsCommand. */ -namespace Drupal\Console\Command\Views; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; @@ -18,11 +18,11 @@ use Drupal\Console\Core\Style\DrupalStyle; /** - * Class DebugCommand + * Class ViewsCommand * - * @package Drupal\Console\Command\Views + * @package Drupal\Console\Command\Debug */ -class DebugCommand extends Command +class ViewsCommand extends Command { use CommandTrait; @@ -48,23 +48,23 @@ public function __construct(EntityTypeManagerInterface $entityTypeManager) protected function configure() { $this - ->setName('views:debug') - ->setDescription($this->trans('commands.views.debug.description')) + ->setName('debug:views') + ->setDescription($this->trans('commands.debug.views.description')) ->addArgument( 'view-id', InputArgument::OPTIONAL, - $this->trans('commands.views.debug.arguments.view-id') + $this->trans('commands.debug.views.arguments.view-id') ) ->addOption( 'tag', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.views.debug.arguments.view-tag') + $this->trans('commands.debug.views.arguments.view-tag') )->addOption( 'status', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.views.debug.arguments.view-status') + $this->trans('commands.debug.views.arguments.view-status') ) ->setAliases(['vde']); } @@ -105,31 +105,31 @@ private function viewDetail(DrupalStyle $io, $view_id) $view = $this->entityTypeManager->getStorage('view')->load($view_id); if (empty($view)) { - $io->error(sprintf($this->trans('commands.views.debug.messages.not-found'), $view_id)); + $io->error(sprintf($this->trans('commands.debug.views.messages.not-found'), $view_id)); return false; } $configuration = []; - $configuration [] = [$this->trans('commands.views.debug.messages.view-id'), $view->get('id')]; - $configuration [] = [$this->trans('commands.views.debug.messages.view-name'), (string) $view->get('label')]; - $configuration [] = [$this->trans('commands.views.debug.messages.tag'), $view->get('tag')]; - $configuration [] = [$this->trans('commands.views.debug.messages.status'), $view->status() ? $this->trans('commands.common.status.enabled') : $this->trans('commands.common.status.disabled')]; - $configuration [] = [$this->trans('commands.views.debug.messages.description'), $view->get('description')]; + $configuration [] = [$this->trans('commands.debug.views.messages.view-id'), $view->get('id')]; + $configuration [] = [$this->trans('commands.debug.views.messages.view-name'), (string) $view->get('label')]; + $configuration [] = [$this->trans('commands.debug.views.messages.tag'), $view->get('tag')]; + $configuration [] = [$this->trans('commands.debug.views.messages.status'), $view->status() ? $this->trans('commands.common.status.enabled') : $this->trans('commands.common.status.disabled')]; + $configuration [] = [$this->trans('commands.debug.views.messages.description'), $view->get('description')]; $io->comment($view_id); $io->table([], $configuration); $tableHeader = [ - $this->trans('commands.views.debug.messages.display-id'), - $this->trans('commands.views.debug.messages.display-name'), - $this->trans('commands.views.debug.messages.display-description'), - $this->trans('commands.views.debug.messages.display-paths'), + $this->trans('commands.debug.views.messages.display-id'), + $this->trans('commands.debug.views.messages.display-name'), + $this->trans('commands.debug.views.messages.display-description'), + $this->trans('commands.debug.views.messages.display-paths'), ]; $displays = $this->viewDisplayList($view); - $io->info(sprintf($this->trans('commands.views.debug.messages.display-list'), $view_id)); + $io->info(sprintf($this->trans('commands.debug.views.messages.display-list'), $view_id)); $tableRows = []; foreach ($displays as $display_id => $display) { @@ -154,11 +154,11 @@ protected function viewList(DrupalStyle $io, $tag, $status) $views = $this->entityTypeManager->getStorage('view')->loadMultiple(); $tableHeader = [ - $this->trans('commands.views.debug.messages.view-id'), - $this->trans('commands.views.debug.messages.view-name'), - $this->trans('commands.views.debug.messages.tag'), - $this->trans('commands.views.debug.messages.status'), - $this->trans('commands.views.debug.messages.path') + $this->trans('commands.debug.views.messages.view-id'), + $this->trans('commands.debug.views.messages.view-name'), + $this->trans('commands.debug.views.messages.tag'), + $this->trans('commands.debug.views.messages.status'), + $this->trans('commands.debug.views.messages.path') ]; $tableRows = []; From 36454877ffa5e7ce31961916710aaf4d2a3da7db Mon Sep 17 00:00:00 2001 From: Mauricio Hernandez Date: Wed, 5 Jul 2017 10:05:51 -0600 Subject: [PATCH 269/321] Move user:debug to debug:user (#3394) --- config/services/drupal-console/debug.yml | 5 ++++ config/services/drupal-console/user.yml | 5 ---- .../UserCommand.php} | 30 +++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-) rename src/Command/{User/DebugCommand.php => Debug/UserCommand.php} (85%) diff --git a/config/services/drupal-console/debug.yml b/config/services/drupal-console/debug.yml index 597bfa4c1..0133861c2 100644 --- a/config/services/drupal-console/debug.yml +++ b/config/services/drupal-console/debug.yml @@ -16,6 +16,11 @@ services: class: Drupal\Console\Command\Debug\PluginCommand tags: - { name: drupal.command } + console.user_debug: + class: Drupal\Console\Command\Debug\UserCommand + arguments: ['@entity_type.manager','@entity.query', '@console.drupal_api'] + tags: + - { name: drupal.command } console.views_debug: class: Drupal\Console\Command\Debug\ViewsCommand arguments: ['@entity_type.manager'] diff --git a/config/services/drupal-console/user.yml b/config/services/drupal-console/user.yml index bf9bc16b3..60e9da724 100644 --- a/config/services/drupal-console/user.yml +++ b/config/services/drupal-console/user.yml @@ -1,9 +1,4 @@ services: - console.user_debug: - class: Drupal\Console\Command\User\DebugCommand - arguments: ['@entity_type.manager','@entity.query', '@console.drupal_api'] - tags: - - { name: drupal.command } console.user_delete: class: Drupal\Console\Command\User\DeleteCommand arguments: ['@entity_type.manager','@entity.query', '@console.drupal_api'] diff --git a/src/Command/User/DebugCommand.php b/src/Command/Debug/UserCommand.php similarity index 85% rename from src/Command/User/DebugCommand.php rename to src/Command/Debug/UserCommand.php index 0294cf0f2..c30df8109 100644 --- a/src/Command/User/DebugCommand.php +++ b/src/Command/Debug/UserCommand.php @@ -5,7 +5,7 @@ * Contains \Drupal\Console\Command\User\DebugCommand. */ -namespace Drupal\Console\Command\User; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; @@ -18,11 +18,11 @@ use Drupal\Console\Utils\DrupalApi; /** - * Class DebugCommand + * Class UserCommand * - * @package Drupal\Console\Command\User + * @package Drupal\Console\Command\Debug */ -class DebugCommand extends Command +class UserCommand extends Command { use CommandTrait; @@ -65,37 +65,37 @@ public function __construct( protected function configure() { $this - ->setName('user:debug') - ->setDescription($this->trans('commands.user.debug.description')) + ->setName('debug:user') + ->setDescription($this->trans('commands.debug.user.description')) ->addOption( 'uid', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.user.debug.options.uid') + $this->trans('commands.debug.user.options.uid') ) ->addOption( 'username', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.user.debug.options.username') + $this->trans('commands.debug.user.options.username') ) ->addOption( 'mail', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.user.debug.options.mail') + $this->trans('commands.debug.user.options.mail') ) ->addOption( 'roles', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_OPTIONAL, - $this->trans('commands.user.debug.options.roles') + $this->trans('commands.debug.user.options.roles') ) ->addOption( 'limit', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.user.debug.options.limit') + $this->trans('commands.debug.user.options.limit') ); } @@ -153,10 +153,10 @@ protected function execute(InputInterface $input, OutputInterface $output) $users = $userStorage->loadMultiple($results); $tableHeader = [ - $this->trans('commands.user.debug.messages.user-id'), - $this->trans('commands.user.debug.messages.username'), - $this->trans('commands.user.debug.messages.roles'), - $this->trans('commands.user.debug.messages.status'), + $this->trans('commands.debug.user.messages.user-id'), + $this->trans('commands.debug.user.messages.username'), + $this->trans('commands.debug.user.messages.roles'), + $this->trans('commands.debug.user.messages.status'), ]; $tableRows = []; From d56747a116d0c12a73652d9ec8621f5017f59922 Mon Sep 17 00:00:00 2001 From: Mauricio Hernandez Date: Wed, 5 Jul 2017 10:13:09 -0600 Subject: [PATCH 270/321] Move update:debug to debug:update (#3395) --- config/services/drupal-console/debug.yml | 5 +++ config/services/drupal-console/update.yml | 7 +--- .../UpdateCommand.php} | 38 +++++++++---------- 3 files changed, 25 insertions(+), 25 deletions(-) rename src/Command/{Update/DebugCommand.php => Debug/UpdateCommand.php} (78%) diff --git a/config/services/drupal-console/debug.yml b/config/services/drupal-console/debug.yml index 0133861c2..c6768337f 100644 --- a/config/services/drupal-console/debug.yml +++ b/config/services/drupal-console/debug.yml @@ -16,6 +16,11 @@ services: class: Drupal\Console\Command\Debug\PluginCommand tags: - { name: drupal.command } + console.update_debug: + class: Drupal\Console\Command\Debug\UpdateCommand + arguments: ['@console.site', '@update.post_update_registry'] + tags: + - { name: drupal.command } console.user_debug: class: Drupal\Console\Command\Debug\UserCommand arguments: ['@entity_type.manager','@entity.query', '@console.drupal_api'] diff --git a/config/services/drupal-console/update.yml b/config/services/drupal-console/update.yml index 2c1c9daff..eed0fa5a8 100644 --- a/config/services/drupal-console/update.yml +++ b/config/services/drupal-console/update.yml @@ -1,9 +1,4 @@ services: - console.update_debug: - class: Drupal\Console\Command\Update\DebugCommand - arguments: ['@console.site', '@update.post_update_registry'] - tags: - - { name: drupal.command } console.update_entities: class: Drupal\Console\Command\Update\EntitiesCommand arguments: ['@state', '@entity.definition_update_manager', '@console.chain_queue'] @@ -13,4 +8,4 @@ services: class: Drupal\Console\Command\Update\ExecuteCommand arguments: ['@console.site', '@state', '@module_handler', '@update.post_update_registry', '@console.extension_manager', '@console.chain_queue'] tags: - - { name: drupal.command } \ No newline at end of file + - { name: drupal.command } diff --git a/src/Command/Update/DebugCommand.php b/src/Command/Debug/UpdateCommand.php similarity index 78% rename from src/Command/Update/DebugCommand.php rename to src/Command/Debug/UpdateCommand.php index a727ab11f..5cdca2e76 100644 --- a/src/Command/Update/DebugCommand.php +++ b/src/Command/Debug/UpdateCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Update\DebugCommand. + * Contains \Drupal\Console\Command\Debug\UpdateCommand. */ -namespace Drupal\Console\Command\Update; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -15,7 +15,7 @@ use Drupal\Console\Utils\Site; use Drupal\Console\Core\Style\DrupalStyle; -class DebugCommand extends Command +class UpdateCommand extends Command { use CommandTrait; @@ -50,8 +50,8 @@ public function __construct( protected function configure() { $this - ->setName('update:debug') - ->setDescription($this->trans('commands.update.debug.description')) + ->setName('debug:update') + ->setDescription($this->trans('commands.debug.update.description')) ->setAliases(['upd']); } @@ -77,7 +77,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if ($severity == REQUIREMENT_ERROR || ($severity == REQUIREMENT_WARNING)) { $this->populateRequirements($io, $requirements); } elseif (empty($updates)) { - $io->info($this->trans('commands.update.debug.messages.no-updates')); + $io->info($this->trans('commands.debug.update.messages.no-updates')); } else { $this->populateUpdate($io, $updates); $this->populatePostUpdate($io); @@ -90,13 +90,13 @@ protected function execute(InputInterface $input, OutputInterface $output) */ private function populateRequirements(DrupalStyle $io, $requirements) { - $io->info($this->trans('commands.update.debug.messages.requirements-error')); + $io->info($this->trans('commands.debug.update.messages.requirements-error')); $tableHeader = [ - $this->trans('commands.update.debug.messages.severity'), - $this->trans('commands.update.debug.messages.title'), - $this->trans('commands.update.debug.messages.value'), - $this->trans('commands.update.debug.messages.description'), + $this->trans('commands.debug.update.messages.severity'), + $this->trans('commands.debug.update.messages.title'), + $this->trans('commands.debug.update.messages.value'), + $this->trans('commands.debug.update.messages.description'), ]; $tableRows = []; @@ -124,11 +124,11 @@ private function populateRequirements(DrupalStyle $io, $requirements) */ private function populateUpdate(DrupalStyle $io, $updates) { - $io->info($this->trans('commands.update.debug.messages.module-list')); + $io->info($this->trans('commands.debug.update.messages.module-list')); $tableHeader = [ - $this->trans('commands.update.debug.messages.module'), - $this->trans('commands.update.debug.messages.update-n'), - $this->trans('commands.update.debug.messages.description') + $this->trans('commands.debug.update.messages.module'), + $this->trans('commands.debug.update.messages.update-n'), + $this->trans('commands.debug.update.messages.description') ]; $tableRows = []; foreach ($updates as $module => $module_updates) { @@ -150,12 +150,12 @@ private function populateUpdate(DrupalStyle $io, $updates) private function populatePostUpdate(DrupalStyle $io) { $io->info( - $this->trans('commands.update.debug.messages.module-list-post-update') + $this->trans('commands.debug.update.messages.module-list-post-update') ); $tableHeader = [ - $this->trans('commands.update.debug.messages.module'), - $this->trans('commands.update.debug.messages.post-update'), - $this->trans('commands.update.debug.messages.description') + $this->trans('commands.debug.update.messages.module'), + $this->trans('commands.debug.update.messages.post-update'), + $this->trans('commands.debug.update.messages.description') ]; $postUpdates = $this->postUpdateRegistry->getPendingUpdateInformation(); From dbc59da153d236bd16e767a3d52d5fe9c22a89bd Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 5 Jul 2017 09:33:28 -0700 Subject: [PATCH 271/321] [debug:views:plugins] Remove old service definition. (#3396) --- config/services/drupal-console/views.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/config/services/drupal-console/views.yml b/config/services/drupal-console/views.yml index 823603ee1..9fdc6a1cd 100644 --- a/config/services/drupal-console/views.yml +++ b/config/services/drupal-console/views.yml @@ -9,8 +9,3 @@ services: arguments: ['@entity_type.manager', '@entity.query'] tags: - { name: drupal.command } - console.views_plugins_debug: - class: Drupal\Console\Command\Views\PluginsDebugCommand - arguments: ['@entity_type.manager'] - tags: - - { name: drupal.command } From 424cad6f9d925282b8672a32b2fa294648ac98e2 Mon Sep 17 00:00:00 2001 From: Mauricio Hernandez Date: Wed, 5 Jul 2017 11:03:47 -0600 Subject: [PATCH 272/321] Move state:debug to debug:state (#3397) --- config/services/drupal-console/debug.yml | 5 +++++ config/services/drupal-console/state.yml | 5 ----- .../StateCommand.php} | 18 +++++++++--------- 3 files changed, 14 insertions(+), 14 deletions(-) rename src/Command/{State/DebugCommand.php => Debug/StateCommand.php} (79%) diff --git a/config/services/drupal-console/debug.yml b/config/services/drupal-console/debug.yml index c6768337f..85408050f 100644 --- a/config/services/drupal-console/debug.yml +++ b/config/services/drupal-console/debug.yml @@ -35,3 +35,8 @@ services: class: Drupal\Console\Command\Debug\ViewsPluginsCommand tags: - { name: drupal.command } + console.state_debug: + class: Drupal\Console\Command\Debug\StateCommand + arguments: ['@state', '@keyvalue'] + tags: + - { name: drupal.command } diff --git a/config/services/drupal-console/state.yml b/config/services/drupal-console/state.yml index 546996688..be8572157 100644 --- a/config/services/drupal-console/state.yml +++ b/config/services/drupal-console/state.yml @@ -1,9 +1,4 @@ services: - console.state_debug: - class: Drupal\Console\Command\State\DebugCommand - arguments: ['@state', '@keyvalue'] - tags: - - { name: drupal.command } console.state_delete: class: Drupal\Console\Command\State\DeleteCommand arguments: ['@state', '@keyvalue'] diff --git a/src/Command/State/DebugCommand.php b/src/Command/Debug/StateCommand.php similarity index 79% rename from src/Command/State/DebugCommand.php rename to src/Command/Debug/StateCommand.php index 9a4f81f87..d4ccd2663 100644 --- a/src/Command/State/DebugCommand.php +++ b/src/Command/Debug/StateCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\State\DebugCommand. + * Contains \Drupal\Console\Command\Debug\DebugCommand. */ -namespace Drupal\Console\Command\State; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -20,9 +20,9 @@ /** * Class DebugCommand * - * @package Drupal\Console\Command\State + * @package Drupal\Console\Command\Debug */ -class DebugCommand extends Command +class StateCommand extends Command { use CommandTrait; @@ -57,13 +57,13 @@ public function __construct( protected function configure() { $this - ->setName('state:debug') - ->setDescription($this->trans('commands.state.debug.description')) - ->setHelp($this->trans('commands.state.debug.help')) + ->setName('debug:state') + ->setDescription($this->trans('commands.debug.state.description')) + ->setHelp($this->trans('commands.debug.state.help')) ->addArgument( 'key', InputArgument::OPTIONAL, - $this->trans('commands.state.debug.arguments.key') + $this->trans('commands.debug.state.arguments.key') ); } @@ -82,7 +82,7 @@ protected function execute(InputInterface $input, OutputInterface $output) return 0; } - $tableHeader = [$this->trans('commands.state.debug.messages.key')]; + $tableHeader = [$this->trans('commands.debug.state.messages.key')]; $keyStoreStates = array_keys($this->keyValue->get('state')->getAll()); $io->table($tableHeader, $keyStoreStates); From b6ad1871273d218b78e043665b15e5bdd7bc523d Mon Sep 17 00:00:00 2001 From: Mauricio Hernandez Date: Wed, 5 Jul 2017 13:18:41 -0600 Subject: [PATCH 273/321] 3380 relocate debug commands (#3398) * Move theme:debug to debug:theme * Move theme:debug to debug:theme * Move router:debug to debug:router * Move queue:debug to debug:queue * Move libraries:debug to debug:libraries * Move module:debug to debug:module * Move image:styles:debug to debug:image:styles --- config/services/drupal-console/debug.yml | 30 ++++++++++++++ config/services/drupal-console/image.yml | 5 --- config/services/drupal-console/libraries.yml | 6 --- config/services/drupal-console/module.yml | 5 --- config/services/drupal-console/queue.yml | 5 --- config/services/drupal-console/router.yml | 5 --- config/services/drupal-console/theme.yml | 5 --- .../ImageStylesCommand.php} | 20 +++++----- .../LibrariesCommand.php} | 14 +++---- .../ModuleCommand.php} | 40 +++++++++---------- .../QueueCommand.php} | 18 ++++----- .../RouterCommand.php} | 26 ++++++------ .../ThemeCommand.php} | 32 +++++++-------- 13 files changed, 105 insertions(+), 106 deletions(-) delete mode 100644 config/services/drupal-console/libraries.yml rename src/Command/{Image/StylesDebugCommand.php => Debug/ImageStylesCommand.php} (76%) rename src/Command/{Libraries/DebugCommand.php => Debug/LibrariesCommand.php} (88%) rename src/Command/{Module/DebugCommand.php => Debug/ModuleCommand.php} (78%) rename src/Command/{Queue/DebugCommand.php => Debug/QueueCommand.php} (78%) rename src/Command/{Router/DebugCommand.php => Debug/RouterCommand.php} (78%) rename src/Command/{Theme/DebugCommand.php => Debug/ThemeCommand.php} (80%) diff --git a/config/services/drupal-console/debug.yml b/config/services/drupal-console/debug.yml index 85408050f..22881be1d 100644 --- a/config/services/drupal-console/debug.yml +++ b/config/services/drupal-console/debug.yml @@ -40,3 +40,33 @@ services: arguments: ['@state', '@keyvalue'] tags: - { name: drupal.command } + console.theme_debug: + class: Drupal\Console\Command\Debug\ThemeCommand + arguments: ['@config.factory', '@theme_handler'] + tags: + - { name: drupal.command } + console.router_debug: + class: Drupal\Console\Command\Debug\RouterCommand + arguments: ['@router.route_provider'] + tags: + - { name: drupal.command } + console.queue_debug: + class: Drupal\Console\Command\Debug\QueueCommand + arguments: ['@plugin.manager.queue_worker'] + tags: + - { name: drupal.command } + console.libraries_debug: + class: Drupal\Console\Command\Debug\LibrariesCommand + arguments: ['@module_handler', '@theme_handler', '@library.discovery', '@app.root'] + tags: + - { name: drupal.command } + console.module_debug: + class: Drupal\Console\Command\Debug\ModuleCommand + arguments: ['@console.configuration_manager', '@console.site', '@http_client'] + tags: + - { name: drupal.command } + console.image_styles_debug: + class: Drupal\Console\Command\Debug\ImageStylesCommand + arguments: ['@entity_type.manager'] + tags: + - { name: drupal.command } diff --git a/config/services/drupal-console/image.yml b/config/services/drupal-console/image.yml index d3c5f2d73..73b5c566a 100644 --- a/config/services/drupal-console/image.yml +++ b/config/services/drupal-console/image.yml @@ -1,9 +1,4 @@ services: - console.image_styles_debug: - class: Drupal\Console\Command\Image\StylesDebugCommand - arguments: ['@entity_type.manager'] - tags: - - { name: drupal.command } console.image_styles_flush: class: Drupal\Console\Command\Image\StylesFlushCommand arguments: ['@entity_type.manager'] diff --git a/config/services/drupal-console/libraries.yml b/config/services/drupal-console/libraries.yml deleted file mode 100644 index 65bb723f7..000000000 --- a/config/services/drupal-console/libraries.yml +++ /dev/null @@ -1,6 +0,0 @@ -services: - console.libraries_debug: - class: Drupal\Console\Command\Libraries\DebugCommand - arguments: ['@module_handler', '@theme_handler', '@library.discovery', '@app.root'] - tags: - - { name: drupal.command } diff --git a/config/services/drupal-console/module.yml b/config/services/drupal-console/module.yml index 8c79ef33c..4dc3b48f7 100644 --- a/config/services/drupal-console/module.yml +++ b/config/services/drupal-console/module.yml @@ -1,9 +1,4 @@ services: - console.module_debug: - class: Drupal\Console\Command\Module\DebugCommand - arguments: ['@console.configuration_manager', '@console.site', '@http_client'] - tags: - - { name: drupal.command } console.module_dependency_install: class: Drupal\Console\Command\Module\InstallDependencyCommand arguments: ['@console.site', '@console.validator', '@module_installer', '@console.chain_queue'] diff --git a/config/services/drupal-console/queue.yml b/config/services/drupal-console/queue.yml index e73b124a1..fc41033fc 100644 --- a/config/services/drupal-console/queue.yml +++ b/config/services/drupal-console/queue.yml @@ -1,9 +1,4 @@ services: - console.queue_debug: - class: Drupal\Console\Command\Queue\DebugCommand - arguments: ['@plugin.manager.queue_worker'] - tags: - - { name: drupal.command } console.queue_run: class: Drupal\Console\Command\Queue\RunCommand arguments: ['@plugin.manager.queue_worker', '@queue'] diff --git a/config/services/drupal-console/router.yml b/config/services/drupal-console/router.yml index 62304e501..4076dc6fd 100644 --- a/config/services/drupal-console/router.yml +++ b/config/services/drupal-console/router.yml @@ -1,9 +1,4 @@ services: - console.router_debug: - class: Drupal\Console\Command\Router\DebugCommand - arguments: ['@router.route_provider'] - tags: - - { name: drupal.command } console.router_rebuild: class: Drupal\Console\Command\Router\RebuildCommand arguments: ['@router.builder'] diff --git a/config/services/drupal-console/theme.yml b/config/services/drupal-console/theme.yml index abe36c413..be708bf19 100644 --- a/config/services/drupal-console/theme.yml +++ b/config/services/drupal-console/theme.yml @@ -1,9 +1,4 @@ services: - console.theme_debug: - class: Drupal\Console\Command\Theme\DebugCommand - arguments: ['@config.factory', '@theme_handler'] - tags: - - { name: drupal.command } console.theme_download: class: Drupal\Console\Command\Theme\DownloadCommand arguments: ['@console.drupal_api', '@http_client', '@app.root'] diff --git a/src/Command/Image/StylesDebugCommand.php b/src/Command/Debug/ImageStylesCommand.php similarity index 76% rename from src/Command/Image/StylesDebugCommand.php rename to src/Command/Debug/ImageStylesCommand.php index 92e548f28..a330ebbaa 100644 --- a/src/Command/Image/StylesDebugCommand.php +++ b/src/Command/Debug/ImageStylesCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Image\StylesDebugCommand. + * Contains \Drupal\Console\Command\Debug\ImageStylesCommand. */ -namespace Drupal\Console\Command\Image; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -17,9 +17,9 @@ /** * Class StylesDebugCommand * - * @package Drupal\Console\Command\Image + * @package Drupal\Console\Command\Debug */ -class StylesDebugCommand extends Command +class ImageStylesCommand extends Command { use CommandTrait; @@ -29,7 +29,7 @@ class StylesDebugCommand extends Command protected $entityTypeManager; /** - * StylesDebugCommand constructor. + * ImageStylesCommand constructor. * * @param EntityTypeManagerInterface $entityTypeManager */ @@ -45,8 +45,8 @@ public function __construct(EntityTypeManagerInterface $entityTypeManager) protected function configure() { $this - ->setName('image:styles:debug') - ->setDescription($this->trans('commands.image.styles.debug.description')); + ->setName('debug:image:styles') + ->setDescription($this->trans('commands.debug.image.styles.description')); } /** @@ -60,7 +60,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $io->newLine(); $io->comment( - $this->trans('commands.image.styles.debug.messages.styles-list') + $this->trans('commands.debug.image.styles.messages.styles-list') ); if ($imageStyle) { @@ -77,8 +77,8 @@ protected function execute(InputInterface $input, OutputInterface $output) protected function imageStyleList(DrupalStyle $io, $imageStyle) { $tableHeader = [ - $this->trans('commands.image.styles.debug.messages.styles-name'), - $this->trans('commands.image.styles.debug.messages.styles-label') + $this->trans('commands.debug.image.styles.messages.styles-name'), + $this->trans('commands.debug.image.styles.messages.styles-label') ]; $tableRows = []; diff --git a/src/Command/Libraries/DebugCommand.php b/src/Command/Debug/LibrariesCommand.php similarity index 88% rename from src/Command/Libraries/DebugCommand.php rename to src/Command/Debug/LibrariesCommand.php index bfa501f63..b1a3c85cf 100644 --- a/src/Command/Libraries/DebugCommand.php +++ b/src/Command/Debug/LibrariesCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Libraries\DebugCommand. + * Contains \Drupal\Console\Command\Debug\LibrariesCommand. */ -namespace Drupal\Console\Command\Libraries; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -18,7 +18,7 @@ use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; -class DebugCommand extends Command +class LibrariesCommand extends Command { use CommandTrait; @@ -69,12 +69,12 @@ public function __construct( protected function configure() { $this - ->setName('libraries:debug') - ->setDescription($this->trans('commands.libraries.debug.description')) + ->setName('debug:libraries') + ->setDescription($this->trans('commands.debug.libraries.description')) ->addArgument( 'group', InputArgument::OPTIONAL, - $this->trans('commands.libraries.debug.options.name') + $this->trans('commands.debug.libraries.options.name') ); } @@ -90,7 +90,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $groups = $this->getAllLibraries(); $tableHeader = [ - $this->trans('commands.libraries.debug.messages.name'), + $this->trans('commands.debug.libraries.messages.name'), ]; $io->table($tableHeader, $groups, 'compact'); diff --git a/src/Command/Module/DebugCommand.php b/src/Command/Debug/ModuleCommand.php similarity index 78% rename from src/Command/Module/DebugCommand.php rename to src/Command/Debug/ModuleCommand.php index 0a48170b1..ee1b8f6c2 100644 --- a/src/Command/Module/DebugCommand.php +++ b/src/Command/Debug/ModuleCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Module\DebugCommand. + * Contains \Drupal\Console\Command\Debug\ModuleCommand. */ -namespace Drupal\Console\Command\Module; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; @@ -18,7 +18,7 @@ use GuzzleHttp\Client; use Drupal\Console\Core\Utils\ConfigurationManager; -class DebugCommand extends Command +class ModuleCommand extends Command { use CommandTrait; @@ -60,24 +60,24 @@ public function __construct( protected function configure() { $this - ->setName('module:debug') - ->setDescription($this->trans('commands.module.debug.description')) + ->setName('debug:module') + ->setDescription($this->trans('commands.debug.module.description')) ->addArgument( 'module', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, - $this->trans('commands.module.debug.module') + $this->trans('commands.debug.module.module') ) ->addOption( 'status', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.module.debug.options.status') + $this->trans('commands.debug.module.options.status') ) ->addOption( 'type', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.module.debug.options.type') + $this->trans('commands.debug.module.options.type') ) ->setAliases(['mod']); } @@ -108,7 +108,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } catch (\Exception $e) { $io->error( sprintf( - $this->trans('commands.module.debug.messages.no-results'), + $this->trans('commands.debug.module.messages.no-results'), $module ) ); @@ -127,17 +127,17 @@ protected function execute(InputInterface $input, OutputInterface $output) ]; $tableRows[] = [ - ''.$this->trans('commands.module.debug.messages.total-downloads').'', + ''.$this->trans('commands.debug.module.messages.total-downloads').'', $data->package->downloads->total ]; $tableRows[] = [ - ''.$this->trans('commands.module.debug.messages.total-monthly').'', + ''.$this->trans('commands.debug.module.messages.total-monthly').'', $data->package->downloads->monthly ]; $tableRows[] = [ - ''.$this->trans('commands.module.debug.messages.total-daily').'', + ''.$this->trans('commands.debug.module.messages.total-daily').'', $data->package->downloads->daily ]; @@ -163,13 +163,13 @@ protected function execute(InputInterface $input, OutputInterface $output) } $tableHeader = [ - $this->trans('commands.module.debug.messages.id'), - $this->trans('commands.module.debug.messages.name'), - $this->trans('commands.module.debug.messages.package'), - $this->trans('commands.module.debug.messages.version'), - $this->trans('commands.module.debug.messages.schema-version'), - $this->trans('commands.module.debug.messages.status'), - $this->trans('commands.module.debug.messages.origin'), + $this->trans('commands.debug.module.messages.id'), + $this->trans('commands.debug.module.messages.name'), + $this->trans('commands.debug.module.messages.package'), + $this->trans('commands.debug.module.messages.version'), + $this->trans('commands.debug.module.messages.schema-version'), + $this->trans('commands.debug.module.messages.status'), + $this->trans('commands.debug.module.messages.origin'), ]; $tableRows = []; @@ -183,7 +183,7 @@ protected function execute(InputInterface $input, OutputInterface $output) continue; } - $module_status = ($module->status) ? $this->trans('commands.module.debug.messages.installed') : $this->trans('commands.module.debug.messages.uninstalled'); + $module_status = ($module->status) ? $this->trans('commands.debug.module.messages.installed') : $this->trans('commands.debug.module.messages.uninstalled'); $module_origin = ($module->origin) ? $module->origin : 'no core'; $schema_version = (drupal_get_installed_schema_version($module_id)!= -1?drupal_get_installed_schema_version($module_id): ''); diff --git a/src/Command/Queue/DebugCommand.php b/src/Command/Debug/QueueCommand.php similarity index 78% rename from src/Command/Queue/DebugCommand.php rename to src/Command/Debug/QueueCommand.php index 8ed257067..13a051cf3 100644 --- a/src/Command/Queue/DebugCommand.php +++ b/src/Command/Debug/QueueCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Queue\DebugCommand. + * Contains \Drupal\Console\Command\Debug\QueueCommand. */ -namespace Drupal\Console\Command\Queue; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; @@ -17,9 +17,9 @@ /** * Class DebugCommand * - * @package Drupal\Console\Command\Queue + * @package Drupal\Console\Command\Debug */ -class DebugCommand extends Command +class QueueCommand extends Command { use CommandTrait; @@ -45,8 +45,8 @@ public function __construct(QueueWorkerManagerInterface $queueWorker) protected function configure() { $this - ->setName('queue:debug') - ->setDescription($this->trans('commands.queue.debug.description')); + ->setName('debug:queue') + ->setDescription($this->trans('commands.debug.queue.description')); } /** @@ -57,9 +57,9 @@ protected function execute(InputInterface $input, OutputInterface $output) $io = new DrupalStyle($input, $output); $tableHeader = [ - $this->trans('commands.queue.debug.messages.queue'), - $this->trans('commands.queue.debug.messages.items'), - $this->trans('commands.queue.debug.messages.class') + $this->trans('commands.debug.queue.messages.queue'), + $this->trans('commands.debug.queue.messages.items'), + $this->trans('commands.debug.queue.messages.class') ]; $tableBody = $this->listQueues(); diff --git a/src/Command/Router/DebugCommand.php b/src/Command/Debug/RouterCommand.php similarity index 78% rename from src/Command/Router/DebugCommand.php rename to src/Command/Debug/RouterCommand.php index f73e44ad3..42e65ff33 100644 --- a/src/Command/Router/DebugCommand.php +++ b/src/Command/Debug/RouterCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\RouterDebugCommand. + * Contains \Drupal\Console\Command\Debug\RouterCommand. */ -namespace Drupal\Console\Command\Router; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -16,7 +16,7 @@ use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Component\Serialization\Yaml; -class DebugCommand extends Command +class RouterCommand extends Command { use CommandTrait; @@ -39,12 +39,12 @@ public function __construct(RouteProviderInterface $routeProvider) protected function configure() { $this - ->setName('router:debug') - ->setDescription($this->trans('commands.router.debug.description')) + ->setName('debug:router') + ->setDescription($this->trans('commands.debug.router.description')) ->addArgument( 'route-name', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, - $this->trans('commands.router.debug.arguments.route-name') + $this->trans('commands.debug.router.arguments.route-name') ) ->setAliases(['rod']); } @@ -67,8 +67,8 @@ protected function getAllRoutes(DrupalStyle $io) $routes = $this->routeProvider->getAllRoutes(); $tableHeader = [ - $this->trans('commands.router.debug.messages.name'), - $this->trans('commands.router.debug.messages.path'), + $this->trans('commands.debug.router.messages.name'), + $this->trans('commands.debug.router.messages.path'), ]; $tableRows = []; @@ -85,29 +85,29 @@ protected function getRouteByNames(DrupalStyle $io, $route_name) foreach ($routes as $name => $route) { $tableHeader = [ - $this->trans('commands.router.debug.messages.route'), + $this->trans('commands.debug.router.messages.route'), ''.$name.'' ]; $tableRows = []; $tableRows[] = [ - ''.$this->trans('commands.router.debug.messages.path').'', + ''.$this->trans('commands.debug.router.messages.path').'', $route->getPath(), ]; - $tableRows[] = [''.$this->trans('commands.router.debug.messages.defaults').'']; + $tableRows[] = [''.$this->trans('commands.debug.router.messages.defaults').'']; $attributes = $this->addRouteAttributes($route->getDefaults()); foreach ($attributes as $attribute) { $tableRows[] = $attribute; } - $tableRows[] = [''.$this->trans('commands.router.debug.messages.requirements').'']; + $tableRows[] = [''.$this->trans('commands.debug.router.messages.requirements').'']; $requirements = $this->addRouteAttributes($route->getRequirements()); foreach ($requirements as $requirement) { $tableRows[] = $requirement; } - $tableRows[] = [''.$this->trans('commands.router.debug.messages.options').'']; + $tableRows[] = [''.$this->trans('commands.debug.router.messages.options').'']; $options = $this->addRouteAttributes($route->getOptions()); foreach ($options as $option) { $tableRows[] = $option; diff --git a/src/Command/Theme/DebugCommand.php b/src/Command/Debug/ThemeCommand.php similarity index 80% rename from src/Command/Theme/DebugCommand.php rename to src/Command/Debug/ThemeCommand.php index bbdc531b5..3485e9100 100644 --- a/src/Command/Theme/DebugCommand.php +++ b/src/Command/Debug/ThemeCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Theme\Debugommand. + * Contains \Drupal\Console\Command\Debug\ThemeCommand. */ -namespace Drupal\Console\Command\Theme; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -16,7 +16,7 @@ use Drupal\Core\Extension\ThemeHandler; use Drupal\Console\Core\Style\DrupalStyle; -class DebugCommand extends Command +class ThemeCommand extends Command { use CommandTrait; @@ -48,12 +48,12 @@ public function __construct( protected function configure() { $this - ->setName('theme:debug') - ->setDescription($this->trans('commands.theme.debug.description')) + ->setName('debug:theme') + ->setDescription($this->trans('commands.debug.theme.description')) ->addArgument( 'theme', InputArgument::OPTIONAL, - $this->trans('commands.theme.debug.arguments.theme') + $this->trans('commands.debug.theme.arguments.theme') ) ->setAliases(['tde']); } @@ -73,10 +73,10 @@ protected function execute(InputInterface $input, OutputInterface $output) protected function themeList(DrupalStyle $io) { $tableHeader = [ - $this->trans('commands.theme.debug.messages.theme-id'), - $this->trans('commands.theme.debug.messages.theme-name'), - $this->trans('commands.theme.debug.messages.status'), - $this->trans('commands.theme.debug.messages.version'), + $this->trans('commands.debug.theme.messages.theme-id'), + $this->trans('commands.debug.theme.messages.theme-name'), + $this->trans('commands.debug.theme.messages.status'), + $this->trans('commands.debug.theme.messages.version'), ]; $themes = $this->themeHandler->rebuildThemeData(); @@ -118,7 +118,7 @@ protected function themeDetail(DrupalStyle $io, $themeId) $io->comment( sprintf( '%s : ', - $this->trans('commands.theme.debug.messages.status') + $this->trans('commands.debug.theme.messages.status') ), false ); @@ -126,18 +126,18 @@ protected function themeDetail(DrupalStyle $io, $themeId) $io->comment( sprintf( '%s : ', - $this->trans('commands.theme.debug.messages.version') + $this->trans('commands.debug.theme.messages.version') ), false ); $io->writeln($theme->info['version']); - $io->comment($this->trans('commands.theme.debug.messages.regions')); + $io->comment($this->trans('commands.debug.theme.messages.regions')); $tableRows = $this->addThemeAttributes($theme->info['regions'], $tableRows); $io->table([], $tableRows); } else { $io->error( sprintf( - $this->trans('commands.theme.debug.messages.invalid-theme'), + $this->trans('commands.debug.theme.messages.invalid-theme'), $themeId ) ); @@ -148,9 +148,9 @@ protected function getThemeStatus($theme) { $defaultTheme = $this->configFactory->get('system.theme')->get('default'); - $status = ($theme->status)?$this->trans('commands.theme.debug.messages.installed'):$this->trans('commands.theme.debug.messages.uninstalled'); + $status = ($theme->status)?$this->trans('commands.debug.theme.messages.installed'):$this->trans('commands.debug.theme.messages.uninstalled'); if ($defaultTheme == $theme) { - $status = $this->trans('commands.theme.debug.messages.default-theme'); + $status = $this->trans('commands.debug.theme.messages.default-theme'); } return $status; From 4531efb76c42fcfa613a4465be003b660801996a Mon Sep 17 00:00:00 2001 From: Mauricio Hernandez Date: Wed, 5 Jul 2017 15:16:02 -0600 Subject: [PATCH 274/321] 3380 relocate to debug (#3399) * Move entity:debug to debug:entity * Move database:log:debug to debug:database:log * Move database:table:debug to debug:database:table * Move cron:debug to debug:cron * Move breakpoints:debug to debug:breakpoints --- config/services/drupal-console/cron.yml | 5 ---- config/services/drupal-console/database.yml | 10 ------- config/services/drupal-console/debug.yml | 25 +++++++++++++++++ config/services/drupal-console/entity.yml | 7 +---- config/services/drupal-core/breakpoint.yml | 6 ---- .../BreakpointsCommand.php} | 16 +++++------ .../CronCommand.php} | 16 +++++------ .../DatabaseLogCommand.php} | 27 +++++++++--------- .../DatabaseTableCommand.php} | 28 +++++++++---------- .../EntityCommand.php} | 18 ++++++------ 10 files changed, 79 insertions(+), 79 deletions(-) delete mode 100644 config/services/drupal-core/breakpoint.yml rename src/Command/{Breakpoints/DebugCommand.php => Debug/BreakpointsCommand.php} (85%) rename src/Command/{Cron/DebugCommand.php => Debug/CronCommand.php} (74%) rename src/Command/{Database/LogDebugCommand.php => Debug/DatabaseLogCommand.php} (81%) rename src/Command/{Database/TableDebugCommand.php => Debug/DatabaseTableCommand.php} (76%) rename src/Command/{Entity/DebugCommand.php => Debug/EntityCommand.php} (83%) diff --git a/config/services/drupal-console/cron.yml b/config/services/drupal-console/cron.yml index 981e551f3..bbd8536d9 100644 --- a/config/services/drupal-console/cron.yml +++ b/config/services/drupal-console/cron.yml @@ -1,9 +1,4 @@ services: - console.cron_debug: - class: Drupal\Console\Command\Cron\DebugCommand - arguments: ['@module_handler'] - tags: - - { name: drupal.command } console.cron_execute: class: Drupal\Console\Command\Cron\ExecuteCommand arguments: ['@module_handler', '@lock', '@state', '@console.chain_queue'] diff --git a/config/services/drupal-console/database.yml b/config/services/drupal-console/database.yml index 354a26c03..902995f57 100644 --- a/config/services/drupal-console/database.yml +++ b/config/services/drupal-console/database.yml @@ -31,11 +31,6 @@ services: arguments: ['@database'] tags: - { name: drupal.command } - console.database_log_debug: - class: Drupal\Console\Command\Database\LogDebugCommand - arguments: ['@database', '@date.formatter', '@entity_type.manager', '@string_translation'] - tags: - - { name: drupal.command } console.database_log_poll: class: Drupal\Console\Command\Database\LogPollCommand arguments: ['@database', '@date.formatter', '@entity_type.manager', '@string_translation'] @@ -46,8 +41,3 @@ services: arguments: ['@app.root'] tags: - { name: drupal.command } - console.database_table_debug: - class: Drupal\Console\Command\Database\TableDebugCommand - arguments: ['@console.redbean', '@database'] - tags: - - { name: drupal.command } diff --git a/config/services/drupal-console/debug.yml b/config/services/drupal-console/debug.yml index 22881be1d..a329bc0d1 100644 --- a/config/services/drupal-console/debug.yml +++ b/config/services/drupal-console/debug.yml @@ -70,3 +70,28 @@ services: arguments: ['@entity_type.manager'] tags: - { name: drupal.command } + console.entity_debug: + class: Drupal\Console\Command\Debug\EntityCommand + arguments: ['@entity_type.repository', '@entity_type.manager'] + tags: + - { name: drupal.command } + console.database_log_debug: + class: Drupal\Console\Command\Debug\DatabaseLogCommand + arguments: ['@database', '@date.formatter', '@entity_type.manager', '@string_translation'] + tags: + - { name: drupal.command } + console.database_table_debug: + class: Drupal\Console\Command\Debug\DatabaseTableCommand + arguments: ['@console.redbean', '@database'] + tags: + - { name: drupal.command } + console.cron_debug: + class: Drupal\Console\Command\Debug\CronCommand + arguments: ['@module_handler'] + tags: + - { name: drupal.command } + console.breakpoints_debug: + class: Drupal\Console\Command\Debug\BreakpointsCommand + arguments: ['@breakpoint.manager', '@app.root'] + tags: + - { name: drupal.command } diff --git a/config/services/drupal-console/entity.yml b/config/services/drupal-console/entity.yml index 447852951..58b018879 100644 --- a/config/services/drupal-console/entity.yml +++ b/config/services/drupal-console/entity.yml @@ -1,11 +1,6 @@ services: - console.entity_debug: - class: Drupal\Console\Command\Entity\DebugCommand - arguments: ['@entity_type.repository', '@entity_type.manager'] - tags: - - { name: drupal.command } console.entity_delete: class: Drupal\Console\Command\Entity\DeleteCommand arguments: ['@entity_type.repository', '@entity_type.manager'] tags: - - { name: drupal.command } \ No newline at end of file + - { name: drupal.command } diff --git a/config/services/drupal-core/breakpoint.yml b/config/services/drupal-core/breakpoint.yml deleted file mode 100644 index 609e495d5..000000000 --- a/config/services/drupal-core/breakpoint.yml +++ /dev/null @@ -1,6 +0,0 @@ -services: - console.breakpoints_debug: - class: Drupal\Console\Command\Breakpoints\DebugCommand - arguments: ['@breakpoint.manager', '@app.root'] - tags: - - { name: drupal.command } diff --git a/src/Command/Breakpoints/DebugCommand.php b/src/Command/Debug/BreakpointsCommand.php similarity index 85% rename from src/Command/Breakpoints/DebugCommand.php rename to src/Command/Debug/BreakpointsCommand.php index bbdbe86bd..41b7730fa 100644 --- a/src/Command/Breakpoints/DebugCommand.php +++ b/src/Command/Debug/BreakpointsCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Breakpoints\DebugCommand. + * Contains \Drupal\Console\Command\Debug\BreakpointsCommand. */ -namespace Drupal\Console\Command\Breakpoints; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -23,7 +23,7 @@ * extensionType = "module" * ) */ -class DebugCommand extends Command +class BreakpointsCommand extends Command { use CommandTrait; @@ -38,7 +38,7 @@ class DebugCommand extends Command protected $appRoot; /** - * DebugCommand constructor. + * BreakpointsCommand constructor. * * @param BreakpointManagerInterface $breakpointManager * @param string $appRoot @@ -58,12 +58,12 @@ public function __construct( protected function configure() { $this - ->setName('breakpoints:debug') - ->setDescription($this->trans('commands.breakpoints.debug.description')) + ->setName('debug:breakpoints') + ->setDescription($this->trans('commands.debug.breakpoints.description')) ->addArgument( 'group', InputArgument::OPTIONAL, - $this->trans('commands.breakpoints.debug.options.group-name') + $this->trans('commands.debug.breakpoints.options.group-name') ); } @@ -87,7 +87,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $groups = array_keys($this->breakpointManager->getGroups()); $tableHeader = [ - $this->trans('commands.breakpoints.debug.messages.name'), + $this->trans('commands.debug.breakpoints.messages.name'), ]; $io->table($tableHeader, $groups, 'compact'); diff --git a/src/Command/Cron/DebugCommand.php b/src/Command/Debug/CronCommand.php similarity index 74% rename from src/Command/Cron/DebugCommand.php rename to src/Command/Debug/CronCommand.php index df06c099a..be6740f91 100644 --- a/src/Command/Cron/DebugCommand.php +++ b/src/Command/Debug/CronCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Cron\DebugCommand. + * Contains \Drupal\Console\Command\Debug\CronCommand. */ -namespace Drupal\Console\Command\Cron; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -14,7 +14,7 @@ use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; -class DebugCommand extends Command +class CronCommand extends Command { use CommandTrait; @@ -24,7 +24,7 @@ class DebugCommand extends Command protected $moduleHandler; /** - * DebugCommand constructor. + * CronCommand constructor. * * @param ModuleHandlerInterface $moduleHandler */ @@ -40,8 +40,8 @@ public function __construct(ModuleHandlerInterface $moduleHandler) protected function configure() { $this - ->setName('cron:debug') - ->setDescription($this->trans('commands.cron.debug.description')); + ->setName('debug:cron') + ->setDescription($this->trans('commands.debug.cron.description')); } /** @@ -52,11 +52,11 @@ protected function execute(InputInterface $input, OutputInterface $output) $io = new DrupalStyle($input, $output); $io->section( - $this->trans('commands.cron.debug.messages.module-list') + $this->trans('commands.debug.cron.messages.module-list') ); $io->table( - [ $this->trans('commands.cron.debug.messages.module') ], + [ $this->trans('commands.debug.cron.messages.module') ], $this->moduleHandler->getImplementations('cron'), 'compact' ); diff --git a/src/Command/Database/LogDebugCommand.php b/src/Command/Debug/DatabaseLogCommand.php similarity index 81% rename from src/Command/Database/LogDebugCommand.php rename to src/Command/Debug/DatabaseLogCommand.php index 3579613ab..6a112eebe 100644 --- a/src/Command/Database/LogDebugCommand.php +++ b/src/Command/Debug/DatabaseLogCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Database\LogDebugCommand. + * Contains \Drupal\Console\Command\Debug\DatabaseLogCommand. */ -namespace Drupal\Console\Command\Database; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; @@ -13,13 +13,14 @@ use Symfony\Component\Console\Output\OutputInterface; use Drupal\Component\Serialization\Yaml; use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Command\Database\DatabaseLogBase; /** - * Class LogDebugCommand + * Class DatabaseLogCommand * - * @package Drupal\Console\Command\Database + * @package Drupal\Console\Command\Debug */ -class LogDebugCommand extends DatabaseLogBase +class DatabaseLogCommand extends DatabaseLogBase { /** * @var @@ -52,8 +53,8 @@ class LogDebugCommand extends DatabaseLogBase protected function configure() { $this - ->setName('database:log:debug') - ->setDescription($this->trans('commands.database.log.debug.description')); + ->setName('debug:database:log') + ->setDescription($this->trans('commands.debug.database.log.description')); $this->addDefaultLoggingOptions(); @@ -61,32 +62,32 @@ protected function configure() ->addArgument( 'event-id', InputArgument::OPTIONAL, - $this->trans('commands.database.log.debug.arguments.event-id') + $this->trans('commands.debug.database.log.arguments.event-id') ) ->addOption( 'asc', null, InputOption::VALUE_NONE, - $this->trans('commands.database.log.debug.options.asc') + $this->trans('commands.debug.database.log.options.asc') ) ->addOption( 'limit', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.database.log.debug.options.limit') + $this->trans('commands.debug.database.log.options.limit') ) ->addOption( 'offset', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.database.log.debug.options.offset'), + $this->trans('commands.debug.database.log.options.offset'), 0 ) ->addOption( 'yml', null, InputOption::VALUE_NONE, - $this->trans('commands.database.log.debug.options.yml'), + $this->trans('commands.debug.database.log.options.yml'), null ) ->setAliases(['dbb']); @@ -131,7 +132,7 @@ private function getEventDetails(DrupalStyle $io) if (!$dblog) { $io->error( sprintf( - $this->trans('commands.database.log.debug.messages.not-found'), + $this->trans('commands.debug.database.log.messages.not-found'), $this->eventId ) ); diff --git a/src/Command/Database/TableDebugCommand.php b/src/Command/Debug/DatabaseTableCommand.php similarity index 76% rename from src/Command/Database/TableDebugCommand.php rename to src/Command/Debug/DatabaseTableCommand.php index b6c9533e0..dd96613c0 100644 --- a/src/Command/Database/TableDebugCommand.php +++ b/src/Command/Debug/DatabaseTableCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Database\TableDebugCommand. + * Contains \Drupal\Console\Command\Debug\DatabaseTableCommand. */ -namespace Drupal\Console\Command\Database; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -19,11 +19,11 @@ use Drupal\Console\Command\Shared\ConnectTrait; /** - * Class TableDebugCommand + * Class DatabaseTableCommand * * @package Drupal\Console\Command\Database */ -class TableDebugCommand extends Command +class DatabaseTableCommand extends Command { use CommandTrait; use ConnectTrait; @@ -39,7 +39,7 @@ class TableDebugCommand extends Command protected $redBean; /** - * TableDebugCommand constructor. + * DatabaseTableCommand constructor. * * @param R $redBean * @param Connection $database @@ -59,22 +59,22 @@ public function __construct( protected function configure() { $this - ->setName('database:table:debug') - ->setDescription($this->trans('commands.database.table.debug.description')) + ->setName('debug:database:table') + ->setDescription($this->trans('commands.debug.database.table.description')) ->addOption( 'database', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.database.table.debug.options.database'), + $this->trans('commands.debug.database.table.options.database'), 'default' ) ->addArgument( 'table', InputArgument::OPTIONAL, - $this->trans('commands.database.table.debug.arguments.table'), + $this->trans('commands.debug.database.table.arguments.table'), null ) - ->setHelp($this->trans('commands.database.table.debug.help')); + ->setHelp($this->trans('commands.debug.database.table.help')); } /** @@ -93,8 +93,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $tableInfo = $this->redBean->inspect($table); $tableHeader = [ - $this->trans('commands.database.table.debug.messages.column'), - $this->trans('commands.database.table.debug.messages.type') + $this->trans('commands.debug.database.table.messages.column'), + $this->trans('commands.debug.database.table.messages.type') ]; $tableRows = []; foreach ($tableInfo as $column => $type) { @@ -114,13 +114,13 @@ protected function execute(InputInterface $input, OutputInterface $output) $io->comment( sprintf( - $this->trans('commands.database.table.debug.messages.table-show'), + $this->trans('commands.debug.database.table.messages.table-show'), $databaseConnection['database'] ) ); $io->table( - [$this->trans('commands.database.table.debug.messages.table')], + [$this->trans('commands.debug.database.table.messages.table')], $tables ); diff --git a/src/Command/Entity/DebugCommand.php b/src/Command/Debug/EntityCommand.php similarity index 83% rename from src/Command/Entity/DebugCommand.php rename to src/Command/Debug/EntityCommand.php index d041d56f7..6f1c25ddd 100644 --- a/src/Command/Entity/DebugCommand.php +++ b/src/Command/Debug/EntityCommand.php @@ -1,10 +1,10 @@ setName('entity:debug') - ->setDescription($this->trans('commands.entity.debug.description')) + ->setName('debug:entity') + ->setDescription($this->trans('commands.debug.entity.description')) ->addArgument( 'entity-type', InputArgument::OPTIONAL, - $this->trans('commands.entity.debug.arguments.entity-type') + $this->trans('commands.debug.entity.arguments.entity-type') ); } @@ -68,8 +68,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $entityType = $input->getArgument('entity-type'); $tableHeader = [ - $this->trans('commands.entity.debug.table-headers.entity-name'), - $this->trans('commands.entity.debug.table-headers.entity-type') + $this->trans('commands.debug.entity.table-headers.entity-name'), + $this->trans('commands.debug.entity.table-headers.entity-type') ]; $tableRows = []; From d9829b1f52e449f8f246483ad672cd7afcd8319d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Iv=C3=A1n=20M=C3=A9ndez=20Castillo?= Date: Wed, 5 Jul 2017 17:46:31 -0500 Subject: [PATCH 275/321] text used in yml fixed for export command (#3401) --- src/Command/Config/ExportCommand.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Command/Config/ExportCommand.php b/src/Command/Config/ExportCommand.php index 9be8e7d61..d0e24e73a 100644 --- a/src/Command/Config/ExportCommand.php +++ b/src/Command/Config/ExportCommand.php @@ -59,23 +59,23 @@ protected function configure() 'directory', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.config.export.arguments.directory') + $this->trans('commands.config.export.options.directory') ) ->addOption( 'tar', null, InputOption::VALUE_NONE, - $this->trans('commands.config.export.arguments.tar') + $this->trans('commands.config.export.options.tar') )->addOption( 'remove-uuid', null, InputOption::VALUE_NONE, - $this->trans('commands.config.export.single.options.remove-uuid') + $this->trans('commands.config.export.options.remove-uuid') )->addOption( 'remove-config-hash', null, InputOption::VALUE_NONE, - $this->trans('commands.config.export.single.options.remove-config-hash') + $this->trans('commands.config.export.options.remove-config-hash') ) ->setAliases(['ce']); } @@ -91,7 +91,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $tar = $input->getOption('tar'); $removeUuid = $input->getOption('remove-uuid'); $removeHash = $input->getOption('remove-config-hash'); - + if (!$directory) { $directory = config_get_config_directory(CONFIG_SYNC_DIRECTORY); } From 801bfb1f8b445cf6e8ffc01623a0cda4e9496dd3 Mon Sep 17 00:00:00 2001 From: Mauricio Hernandez Date: Wed, 5 Jul 2017 17:23:57 -0600 Subject: [PATCH 276/321] 3380 relocate to debug config (#3402) * Move cache:context:debug to debug:cache:context * Move config:debug to debug:config * Move config:settings:debug to debug:config:settings * Move config:validate:debug to debug:config:validate * Move multisite:debug to debug:multisite --- config/services/drupal-console/cache.yml | 4 --- config/services/drupal-console/config.yml | 14 --------- config/services/drupal-console/debug.yml | 23 +++++++++++++++ .../CacheContextCommand.php} | 20 ++++++------- .../ConfigCommand.php} | 18 ++++++------ .../ConfigSettingsCommand.php} | 18 ++++++------ .../ConfigValidateCommand.php} | 29 ++++++++++--------- .../MultisiteCommand.php} | 28 +++++++++--------- uninstall.services.yml | 5 ---- 9 files changed, 80 insertions(+), 79 deletions(-) rename src/Command/{Cache/ContextDebugCommand.php => Debug/CacheContextCommand.php} (67%) rename src/Command/{Config/DebugCommand.php => Debug/ConfigCommand.php} (85%) rename src/Command/{Config/SettingsDebugCommand.php => Debug/ConfigSettingsCommand.php} (73%) rename src/Command/{Config/ValidateDebugCommand.php => Debug/ConfigValidateCommand.php} (78%) rename src/Command/{Multisite/DebugCommand.php => Debug/MultisiteCommand.php} (67%) diff --git a/config/services/drupal-console/cache.yml b/config/services/drupal-console/cache.yml index 1f4df9099..632fe211a 100644 --- a/config/services/drupal-console/cache.yml +++ b/config/services/drupal-console/cache.yml @@ -1,8 +1,4 @@ services: - console.cache_context_debug: - class: Drupal\Console\Command\Cache\ContextDebugCommand - tags: - - { name: drupal.command } console.cache_rebuild: class: Drupal\Console\Command\Cache\RebuildCommand arguments: ['@console.drupal_api', '@console.site', '@class_loader', '@request_stack'] diff --git a/config/services/drupal-console/config.yml b/config/services/drupal-console/config.yml index 1bd38a653..6ed2c03f5 100644 --- a/config/services/drupal-console/config.yml +++ b/config/services/drupal-console/config.yml @@ -1,9 +1,4 @@ services: - console.config_debug: - class: Drupal\Console\Command\Config\DebugCommand - arguments: ['@config.factory', '@config.storage'] - tags: - - { name: drupal.command } console.config_delete: class: Drupal\Console\Command\Config\DeleteCommand arguments: ['@config.factory', '@config.storage', '@config.storage.sync'] @@ -54,19 +49,10 @@ services: arguments: ['@config.storage', '@config.factory'] tags: - { name: drupal.command } - console.config_settings_debug: - class: Drupal\Console\Command\Config\SettingsDebugCommand - arguments: ['@settings'] - tags: - - { name: drupal.command } console.config_validate: class: Drupal\Console\Command\Config\ValidateCommand tags: - { name: drupal.command } - console.config_validate_debug: - class: Drupal\Console\Command\Config\ValidateDebugCommand - tags: - - { name: drupal.command } diff --git a/config/services/drupal-console/debug.yml b/config/services/drupal-console/debug.yml index a329bc0d1..a7ee0db72 100644 --- a/config/services/drupal-console/debug.yml +++ b/config/services/drupal-console/debug.yml @@ -95,3 +95,26 @@ services: arguments: ['@breakpoint.manager', '@app.root'] tags: - { name: drupal.command } + console.cache_context_debug: + class: Drupal\Console\Command\Debug\CacheContextCommand + tags: + - { name: drupal.command } + console.config_debug: + class: Drupal\Console\Command\Debug\ConfigCommand + arguments: ['@config.factory', '@config.storage'] + tags: + - { name: drupal.command } + console.config_settings_debug: + class: Drupal\Console\Command\Debug\ConfigSettingsCommand + arguments: ['@settings'] + tags: + - { name: drupal.command } + console.config_validate_debug: + class: Drupal\Console\Command\Debug\ConfigValidateCommand + tags: + - { name: drupal.command } + console.multisite_debug: + class: Drupal\Console\Command\Debug\MultisiteCommand + arguments: ['@app.root'] + tags: + - { name: drupal.command } diff --git a/src/Command/Cache/ContextDebugCommand.php b/src/Command/Debug/CacheContextCommand.php similarity index 67% rename from src/Command/Cache/ContextDebugCommand.php rename to src/Command/Debug/CacheContextCommand.php index b14f849f0..d1aa713fc 100644 --- a/src/Command/Cache/ContextDebugCommand.php +++ b/src/Command/Debug/CacheContextCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Cache\ContextDebugCommand. + * Contains \Drupal\Console\Command\Debug\CacheContextCommand. */ -namespace Drupal\Console\Command\Cache; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -14,11 +14,11 @@ use Drupal\Console\Core\Style\DrupalStyle; /** - * Class ContextDebugCommand. + * Class CacheContextCommand. * - * @package Drupal\Console\Command\Cache + * @package Drupal\Console\Command\Debug */ -class ContextDebugCommand extends Command +class CacheContextCommand extends Command { use ContainerAwareCommandTrait; @@ -28,8 +28,8 @@ class ContextDebugCommand extends Command protected function configure() { $this - ->setName('cache:context:debug') - ->setDescription($this->trans('commands.cache.context.debug.description')); + ->setName('debug:cache:context') + ->setDescription($this->trans('commands.debug.cache.context.description')); } /** @@ -41,9 +41,9 @@ protected function execute(InputInterface $input, OutputInterface $output) $contextManager = $this->get('cache_contexts_manager'); $tableHeader = [ - $this->trans('commands.cache.context.debug.messages.code'), - $this->trans('commands.cache.context.debug.messages.label'), - $this->trans('commands.cache.context.debug.messages.class'), + $this->trans('commands.debug.cache.context.messages.code'), + $this->trans('commands.debug.cache.context.messages.label'), + $this->trans('commands.debug.cache.context.messages.class'), ]; $tableRows = []; diff --git a/src/Command/Config/DebugCommand.php b/src/Command/Debug/ConfigCommand.php similarity index 85% rename from src/Command/Config/DebugCommand.php rename to src/Command/Debug/ConfigCommand.php index fc7406a42..4e5e0f278 100644 --- a/src/Command/Config/DebugCommand.php +++ b/src/Command/Debug/ConfigCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Config\DebugCommand. + * Contains \Drupal\Console\Command\Debug\ConfigCommand. */ -namespace Drupal\Console\Command\Config; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -17,7 +17,7 @@ use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; -class DebugCommand extends Command +class ConfigCommand extends Command { use CommandTrait; @@ -32,7 +32,7 @@ class DebugCommand extends Command protected $configStorage; /** - * DebugCommand constructor. + * ConfigCommand constructor. * * @param ConfigFactory $configFactory * @param CachedStorage $configStorage @@ -52,12 +52,12 @@ public function __construct( protected function configure() { $this - ->setName('config:debug') - ->setDescription($this->trans('commands.config.debug.description')) + ->setName('debug:config') + ->setDescription($this->trans('commands.debug.config.description')) ->addArgument( 'name', InputArgument::OPTIONAL, - $this->trans('commands.config.debug.arguments.name') + $this->trans('commands.debug.config.arguments.name') ) ->setAliases(['cde']); } @@ -84,7 +84,7 @@ private function getAllConfigurations(DrupalStyle $io) { $names = $this->configFactory->listAll(); $tableHeader = [ - $this->trans('commands.config.debug.arguments.name'), + $this->trans('commands.debug.config.arguments.name'), ]; $tableRows = []; foreach ($names as $name) { @@ -117,7 +117,7 @@ private function getConfigurationByName(DrupalStyle $io, $config_name) $io->table($tableHeader, $tableRows, 'compact'); } else { $io->error( - sprintf($this->trans('commands.config.debug.errors.not-exists'), $config_name) + sprintf($this->trans('commands.debug.config.errors.not-exists'), $config_name) ); } } diff --git a/src/Command/Config/SettingsDebugCommand.php b/src/Command/Debug/ConfigSettingsCommand.php similarity index 73% rename from src/Command/Config/SettingsDebugCommand.php rename to src/Command/Debug/ConfigSettingsCommand.php index 38b3c8d60..9dfe2d4b1 100644 --- a/src/Command/Config/SettingsDebugCommand.php +++ b/src/Command/Debug/ConfigSettingsCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Config\SettingsDebugCommand. + * Contains \Drupal\Console\Command\Debug\ConfigSettingsCommand. */ -namespace Drupal\Console\Command\Config; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -18,9 +18,9 @@ /** * Class DebugCommand * - * @package Drupal\Console\Command\Config + * @package Drupal\Console\Command\Debug */ -class SettingsDebugCommand extends Command +class ConfigSettingsCommand extends Command { use CommandTrait; @@ -30,7 +30,7 @@ class SettingsDebugCommand extends Command protected $settings; /** - * SettingsDebugCommand constructor. + * ConfigSettingsCommand constructor. * * @param Settings $settings */ @@ -46,9 +46,9 @@ public function __construct(Settings $settings) protected function configure() { $this - ->setName('config:settings:debug') - ->setDescription($this->trans('commands.config.settings.debug.description')) - ->setHelp($this->trans('commands.config.settings.debug.help')); + ->setName('debug:config:settings') + ->setDescription($this->trans('commands.debug.config.settings.description')) + ->setHelp($this->trans('commands.debug.config.settings.help')); } /** @@ -61,7 +61,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $settingKeys = array_keys($this->settings->getAll()); $io->newLine(); - $io->info($this->trans('commands.config.settings.debug.messages.current')); + $io->info($this->trans('commands.debug.config.settings.messages.current')); $io->newLine(); foreach ($settingKeys as $settingKey) { diff --git a/src/Command/Config/ValidateDebugCommand.php b/src/Command/Debug/ConfigValidateCommand.php similarity index 78% rename from src/Command/Config/ValidateDebugCommand.php rename to src/Command/Debug/ConfigValidateCommand.php index ec193d7bd..ab31d2c6f 100644 --- a/src/Command/Config/ValidateDebugCommand.php +++ b/src/Command/Debug/ConfigValidateCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Config\ValidateDebugCommand. + * Contains \Drupal\Console\Command\Debug\ConfigValidateCommand. */ -namespace Drupal\Console\Command\Config; +namespace Drupal\Console\Command\Debug; use Drupal\Core\Config\Schema\SchemaCheckTrait; use Symfony\Component\Console\Input\InputInterface; @@ -17,13 +17,14 @@ use Symfony\Component\Console\Input\InputArgument; use Drupal\Core\Config\TypedConfigManagerInterface; use Drupal\Core\Serialization\Yaml; +use Drupal\Console\Command\Config\PrintConfigValidationTrait; /** - * Class ValidateDebugCommand. + * Class ConfigValidateCommand. * - *@package Drupal\Console\Command\Config + *@package Drupal\Console\Command\Debug */ -class ValidateDebugCommand extends Command +class ConfigValidateCommand extends Command { use ContainerAwareCommandTrait; use SchemaCheckTrait; @@ -35,19 +36,19 @@ class ValidateDebugCommand extends Command protected function configure() { $this - ->setName('config:validate:debug') - ->setDescription($this->trans('commands.config.validate.debug.description')) + ->setName('debug:config:validate') + ->setDescription($this->trans('commands.debug.config.validate.description')) ->addArgument( - 'filepath', + 'filepath', InputArgument::REQUIRED ) ->addArgument( - 'schema-filepath', + 'schema-filepath', InputArgument::REQUIRED ) ->addOption( - 'schema-name', - 'sch', + 'schema-name', + 'sch', InputOption::VALUE_REQUIRED ); } @@ -68,14 +69,14 @@ protected function execute(InputInterface $input, OutputInterface $output) //Validate config file path $configFilePath = $input->getArgument('filepath'); if (!file_exists($configFilePath)) { - $io->info($this->trans('commands.config.validate.debug.messages.noConfFile')); + $io->info($this->trans('commands.debug.config.validate.messages.noConfFile')); return 1; } //Validate schema path $configSchemaFilePath = $input->getArgument('schema-filepath'); if (!file_exists($configSchemaFilePath)) { - $io->info($this->trans('commands.config.validate.debug.messages.noConfSchema')); + $io->info($this->trans('commands.debug.config.validate.messages.noConfSchema')); return 1; } @@ -85,7 +86,7 @@ protected function execute(InputInterface $input, OutputInterface $output) //Get the schema name and check it exists in the schema array $schemaName = $this->getSchemaName($input, $configFilePath); if (!array_key_exists($schemaName, $schema)) { - $io->warning($this->trans('commands.config.validate.debug.messages.noSchemaName') . $schemaName); + $io->warning($this->trans('commands.debug.config.validate.messages.noSchemaName') . $schemaName); return 1; } diff --git a/src/Command/Multisite/DebugCommand.php b/src/Command/Debug/MultisiteCommand.php similarity index 67% rename from src/Command/Multisite/DebugCommand.php rename to src/Command/Debug/MultisiteCommand.php index 541eebd69..a05a2177e 100644 --- a/src/Command/Multisite/DebugCommand.php +++ b/src/Command/Debug/MultisiteCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Site\DebugCommand. + * Contains \Drupal\Console\Command\Debug\MultisiteCommand. */ -namespace Drupal\Console\Command\Multisite; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -14,18 +14,18 @@ use Drupal\Console\Core\Style\DrupalStyle; /** - * Class SiteDebugCommand + * Class MultisiteCommand * - * @package Drupal\Console\Command\Site + * @package Drupal\Console\Command\Debug */ -class DebugCommand extends Command +class MultisiteCommand extends Command { use CommandTrait; protected $appRoot; /** - * DebugCommand constructor. + * MultisiteCommand constructor. * * @param $appRoot */ @@ -41,10 +41,10 @@ public function __construct($appRoot) public function configure() { $this - ->setName('multisite:debug') - ->setDescription($this->trans('commands.multisite.debug.description')) - ->setHelp($this->trans('commands.multisite.debug.help')) - ->setAliases(['sd']); + ->setName('debug:multisite') + ->setDescription($this->trans('commands.debug.multisite.description')) + ->setHelp($this->trans('commands.debug.multisite.help')) + ->setAliases(['msd']); ; } @@ -68,19 +68,19 @@ protected function execute(InputInterface $input, OutputInterface $output) if (!$sites) { $io->error( - $this->trans('commands.multisite.debug.messages.no-multisites') + $this->trans('commands.debug.multisite.messages.no-multisites') ); return 1; } $io->info( - $this->trans('commands.multisite.debug.messages.site-format') + $this->trans('commands.debug.multisite.messages.site-format') ); $tableHeader = [ - $this->trans('commands.multisite.debug.messages.site'), - $this->trans('commands.multisite.debug.messages.directory'), + $this->trans('commands.debug.multisite.messages.site'), + $this->trans('commands.debug.multisite.messages.directory'), ]; $tableRows = []; diff --git a/uninstall.services.yml b/uninstall.services.yml index e85c0feb5..c1835417a 100644 --- a/uninstall.services.yml +++ b/uninstall.services.yml @@ -15,11 +15,6 @@ services: arguments: ['@console.extension_manager', '@console.site', '@console.configuration_manager', '@app.root'] tags: - { name: drupal.command } - console.multisite_debug: - class: Drupal\Console\Command\Multisite\DebugCommand - arguments: ['@app.root'] - tags: - - { name: drupal.command } console.multisite_new: class: Drupal\Console\Command\Multisite\NewCommand arguments: ['@app.root'] From 2a4100241b8d5e55c44f9d3184b376af52aec49c Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 5 Jul 2017 20:56:23 -0700 Subject: [PATCH 277/321] [console] Relocate core dependent command registration. (#3403) * [console] Relocate core dependant command registration. * [console] Move services files. --- config/services/{drupal-console => }/cache.yml | 0 config/services/{drupal-console => }/config.yml | 0 config/services/{drupal-console => }/create.yml | 0 config/services/{drupal-console => }/cron.yml | 0 .../services/{drupal-console => }/database.yml | 0 config/services/{drupal-console => }/debug.yml | 0 config/services/{drupal-console => }/develop.yml | 0 config/services/{drupal-console => }/entity.yml | 0 config/services/{drupal-console => }/feature.yml | 0 config/services/{drupal-console => }/field.yml | 0 .../services/{drupal-console => }/generate.yml | 0 .../services/{drupal-console => }/generator.yml | 0 config/services/{drupal-console => }/image.yml | 0 config/services/{drupal-console => }/locale.yml | 0 config/services/{drupal-core => }/migrate.yml | 9 +++++---- config/services/{drupal-console => }/misc.yml | 0 config/services/{drupal-console => }/module.yml | 0 config/services/{drupal-console => }/node.yml | 0 config/services/{drupal-console => }/queue.yml | 0 config/services/{drupal-core => }/rest.yml | 11 ++++++++--- config/services/{drupal-console => }/router.yml | 0 config/services/{drupal-core => }/simpletest.yml | 4 ++-- config/services/{drupal-console => }/site.yml | 0 config/services/{drupal-console => }/state.yml | 0 .../services/{drupal-console => }/taxonomy.yml | 0 config/services/{drupal-console => }/theme.yml | 0 config/services/{drupal-console => }/update.yml | 0 config/services/{drupal-console => }/user.yml | 0 config/services/{drupal-console => }/views.yml | 0 src/Bootstrap/AddServicesCompilerPass.php | 14 +------------- src/Command/Migrate/DebugCommand.php | 6 +++--- src/Command/Migrate/ExecuteCommand.php | 12 ++++++++++-- src/Command/Migrate/RollBackCommand.php | 9 +++++---- src/Command/Migrate/SetupCommand.php | 16 +++++++++++++--- src/Command/Rest/DebugCommand.php | 1 - src/Command/Test/RunCommand.php | 2 -- 36 files changed, 47 insertions(+), 37 deletions(-) rename config/services/{drupal-console => }/cache.yml (100%) rename config/services/{drupal-console => }/config.yml (100%) rename config/services/{drupal-console => }/create.yml (100%) rename config/services/{drupal-console => }/cron.yml (100%) rename config/services/{drupal-console => }/database.yml (100%) rename config/services/{drupal-console => }/debug.yml (100%) rename config/services/{drupal-console => }/develop.yml (100%) rename config/services/{drupal-console => }/entity.yml (100%) rename config/services/{drupal-console => }/feature.yml (100%) rename config/services/{drupal-console => }/field.yml (100%) rename config/services/{drupal-console => }/generate.yml (100%) rename config/services/{drupal-console => }/generator.yml (100%) rename config/services/{drupal-console => }/image.yml (100%) rename config/services/{drupal-console => }/locale.yml (100%) rename config/services/{drupal-core => }/migrate.yml (72%) rename config/services/{drupal-console => }/misc.yml (100%) rename config/services/{drupal-console => }/module.yml (100%) rename config/services/{drupal-console => }/node.yml (100%) rename config/services/{drupal-console => }/queue.yml (100%) rename config/services/{drupal-core => }/rest.yml (52%) rename config/services/{drupal-console => }/router.yml (100%) rename config/services/{drupal-core => }/simpletest.yml (66%) rename config/services/{drupal-console => }/site.yml (100%) rename config/services/{drupal-console => }/state.yml (100%) rename config/services/{drupal-console => }/taxonomy.yml (100%) rename config/services/{drupal-console => }/theme.yml (100%) rename config/services/{drupal-console => }/update.yml (100%) rename config/services/{drupal-console => }/user.yml (100%) rename config/services/{drupal-console => }/views.yml (100%) diff --git a/config/services/drupal-console/cache.yml b/config/services/cache.yml similarity index 100% rename from config/services/drupal-console/cache.yml rename to config/services/cache.yml diff --git a/config/services/drupal-console/config.yml b/config/services/config.yml similarity index 100% rename from config/services/drupal-console/config.yml rename to config/services/config.yml diff --git a/config/services/drupal-console/create.yml b/config/services/create.yml similarity index 100% rename from config/services/drupal-console/create.yml rename to config/services/create.yml diff --git a/config/services/drupal-console/cron.yml b/config/services/cron.yml similarity index 100% rename from config/services/drupal-console/cron.yml rename to config/services/cron.yml diff --git a/config/services/drupal-console/database.yml b/config/services/database.yml similarity index 100% rename from config/services/drupal-console/database.yml rename to config/services/database.yml diff --git a/config/services/drupal-console/debug.yml b/config/services/debug.yml similarity index 100% rename from config/services/drupal-console/debug.yml rename to config/services/debug.yml diff --git a/config/services/drupal-console/develop.yml b/config/services/develop.yml similarity index 100% rename from config/services/drupal-console/develop.yml rename to config/services/develop.yml diff --git a/config/services/drupal-console/entity.yml b/config/services/entity.yml similarity index 100% rename from config/services/drupal-console/entity.yml rename to config/services/entity.yml diff --git a/config/services/drupal-console/feature.yml b/config/services/feature.yml similarity index 100% rename from config/services/drupal-console/feature.yml rename to config/services/feature.yml diff --git a/config/services/drupal-console/field.yml b/config/services/field.yml similarity index 100% rename from config/services/drupal-console/field.yml rename to config/services/field.yml diff --git a/config/services/drupal-console/generate.yml b/config/services/generate.yml similarity index 100% rename from config/services/drupal-console/generate.yml rename to config/services/generate.yml diff --git a/config/services/drupal-console/generator.yml b/config/services/generator.yml similarity index 100% rename from config/services/drupal-console/generator.yml rename to config/services/generator.yml diff --git a/config/services/drupal-console/image.yml b/config/services/image.yml similarity index 100% rename from config/services/drupal-console/image.yml rename to config/services/image.yml diff --git a/config/services/drupal-console/locale.yml b/config/services/locale.yml similarity index 100% rename from config/services/drupal-console/locale.yml rename to config/services/locale.yml diff --git a/config/services/drupal-core/migrate.yml b/config/services/migrate.yml similarity index 72% rename from config/services/drupal-core/migrate.yml rename to config/services/migrate.yml index feae3909a..660176519 100644 --- a/config/services/drupal-core/migrate.yml +++ b/config/services/migrate.yml @@ -1,21 +1,22 @@ services: console.migrate_rollback: class: Drupal\Console\Command\Migrate\RollBackCommand - arguments: ['@plugin.manager.migration'] + arguments: ['@?plugin.manager.migration'] tags: - { name: drupal.command } console.migrate_execute: class: Drupal\Console\Command\Migrate\ExecuteCommand - arguments: ['@plugin.manager.migration'] + arguments: ['@?plugin.manager.migration'] tags: - { name: drupal.command } console.migrate_debug: class: Drupal\Console\Command\Migrate\DebugCommand - arguments: ['@plugin.manager.migration'] + arguments: ['@?plugin.manager.migration'] tags: - { name: drupal.command } console.migrate_setup: class: Drupal\Console\Command\Migrate\SetupCommand - arguments: ['@state', '@plugin.manager.migration'] + arguments: ['@state', '@?plugin.manager.migration'] tags: - { name: drupal.command } + diff --git a/config/services/drupal-console/misc.yml b/config/services/misc.yml similarity index 100% rename from config/services/drupal-console/misc.yml rename to config/services/misc.yml diff --git a/config/services/drupal-console/module.yml b/config/services/module.yml similarity index 100% rename from config/services/drupal-console/module.yml rename to config/services/module.yml diff --git a/config/services/drupal-console/node.yml b/config/services/node.yml similarity index 100% rename from config/services/drupal-console/node.yml rename to config/services/node.yml diff --git a/config/services/drupal-console/queue.yml b/config/services/queue.yml similarity index 100% rename from config/services/drupal-console/queue.yml rename to config/services/queue.yml diff --git a/config/services/drupal-core/rest.yml b/config/services/rest.yml similarity index 52% rename from config/services/drupal-core/rest.yml rename to config/services/rest.yml index 8a5935470..cfc280bd5 100644 --- a/config/services/drupal-core/rest.yml +++ b/config/services/rest.yml @@ -1,16 +1,21 @@ services: console.rest_debug: class: Drupal\Console\Command\Rest\DebugCommand - arguments: ['@plugin.manager.rest'] + arguments: ['@?plugin.manager.rest'] tags: - { name: drupal.command } console.rest_disable: class: Drupal\Console\Command\Rest\DisableCommand - arguments: ['@config.factory', '@plugin.manager.rest'] + arguments: ['@config.factory', '@?plugin.manager.rest'] tags: - { name: drupal.command } console.rest_enable: class: Drupal\Console\Command\Rest\EnableCommand - arguments: ['@plugin.manager.rest', '@authentication_collector', '@config.factory', '%serializer.formats%', '@entity.manager'] + arguments: + - '@?plugin.manager.rest' + - '@authentication_collector' + - '@config.factory' + - "@=container.hasParameter('serializer.formats') ? parameter('serializer.formats') : []" + - '@entity.manager' tags: - { name: drupal.command } diff --git a/config/services/drupal-console/router.yml b/config/services/router.yml similarity index 100% rename from config/services/drupal-console/router.yml rename to config/services/router.yml diff --git a/config/services/drupal-core/simpletest.yml b/config/services/simpletest.yml similarity index 66% rename from config/services/drupal-core/simpletest.yml rename to config/services/simpletest.yml index 862b856a6..4c5570296 100644 --- a/config/services/drupal-core/simpletest.yml +++ b/config/services/simpletest.yml @@ -1,11 +1,11 @@ services: console.test_debug: class: Drupal\Console\Command\Test\DebugCommand - arguments: ['@test_discovery'] + arguments: ['@?test_discovery'] tags: - { name: drupal.command } console.test_run: class: Drupal\Console\Command\Test\RunCommand - arguments: ['@app.root', '@test_discovery', '@module_handler', '@date.formatter'] + arguments: ['@app.root', '@?test_discovery', '@module_handler', '@date.formatter'] tags: - { name: drupal.command } diff --git a/config/services/drupal-console/site.yml b/config/services/site.yml similarity index 100% rename from config/services/drupal-console/site.yml rename to config/services/site.yml diff --git a/config/services/drupal-console/state.yml b/config/services/state.yml similarity index 100% rename from config/services/drupal-console/state.yml rename to config/services/state.yml diff --git a/config/services/drupal-console/taxonomy.yml b/config/services/taxonomy.yml similarity index 100% rename from config/services/drupal-console/taxonomy.yml rename to config/services/taxonomy.yml diff --git a/config/services/drupal-console/theme.yml b/config/services/theme.yml similarity index 100% rename from config/services/drupal-console/theme.yml rename to config/services/theme.yml diff --git a/config/services/drupal-console/update.yml b/config/services/update.yml similarity index 100% rename from config/services/drupal-console/update.yml rename to config/services/update.yml diff --git a/config/services/drupal-console/user.yml b/config/services/user.yml similarity index 100% rename from config/services/drupal-console/user.yml rename to config/services/user.yml diff --git a/config/services/drupal-console/views.yml b/config/services/views.yml similarity index 100% rename from config/services/drupal-console/views.yml rename to config/services/views.yml diff --git a/src/Bootstrap/AddServicesCompilerPass.php b/src/Bootstrap/AddServicesCompilerPass.php index 9e29c83e2..b259423e5 100644 --- a/src/Bootstrap/AddServicesCompilerPass.php +++ b/src/Bootstrap/AddServicesCompilerPass.php @@ -87,7 +87,7 @@ public function process(ContainerBuilder $container) ->name('*.yml') ->in( sprintf( - '%s/config/services/drupal-console', + '%s/config/services', $this->root.DRUPAL_CONSOLE ) ); @@ -115,18 +115,6 @@ public function process(ContainerBuilder $container) ->getList(false); foreach ($modules as $module) { - if ($module->origin == 'core') { - $consoleServicesExtensionFile = $this->root . DRUPAL_CONSOLE . - 'config/services/drupal-core/'.$module->getName().'.yml'; - if (is_file($consoleServicesExtensionFile)) { - $loader->load($consoleServicesExtensionFile); - $servicesData = $this->extractServiceData( - $consoleServicesExtensionFile, - $servicesData - ); - } - } - $consoleServicesExtensionFile = $this->appRoot . '/' . $module->getPath() . '/console.services.yml'; if (is_file($consoleServicesExtensionFile)) { diff --git a/src/Command/Migrate/DebugCommand.php b/src/Command/Migrate/DebugCommand.php index 85a3f75ea..da908d8c9 100644 --- a/src/Command/Migrate/DebugCommand.php +++ b/src/Command/Migrate/DebugCommand.php @@ -23,7 +23,6 @@ * extensionType = "module" * ) */ - class DebugCommand extends Command { use MigrationTrait; @@ -39,8 +38,9 @@ class DebugCommand extends Command * * @param MigrationPluginManagerInterface $pluginManagerMigration */ - public function __construct(MigrationPluginManagerInterface $pluginManagerMigration) - { + public function __construct( + MigrationPluginManagerInterface $pluginManagerMigration + ) { $this->pluginManagerMigration = $pluginManagerMigration; parent::__construct(); } diff --git a/src/Command/Migrate/ExecuteCommand.php b/src/Command/Migrate/ExecuteCommand.php index d5ca9ed38..c0aa47144 100644 --- a/src/Command/Migrate/ExecuteCommand.php +++ b/src/Command/Migrate/ExecuteCommand.php @@ -22,7 +22,14 @@ use Drupal\State\StateInterface; use Symfony\Component\Console\Command\Command; use Drupal\migrate\Plugin\MigrationPluginManagerInterface; +use Drupal\Console\Annotations\DrupalCommand; +/** + * @DrupalCommand( + * extension = "migrate", + * extensionType = "module" + * ) + */ class ExecuteCommand extends Command { use DatabaseTrait; @@ -41,8 +48,9 @@ class ExecuteCommand extends Command * * @param MigrationPluginManagerInterface $pluginManagerMigration */ - public function __construct(MigrationPluginManagerInterface $pluginManagerMigration) - { + public function __construct( + MigrationPluginManagerInterface $pluginManagerMigration + ) { $this->pluginManagerMigration = $pluginManagerMigration; parent::__construct(); } diff --git a/src/Command/Migrate/RollBackCommand.php b/src/Command/Migrate/RollBackCommand.php index 91a2fe202..e10d59e26 100644 --- a/src/Command/Migrate/RollBackCommand.php +++ b/src/Command/Migrate/RollBackCommand.php @@ -28,7 +28,6 @@ * extensionType = "module" * ) */ - class RollBackCommand extends Command { use MigrationTrait; @@ -44,8 +43,9 @@ class RollBackCommand extends Command * * @param MigrationPluginManagerInterface $pluginManagerMigration */ - public function __construct(MigrationPluginManagerInterface $pluginManagerMigration) - { + public function __construct( + MigrationPluginManagerInterface $pluginManagerMigration + ) { $this->pluginManagerMigration = $pluginManagerMigration; parent::__construct(); } @@ -61,7 +61,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.migrate.setup.options.source-base_path') - ); + )->setAliases(['mir']); + ; } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Migrate/SetupCommand.php b/src/Command/Migrate/SetupCommand.php index 4430d9387..e54c002b3 100644 --- a/src/Command/Migrate/SetupCommand.php +++ b/src/Command/Migrate/SetupCommand.php @@ -20,7 +20,14 @@ use Drupal\migrate\Plugin\RequirementsInterface; use Drupal\migrate\Exception\RequirementsException; use Drupal\Component\Plugin\Exception\PluginNotFoundException; +use Drupal\Console\Annotations\DrupalCommand; +/** + * @DrupalCommand( + * extension = "migrate", + * extensionType = "module" + * ) + */ class SetupCommand extends Command { use ContainerAwareCommandTrait; @@ -42,8 +49,10 @@ class SetupCommand extends Command * * @param StateInterface $pluginManagerMigration */ - public function __construct(StateInterface $state, MigrationPluginManagerInterface $pluginManagerMigration) - { + public function __construct( + StateInterface $state, + MigrationPluginManagerInterface $pluginManagerMigration + ) { $this->state = $state; $this->pluginManagerMigration = $pluginManagerMigration; parent::__construct(); @@ -101,7 +110,8 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.migrate.setup.options.source-base_path') - ); + )->setAliases(['mis']); + ; } /** diff --git a/src/Command/Rest/DebugCommand.php b/src/Command/Rest/DebugCommand.php index 2a20e5d26..2ffa178de 100644 --- a/src/Command/Rest/DebugCommand.php +++ b/src/Command/Rest/DebugCommand.php @@ -29,7 +29,6 @@ class DebugCommand extends Command use CommandTrait; use RestTrait; - /** * @var ResourcePluginManager $pluginManagerRest */ diff --git a/src/Command/Test/RunCommand.php b/src/Command/Test/RunCommand.php index be4c4d408..0539ad0e6 100644 --- a/src/Command/Test/RunCommand.php +++ b/src/Command/Test/RunCommand.php @@ -52,8 +52,6 @@ class RunCommand extends Command */ protected $dateFormatter; - - /** * RunCommand constructor. * From 0efa2cc300297b9f6c949154e9d4e47d8dd3a488 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 5 Jul 2017 23:06:03 -0700 Subject: [PATCH 278/321] [console] Relocate services cache file. (#3404) --- .gitignore | 1 + composer.lock | 12 ++-- src/Bootstrap/AddServicesCompilerPass.php | 10 +++- src/Bootstrap/Drupal.php | 4 +- src/Utils/Site.php | 73 ++++++----------------- 5 files changed, 35 insertions(+), 65 deletions(-) diff --git a/.gitignore b/.gitignore index 850cec01f..c6549b085 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ autoload.local.php # drupal/console-extend-plugin generated files extend.console.*.yml +*.console.services.yml diff --git a/composer.lock b/composer.lock index 193c280ff..996933354 100644 --- a/composer.lock +++ b/composer.lock @@ -659,16 +659,16 @@ }, { "name": "drupal/console-dotenv", - "version": "0.1.0", + "version": "0.3.0", "source": { "type": "git", "url": "https://github.com/weknowinc/drupal-console-dotenv.git", - "reference": "48bb017993ab3e10217a63fd5b099f5be432706e" + "reference": "94e88646801c2f80ec2e5e66d3d8f21b0b467405" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/weknowinc/drupal-console-dotenv/zipball/48bb017993ab3e10217a63fd5b099f5be432706e", - "reference": "48bb017993ab3e10217a63fd5b099f5be432706e", + "url": "https://api.github.com/repos/weknowinc/drupal-console-dotenv/zipball/94e88646801c2f80ec2e5e66d3d8f21b0b467405", + "reference": "94e88646801c2f80ec2e5e66d3d8f21b0b467405", "shasum": "" }, "require": { @@ -693,8 +693,8 @@ "email": "jesus.olivas@gmail.com" } ], - "description": "Drupal Console dotenv", - "time": "2017-06-20T19:02:39+00:00" + "description": "Drupal Console Dotenv", + "time": "2017-07-04T01:14:02+00:00" }, { "name": "drupal/console-en", diff --git a/src/Bootstrap/AddServicesCompilerPass.php b/src/Bootstrap/AddServicesCompilerPass.php index b259423e5..c10813262 100644 --- a/src/Bootstrap/AddServicesCompilerPass.php +++ b/src/Bootstrap/AddServicesCompilerPass.php @@ -77,9 +77,13 @@ public function process(ContainerBuilder $container) * @var Site $site */ $site = $container->get('console.site'); + \Drupal::getContainer()->set( + 'console.root', + $this->root + ); if (!$this->rebuild && $site->cachedServicesFileExists()) { - $loader->load($site->cachedServicesFile()); + $loader->load($site->getCachedServicesFile()); } else { $site->removeCachedServicesFile(); $finder = new Finder(); @@ -146,9 +150,9 @@ public function process(ContainerBuilder $container) } } - if ($servicesData && is_writable($site->getCacheDirectory())) { + if ($servicesData) { file_put_contents( - $site->cachedServicesFile(), + $site->getCachedServicesFile(), Yaml::dump($servicesData, 4, 2) ); } diff --git a/src/Bootstrap/Drupal.php b/src/Bootstrap/Drupal.php index 2aefeafe4..7871548de 100644 --- a/src/Bootstrap/Drupal.php +++ b/src/Bootstrap/Drupal.php @@ -149,7 +149,9 @@ public function boot() $this->drupalFinder->getComposerRoot() ); - $consoleExtendConfigFile = $this->drupalFinder->getComposerRoot() . DRUPAL_CONSOLE .'/extend.console.config.yml'; + $consoleExtendConfigFile = $this->drupalFinder + ->getComposerRoot() . DRUPAL_CONSOLE + .'/extend.console.config.yml'; if (file_exists($consoleExtendConfigFile)) { $container->get('console.configuration_manager') ->importConfigurationFile($consoleExtendConfigFile); diff --git a/src/Utils/Site.php b/src/Utils/Site.php index 46fbc86cf..9e7e53a90 100644 --- a/src/Utils/Site.php +++ b/src/Utils/Site.php @@ -3,7 +3,6 @@ namespace Drupal\Console\Utils; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Finder\Finder; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\Logger\LoggerChannelFactory; @@ -27,7 +26,7 @@ class Site /** * @var string */ - protected $cacheDirectory; + protected $cacheServicesFile; /** * Site constructor. @@ -203,72 +202,36 @@ public function validMultisite($uri) return false; } - public function getCacheDirectory() + public function getCachedServicesFile() { - if ($this->cacheDirectory) { - return $this->cacheDirectory; - } - - $configFactory = \Drupal::configFactory(); - $siteId = $configFactory->get('system.site') - ->get('uuid'); - $pathTemporary = $configFactory->get('system.file') - ->get('path.temporary'); - $configuration = $this->configurationManager->getConfiguration(); - $cacheDirectory = $configuration->get('application.cache.directory')?:''; - if ($cacheDirectory) { - if (strpos($cacheDirectory, '/') != 0) { - $cacheDirectory = $this->configurationManager - ->getApplicationDirectory() . '/' . $cacheDirectory; - } - $cacheDirectories[] = $cacheDirectory . '/' . $siteId . '/'; - } - $cacheDirectories[] = sprintf( - '%s/cache/%s/', - $this->configurationManager->getConsoleDirectory(), - $siteId - ); - $cacheDirectories[] = $pathTemporary . '/console/cache/' . $siteId . '/'; + if (!$this->cacheServicesFile) { + $configFactory = \Drupal::configFactory(); + $siteId = $configFactory->get('system.site')->get('uuid'); - foreach ($cacheDirectories as $cacheDirectory) { - if ($this->isValidDirectory($cacheDirectory)) { - $this->cacheDirectory = $cacheDirectory; - break; - } + $this->cacheServicesFile = \Drupal::service('console.root') . + DRUPAL_CONSOLE . $siteId . '.console.services.yml'; } - return $this->cacheDirectory; - } - - private function isValidDirectory($path) - { - $fileSystem = new Filesystem(); - if ($fileSystem->exists($path)) { - return true; - } - try { - $fileSystem->mkdir($path); - - return true; - } catch (\Exception $e) { - return false; - } - } - - public function cachedServicesFile() - { - return $this->getCacheDirectory().'/console.services.yml'; + return $this->cacheServicesFile; } public function cachedServicesFileExists() { - return file_exists($this->cachedServicesFile()); + return file_exists($this->getCachedServicesFile()); } public function removeCachedServicesFile() { if ($this->cachedServicesFileExists()) { - unlink($this->cachedServicesFile()); + unlink($this->getCachedServicesFile()); } } + + /** + * @param string $root + */ + public function setRoot($root) + { + $this->root = $root; + } } From 28c82ab985383c264e70f90bff2aad538d07e566 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 6 Jul 2017 01:01:23 -0700 Subject: [PATCH 279/321] [console] Make services lazy. (#3405) --- config/services/cache.yml | 1 + config/services/config.yml | 14 ++++++++-- config/services/create.yml | 5 ++++ config/services/cron.yml | 2 ++ config/services/database.yml | 9 ++++++ config/services/debug.yml | 33 +++++++++++++++++++--- config/services/develop.yml | 8 ++++++ config/services/entity.yml | 1 + config/services/feature.yml | 2 ++ config/services/field.yml | 1 + config/services/generate.yml | 49 ++++++++++++++++++++++++++++++--- config/services/generator.yml | 49 ++++++++++++++++++++++++++++++--- config/services/image.yml | 1 + config/services/locale.yml | 3 ++ config/services/migrate.yml | 5 +++- config/services/misc.yml | 2 ++ config/services/module.yml | 22 +++++++++------ config/services/node.yml | 1 + config/services/queue.yml | 1 + config/services/rest.yml | 3 ++ config/services/router.yml | 1 + config/services/simpletest.yml | 2 ++ config/services/site.yml | 5 ++++ config/services/state.yml | 2 ++ config/services/taxonomy.yml | 1 + config/services/theme.yml | 4 +++ config/services/update.yml | 2 ++ config/services/user.yml | 7 +++++ config/services/views.yml | 2 ++ services.yml | 11 ++++++++ src/Application.php | 28 +++++++++---------- src/Utils/TranslatorManager.php | 1 + uninstall.services.yml | 6 ++++ 33 files changed, 246 insertions(+), 38 deletions(-) diff --git a/config/services/cache.yml b/config/services/cache.yml index 632fe211a..028c19a83 100644 --- a/config/services/cache.yml +++ b/config/services/cache.yml @@ -4,3 +4,4 @@ services: arguments: ['@console.drupal_api', '@console.site', '@class_loader', '@request_stack'] tags: - { name: drupal.command } + lazy: true diff --git a/config/services/config.yml b/config/services/config.yml index 6ed2c03f5..cbdb2ef14 100644 --- a/config/services/config.yml +++ b/config/services/config.yml @@ -4,55 +4,63 @@ services: arguments: ['@config.factory', '@config.storage', '@config.storage.sync'] tags: - { name: drupal.command } + lazy: true console.config_diff: class: Drupal\Console\Command\Config\DiffCommand arguments: ['@config.storage', '@config.manager'] tags: - { name: drupal.command } + lazy: true console.config_edit: class: Drupal\Console\Command\Config\EditCommand arguments: ['@config.factory', '@config.storage', '@console.configuration_manager'] tags: - { name: drupal.command } + lazy: true console.config_export: class: Drupal\Console\Command\Config\ExportCommand arguments: ['@config.manager', '@config.storage'] tags: - { name: drupal.command } + lazy: true console.config_export_content_type: class: Drupal\Console\Command\Config\ExportContentTypeCommand arguments: ['@entity_type.manager', '@config.storage', '@console.extension_manager'] tags: - { name: drupal.command } + lazy: true console.config_export_single: class: Drupal\Console\Command\Config\ExportSingleCommand arguments: ['@entity_type.manager', '@config.storage', '@console.extension_manager'] tags: - { name: drupal.command } + lazy: true console.config_export_view: class: Drupal\Console\Command\Config\ExportViewCommand arguments: ['@entity_type.manager', '@config.storage', '@console.extension_manager'] tags: - { name: drupal.command } + lazy: true console.config_import: class: Drupal\Console\Command\Config\ImportCommand arguments: ['@config.storage', '@config.manager'] tags: - { name: drupal.command } + lazy: true console.config_import_single: class: Drupal\Console\Command\Config\ImportSingleCommand arguments: ['@config.storage', '@config.manager'] tags: - { name: drupal.command } + lazy: true console.config_override: class: Drupal\Console\Command\Config\OverrideCommand arguments: ['@config.storage', '@config.factory'] tags: - { name: drupal.command } + lazy: true console.config_validate: class: Drupal\Console\Command\Config\ValidateCommand tags: - { name: drupal.command } - - - + lazy: true diff --git a/config/services/create.yml b/config/services/create.yml index 650fb4d59..b2ba06009 100644 --- a/config/services/create.yml +++ b/config/services/create.yml @@ -4,23 +4,28 @@ services: arguments: ['@console.drupal_api', '@console.create_node_data'] tags: - { name: drupal.command } + lazy: true console.create_comments: class: Drupal\Console\Command\Create\CommentsCommand arguments: ['@console.create_comment_data'] tags: - { name: drupal.command } + lazy: true console.create_terms: class: Drupal\Console\Command\Create\TermsCommand arguments: ['@console.drupal_api', '@console.create_term_data'] tags: - { name: drupal.command } + lazy: true console.create_users: class: Drupal\Console\Command\Create\UsersCommand arguments: ['@console.drupal_api', '@console.create_user_data'] tags: - { name: drupal.command } + lazy: true console.create_vocabularies: class: Drupal\Console\Command\Create\VocabulariesCommand arguments: ['@console.create_vocabulary_data'] tags: - { name: drupal.command } + lazy: true diff --git a/config/services/cron.yml b/config/services/cron.yml index bbd8536d9..865c2cd61 100644 --- a/config/services/cron.yml +++ b/config/services/cron.yml @@ -4,8 +4,10 @@ services: arguments: ['@module_handler', '@lock', '@state', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.cron_release: class: Drupal\Console\Command\Cron\ReleaseCommand arguments: ['@lock','@console.chain_queue'] tags: - { name: drupal.command } + lazy: true diff --git a/config/services/database.yml b/config/services/database.yml index 902995f57..573eda99c 100644 --- a/config/services/database.yml +++ b/config/services/database.yml @@ -4,40 +4,49 @@ services: arguments: ['@console.database_settings_generator'] tags: - { name: drupal.command } + lazy: true console.database_client: class: Drupal\Console\Command\Database\ClientCommand tags: - { name: drupal.command } + lazy: true console.database_query: class: Drupal\Console\Command\Database\QueryCommand tags: - { name: drupal.command } + lazy: true console.database_connect: class: Drupal\Console\Command\Database\ConnectCommand tags: - { name: drupal.command } + lazy: true console.database_drop: class: Drupal\Console\Command\Database\DropCommand arguments: ['@database'] tags: - { name: drupal.command } + lazy: true console.database_dump: class: Drupal\Console\Command\Database\DumpCommand arguments: ['@app.root', '@console.shell_process'] tags: - { name: drupal.command } + lazy: true console.database_log_clear: class: Drupal\Console\Command\Database\LogClearCommand arguments: ['@database'] tags: - { name: drupal.command } + lazy: true console.database_log_poll: class: Drupal\Console\Command\Database\LogPollCommand arguments: ['@database', '@date.formatter', '@entity_type.manager', '@string_translation'] tags: - { name: drupal.command } + lazy: true console.database_restore: class: Drupal\Console\Command\Database\RestoreCommand arguments: ['@app.root'] tags: - { name: drupal.command } + lazy: true diff --git a/config/services/debug.yml b/config/services/debug.yml index a7ee0db72..6f201e81a 100644 --- a/config/services/debug.yml +++ b/config/services/debug.yml @@ -3,118 +3,143 @@ services: class: Drupal\Console\Command\Debug\ContainerCommand tags: - { name: drupal.command } + lazy: true console.event_debug: class: Drupal\Console\Command\Debug\EventCommand arguments: ['@event_dispatcher'] tags: - { name: drupal.command } + lazy: true console.permission_debug: class: Drupal\Console\Command\Debug\PermissionCommand tags: - { name: drupal.command } + lazy: true console.plugin_debug: class: Drupal\Console\Command\Debug\PluginCommand tags: - { name: drupal.command } + lazy: true console.update_debug: - class: Drupal\Console\Command\Debug\UpdateCommand - arguments: ['@console.site', '@update.post_update_registry'] - tags: - - { name: drupal.command } + class: Drupal\Console\Command\Debug\UpdateCommand + arguments: ['@console.site', '@update.post_update_registry'] + tags: + - { name: drupal.command } + lazy: true console.user_debug: class: Drupal\Console\Command\Debug\UserCommand arguments: ['@entity_type.manager','@entity.query', '@console.drupal_api'] tags: - { name: drupal.command } + lazy: true console.views_debug: class: Drupal\Console\Command\Debug\ViewsCommand arguments: ['@entity_type.manager'] tags: - { name: drupal.command } + lazy: true console.views_plugins_debug: class: Drupal\Console\Command\Debug\ViewsPluginsCommand tags: - { name: drupal.command } + lazy: true console.state_debug: class: Drupal\Console\Command\Debug\StateCommand arguments: ['@state', '@keyvalue'] tags: - { name: drupal.command } + lazy: true console.theme_debug: class: Drupal\Console\Command\Debug\ThemeCommand arguments: ['@config.factory', '@theme_handler'] tags: - { name: drupal.command } + lazy: true console.router_debug: class: Drupal\Console\Command\Debug\RouterCommand arguments: ['@router.route_provider'] tags: - { name: drupal.command } + lazy: true console.queue_debug: class: Drupal\Console\Command\Debug\QueueCommand arguments: ['@plugin.manager.queue_worker'] tags: - { name: drupal.command } + lazy: true console.libraries_debug: class: Drupal\Console\Command\Debug\LibrariesCommand arguments: ['@module_handler', '@theme_handler', '@library.discovery', '@app.root'] tags: - { name: drupal.command } + lazy: true console.module_debug: class: Drupal\Console\Command\Debug\ModuleCommand arguments: ['@console.configuration_manager', '@console.site', '@http_client'] tags: - { name: drupal.command } + lazy: true console.image_styles_debug: class: Drupal\Console\Command\Debug\ImageStylesCommand arguments: ['@entity_type.manager'] tags: - { name: drupal.command } + lazy: true console.entity_debug: class: Drupal\Console\Command\Debug\EntityCommand arguments: ['@entity_type.repository', '@entity_type.manager'] tags: - { name: drupal.command } + lazy: true console.database_log_debug: class: Drupal\Console\Command\Debug\DatabaseLogCommand arguments: ['@database', '@date.formatter', '@entity_type.manager', '@string_translation'] tags: - { name: drupal.command } + lazy: true console.database_table_debug: class: Drupal\Console\Command\Debug\DatabaseTableCommand arguments: ['@console.redbean', '@database'] tags: - { name: drupal.command } + lazy: true console.cron_debug: class: Drupal\Console\Command\Debug\CronCommand arguments: ['@module_handler'] tags: - { name: drupal.command } + lazy: true console.breakpoints_debug: class: Drupal\Console\Command\Debug\BreakpointsCommand arguments: ['@breakpoint.manager', '@app.root'] tags: - { name: drupal.command } + lazy: true console.cache_context_debug: class: Drupal\Console\Command\Debug\CacheContextCommand tags: - { name: drupal.command } + lazy: true console.config_debug: class: Drupal\Console\Command\Debug\ConfigCommand arguments: ['@config.factory', '@config.storage'] tags: - { name: drupal.command } + lazy: true console.config_settings_debug: class: Drupal\Console\Command\Debug\ConfigSettingsCommand arguments: ['@settings'] tags: - { name: drupal.command } + lazy: true console.config_validate_debug: class: Drupal\Console\Command\Debug\ConfigValidateCommand tags: - { name: drupal.command } + lazy: true console.multisite_debug: class: Drupal\Console\Command\Debug\MultisiteCommand arguments: ['@app.root'] tags: - { name: drupal.command } + lazy: true diff --git a/config/services/develop.yml b/config/services/develop.yml index 3076e547c..c776f60f9 100644 --- a/config/services/develop.yml +++ b/config/services/develop.yml @@ -3,37 +3,45 @@ services: class: Drupal\Console\Command\Develop\GenerateDocCheatsheetCommand tags: - { name: drupal.command } + lazy: true console.generate_doc_dash: class: Drupal\Console\Command\Develop\GenerateDocDashCommand arguments: ['@console.renderer', '@console.root'] tags: - { name: drupal.command } + lazy: true console.generate_doc_data: class: Drupal\Console\Command\Develop\GenerateDocDataCommand tags: - { name: drupal.command } + lazy: true console.generate_doc_gitbook: class: Drupal\Console\Command\Develop\GenerateDocGitbookCommand arguments: ['@console.renderer'] tags: - { name: drupal.command } + lazy: true console.translation_cleanup: class: Drupal\Console\Command\Develop\TranslationCleanupCommand arguments: ['@console.root', '@console.configuration_manager'] tags: - { name: drupal.command } + lazy: true console.translation_pending: class: Drupal\Console\Command\Develop\TranslationPendingCommand arguments: ['@console.root', '@console.configuration_manager', '@console.nested_array'] tags: - { name: drupal.command } + lazy: true console.translation_stats: class: Drupal\Console\Command\Develop\TranslationStatsCommand arguments: ['@console.root', '@console.configuration_manager', '@console.renderer', '@console.nested_array'] tags: - { name: drupal.command } + lazy: true console.translation_sync: class: Drupal\Console\Command\Develop\TranslationSyncCommand arguments: ['@console.root', '@console.configuration_manager'] tags: - { name: drupal.command } + lazy: true diff --git a/config/services/entity.yml b/config/services/entity.yml index 58b018879..592389d55 100644 --- a/config/services/entity.yml +++ b/config/services/entity.yml @@ -4,3 +4,4 @@ services: arguments: ['@entity_type.repository', '@entity_type.manager'] tags: - { name: drupal.command } + lazy: true diff --git a/config/services/feature.yml b/config/services/feature.yml index b102fbf8a..9fd6bf21d 100644 --- a/config/services/feature.yml +++ b/config/services/feature.yml @@ -3,7 +3,9 @@ services: class: Drupal\Console\Command\Features\DebugCommand tags: - { name: drupal.command } + lazy: true console.feature_import: class: Drupal\Console\Command\Features\ImportCommand tags: - { name: drupal.command } + lazy: true diff --git a/config/services/field.yml b/config/services/field.yml index 0a181035d..caaebd3ca 100644 --- a/config/services/field.yml +++ b/config/services/field.yml @@ -4,3 +4,4 @@ services: arguments: ['@entity_type.manager', '@entity_field.manager'] tags: - { name: drupal.command } + lazy: true diff --git a/config/services/generate.yml b/config/services/generate.yml index 499a63246..35b47fa17 100644 --- a/config/services/generate.yml +++ b/config/services/generate.yml @@ -4,203 +4,244 @@ services: arguments: ['@console.module_generator', '@console.validator', '@app.root', '@console.string_converter', '@console.drupal_api'] tags: - { name: drupal.command } + lazy: true console.generate_modulefile: class: Drupal\Console\Command\Generate\ModuleFileCommand arguments: ['@console.extension_manager', '@console.modulefile_generator'] tags: - { name: drupal.command } + lazy: true console.generate_authentication_provider: class: Drupal\Console\Command\Generate\AuthenticationProviderCommand arguments: ['@console.extension_manager', '@console.authentication_provider_generator', '@console.string_converter'] tags: - { name: drupal.command } + lazy: true console.generate_controller: class: Drupal\Console\Command\Generate\ControllerCommand arguments: ['@console.extension_manager', '@console.controller_generator', '@console.string_converter', '@console.validator', '@router.route_provider', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.generate_breakpoint: class: Drupal\Console\Command\Generate\BreakPointCommand arguments: ['@console.breakpoint_generator', '@app.root', '@theme_handler', '@console.validator', '@console.string_converter'] tags: - { name: drupal.command } + lazy: true console.generate_help: class: Drupal\Console\Command\Generate\HelpCommand arguments: ['@console.help_generator', '@console.site', '@console.extension_manager', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.generate_form: class: Drupal\Console\Command\Generate\FormBaseCommand arguments: ['@console.extension_manager', '@console.form_generator', '@console.chain_queue', '@console.string_converter', '@plugin.manager.element_info', '@router.route_provider'] tags: - { name: drupal.command } + lazy: true console.generate_form_alter: class: Drupal\Console\Command\Generate\FormAlterCommand arguments: ['@console.extension_manager', '@console.form_alter_generator', '@console.string_converter', '@module_handler', '@plugin.manager.element_info', '@?profiler', '@app.root', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.generate_permissions: class: Drupal\Console\Command\Generate\PermissionCommand arguments: ['@console.extension_manager', '@console.string_converter', '@console.permission_generator'] tags: - { name: drupal.command } + lazy: true console.generate_event_subscriber: class: Drupal\Console\Command\Generate\EventSubscriberCommand arguments: ['@console.extension_manager', '@console.event_subscriber_generator', '@console.string_converter', '@event_dispatcher', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.generate_form_config: class: Drupal\Console\Command\Generate\ConfigFormBaseCommand arguments: ['@console.extension_manager', '@console.form_generator', '@console.string_converter', '@router.route_provider', '@plugin.manager.element_info', '@app.root', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.generate_plugin_type_annotation: class: Drupal\Console\Command\Generate\PluginTypeAnnotationCommand arguments: ['@console.extension_manager', '@console.plugin_type_annotation_generator', '@console.string_converter'] tags: - { name: drupal.command } + lazy: true console.generate_plugin_condition: class: Drupal\Console\Command\Generate\PluginConditionCommand arguments: ['@console.extension_manager', '@console.plugin_condition_generator', '@console.chain_queue', '@entity_type.repository', '@console.string_converter'] tags: - { name: drupal.command } + lazy: true console.generate_plugin_field: class: Drupal\Console\Command\Generate\PluginFieldCommand arguments: ['@console.extension_manager','@console.string_converter', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.generate_plugin_field_formatter: class: Drupal\Console\Command\Generate\PluginFieldFormatterCommand arguments: ['@console.extension_manager', '@console.plugin_field_formatter_generator','@console.string_converter', '@plugin.manager.field.field_type', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.generate_plugin_field_type: class: Drupal\Console\Command\Generate\PluginFieldTypeCommand arguments: ['@console.extension_manager', '@console.plugin_field_type_generator','@console.string_converter', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.generate_plugin_field_widget: class: Drupal\Console\Command\Generate\PluginFieldWidgetCommand arguments: ['@console.extension_manager', '@console.plugin_field_widget_generator','@console.string_converter', '@plugin.manager.field.field_type', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.generate_plugin_image_effect: class: Drupal\Console\Command\Generate\PluginImageEffectCommand arguments: ['@console.extension_manager', '@console.plugin_image_effect_generator','@console.string_converter', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.generate_plugin_image_formatter: class: Drupal\Console\Command\Generate\PluginImageFormatterCommand arguments: ['@console.extension_manager', '@console.plugin_image_formatter_generator','@console.string_converter', '@console.validator', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.generate_plugin_mail: class: Drupal\Console\Command\Generate\PluginMailCommand arguments: ['@console.extension_manager', '@console.plugin_mail_generator','@console.string_converter', '@console.validator', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.generate_plugin_migrate_source: class: Drupal\Console\Command\Generate\PluginMigrateSourceCommand arguments: ['@config.factory', '@console.chain_queue', '@console.plugin_migrate_source_generator', '@entity_type.manager', '@console.extension_manager', '@console.validator', '@console.string_converter', '@plugin.manager.element_info'] tags: - { name: drupal.command } + lazy: true console.generate_plugin_migrate_process: class: Drupal\Console\Command\Generate\PluginMigrateProcessCommand arguments: [ '@console.plugin_migrate_process_generator', '@console.chain_queue', '@console.extension_manager', '@console.string_converter'] tags: - { name: drupal.command } + lazy: true console.generate_plugin_rest_resource: class: Drupal\Console\Command\Generate\PluginRestResourceCommand arguments: ['@console.extension_manager', '@console.plugin_rest_resource_generator','@console.string_converter', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.generate_plugin_rules_action: class: Drupal\Console\Command\Generate\PluginRulesActionCommand arguments: ['@console.extension_manager', '@console.plugin_rules_action_generator','@console.string_converter', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.generate_plugin_skeleton: class: Drupal\Console\Command\Generate\PluginSkeletonCommand arguments: ['@console.extension_manager', '@console.plugin_skeleton_generator','@console.string_converter', '@console.validator', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.generate_plugin_type_yaml: class: Drupal\Console\Command\Generate\PluginTypeYamlCommand arguments: ['@console.extension_manager', '@console.plugin_type_yaml_generator','@console.string_converter'] tags: - { name: drupal.command } + lazy: true console.generate_plugin_views_field: class: Drupal\Console\Command\Generate\PluginViewsFieldCommand arguments: ['@console.extension_manager', '@console.plugin_views_field_generator', '@console.site','@console.string_converter','@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.generate_post_update: class: Drupal\Console\Command\Generate\PostUpdateCommand arguments: ['@console.extension_manager', '@console.post_update_generator', '@console.site', '@console.validator','@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.generate_profile: class: Drupal\Console\Command\Generate\ProfileCommand arguments: ['@console.extension_manager', '@console.profile_generator', '@console.string_converter', '@console.validator', '@app.root'] tags: - { name: drupal.command } + lazy: true console.generate_route_subscriber: class: Drupal\Console\Command\Generate\RouteSubscriberCommand arguments: ['@console.extension_manager', '@console.route_subscriber_generator', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.generate_service: class: Drupal\Console\Command\Generate\ServiceCommand arguments: ['@console.extension_manager', '@console.service_generator', '@console.string_converter', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.generate_theme: class: Drupal\Console\Command\Generate\ThemeCommand arguments: ['@console.extension_manager', '@console.theme_generator', '@console.validator', '@app.root', '@theme_handler', '@console.site', '@console.string_converter'] tags: - { name: drupal.command } + lazy: true console.generate_twig_extension: class: Drupal\Console\Command\Generate\TwigExtensionCommand arguments: ['@console.extension_manager', '@console.twig_extension_generator', '@console.site', '@console.string_converter', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.generate_update: class: Drupal\Console\Command\Generate\UpdateCommand arguments: ['@console.extension_manager', '@console.update_generator', '@console.site', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.generate_pluginblock: class: Drupal\Console\Command\Generate\PluginBlockCommand arguments: ['@config.factory', '@console.chain_queue', '@console.pluginblock_generator', '@entity_type.manager', '@console.extension_manager', '@console.validator', '@console.string_converter', '@plugin.manager.element_info'] tags: - { name: drupal.command } + lazy: true console.generate_command: class: Drupal\Console\Command\Generate\CommandCommand arguments: ['@console.command_generator', '@console.extension_manager', '@console.validator', '@console.string_converter', '@console.site'] tags: - { name: drupal.command } + lazy: true console.generate_ckeditorbutton: class: Drupal\Console\Command\Generate\PluginCKEditorButtonCommand arguments: ['@console.chain_queue', '@console.command_ckeditorbutton', '@console.extension_manager', '@console.string_converter'] tags: - { name: drupal.command } + lazy: true console.generate_entitycontent: class: Drupal\Console\Command\Generate\EntityContentCommand arguments: ['@console.chain_queue', '@console.entitycontent_generator', '@console.string_converter', '@console.extension_manager', '@console.validator'] tags: - { name: drupal.command } + lazy: true console.generate_entitybundle: class: Drupal\Console\Command\Generate\EntityBundleCommand arguments: ['@console.validator', '@console.entitybundle_generator', '@console.extension_manager'] tags: - { name: drupal.command } + lazy: true console.generate_entityconfig: class: Drupal\Console\Command\Generate\EntityConfigCommand arguments: ['@console.extension_manager', '@console.entityconfig_generator', '@console.validator', '@console.string_converter'] tags: - { name: drupal.command } + lazy: true console.generate_cache_context: - class: Drupal\Console\Command\Generate\CacheContextCommand - arguments: [ '@console.cache_context_generator', '@console.chain_queue', '@console.extension_manager', '@console.string_converter'] - tags: - - { name: drupal.command } + class: Drupal\Console\Command\Generate\CacheContextCommand + arguments: [ '@console.cache_context_generator', '@console.chain_queue', '@console.extension_manager', '@console.string_converter'] + tags: + - { name: drupal.command } + lazy: true diff --git a/config/services/generator.yml b/config/services/generator.yml index 41ccdebda..aa2b56c7d 100644 --- a/config/services/generator.yml +++ b/config/services/generator.yml @@ -3,201 +3,242 @@ services: class: Drupal\Console\Generator\ModuleGenerator tags: - { name: drupal.generator } + lazy: true console.modulefile_generator: class: Drupal\Console\Generator\ModuleFileGenerator tags: - { name: drupal.generator } + lazy: true console.authentication_provider_generator: class: Drupal\Console\Generator\AuthenticationProviderGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.help_generator: class: Drupal\Console\Generator\HelpGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.controller_generator: class: Drupal\Console\Generator\ControllerGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.breakpoint_generator: class: Drupal\Console\Generator\BreakPointGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.form_alter_generator: class: Drupal\Console\Generator\FormAlterGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.permission_generator: class: Drupal\Console\Generator\PermissionGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.event_subscriber_generator: class: Drupal\Console\Generator\EventSubscriberGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.form_generator: class: Drupal\Console\Generator\FormGenerator arguments: ['@console.extension_manager', '@console.string_converter'] tags: - { name: drupal.generator } + lazy: true console.profile_generator: class: Drupal\Console\Generator\ProfileGenerator tags: - { name: drupal.generator } + lazy: true console.post_update_generator: class: Drupal\Console\Generator\PostUpdateGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.plugin_condition_generator: class: Drupal\Console\Generator\PluginConditionGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.plugin_field_generator: class: Drupal\Console\Generator\PluginFieldFormatterGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.plugin_field_formatter_generator: class: Drupal\Console\Generator\PluginFieldFormatterGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.plugin_field_type_generator: class: Drupal\Console\Generator\PluginFieldTypeGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.plugin_field_widget_generator: class: Drupal\Console\Generator\PluginFieldWidgetGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.plugin_image_effect_generator: class: Drupal\Console\Generator\PluginImageEffectGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.plugin_image_formatter_generator: class: Drupal\Console\Generator\PluginImageFormatterGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.plugin_mail_generator: class: Drupal\Console\Generator\PluginMailGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.plugin_migrate_source_generator: class: Drupal\Console\Generator\PluginMigrateSourceGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.plugin_migrate_process_generator: class: Drupal\Console\Generator\PluginMigrateProcessGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.plugin_rest_resource_generator: class: Drupal\Console\Generator\PluginRestResourceGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.plugin_rules_action_generator: class: Drupal\Console\Generator\PluginRulesActionGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.plugin_skeleton_generator: class: Drupal\Console\Generator\PluginSkeletonGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.plugin_views_field_generator: class: Drupal\Console\Generator\PluginViewsFieldGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.plugin_type_annotation_generator: class: Drupal\Console\Generator\PluginTypeAnnotationGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.plugin_type_yaml_generator: class: Drupal\Console\Generator\PluginTypeYamlGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.route_subscriber_generator: class: Drupal\Console\Generator\RouteSubscriberGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.service_generator: class: Drupal\Console\Generator\ServiceGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.theme_generator: class: Drupal\Console\Generator\ThemeGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.twig_extension_generator: class: Drupal\Console\Generator\TwigExtensionGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.update_generator: class: Drupal\Console\Generator\UpdateGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.pluginblock_generator: class: Drupal\Console\Generator\PluginBlockGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.command_generator: class: Drupal\Console\Generator\CommandGenerator arguments: ['@console.extension_manager', '@console.translator_manager'] tags: - { name: drupal.generator } + lazy: true console.command_ckeditorbutton: class: Drupal\Console\Generator\PluginCKEditorButtonGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.database_settings_generator: class: Drupal\Console\Generator\DatabaseSettingsGenerator arguments: ['@kernel'] tags: - { name: drupal.generator } + lazy: true console.entitycontent_generator: class: Drupal\Console\Generator\EntityContentGenerator arguments: ['@console.extension_manager', '@console.site', '@console.renderer'] tags: - { name: drupal.generator } + lazy: true console.entitybundle_generator: class: Drupal\Console\Generator\EntityBundleGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.entityconfig_generator: class: Drupal\Console\Generator\EntityConfigGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } + lazy: true console.cache_context_generator: - class: Drupal\Console\Generator\CacheContextGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } + class: Drupal\Console\Generator\CacheContextGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true diff --git a/config/services/image.yml b/config/services/image.yml index 73b5c566a..b9157c28f 100644 --- a/config/services/image.yml +++ b/config/services/image.yml @@ -4,3 +4,4 @@ services: arguments: ['@entity_type.manager'] tags: - { name: drupal.command } + lazy: true diff --git a/config/services/locale.yml b/config/services/locale.yml index a498b84e9..f17b9df97 100644 --- a/config/services/locale.yml +++ b/config/services/locale.yml @@ -4,13 +4,16 @@ services: arguments: ['@console.site', '@console.extension_manager'] tags: - { name: drupal.command } + lazy: true console.language_delete: class: Drupal\Console\Command\Locale\LanguageDeleteCommand arguments: ['@console.site', '@entity_type.manager', '@module_handler'] tags: - { name: drupal.command } + lazy: true console.language_add: class: Drupal\Console\Command\Locale\LanguageAddCommand arguments: ['@console.site', '@module_handler'] tags: - { name: drupal.command } + lazy: true diff --git a/config/services/migrate.yml b/config/services/migrate.yml index 660176519..ab1ba6817 100644 --- a/config/services/migrate.yml +++ b/config/services/migrate.yml @@ -4,19 +4,22 @@ services: arguments: ['@?plugin.manager.migration'] tags: - { name: drupal.command } + lazy: true console.migrate_execute: class: Drupal\Console\Command\Migrate\ExecuteCommand arguments: ['@?plugin.manager.migration'] tags: - { name: drupal.command } + lazy: true console.migrate_debug: class: Drupal\Console\Command\Migrate\DebugCommand arguments: ['@?plugin.manager.migration'] tags: - { name: drupal.command } + lazy: true console.migrate_setup: class: Drupal\Console\Command\Migrate\SetupCommand arguments: ['@state', '@?plugin.manager.migration'] tags: - { name: drupal.command } - + lazy: true diff --git a/config/services/misc.yml b/config/services/misc.yml index 9fad17087..59986a81a 100644 --- a/config/services/misc.yml +++ b/config/services/misc.yml @@ -4,7 +4,9 @@ services: arguments: ['@?plugin.manager.devel_dumper'] tags: - { name: drupal.command } + lazy: true console.shell: class: Drupal\Console\Command\ShellCommand tags: - { name: drupal.command } + lazy: true diff --git a/config/services/module.yml b/config/services/module.yml index 4dc3b48f7..16be0836e 100644 --- a/config/services/module.yml +++ b/config/services/module.yml @@ -4,28 +4,34 @@ services: arguments: ['@console.site', '@console.validator', '@module_installer', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.module_download: class: Drupal\Console\Command\Module\DownloadCommand arguments: ['@console.drupal_api', '@http_client', '@app.root', '@console.extension_manager', '@console.validator', '@console.site', '@console.configuration_manager', '@console.shell_process', '@console.root'] tags: - { name: drupal.command } + lazy: true console.module_install: - class: Drupal\Console\Command\Module\InstallCommand - arguments: ['@console.site', '@console.validator', '@module_installer', '@console.drupal_api', '@console.extension_manager', '@app.root', '@console.chain_queue'] - tags: - - { name: drupal.command } + class: Drupal\Console\Command\Module\InstallCommand + arguments: ['@console.site', '@console.validator', '@module_installer', '@console.drupal_api', '@console.extension_manager', '@app.root', '@console.chain_queue'] + tags: + - { name: drupal.command } + lazy: true console.module_path: - class: Drupal\Console\Command\Module\PathCommand - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.command } + class: Drupal\Console\Command\Module\PathCommand + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.command } + lazy: true console.module_uninstall: class: Drupal\Console\Command\Module\UninstallCommand arguments: ['@console.site','@module_installer', '@console.chain_queue', '@config.factory', '@console.extension_manager'] tags: - { name: drupal.command } + lazy: true console.module_update: class: Drupal\Console\Command\Module\UpdateCommand arguments: ['@console.shell_process', '@console.root'] tags: - { name: drupal.command } + lazy: true diff --git a/config/services/node.yml b/config/services/node.yml index 4dc94e2aa..5d79618a7 100644 --- a/config/services/node.yml +++ b/config/services/node.yml @@ -4,3 +4,4 @@ services: arguments: ['@state'] tags: - { name: drupal.command } + lazy: true diff --git a/config/services/queue.yml b/config/services/queue.yml index fc41033fc..91926b0ee 100644 --- a/config/services/queue.yml +++ b/config/services/queue.yml @@ -4,3 +4,4 @@ services: arguments: ['@plugin.manager.queue_worker', '@queue'] tags: - { name: drupal.command } + lazy: true diff --git a/config/services/rest.yml b/config/services/rest.yml index cfc280bd5..5b59ced3b 100644 --- a/config/services/rest.yml +++ b/config/services/rest.yml @@ -4,11 +4,13 @@ services: arguments: ['@?plugin.manager.rest'] tags: - { name: drupal.command } + lazy: true console.rest_disable: class: Drupal\Console\Command\Rest\DisableCommand arguments: ['@config.factory', '@?plugin.manager.rest'] tags: - { name: drupal.command } + lazy: true console.rest_enable: class: Drupal\Console\Command\Rest\EnableCommand arguments: @@ -19,3 +21,4 @@ services: - '@entity.manager' tags: - { name: drupal.command } + lazy: true diff --git a/config/services/router.yml b/config/services/router.yml index 4076dc6fd..1d78f21a2 100644 --- a/config/services/router.yml +++ b/config/services/router.yml @@ -4,3 +4,4 @@ services: arguments: ['@router.builder'] tags: - { name: drupal.command } + lazy: true diff --git a/config/services/simpletest.yml b/config/services/simpletest.yml index 4c5570296..52668d29a 100644 --- a/config/services/simpletest.yml +++ b/config/services/simpletest.yml @@ -4,8 +4,10 @@ services: arguments: ['@?test_discovery'] tags: - { name: drupal.command } + lazy: true console.test_run: class: Drupal\Console\Command\Test\RunCommand arguments: ['@app.root', '@?test_discovery', '@module_handler', '@date.formatter'] tags: - { name: drupal.command } + lazy: true diff --git a/config/services/site.yml b/config/services/site.yml index 17ad4e7a6..2d3e3c650 100644 --- a/config/services/site.yml +++ b/config/services/site.yml @@ -4,23 +4,28 @@ services: arguments: ['@app.root','@console.configuration_manager'] tags: - { name: drupal.command } + lazy: true console.site_maintenance: class: Drupal\Console\Command\Site\MaintenanceCommand arguments: ['@state', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.site_mode: class: Drupal\Console\Command\Site\ModeCommand arguments: ['@config.factory', '@console.configuration_manager', '@app.root', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.site_statistics: class: Drupal\Console\Command\Site\StatisticsCommand arguments: ['@console.drupal_api', '@entity.query', '@console.extension_manager', '@module_handler'] tags: - { name: drupal.command } + lazy: true console.site_status: class: Drupal\Console\Command\Site\StatusCommand arguments: ['@system.manager', '@settings', '@config.factory', '@theme_handler', '@app.root'] tags: - { name: drupal.command } + lazy: true diff --git a/config/services/state.yml b/config/services/state.yml index be8572157..03d8c97ba 100644 --- a/config/services/state.yml +++ b/config/services/state.yml @@ -4,8 +4,10 @@ services: arguments: ['@state', '@keyvalue'] tags: - { name: drupal.command } + lazy: true console.state_override: class: Drupal\Console\Command\State\OverrideCommand arguments: ['@state', '@keyvalue'] tags: - { name: drupal.command } + lazy: true diff --git a/config/services/taxonomy.yml b/config/services/taxonomy.yml index 4fc0cce59..86344ea69 100644 --- a/config/services/taxonomy.yml +++ b/config/services/taxonomy.yml @@ -4,3 +4,4 @@ services: arguments: ['@entity_type.manager'] tags: - { name: drupal.command } + lazy: true diff --git a/config/services/theme.yml b/config/services/theme.yml index be708bf19..c66cc79aa 100644 --- a/config/services/theme.yml +++ b/config/services/theme.yml @@ -4,18 +4,22 @@ services: arguments: ['@console.drupal_api', '@http_client', '@app.root'] tags: - { name: drupal.command } + lazy: true console.theme_install: class: Drupal\Console\Command\Theme\InstallCommand arguments: ['@config.factory', '@theme_handler', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.theme_path: class: Drupal\Console\Command\Theme\PathCommand arguments: ['@console.extension_manager'] tags: - { name: drupal.command } + lazy: true console.theme_uninstall: class: Drupal\Console\Command\Theme\UninstallCommand arguments: ['@config.factory', '@theme_handler', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true diff --git a/config/services/update.yml b/config/services/update.yml index eed0fa5a8..c2417c88f 100644 --- a/config/services/update.yml +++ b/config/services/update.yml @@ -4,8 +4,10 @@ services: arguments: ['@state', '@entity.definition_update_manager', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.update_execute: class: Drupal\Console\Command\Update\ExecuteCommand arguments: ['@console.site', '@state', '@module_handler', '@update.post_update_registry', '@console.extension_manager', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true diff --git a/config/services/user.yml b/config/services/user.yml index 60e9da724..8cf29da20 100644 --- a/config/services/user.yml +++ b/config/services/user.yml @@ -4,33 +4,40 @@ services: arguments: ['@entity_type.manager','@entity.query', '@console.drupal_api'] tags: - { name: drupal.command } + lazy: true console.user_login_clear_attempts: class: Drupal\Console\Command\User\LoginCleanAttemptsCommand arguments: ['@database'] tags: - { name: drupal.command } + lazy: true console.user_login_url: class: Drupal\Console\Command\User\LoginUrlCommand arguments: ['@entity_type.manager'] tags: - { name: drupal.command } + lazy: true console.user_password_hash: class: Drupal\Console\Command\User\PasswordHashCommand arguments: ['@password'] tags: - { name: drupal.command } + lazy: true console.user_password_reset: class: Drupal\Console\Command\User\PasswordResetCommand arguments: ['@database', '@console.chain_queue'] tags: - { name: drupal.command } + lazy: true console.user_role: class: Drupal\Console\Command\User\RoleCommand arguments: ['@console.drupal_api'] tags: - { name: drupal.command } + lazy: true console.user_create: class: Drupal\Console\Command\User\CreateCommand arguments: ['@database', '@entity_type.manager', '@date.formatter', '@console.drupal_api'] tags: - { name: drupal.command } + lazy: true diff --git a/config/services/views.yml b/config/services/views.yml index 9fdc6a1cd..95fda2f89 100644 --- a/config/services/views.yml +++ b/config/services/views.yml @@ -4,8 +4,10 @@ services: arguments: ['@entity_type.manager', '@entity.query'] tags: - { name: drupal.command } + lazy: true console.views_enable: class: Drupal\Console\Command\Views\EnableCommand arguments: ['@entity_type.manager', '@entity.query'] tags: - { name: drupal.command } + lazy: true diff --git a/services.yml b/services.yml index e71584db1..5ca6761c8 100644 --- a/services.yml +++ b/services.yml @@ -1,31 +1,42 @@ services: console.root: class: SplString + lazy: true console.redbean: class: RedBeanPHP\R + lazy: true console.validator: class: Drupal\Console\Utils\Validator arguments: ['@console.extension_manager', '@console.translator_manager'] + lazy: true console.drupal_api: class: Drupal\Console\Utils\DrupalApi arguments: ['@app.root', '@entity_type.manager', '@http_client'] + lazy: true console.create_node_data: class: Drupal\Console\Utils\Create\NodeData arguments: ['@entity_type.manager', '@entity_field.manager', '@date.formatter', '@=service("console.drupal_api").getBundles()'] + lazy: true console.create_comment_data: class: Drupal\Console\Utils\Create\CommentData arguments: ['@entity_type.manager', '@entity_field.manager', '@date.formatter'] + lazy: true console.create_term_data: class: Drupal\Console\Utils\Create\TermData arguments: ['@entity_type.manager', '@entity_field.manager', '@date.formatter', '@=service("console.drupal_api").getVocabularies()'] + lazy: true console.create_user_data: class: Drupal\Console\Utils\Create\UserData arguments: ['@entity_type.manager', '@entity_field.manager', '@date.formatter', '@=service("console.drupal_api").getRoles()'] + lazy: true console.create_vocabulary_data: class: Drupal\Console\Utils\Create\VocabularyData arguments: ['@entity_type.manager', '@entity_field.manager', '@date.formatter'] + lazy: true console.annotation_command_reader: class: Drupal\Console\Annotations\DrupalCommandAnnotationReader + lazy: true console.annotation_validator: class: Drupal\Console\Utils\AnnotationValidator arguments: ['@console.annotation_command_reader', '@console.extension_manager'] + lazy: true diff --git a/src/Application.php b/src/Application.php index cad7ac634..0794a8a7d 100644 --- a/src/Application.php +++ b/src/Application.php @@ -151,9 +151,9 @@ private function registerCommands() ->get('console.annotation_validator'); } - $aliases = $this->container->get('console.configuration_manager') - ->getConfiguration() - ->get('application.commands.aliases')?:[]; +// $aliases = $this->container->get('console.configuration_manager') +// ->getConfiguration() +// ->get('application.commands.aliases')?:[]; foreach ($consoleCommands as $name) { AnnotationRegistry::reset(); @@ -173,6 +173,10 @@ private function registerCommands() continue; } + if (!$annotationValidator->isValidCommand($serviceDefinition->getClass())) { + continue; + } + $annotation = $annotationCommandReader ->readAnnotation($serviceDefinition->getClass()); if ($annotation) { @@ -182,10 +186,6 @@ private function registerCommands() $annotation['extensionType'] ); } - - if (!$annotationValidator->isValidCommand($serviceDefinition->getClass())) { - continue; - } } try { @@ -212,13 +212,13 @@ private function registerCommands() ); } - if (array_key_exists($command->getName(), $aliases)) { - $commandAliases = $aliases[$command->getName()]; - if (!is_array($commandAliases)) { - $commandAliases = [$commandAliases]; - } - $command->setAliases($commandAliases); - } +// if (array_key_exists($command->getName(), $aliases)) { +// $commandAliases = $aliases[$command->getName()]; +// if (!is_array($commandAliases)) { +// $commandAliases = [$commandAliases]; +// } +// $command->setAliases($commandAliases); +// } $this->add($command); } diff --git a/src/Utils/TranslatorManager.php b/src/Utils/TranslatorManager.php index b5c3b9d6e..a2eccaccd 100644 --- a/src/Utils/TranslatorManager.php +++ b/src/Utils/TranslatorManager.php @@ -95,6 +95,7 @@ public function addResourceTranslationsByExtension($extension, $type) if (array_search($extension, $this->extensions) !== false) { return; } + $this->extensions[] = $extension; if ($type == 'module') { $this->addResourceTranslationsByModule($extension); diff --git a/uninstall.services.yml b/uninstall.services.yml index c1835417a..f18085141 100644 --- a/uninstall.services.yml +++ b/uninstall.services.yml @@ -2,23 +2,29 @@ services: console.site: class: Drupal\Console\Utils\Site arguments: ['@app.root', '@console.configuration_manager'] + lazy: true console.extension_manager: class: Drupal\Console\Extension\Manager arguments: ['@console.site', '@http_client', '@app.root'] + lazy: true console.server: class: Drupal\Console\Command\ServerCommand arguments: ['@app.root', '@console.configuration_manager'] tags: - { name: drupal.command } + lazy: true console.site_install: class: Drupal\Console\Command\Site\InstallCommand arguments: ['@console.extension_manager', '@console.site', '@console.configuration_manager', '@app.root'] tags: - { name: drupal.command } + lazy: true console.multisite_new: class: Drupal\Console\Command\Multisite\NewCommand arguments: ['@app.root'] tags: - { name: drupal.command } + lazy: true http_client: class: GuzzleHttp\Client + lazy: true From de04f6b5e2149cbf02ba5bb74275435b1be7e574 Mon Sep 17 00:00:00 2001 From: Jose Angel Bonfil Date: Thu, 6 Jul 2017 12:59:40 -0500 Subject: [PATCH 280/321] deleting develop services (#3406) --- config.yml | 6 +- config/services/develop.yml | 47 --- src/Command/Develop/ExampleCommand.php | 84 ------ .../Develop/ExampleContainerAwareCommand.php | 92 ------ .../Develop/GenerateDocCheatsheetCommand.php | 267 ----------------- .../Develop/GenerateDocDashCommand.php | 280 ------------------ .../Develop/GenerateDocDataCommand.php | 61 ---- .../Develop/GenerateDocGitbookCommand.php | 116 -------- .../Develop/TranslationCleanupCommand.php | 122 -------- .../Develop/TranslationPendingCommand.php | 237 --------------- .../Develop/TranslationStatsCommand.php | 248 ---------------- .../Develop/TranslationSyncCommand.php | 204 ------------- 12 files changed, 1 insertion(+), 1763 deletions(-) delete mode 100644 config/services/develop.yml delete mode 100644 src/Command/Develop/ExampleCommand.php delete mode 100644 src/Command/Develop/ExampleContainerAwareCommand.php delete mode 100644 src/Command/Develop/GenerateDocCheatsheetCommand.php delete mode 100644 src/Command/Develop/GenerateDocDashCommand.php delete mode 100644 src/Command/Develop/GenerateDocDataCommand.php delete mode 100644 src/Command/Develop/GenerateDocGitbookCommand.php delete mode 100644 src/Command/Develop/TranslationCleanupCommand.php delete mode 100644 src/Command/Develop/TranslationPendingCommand.php delete mode 100644 src/Command/Develop/TranslationStatsCommand.php delete mode 100644 src/Command/Develop/TranslationSyncCommand.php diff --git a/config.yml b/config.yml index 0db654316..84bc95aa0 100644 --- a/config.yml +++ b/config.yml @@ -2,8 +2,4 @@ application: autowire: commands: forced: {} - name: - 'develop:example': - class: '\Drupal\Console\Command\Develop\ExampleCommand' - 'develop:example:container:aware': - class: '\Drupal\Console\Command\Develop\ExampleContainerAwareCommand' + name: {} diff --git a/config/services/develop.yml b/config/services/develop.yml deleted file mode 100644 index c776f60f9..000000000 --- a/config/services/develop.yml +++ /dev/null @@ -1,47 +0,0 @@ -services: - console.generate_doc_cheatsheet: - class: Drupal\Console\Command\Develop\GenerateDocCheatsheetCommand - tags: - - { name: drupal.command } - lazy: true - console.generate_doc_dash: - class: Drupal\Console\Command\Develop\GenerateDocDashCommand - arguments: ['@console.renderer', '@console.root'] - tags: - - { name: drupal.command } - lazy: true - console.generate_doc_data: - class: Drupal\Console\Command\Develop\GenerateDocDataCommand - tags: - - { name: drupal.command } - lazy: true - console.generate_doc_gitbook: - class: Drupal\Console\Command\Develop\GenerateDocGitbookCommand - arguments: ['@console.renderer'] - tags: - - { name: drupal.command } - lazy: true - console.translation_cleanup: - class: Drupal\Console\Command\Develop\TranslationCleanupCommand - arguments: ['@console.root', '@console.configuration_manager'] - tags: - - { name: drupal.command } - lazy: true - console.translation_pending: - class: Drupal\Console\Command\Develop\TranslationPendingCommand - arguments: ['@console.root', '@console.configuration_manager', '@console.nested_array'] - tags: - - { name: drupal.command } - lazy: true - console.translation_stats: - class: Drupal\Console\Command\Develop\TranslationStatsCommand - arguments: ['@console.root', '@console.configuration_manager', '@console.renderer', '@console.nested_array'] - tags: - - { name: drupal.command } - lazy: true - console.translation_sync: - class: Drupal\Console\Command\Develop\TranslationSyncCommand - arguments: ['@console.root', '@console.configuration_manager'] - tags: - - { name: drupal.command } - lazy: true diff --git a/src/Command/Develop/ExampleCommand.php b/src/Command/Develop/ExampleCommand.php deleted file mode 100644 index 54ee68c18..000000000 --- a/src/Command/Develop/ExampleCommand.php +++ /dev/null @@ -1,84 +0,0 @@ -setName('develop:example'); - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - /* Register your command as a service - * - * Make sure you register your command class at - * config/services/namespace.yml file and add the `drupal.command` tag. - * - * develop_example: - * class: Drupal\Console\Command\Develop\ExampleCommand - * arguments: ['@service_id', '@console.service_id'] - * tags: - * - { name: drupal.command } - * - * NOTE: Make the proper changes on the namespace and class - * according your new command. - * - * DrupalConsole extends the SymfonyStyle class to provide - * an standardized Output Formatting Style. - * - * Drupal Console provides the DrupalStyle helper class: - */ - $io = new DrupalStyle($input, $output); - $io->simple('This text could be translatable by'); - $io->simple('adding a YAML file at "config/translations/LANGUAGE/command.name.yml"'); - - /** - * Reading user input argument - * $input->getArgument('ARGUMENT_NAME'); - * - * Reading user input option - * $input->getOption('OPTION_NAME'); - */ - } -} diff --git a/src/Command/Develop/ExampleContainerAwareCommand.php b/src/Command/Develop/ExampleContainerAwareCommand.php deleted file mode 100644 index 0028bb1a5..000000000 --- a/src/Command/Develop/ExampleContainerAwareCommand.php +++ /dev/null @@ -1,92 +0,0 @@ -setName('develop:example:container:aware'); - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - /* Register your command as a service - * - * Make sure you register your command class at - * config/services/namespace.yml file and add the `drupal.command` tag. - * - * develop_example_container_aware: - * class: Drupal\Console\Command\Develop\ExampleContainerAwareCommand - * tags: - * - { name: drupal.command } - * - * NOTE: Make the proper changes on the namespace and class - * according your new command. - * - * DrupalConsole extends the SymfonyStyle class to provide - * an standardized Output Formatting Style. - * - * Drupal Console provides the DrupalStyle helper class: - */ - $io = new DrupalStyle($input, $output); - $io->simple('This text could be translatable by'); - $io->simple('adding a YAML file at "config/translations/LANGUAGE/command.name.yml"'); - - /** - * By using ContainerAwareCommandTrait on your class for the command - * (instead of the more basic CommandTrait), you have access to - * the service container. - * - * In other words, you can access to any configured Drupal service - * using the provided get method. - * - * $this->get('entity_type.manager'); - * - * Reading user input argument - * $input->getArgument('ARGUMENT_NAME'); - * - * Reading user input option - * $input->getOption('OPTION_NAME'); - */ - } -} diff --git a/src/Command/Develop/GenerateDocCheatsheetCommand.php b/src/Command/Develop/GenerateDocCheatsheetCommand.php deleted file mode 100644 index c904ef35a..000000000 --- a/src/Command/Develop/GenerateDocCheatsheetCommand.php +++ /dev/null @@ -1,267 +0,0 @@ -setName('generate:doc:cheatsheet') - ->setDescription($this->trans('commands.generate.doc.cheatsheet.description')) - ->addOption( - 'path', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.doc.cheatsheet.options.path') - ) - ->addOption( - 'wkhtmltopdf', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.doc.cheatsheet.options.wkhtmltopdf') - ) - ->setAliases(['gdc']); - ; - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $path = null; - - if ($input->hasOption('path')) { - $path = $input->getOption('path'); - } - - if (!$path) { - $io->error( - $this->trans('commands.generate.doc.gitbook.messages.missing_path') - ); - - return 1; - } - - // $wkhtmltopdfPath is overwritable by command option - - if ($input->getOption('wkhtmltopdf')) { - $this->wkhtmltopdfPath = $input->getOption('wkhtmltopdf'); - } - - $application = $this->getApplication(); - $command_list = []; - - foreach ($this->singleCommands as $single_command) { - $command = $application->find($single_command); - $command_list['none'][] = [ - 'name' => $command->getName(), - 'description' => $command->getDescription(), - ]; - } - - $namespaces = $application->getNamespaces(); - sort($namespaces); - - $namespaces = array_filter( - $namespaces, function ($item) { - return (strpos($item, ':')<=0); - } - ); - - foreach ($namespaces as $namespace) { - $commands = $application->all($namespace); - - usort( - $commands, function ($cmd1, $cmd2) { - return strcmp($cmd1->getName(), $cmd2->getName()); - } - ); - - foreach ($commands as $command) { - if ($command->getModule()=='Console') { - $command_list[$namespace][] = [ - 'name' => $command->getName(), - 'description' => $command->getDescription(), - ]; - } - } - } - - if (!empty($command_list)) { - $this->prepareHtml($command_list, $path, $io); - } - } - - - /** - * Generates (programatically, not with twig) the HTML to convert to PDF - * - * @param array $array_content - * @param string $path - */ - protected function prepareHtml($array_content, $path, $io) - { - $str = ''; - $str .= "
Drupal Console cheatsheet
"; - - // 1st page - foreach ($this->orderCommands as $command) { - $str .= $this->doTable($command, $array_content[$command]); - } - - // 2nd page - $str .= "

"; - - $str .= "

DrupalConsole Cheatsheet



"; - - $str .= $this->doTable("generate", $array_content["generate"]); - $str .= $this->doTable("miscelaneous", $array_content["none"]); - - $this->doPdf($str, $path, $io); - } - - - /** - * Generates the pdf with Snappy - * - * @param string $content - * @param string $path - * - * @return string - */ - protected function doPdf($content, $path, $io) - { - $snappy = new Pdf(); - //@TODO: catch exception if binary path doesn't exist! - $snappy->setBinary($this->wkhtmltopdfPath); - $snappy->setOption('orientation', "Landscape"); - $snappy->generateFromHtml($content, "/" .$path . 'dc-cheatsheet.pdf'); - $io->success("cheatsheet generated at /" .$path ."/dc-cheatsheet.pdf"); - - // command execution ends here - } - - /** - * Encloses text in tags - * - * @param string $str - * - * @return string - */ - public function td($str, $mode = null) - { - if ("header" == $mode) { - return "" . strtoupper($str) . ""; - } else { - if ("body" == $mode) { - return "". $str. ""; - } else { - return "" . $str . ""; - } - } - } - - /** - * Encloses text in tags - * - * @param string $str - * @param array $element - * - * @return string - */ - public function tr($str) - { - return "" . $str . ""; - } - - /** - * Encloses text in tag - * - * @param string $key_element - header - * @param array $element - command, description - * - * @return string - */ - public function doTable($key_element, $element) - { - $str = "
"; - $str .= $this->td($key_element, "header"); - - foreach ($element as $section) { - $str .= $this->tr($this->td($section["name"], "body") . $this->td($section["description"], "body")); - } - - return $str . "
\n\r"; - } -} diff --git a/src/Command/Develop/GenerateDocDashCommand.php b/src/Command/Develop/GenerateDocDashCommand.php deleted file mode 100644 index ba8492b50..000000000 --- a/src/Command/Develop/GenerateDocDashCommand.php +++ /dev/null @@ -1,280 +0,0 @@ - - - - - CFBundleIdentifier - drupalconsole - CFBundleName - Drupal Console - DocSetPlatformFamily - drupalconsole - isDashDocset - - dashIndexFilePath - index.html - - -PLIST; - - private $single_commands = [ - 'about', - 'chain', - 'drush', - 'help', - 'init', - 'list', - 'self-update' - ]; - - /** - * @var SQLite3 Controller for the sqlite db required by the docset format. - */ - private $sqlite; - - /** - * @var ConfigurationManager $configurationManager - */ - protected $configurationManager; - - /** - * GenerateDocDashCommand constructor. - * - * @param $renderer - * @param $consoleRoot - */ - public function __construct(TwigRenderer $renderer, $consoleRoot) - { - $this->renderer = $renderer; - $this->consoleRoot = $consoleRoot; - parent::__construct(); - } - - - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName('generate:doc:dash') - ->setDescription($this->trans('commands.generate.doc.dash.description')) - ->addOption( - 'path', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.doc.dash.options.path') - ) - ->setAliases(['gdd']); - ; - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $path = null; - if ($input->hasOption('path')) { - $path = $input->getOption('path'); - } - - if (!$path) { - $io->error( - $this->trans('commands.generate.doc.dash.messages.missing_path') - ); - - return 1; - } - - // Setup the docset structure - $this->initDocset($path); - - $application = $this->getApplication(); - $command_list = []; - - foreach ($this->single_commands as $single_command) { - $command = $application->find($single_command); - $command_list['none'][] = [ - 'name' => $command->getName(), - 'description' => $command->getDescription(), - ]; - $this->renderCommand($command, $path, $this->renderer); - $this->registerCommand($command, $path); - } - - $namespaces = $application->getNamespaces(); - sort($namespaces); - - $namespaces = array_filter( - $namespaces, function ($item) { - return (strpos($item, ':') <= 0); - } - ); - - foreach ($namespaces as $namespace) { - $commands = $application->all($namespace); - - usort( - $commands, function ($cmd1, $cmd2) { - return strcmp($cmd1->getName(), $cmd2->getName()); - } - ); - - foreach ($commands as $command) { - if ($command->getModule() == 'Console') { - $command_list[$namespace][] = [ - 'name' => $command->getName(), - 'description' => $command->getDescription(), - ]; - $this->renderCommand($command, $path, $this->renderer); - $this->registerCommand($command, $path); - } - } - } - - $input = $application->getDefinition(); - $options = $input->getOptions(); - $arguments = $input->getArguments(); - $parameters = [ - 'command_list' => $command_list, - 'options' => $options, - 'arguments' => $arguments, - 'css_path' => 'style.css' - ]; - - // Set the index page - $this->renderFile( - 'dash/index.html.twig', - $path . '/DrupalConsole.docset/Contents/Resources/Documents/index.html', - $parameters, - null, - $this->renderer - ); - } - - private function renderCommand($command, $path, $renderer) - { - $input = $command->getDefinition(); - $options = $input->getOptions(); - $arguments = $input->getArguments(); - - $parameters = [ - 'options' => $options, - 'arguments' => $arguments, - 'command' => $command->getName(), - 'description' => $command->getDescription(), - 'aliases' => $command->getAliases(), - 'css_path' => '../style.css' - ]; - - $this->renderFile( - 'dash/generate-doc.html.twig', - $path . '/DrupalConsole.docset/Contents/Resources/Documents/commands/' - . str_replace(':', '-', $command->getName()) . '.html', - $parameters, - null, - $renderer - ); - } - - private function registerCommand($command) - { - try { - $statement = $this->sqlite->prepare('INSERT OR IGNORE INTO searchIndex(name, type, path) VALUES (:name, :type, :path)'); - $statement->bindValue(':name', $command->getName(), SQLITE3_TEXT); - $statement->bindValue(':type', 'Command', SQLITE3_TEXT); - $statement->bindValue( - ':path', - 'commands/' - . str_replace(':', '-', $command->getName()) . '.html', - SQLITE3_TEXT - ); - $statement->execute(); - } catch (\Exception $e) { - throw $e; - } - } - - private function renderFile( - $template, - $target, - $parameters, - $renderer - ) { - $filesystem = new Filesystem(); - try { - $filesystem->dumpFile( - $target, - $renderer->render($template, $parameters) - ); - } catch (IOException $e) { - throw $e; - } - } - - private function initDocset($path) - { - try { - $filesystem = new Filesystem(); - $filesystem->mkdir( - $path . '/DrupalConsole.docset/Contents/Resources/Documents/', - 0777 - ); - $filesystem->dumpFile( - $path . '/DrupalConsole.docset/Contents/Info.plist', - self::PLIST - ); - - $filesystem->copy( - $this->consoleRoot . '/resources/drupal-console.png', - $path . '/DrupalConsole.docset/icon.png' - ); - $filesystem->copy( - $this->consoleRoot . '/resources/dash.css', - $path . '/DrupalConsole.docset/Contents/Resources/Documents/style.css' - ); - // create the required sqlite db - $this->sqlite = new \SQLite3($path . '/DrupalConsole.docset/Contents/Resources/docSet.dsidx'); - $this->sqlite->query("CREATE TABLE searchIndex(id INTEGER PRIMARY KEY, name TEXT, type TEXT, path TEXT)"); - $this->sqlite->query("CREATE UNIQUE INDEX anchor ON searchIndex (name, type, path)"); - } catch (\Exception $e) { - throw $e; - } - } -} diff --git a/src/Command/Develop/GenerateDocDataCommand.php b/src/Command/Develop/GenerateDocDataCommand.php deleted file mode 100644 index 587280525..000000000 --- a/src/Command/Develop/GenerateDocDataCommand.php +++ /dev/null @@ -1,61 +0,0 @@ -setName('generate:doc:data') - ->setDescription( - $this->trans('commands.generate.doc.data.description') - ) - ->addOption( - 'file', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.doc.data.options.file') - ); - ; - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - $file = null; - if ($input->hasOption('file')) { - $file = $input->getOption('file'); - } - - $data = $this->getApplication()->getData(); - if ($file) { - file_put_contents($file, json_encode($data, JSON_PRETTY_PRINT)); - - return 0; - } - - $io->write(json_encode($data, JSON_PRETTY_PRINT)); - } -} diff --git a/src/Command/Develop/GenerateDocGitbookCommand.php b/src/Command/Develop/GenerateDocGitbookCommand.php deleted file mode 100644 index 939c0a899..000000000 --- a/src/Command/Develop/GenerateDocGitbookCommand.php +++ /dev/null @@ -1,116 +0,0 @@ -renderer = $renderer; - parent::__construct(); - } - - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName('generate:doc:gitbook') - ->setDescription($this->trans('commands.generate.doc.gitbook.description')) - ->addOption( - 'path', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.doc.gitbook.options.path') - ) - ->setAliases(['gdg']); - ; - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $path = null; - if ($input->hasOption('path')) { - $path = $input->getOption('path'); - } - - if (!$path) { - $io->error( - $this->trans('commands.generate.doc.gitbook.messages.missing_path') - ); - - return 1; - } - - $application = $this->getApplication(); - $applicationData = $application->getData(); - $namespaces = $applicationData['application']['namespaces']; - foreach ($namespaces as $namespace) { - foreach ($applicationData['commands'][$namespace] as $command) { - $this->renderFile( - 'gitbook' . DIRECTORY_SEPARATOR . 'command.md.twig', - $path . DIRECTORY_SEPARATOR . 'commands' . DIRECTORY_SEPARATOR . $command['dashed'] . '.md', - $command, - null, - $this->renderer - ); - } - } - - $this->renderFile( - 'gitbook'.DIRECTORY_SEPARATOR.'available-commands.md.twig', - $path . DIRECTORY_SEPARATOR . 'commands'.DIRECTORY_SEPARATOR.'available-commands.md', - $applicationData, - null, - $this->renderer - ); - - $this->renderFile( - 'gitbook'.DIRECTORY_SEPARATOR.'available-commands-list.md.twig', - $path . DIRECTORY_SEPARATOR . 'commands'.DIRECTORY_SEPARATOR.'available-commands-list.md', - $applicationData, - null, - $this->renderer - ); - } - - private function renderFile($template, $target, $parameters, $flag = null, $renderer) - { - if (!is_dir(dirname($target))) { - mkdir(dirname($target), 0777, true); - } - - return file_put_contents($target, $renderer->render($template, $parameters), $flag); - } -} diff --git a/src/Command/Develop/TranslationCleanupCommand.php b/src/Command/Develop/TranslationCleanupCommand.php deleted file mode 100644 index 9263f4ba4..000000000 --- a/src/Command/Develop/TranslationCleanupCommand.php +++ /dev/null @@ -1,122 +0,0 @@ -consoleRoot = $consoleRoot; - $this->configurationManager = $configurationManager; - parent::__construct(); - } - - /** - * {@inheritdoc} - */ - - protected function configure() - { - $this - ->setName('translation:cleanup') - ->setDescription($this->trans('commands.translation.cleanup.description')) - ->addArgument( - 'language', - InputArgument::OPTIONAL, - $this->trans('commands.translation.cleanup.arguments.language'), - null - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $language = $input->getArgument('language'); - - $languages = $this->configurationManager->getConfiguration()->get('application.languages'); - unset($languages['en']); - - if ($language && !isset($languages[$language])) { - $io->error( - sprintf( - $this->trans('commands.translation.cleanup.messages.invalid-language'), - $language - ) - ); - return 1; - } - - if ($language) { - $languages = [$language => $languages[$language]]; - } - - $this->cleanupTranslations($io, $language, $languages); - - $io->success( - $this->trans('commands.translation.cleanup.messages.success') - ); - } - - protected function cleanupTranslations($io, $language = null, $languages) - { - $finder = new Finder(); - - foreach ($languages as $langCode => $languageName) { - if (file_exists($this->consoleRoot . sprintf(DRUPAL_CONSOLE_LANGUAGE, $langCode))) { - foreach ($finder->files()->name('*.yml')->in($this->consoleRoot . sprintf(DRUPAL_CONSOLE_LANGUAGE, $langCode)) as $file) { - $filename = $file->getBasename('.yml'); - if (!file_exists($this->consoleRoot . sprintf(DRUPAL_CONSOLE_LANGUAGE, 'en') . $filename . '.yml')) { - $io->info( - sprintf( - $this->trans('commands.translation.cleanup.messages.file-deleted'), - $filename, - $languageName - ) - ); - unlink($this->consoleRoot . sprintf(DRUPAL_CONSOLE_LANGUAGE, $langCode). '/' . $filename . '.yml'); - } - } - } - } - } -} diff --git a/src/Command/Develop/TranslationPendingCommand.php b/src/Command/Develop/TranslationPendingCommand.php deleted file mode 100644 index a7aa68ea0..000000000 --- a/src/Command/Develop/TranslationPendingCommand.php +++ /dev/null @@ -1,237 +0,0 @@ -consoleRoot = $consoleRoot; - $this->configurationManager = $configurationManager; - $this->nestedArray = $nestedArray; - parent::__construct(); - } - - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName('translation:pending') - ->setDescription($this->trans('commands.translation.pending.description')) - ->addArgument( - 'language', - InputArgument::REQUIRED, - $this->trans('commands.translation.pending.arguments.language'), - null - ) - ->addOption( - 'file', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.translation.pending.options.file'), - null - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $language = $input->getArgument('language'); - $file = $input->getOption('file'); - - $languages = $this->configurationManager->getConfiguration()->get('application.languages'); - unset($languages['en']); - - if ($language && !isset($languages[$language])) { - $io->error( - sprintf( - $this->trans('commands.translation.pending.messages.invalid-language'), - $language - ) - ); - return 1; - } - - if ($language) { - $languages = [$language => $languages[$language]]; - } - - $pendingTranslations = $this->determinePendingTranslation($io, $language, $languages, $file); - - if ($file) { - $io->success( - sprintf( - $this->trans('commands.translation.pending.messages.success-language-file'), - $pendingTranslations, - $languages[$language], - $file - ) - ); - } else { - $io->success( - sprintf( - $this->trans('commands.translation.pending.messages.success-language'), - $pendingTranslations, - $languages[$language] - ) - ); - } - } - - protected function determinePendingTranslation($io, $language = null, $languages, $fileFilter) - { - $englishFilesFinder = new Finder(); - $yaml = new Parser(); - $statistics = []; - - $englishDirectory = $this->consoleRoot . - sprintf( - DRUPAL_CONSOLE_LANGUAGE, - 'en' - ); - - $englishFiles = $englishFilesFinder->files()->name('*.yml')->in($englishDirectory); - - $pendingTranslations = 0; - foreach ($englishFiles as $file) { - $resource = $englishDirectory . '/' . $file->getBasename(); - $filename = $file->getBasename('.yml'); - - if ($fileFilter && $fileFilter != $file->getBasename()) { - continue; - } - - try { - $englishFileParsed = $yaml->parse(file_get_contents($resource)); - } catch (ParseException $e) { - $io->error($filename . '.yml: ' . $e->getMessage()); - continue; - } - - foreach ($languages as $langCode => $languageName) { - $languageDir = $this->consoleRoot . - sprintf( - DRUPAL_CONSOLE_LANGUAGE, - $langCode - ); - if (isset($language) && $langCode != $language) { - continue; - } - - $resourceTranslated = $languageDir . '/' . $file->getBasename(); - if (!file_exists($resourceTranslated)) { - $io->info( - sprintf( - $this->trans('commands.translation.pending.messages.missing-file'), - $languageName, - $file->getBasename() - ) - ); - continue; - } - - try { - $resourceTranslatedParsed = $yaml->parse(file_get_contents($resourceTranslated)); - } catch (ParseException $e) { - $io->error($resourceTranslated . ':' . $e->getMessage()); - } - - $diffStatistics = ['total' => 0, 'equal' => 0, 'diff' => 0]; - $diff = $this->nestedArray->arrayDiff($englishFileParsed, $resourceTranslatedParsed, true, $diffStatistics); - - if (!empty($diff)) { - $diffFlatten = []; - $keyFlatten = ''; - $this->nestedArray->yamlFlattenArray($diff, $diffFlatten, $keyFlatten); - - $tableHeader = [ - $this->trans('commands.yaml.diff.messages.key'), - $this->trans('commands.yaml.diff.messages.value'), - ]; - - $tableRows = []; - foreach ($diffFlatten as $yamlKey => $yamlValue) { - if ($this->isYamlKey($yamlValue)) { - unset($diffFlatten[$yamlKey]); - } else { - $tableRows[] = [ - $yamlKey, - $yamlValue - ]; - } - } - - if (count($diffFlatten)) { - $io->writeln( - sprintf( - $this->trans('commands.translation.pending.messages.pending-translations'), - $languageName, - $file->getBasename() - ) - ); - - $io->table($tableHeader, $tableRows, 'compact'); - $pendingTranslations+= count($diffFlatten); - } - } - } - } - - return $pendingTranslations; - } -} diff --git a/src/Command/Develop/TranslationStatsCommand.php b/src/Command/Develop/TranslationStatsCommand.php deleted file mode 100644 index 9d898aff5..000000000 --- a/src/Command/Develop/TranslationStatsCommand.php +++ /dev/null @@ -1,248 +0,0 @@ -consoleRoot = $consoleRoot; - $this->configurationManager = $configurationManager; - $this->renderer = $renderer; - $this->nestedArray = $nestedArray; - parent::__construct(); - } - - /** - * {@inheritdoc} - */ - - protected function configure() - { - $this - ->setName('translation:stats') - ->setDescription($this->trans('commands.translation.stats.description')) - ->addArgument( - 'language', - InputArgument::OPTIONAL, - $this->trans('commands.translation.stats.arguments.language'), - null - ) - ->addOption( - 'format', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.translation.stats.options.format'), - 'table' - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $language = $input->getArgument('language'); - $format = $input->getOption('format'); - - $languages = $this->configurationManager->getConfiguration()->get('application.languages'); - unset($languages['en']); - - if ($language && !isset($languages[$language])) { - $io->error( - sprintf( - $this->trans('commands.translation.stats.messages.invalid-language'), - $language - ) - ); - return 1; - } - - if ($language) { - $languages = [$language => $languages[$language]]; - } - - $stats = $this->calculateStats($io, $language, $languages); - - if ($format == 'table') { - $tableHeaders = [ - $this->trans('commands.translation.stats.messages.language'), - $this->trans('commands.translation.stats.messages.percentage'), - $this->trans('commands.translation.stats.messages.iso') - ]; - - $io->table($tableHeaders, $stats); - return 0; - } - - if ($format == 'markdown') { - $arguments['language'] = $this->trans('commands.translation.stats.messages.language'); - $arguments['percentage'] = $this->trans('commands.translation.stats.messages.percentage'); - - $arguments['languages'] = $stats; - - $io->writeln( - $this->renderFile( - 'core/translation/stats.md.twig', - null, - $arguments - ) - ); - } - } - - protected function calculateStats($io, $language = null, $languages) - { - $englishFilesFinder = new Finder(); - $yaml = new Parser(); - $statistics = []; - - $englishDirectory = $this->consoleRoot . - sprintf( - DRUPAL_CONSOLE_LANGUAGE, - 'en' - ); - - $englishFiles = $englishFilesFinder->files()->name('*.yml')->in($englishDirectory); - - foreach ($englishFiles as $file) { - $resource = $englishDirectory . '/' . $file->getBasename(); - $filename = $file->getBasename('.yml'); - - try { - $englishFileParsed = $yaml->parse(file_get_contents($resource)); - } catch (ParseException $e) { - $io->error($filename . '.yml: ' . $e->getMessage()); - continue; - } - - foreach ($languages as $langCode => $languageName) { - $languageDir = $this->consoleRoot . - sprintf( - DRUPAL_CONSOLE_LANGUAGE, - $langCode - ); - //don't show that language if that repo isn't present - if (!file_exists($languageDir)) { - continue; - } - if (isset($language) && $langCode != $language) { - continue; - } - if (!isset($statistics[$langCode])) { - $statistics[$langCode] = ['total' => 0, 'equal'=> 0 , 'diff' => 0]; - } - - $resourceTranslated = $languageDir . '/' . $file->getBasename(); - if (!file_exists($resourceTranslated)) { - $englishFileEntries = count($englishFileParsed, COUNT_RECURSIVE); - $statistics[$langCode]['total'] += $englishFileEntries; - $statistics[$langCode]['equal'] += $englishFileEntries; - continue; - } - - try { - $resourceTranslatedParsed = $yaml->parse(file_get_contents($resourceTranslated)); - } catch (ParseException $e) { - $io->error($resourceTranslated . ':' . $e->getMessage()); - } - - $diffStatistics = ['total' => 0, 'equal' => 0, 'diff' => 0]; - $diff = $this->nestedArray->arrayDiff($englishFileParsed, $resourceTranslatedParsed, true, $diffStatistics); - - $yamlKeys = 0; - if (!empty($diff)) { - $diffFlatten = []; - $keyFlatten = ''; - $this->nestedArray->yamlFlattenArray($diff, $diffFlatten, $keyFlatten); - - // Determine how many yaml keys were returned as values - foreach ($diffFlatten as $yamlKey => $yamlValue) { - if ($this->isYamlKey($yamlValue)) { - $yamlKeys++; - } - } - } - - $statistics[$langCode]['total'] += $diffStatistics['total']; - $statistics[$langCode]['equal'] += ($diffStatistics['equal'] - $yamlKeys); - $statistics[$langCode]['diff'] += $diffStatistics['diff'] + $yamlKeys; - } - } - - $stats = []; - foreach ($statistics as $langCode => $statistic) { - $index = isset($languages[$langCode])? $languages[$langCode]: $langCode; - $stats[] = [ - 'name' => $index, - 'percentage' => round($statistic['diff']/$statistic['total']*100, 2), - 'iso' => $langCode - ]; - } - - usort( - $stats, function ($a, $b) { - return $a["percentage"] < $b["percentage"]; - } - ); - - return $stats; - } -} diff --git a/src/Command/Develop/TranslationSyncCommand.php b/src/Command/Develop/TranslationSyncCommand.php deleted file mode 100644 index be719800a..000000000 --- a/src/Command/Develop/TranslationSyncCommand.php +++ /dev/null @@ -1,204 +0,0 @@ -consoleRoot = $consoleRoot; - $this->configurationManager = $configurationManager; - parent::__construct(); - } - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName('translation:sync') - ->setDescription($this->trans('commands.translation.sync.description')) - ->addArgument( - 'language', - InputArgument::OPTIONAL, - $this->trans('commands.translation.sync.arguments.language'), - null - ) - ->addOption( - 'file', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.translation.stats.options.file'), - null - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $language = $input->getArgument('language'); - $file = $input->getOption('file'); - $languages = $this->configurationManager->getConfiguration()->get('application.languages'); - unset($languages['en']); - - if ($language && !isset($languages[$language])) { - $io->error( - sprintf( - $this->trans('commands.translation.stats.messages.invalid-language'), - $language - ) - ); - return 1; - } - - if ($language) { - $languages = [$language => $languages[$language]]; - } - - $this->syncTranslations($io, $language, $languages, $file); - - $io->success($this->trans('commands.translation.sync.messages.sync-finished')); - } - - protected function syncTranslations($io, $language = null, $languages, $file) - { - $englishFilesFinder = new Finder(); - $yaml = new Parser(); - $dumper = new Dumper(); - - $englishDirectory = $this->consoleRoot . - sprintf( - DRUPAL_CONSOLE_LANGUAGE, - 'en' - ); - - if ($file) { - $englishFiles = $englishFilesFinder->files()->name($file)->in($englishDirectory); - } else { - $englishFiles = $englishFilesFinder->files()->name('*.yml')->in($englishDirectory); - } - - foreach ($englishFiles as $file) { - $resource = $englishDirectory . '/' . $file->getBasename(); - $filename = $file->getBasename('.yml'); - - try { - $englishFile = file_get_contents($resource); - $englishFileParsed = $yaml->parse($englishFile); - } catch (ParseException $e) { - $io->error($filename . '.yml: ' . $e->getMessage()); - continue; - } - - foreach ($languages as $langCode => $languageName) { - $languageDir = $this->consoleRoot . - sprintf( - DRUPAL_CONSOLE_LANGUAGE, - $langCode - ); - if (isset($language) && $langCode != $language) { - continue; - } - if (!isset($statistics[$langCode])) { - $statistics[$langCode] = ['total' => 0, 'equal'=> 0 , 'diff' => 0]; - } - - $resourceTranslated = $languageDir . '/' . $file->getBasename(); - if (!file_exists($resourceTranslated)) { - file_put_contents($resourceTranslated, $englishFile); - $io->info( - sprintf( - $this->trans('commands.translation.sync.messages.created-file'), - $file->getBasename(), - $languageName - ) - ); - continue; - } - - try { - //print $resourceTranslated . "\n"; - $resourceTranslatedParsed = $yaml->parse(file_get_contents($resourceTranslated)); - } catch (ParseException $e) { - $io->error($resourceTranslated . ':' . $e->getMessage()); - continue; - } - - $resourceTranslatedParsed = array_replace_recursive($englishFileParsed, $resourceTranslatedParsed); - - try { - $resourceTranslatedParsedYaml = $dumper->dump($resourceTranslatedParsed, 10); - } catch (\Exception $e) { - $io->error( - sprintf( - $this->trans('commands.translation.sync.messages.error-generating'), - $resourceTranslated, - $languageName, - $e->getMessage() - ) - ); - - continue; - } - - try { - file_put_contents($resourceTranslated, $resourceTranslatedParsedYaml); - } catch (\Exception $e) { - $io->error( - sprintf( - '%s: %s', - $this->trans('commands.translation.sync.messages.error-writing'), - $resourceTranslated, - $languageName, - $e->getMessage() - ) - ); - - return 1; - } - } - } - } -} From c8830e2a5847f4c6c17b4c2a3372c5bd972979cf Mon Sep 17 00:00:00 2001 From: Mauricio Hernandez Date: Thu, 6 Jul 2017 14:21:37 -0600 Subject: [PATCH 281/321] 3380 relocate to debug module commands (#3409) * Move migrate:debug to debug:migrate * Move rest:debug to debug:rest * Move test:debug to debug:test * Move features:debug to debug:features --- config/services/debug.yml | 23 ++++++++++ config/services/feature.yml | 5 -- config/services/migrate.yml | 6 --- config/services/rest.yml | 6 --- config/services/simpletest.yml | 6 --- .../FeaturesCommand.php} | 26 +++++------ .../MigrateCommand.php} | 26 +++++------ .../RestCommand.php} | 46 +++++++++---------- .../TestCommand.php} | 32 ++++++------- 9 files changed, 88 insertions(+), 88 deletions(-) rename src/Command/{Features/DebugCommand.php => Debug/FeaturesCommand.php} (66%) rename src/Command/{Migrate/DebugCommand.php => Debug/MigrateCommand.php} (76%) rename src/Command/{Rest/DebugCommand.php => Debug/RestCommand.php} (74%) rename src/Command/{Test/DebugCommand.php => Debug/TestCommand.php} (84%) diff --git a/config/services/debug.yml b/config/services/debug.yml index 6f201e81a..e63e3da6e 100644 --- a/config/services/debug.yml +++ b/config/services/debug.yml @@ -143,3 +143,26 @@ services: tags: - { name: drupal.command } lazy: true + console.migrate_debug: + class: Drupal\Console\Command\Debug\MigrateCommand + arguments: ['@?plugin.manager.migration'] + tags: + - { name: drupal.command } + lazy: true + console.rest_debug: + class: Drupal\Console\Command\Debug\RestCommand + arguments: ['@?plugin.manager.rest'] + tags: + - { name: drupal.command } + lazy: true + console.test_debug: + class: Drupal\Console\Command\Debug\TestCommand + arguments: ['@?test_discovery'] + tags: + - { name: drupal.command } + lazy: true + console.feature_debug: + class: Drupal\Console\Command\Debug\FeaturesCommand + tags: + - { name: drupal.command } + lazy: true diff --git a/config/services/feature.yml b/config/services/feature.yml index 9fd6bf21d..1c4041b7c 100644 --- a/config/services/feature.yml +++ b/config/services/feature.yml @@ -1,9 +1,4 @@ services: - console.feature_debug: - class: Drupal\Console\Command\Features\DebugCommand - tags: - - { name: drupal.command } - lazy: true console.feature_import: class: Drupal\Console\Command\Features\ImportCommand tags: diff --git a/config/services/migrate.yml b/config/services/migrate.yml index ab1ba6817..ba69672b6 100644 --- a/config/services/migrate.yml +++ b/config/services/migrate.yml @@ -11,12 +11,6 @@ services: tags: - { name: drupal.command } lazy: true - console.migrate_debug: - class: Drupal\Console\Command\Migrate\DebugCommand - arguments: ['@?plugin.manager.migration'] - tags: - - { name: drupal.command } - lazy: true console.migrate_setup: class: Drupal\Console\Command\Migrate\SetupCommand arguments: ['@state', '@?plugin.manager.migration'] diff --git a/config/services/rest.yml b/config/services/rest.yml index 5b59ced3b..be4a30613 100644 --- a/config/services/rest.yml +++ b/config/services/rest.yml @@ -1,10 +1,4 @@ services: - console.rest_debug: - class: Drupal\Console\Command\Rest\DebugCommand - arguments: ['@?plugin.manager.rest'] - tags: - - { name: drupal.command } - lazy: true console.rest_disable: class: Drupal\Console\Command\Rest\DisableCommand arguments: ['@config.factory', '@?plugin.manager.rest'] diff --git a/config/services/simpletest.yml b/config/services/simpletest.yml index 52668d29a..327f8ae40 100644 --- a/config/services/simpletest.yml +++ b/config/services/simpletest.yml @@ -1,10 +1,4 @@ services: - console.test_debug: - class: Drupal\Console\Command\Test\DebugCommand - arguments: ['@?test_discovery'] - tags: - - { name: drupal.command } - lazy: true console.test_run: class: Drupal\Console\Command\Test\RunCommand arguments: ['@app.root', '@?test_discovery', '@module_handler', '@date.formatter'] diff --git a/src/Command/Features/DebugCommand.php b/src/Command/Debug/FeaturesCommand.php similarity index 66% rename from src/Command/Features/DebugCommand.php rename to src/Command/Debug/FeaturesCommand.php index 5c7b5f1c3..21c195cb8 100644 --- a/src/Command/Features/DebugCommand.php +++ b/src/Command/Debug/FeaturesCommand.php @@ -2,10 +2,10 @@ /** * @file -* Contains \Drupal\Console\Command\Features\DebugCommand. +* Contains \Drupal\Console\Command\Debug\FeaturesCommand. */ -namespace Drupal\Console\Command\Features; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -23,7 +23,7 @@ * ) */ -class DebugCommand extends Command +class FeaturesCommand extends Command { use CommandTrait; use FeatureTrait; @@ -31,12 +31,12 @@ class DebugCommand extends Command protected function configure() { $this - ->setName('features:debug') - ->setDescription($this->trans('commands.features.debug.description')) + ->setName('debug:features') + ->setDescription($this->trans('commands.debug.features.description')) ->addArgument( 'bundle', InputArgument::OPTIONAL, - $this->trans('commands.features.debug.arguments.bundle') + $this->trans('commands.debug.features.arguments.bundle') ); } @@ -46,17 +46,17 @@ protected function execute(InputInterface $input, OutputInterface $output) $bundle= $input->getArgument('bundle'); $tableHeader = [ - $this->trans('commands.features.debug.messages.bundle'), - $this->trans('commands.features.debug.messages.name'), - $this->trans('commands.features.debug.messages.machine_name'), - $this->trans('commands.features.debug.messages.status'), - $this->trans('commands.features.debug.messages.state'), + $this->trans('commands.debug.features.messages.bundle'), + $this->trans('commands.debug.features.messages.name'), + $this->trans('commands.debug.features.messages.machine_name'), + $this->trans('commands.debug.features.messages.status'), + $this->trans('commands.debug.features.messages.state'), ]; $tableRows = []; - + $features = $this->getFeatureList($io, $bundle); - + foreach ($features as $feature) { $tableRows[] = [$feature['bundle_name'],$feature['name'], $feature['machine_name'], $feature['status'],$feature['state']]; } diff --git a/src/Command/Migrate/DebugCommand.php b/src/Command/Debug/MigrateCommand.php similarity index 76% rename from src/Command/Migrate/DebugCommand.php rename to src/Command/Debug/MigrateCommand.php index da908d8c9..9b2f8b20d 100644 --- a/src/Command/Migrate/DebugCommand.php +++ b/src/Command/Debug/MigrateCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Migrate\DebugCommand. + * Contains \Drupal\Console\Command\Debug\MigrateCommand. */ -namespace Drupal\Console\Command\Migrate; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -23,7 +23,7 @@ * extensionType = "module" * ) */ -class DebugCommand extends Command +class MigrateCommand extends Command { use MigrationTrait; use CommandTrait; @@ -34,7 +34,7 @@ class DebugCommand extends Command protected $pluginManagerMigration; /** - * DebugCommand constructor. + * MigrateCommand constructor. * * @param MigrationPluginManagerInterface $pluginManagerMigration */ @@ -48,12 +48,12 @@ public function __construct( protected function configure() { $this - ->setName('migrate:debug') - ->setDescription($this->trans('commands.migrate.debug.description')) + ->setName('debug:migrate') + ->setDescription($this->trans('commands.debug.migrate.description')) ->addArgument( 'tag', InputArgument::OPTIONAL, - $this->trans('commands.migrate.debug.arguments.tag') + $this->trans('commands.debug.migrate.arguments.tag') ) ->setAliases(['mid']); } @@ -62,21 +62,21 @@ protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); $drupal_version = 'Drupal ' . $input->getArgument('tag'); - + $migrations = $this->getMigrations($drupal_version); - + $tableHeader = [ - $this->trans('commands.migrate.debug.messages.id'), - $this->trans('commands.migrate.debug.messages.description'), - $this->trans('commands.migrate.debug.messages.tags'), + $this->trans('commands.debug.migrate.messages.id'), + $this->trans('commands.debug.migrate.messages.description'), + $this->trans('commands.debug.migrate.messages.tags'), ]; $tableRows = []; if (empty($migrations)) { $io->error( sprintf( - $this->trans('commands.migrate.debug.messages.no-migrations'), + $this->trans('commands.debug.migrate.messages.no-migrations'), count($migrations) ) ); diff --git a/src/Command/Rest/DebugCommand.php b/src/Command/Debug/RestCommand.php similarity index 74% rename from src/Command/Rest/DebugCommand.php rename to src/Command/Debug/RestCommand.php index 2ffa178de..456cc1b83 100644 --- a/src/Command/Rest/DebugCommand.php +++ b/src/Command/Debug/RestCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Rest\DebugCommand. + * Contains \Drupal\Console\Command\Debug\RestCommand. */ -namespace Drupal\Console\Command\Rest; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; @@ -24,7 +24,7 @@ * extensionType = "module" * ) */ -class DebugCommand extends Command +class RestCommand extends Command { use CommandTrait; use RestTrait; @@ -35,7 +35,7 @@ class DebugCommand extends Command protected $pluginManagerRest; /** - * DebugCommand constructor. + * RestCommand constructor. * * @param ResourcePluginManager $pluginManagerRest */ @@ -48,18 +48,18 @@ public function __construct(ResourcePluginManager $pluginManagerRest) protected function configure() { $this - ->setName('rest:debug') - ->setDescription($this->trans('commands.rest.debug.description')) + ->setName('debug:rest') + ->setDescription($this->trans('commands.debug.rest.description')) ->addArgument( 'resource-id', InputArgument::OPTIONAL, - $this->trans('commands.rest.debug.arguments.resource-id') + $this->trans('commands.debug.rest.arguments.resource-id') ) ->addOption( 'authorization', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.rest.debug.options.status') + $this->trans('commands.debug.rest.options.status') ) ->setAliases(['rede']); } @@ -89,7 +89,7 @@ private function restDetail(DrupalStyle $io, $resource_id) if (empty($plugin)) { $io->error( sprintf( - $this->trans('commands.rest.debug.messages.not-found'), + $this->trans('commands.debug.rest.messages.not-found'), $resource_id ) ); @@ -101,24 +101,24 @@ private function restDetail(DrupalStyle $io, $resource_id) $configuration = []; $configuration[] = [ - $this->trans('commands.rest.debug.messages.id'), + $this->trans('commands.debug.rest.messages.id'), $resource['id'] ]; $configuration[] = [ - $this->trans('commands.rest.debug.messages.label'), + $this->trans('commands.debug.rest.messages.label'), (string) $resource['label'] ]; $configuration[] = [ - $this->trans('commands.rest.debug.messages.canonical_url'), + $this->trans('commands.debug.rest.messages.canonical_url'), $resource['uri_paths']['canonical'] ]; $configuration[] = [ - $this->trans('commands.rest.debug.messages.status'), - (isset($config[$resource['id']])) ? $this->trans('commands.rest.debug.messages.enabled') : $this->trans('commands.rest.debug.messages.disabled')]; + $this->trans('commands.debug.rest.messages.status'), + (isset($config[$resource['id']])) ? $this->trans('commands.debug.rest.messages.enabled') : $this->trans('commands.debug.rest.messages.disabled')]; $configuration[] = [ $this->trans( sprintf( - 'commands.rest.debug.messages.provider', + 'commands.debug.rest.messages.provider', $resource['provider'] ) ) @@ -130,9 +130,9 @@ private function restDetail(DrupalStyle $io, $resource_id) $io->table([], $configuration, 'compact'); $tableHeader = [ - $this->trans('commands.rest.debug.messages.rest-state'), - $this->trans('commands.rest.debug.messages.supported-formats'), - $this->trans('commands.rest.debug.messages.supported_auth'), + $this->trans('commands.debug.rest.messages.rest-state'), + $this->trans('commands.debug.rest.messages.supported-formats'), + $this->trans('commands.debug.rest.messages.supported_auth'), ]; $tableRows = []; @@ -152,11 +152,11 @@ protected function restList(DrupalStyle $io, $status) $rest_resources = $this->getRestResources($status); $tableHeader = [ - $this->trans('commands.rest.debug.messages.id'), - $this->trans('commands.rest.debug.messages.label'), - $this->trans('commands.rest.debug.messages.canonical_url'), - $this->trans('commands.rest.debug.messages.status'), - $this->trans('commands.rest.debug.messages.provider'), + $this->trans('commands.debug.rest.messages.id'), + $this->trans('commands.debug.rest.messages.label'), + $this->trans('commands.debug.rest.messages.canonical_url'), + $this->trans('commands.debug.rest.messages.status'), + $this->trans('commands.debug.rest.messages.provider'), ]; $tableRows = []; diff --git a/src/Command/Test/DebugCommand.php b/src/Command/Debug/TestCommand.php similarity index 84% rename from src/Command/Test/DebugCommand.php rename to src/Command/Debug/TestCommand.php index 9f3c5e53a..e18c784a5 100644 --- a/src/Command/Test/DebugCommand.php +++ b/src/Command/Debug/TestCommand.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Console\Command\Test\DebugCommand. + * Contains \Drupal\Console\Command\Debug\TestCommand. */ -namespace Drupal\Console\Command\Test; +namespace Drupal\Console\Command\Debug; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; @@ -24,7 +24,7 @@ * extensionType = "module", * ) */ -class DebugCommand extends Command +class TestCommand extends Command { use CommandTrait; @@ -34,7 +34,7 @@ class DebugCommand extends Command protected $test_discovery; /** - * DebugCommand constructor. + * TestCommand constructor. * * @param TestDiscovery $test_discovery */ @@ -49,19 +49,19 @@ public function __construct( protected function configure() { $this - ->setName('test:debug') - ->setDescription($this->trans('commands.test.debug.description')) + ->setName('debug:test') + ->setDescription($this->trans('commands.debug.test.description')) ->addArgument( 'group', InputArgument::OPTIONAL, - $this->trans('commands.test.debug.options.group'), + $this->trans('commands.debug.test.options.group'), null ) ->addOption( 'test-class', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.test.debug.arguments.test-class') + $this->trans('commands.debug.test.arguments.test-class') ) ->setAliases(['td']); } @@ -124,7 +124,7 @@ private function testDetail(DrupalStyle $io, $test_class) if ($class) { $methods = $class->getMethods(\ReflectionMethod::IS_PUBLIC); - $io->info($this->trans('commands.test.debug.messages.methods')); + $io->info($this->trans('commands.debug.test.messages.methods')); foreach ($methods as $method) { if ($method->class == $testDetails['name'] && strpos($method->name, 'test') === 0) { $io->simple($method->name); @@ -132,7 +132,7 @@ private function testDetail(DrupalStyle $io, $test_class) } } } else { - $io->error($this->trans('commands.test.debug.messages.not-found')); + $io->error($this->trans('commands.debug.test.messages.not-found')); } } @@ -142,17 +142,17 @@ protected function testList(DrupalStyle $io, $group) ->getTestClasses(null); if (empty($group)) { - $tableHeader = [$this->trans('commands.test.debug.messages.group')]; + $tableHeader = [$this->trans('commands.debug.test.messages.group')]; } else { $tableHeader = [ - $this->trans('commands.test.debug.messages.class'), - $this->trans('commands.test.debug.messages.type') + $this->trans('commands.debug.test.messages.class'), + $this->trans('commands.debug.test.messages.type') ]; $io->writeln( sprintf( '%s: %s', - $this->trans('commands.test.debug.messages.group'), + $this->trans('commands.debug.test.messages.group'), $group ) ); @@ -186,13 +186,13 @@ protected function testList(DrupalStyle $io, $group) if ($group) { $io->success( sprintf( - $this->trans('commands.test.debug.messages.success-group'), + $this->trans('commands.debug.test.messages.success-group'), $group ) ); } else { $io->success( - $this->trans('commands.test.debug.messages.success-groups') + $this->trans('commands.debug.test.messages.success-groups') ); } } From 030bdbe40ffe6fa7f75bd3af7705cb14d646c107 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 6 Jul 2017 21:53:15 -0700 Subject: [PATCH 282/321] [console] Rename cache services file. (#3411) --- .gitignore | 2 +- src/Utils/Site.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c6549b085..6c785063f 100644 --- a/.gitignore +++ b/.gitignore @@ -33,4 +33,4 @@ autoload.local.php # drupal/console-extend-plugin generated files extend.console.*.yml -*.console.services.yml +*-console.services.yml diff --git a/src/Utils/Site.php b/src/Utils/Site.php index 9e7e53a90..748acd079 100644 --- a/src/Utils/Site.php +++ b/src/Utils/Site.php @@ -209,7 +209,7 @@ public function getCachedServicesFile() $siteId = $configFactory->get('system.site')->get('uuid'); $this->cacheServicesFile = \Drupal::service('console.root') . - DRUPAL_CONSOLE . $siteId . '.console.services.yml'; + DRUPAL_CONSOLE . $siteId . '-console.services.yml'; } return $this->cacheServicesFile; From d4acb53916eb5496254fd1f3e73431c1a5d2adc9 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 9 Jul 2017 00:59:16 -0700 Subject: [PATCH 283/321] [console] Load command aliases. (#3413) --- src/Application.php | 30 +++++++++++--------------- src/Command/Debug/ContainerCommand.php | 2 +- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/Application.php b/src/Application.php index 0794a8a7d..3dd0209ab 100644 --- a/src/Application.php +++ b/src/Application.php @@ -151,18 +151,11 @@ private function registerCommands() ->get('console.annotation_validator'); } -// $aliases = $this->container->get('console.configuration_manager') -// ->getConfiguration() -// ->get('application.commands.aliases')?:[]; + $aliases = $this->container->get('console.configuration_manager') + ->getConfiguration() + ->get('application.commands.aliases')?:[]; foreach ($consoleCommands as $name) { - AnnotationRegistry::reset(); - AnnotationRegistry::registerLoader( - [ - $this->container->get('class_loader'), - "loadClass" - ] - ); if (!$this->container->has($name)) { continue; @@ -212,13 +205,16 @@ private function registerCommands() ); } -// if (array_key_exists($command->getName(), $aliases)) { -// $commandAliases = $aliases[$command->getName()]; -// if (!is_array($commandAliases)) { -// $commandAliases = [$commandAliases]; -// } -// $command->setAliases($commandAliases); -// } + if (array_key_exists($command->getName(), $aliases)) { + $commandAliases = array_merge( + $command->getAliases(), + $aliases[$command->getName()] + ); + if (!is_array($commandAliases)) { + $commandAliases = [$commandAliases]; + } + $command->setAliases($commandAliases); + } $this->add($command); } diff --git a/src/Command/Debug/ContainerCommand.php b/src/Command/Debug/ContainerCommand.php index 5dc1d5637..5f37ed32e 100644 --- a/src/Command/Debug/ContainerCommand.php +++ b/src/Command/Debug/ContainerCommand.php @@ -52,7 +52,7 @@ protected function configure() InputArgument::OPTIONAL, $this->trans('commands.debug.container.arguments.arguments') ) - ->setAliases(['cod']); + ->setAliases(['dco']); } /** From e7f2bee5f9d7277741c8972bfd05ec1e7a621a6d Mon Sep 17 00:00:00 2001 From: Blas Date: Wed, 12 Jul 2017 17:15:16 -0500 Subject: [PATCH 284/321] Replacing in translation key from _ to - (#3422) --- src/Command/Cache/RebuildCommand.php | 2 +- src/Command/Config/ExportContentTypeCommand.php | 2 +- src/Command/Config/ExportViewCommand.php | 2 +- src/Command/Debug/ContainerCommand.php | 6 +++--- src/Command/Debug/FeaturesCommand.php | 2 +- src/Command/Debug/RestCommand.php | 8 ++++---- src/Command/Migrate/ExecuteCommand.php | 4 ++-- src/Command/Migrate/RollBackCommand.php | 4 ++-- src/Command/Migrate/SetupCommand.php | 4 ++-- src/Command/Shared/FormTrait.php | 2 +- src/Command/Site/StatusCommand.php | 10 +++++----- 11 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/Command/Cache/RebuildCommand.php b/src/Command/Cache/RebuildCommand.php index 36bd3c6e9..01fedcd59 100644 --- a/src/Command/Cache/RebuildCommand.php +++ b/src/Command/Cache/RebuildCommand.php @@ -90,7 +90,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if ($cache && !$this->drupalApi->isValidCache($cache)) { $io->error( sprintf( - $this->trans('commands.cache.rebuild.messages.invalid_cache'), + $this->trans('commands.cache.rebuild.messages.invalid-cache'), $cache ) ); diff --git a/src/Command/Config/ExportContentTypeCommand.php b/src/Command/Config/ExportContentTypeCommand.php index e33e8b9d3..684814b8f 100644 --- a/src/Command/Config/ExportContentTypeCommand.php +++ b/src/Command/Config/ExportContentTypeCommand.php @@ -150,7 +150,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->getViewDisplays($contentType, $optionalConfig); - $this->exportConfigToModule($module, $io, $this->trans('commands.config.export.content.type.messages.content_type_exported')); + $this->exportConfigToModule($module, $io, $this->trans('commands.config.export.content.type.messages.content-type-exported')); } protected function getFields($contentType, $optional = false) diff --git a/src/Command/Config/ExportViewCommand.php b/src/Command/Config/ExportViewCommand.php index d474738f6..3d715472f 100644 --- a/src/Command/Config/ExportViewCommand.php +++ b/src/Command/Config/ExportViewCommand.php @@ -172,6 +172,6 @@ protected function execute(InputInterface $input, OutputInterface $output) } } - $this->exportConfigToModule($module, $io, $this->trans('commands.views.export.messages.view_exported')); + $this->exportConfigToModule($module, $io, $this->trans('commands.views.export.messages.view-exported')); } } diff --git a/src/Command/Debug/ContainerCommand.php b/src/Command/Debug/ContainerCommand.php index 5f37ed32e..a8630cef2 100644 --- a/src/Command/Debug/ContainerCommand.php +++ b/src/Command/Debug/ContainerCommand.php @@ -90,8 +90,8 @@ protected function execute(InputInterface $input, OutputInterface $output) } $tableHeader = [ - $this->trans('commands.debug.container.messages.service_id'), - $this->trans('commands.debug.container.messages.class_name') + $this->trans('commands.debug.container.messages.service-id'), + $this->trans('commands.debug.container.messages.class-name') ]; $tableRows = $this->getServiceList(); @@ -114,7 +114,7 @@ private function getCallbackReturnList($service, $method, $args) $serviceInstance = \Drupal::service($service); if (!method_exists($serviceInstance, $method)) { - throw new \Symfony\Component\DependencyInjection\Exception\BadMethodCallException($this->trans('commands.debug.container.errors.method_not_exists')); + throw new \Symfony\Component\DependencyInjection\Exception\BadMethodCallException($this->trans('commands.debug.container.errors.method-not-exists')); return $serviceDetail; } diff --git a/src/Command/Debug/FeaturesCommand.php b/src/Command/Debug/FeaturesCommand.php index 21c195cb8..a94806058 100644 --- a/src/Command/Debug/FeaturesCommand.php +++ b/src/Command/Debug/FeaturesCommand.php @@ -48,7 +48,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $tableHeader = [ $this->trans('commands.debug.features.messages.bundle'), $this->trans('commands.debug.features.messages.name'), - $this->trans('commands.debug.features.messages.machine_name'), + $this->trans('commands.debug.features.messages.machine-name'), $this->trans('commands.debug.features.messages.status'), $this->trans('commands.debug.features.messages.state'), ]; diff --git a/src/Command/Debug/RestCommand.php b/src/Command/Debug/RestCommand.php index 456cc1b83..ad1205800 100644 --- a/src/Command/Debug/RestCommand.php +++ b/src/Command/Debug/RestCommand.php @@ -109,7 +109,7 @@ private function restDetail(DrupalStyle $io, $resource_id) (string) $resource['label'] ]; $configuration[] = [ - $this->trans('commands.debug.rest.messages.canonical_url'), + $this->trans('commands.debug.rest.messages.canonical-url'), $resource['uri_paths']['canonical'] ]; $configuration[] = [ @@ -132,7 +132,7 @@ private function restDetail(DrupalStyle $io, $resource_id) $tableHeader = [ $this->trans('commands.debug.rest.messages.rest-state'), $this->trans('commands.debug.rest.messages.supported-formats'), - $this->trans('commands.debug.rest.messages.supported_auth'), + $this->trans('commands.debug.rest.messages.supported-auth'), ]; $tableRows = []; @@ -140,7 +140,7 @@ private function restDetail(DrupalStyle $io, $resource_id) $tableRows[] = [ $method, implode(', ', $settings['supported_formats']), - implode(', ', $settings['supported_auth']), + implode(', ', $settings['supported-auth']), ]; } @@ -154,7 +154,7 @@ protected function restList(DrupalStyle $io, $status) $tableHeader = [ $this->trans('commands.debug.rest.messages.id'), $this->trans('commands.debug.rest.messages.label'), - $this->trans('commands.debug.rest.messages.canonical_url'), + $this->trans('commands.debug.rest.messages.canonical-url'), $this->trans('commands.debug.rest.messages.status'), $this->trans('commands.debug.rest.messages.provider'), ]; diff --git a/src/Command/Migrate/ExecuteCommand.php b/src/Command/Migrate/ExecuteCommand.php index c0aa47144..ceb4083c3 100644 --- a/src/Command/Migrate/ExecuteCommand.php +++ b/src/Command/Migrate/ExecuteCommand.php @@ -120,7 +120,7 @@ protected function configure() 'source-base_path', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.migrate.execute.options.source-base_path') + $this->trans('commands.migrate.execute.options.source-base-path') ) ->setAliases(['mie']); ; @@ -274,7 +274,7 @@ protected function interact(InputInterface $input, OutputInterface $output) $sourceBasepath = $input->getOption('source-base_path'); if (!$sourceBasepath) { $sourceBasepath = $io->ask( - $this->trans('commands.migrate.setup.questions.source-base_path'), + $this->trans('commands.migrate.setup.questions.source-base-path'), '' ); $input->setOption('source-base_path', $sourceBasepath); diff --git a/src/Command/Migrate/RollBackCommand.php b/src/Command/Migrate/RollBackCommand.php index e10d59e26..84468e6d2 100644 --- a/src/Command/Migrate/RollBackCommand.php +++ b/src/Command/Migrate/RollBackCommand.php @@ -60,7 +60,7 @@ protected function configure() 'source-base_path', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.migrate.setup.options.source-base_path') + $this->trans('commands.migrate.setup.options.source-base-path') )->setAliases(['mir']); ; } @@ -175,7 +175,7 @@ protected function interact(InputInterface $input, OutputInterface $output) $sourceBasepath = $input->getOption('source-base_path'); if (!$sourceBasepath) { $sourceBasepath = $io->ask( - $this->trans('commands.migrate.setup.questions.source-base_path'), + $this->trans('commands.migrate.setup.questions.source-base-path'), '' ); $input->setOption('source-base_path', $sourceBasepath); diff --git a/src/Command/Migrate/SetupCommand.php b/src/Command/Migrate/SetupCommand.php index e54c002b3..ae249249e 100644 --- a/src/Command/Migrate/SetupCommand.php +++ b/src/Command/Migrate/SetupCommand.php @@ -109,7 +109,7 @@ protected function configure() 'source-base_path', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.migrate.setup.options.source-base_path') + $this->trans('commands.migrate.setup.options.source-base-path') )->setAliases(['mis']); ; } @@ -174,7 +174,7 @@ protected function interact(InputInterface $input, OutputInterface $output) $sourceBasepath = $input->getOption('source-base_path'); if (!$sourceBasepath) { $sourceBasepath = $io->ask( - $this->trans('commands.migrate.setup.questions.source-base_path'), + $this->trans('commands.migrate.setup.questions.source-base-path'), '' ); $input->setOption('source-base_path', $sourceBasepath); diff --git a/src/Command/Shared/FormTrait.php b/src/Command/Shared/FormTrait.php index a6e9085d6..f55da0134 100644 --- a/src/Command/Shared/FormTrait.php +++ b/src/Command/Shared/FormTrait.php @@ -69,7 +69,7 @@ public function formQuestion(DrupalStyle $io) $input_machine_name = $this->stringConverter->createMachineName($input_label); $input_name = $io->ask( - $this->trans('commands.common.questions.inputs.machine_name'), + $this->trans('commands.common.questions.inputs.machine-name'), $input_machine_name ); diff --git a/src/Command/Site/StatusCommand.php b/src/Command/Site/StatusCommand.php index 61f62cf65..e0ee9502b 100644 --- a/src/Command/Site/StatusCommand.php +++ b/src/Command/Site/StatusCommand.php @@ -170,7 +170,7 @@ protected function getSystemData() } catch (\Exception $e) { $hashSalt = ''; } - $systemData['system'][$this->trans('commands.site.status.messages.hash_salt')] = $hashSalt; + $systemData['system'][$this->trans('commands.site.status.messages.hash-salt')] = $hashSalt; $systemData['system'][$this->trans('commands.site.status.messages.console')] = $this->getApplication()->getVersion(); } @@ -239,10 +239,10 @@ protected function getDirectoryData() return [ 'directory' => [ - $this->trans('commands.site.status.messages.directory_root') => $this->appRoot, - $this->trans('commands.site.status.messages.directory_temporary') => $systemFile->get('path.temporary'), - $this->trans('commands.site.status.messages.directory_theme_default') => $themeDefaultDirectory, - $this->trans('commands.site.status.messages.directory_theme_admin') => $themeAdminDirectory, + $this->trans('commands.site.status.messages.directory-root') => $this->appRoot, + $this->trans('commands.site.status.messages.directory-temporary') => $systemFile->get('path.temporary'), + $this->trans('commands.site.status.messages.directory-theme-default') => $themeDefaultDirectory, + $this->trans('commands.site.status.messages.directory-theme-admin') => $themeAdminDirectory, ], ]; } From 1dea474267555f569ca7f1d8d61396918be99bfb Mon Sep 17 00:00:00 2001 From: enzo - Eduardo Garcia Date: Thu, 13 Jul 2017 09:44:20 +1000 Subject: [PATCH 285/321] Removed generate commands and generators (#3417) --- config/services/database.yml | 6 + config/services/generate.yml | 247 ----------- config/services/generator.yml | 244 ----------- .../AuthenticationProviderCommand.php | 158 ------- src/Command/Generate/BreakPointCommand.php | 172 -------- src/Command/Generate/CacheContextCommand.php | 174 -------- src/Command/Generate/CommandCommand.php | 224 ---------- .../Generate/ConfigFormBaseCommand.php | 91 ---- src/Command/Generate/ControllerCommand.php | 320 -------------- src/Command/Generate/EntityBundleCommand.php | 151 ------- src/Command/Generate/EntityCommand.php | 176 -------- src/Command/Generate/EntityConfigCommand.php | 101 ----- src/Command/Generate/EntityContentCommand.php | 174 -------- .../Generate/EventSubscriberCommand.php | 197 --------- src/Command/Generate/FormAlterCommand.php | 324 -------------- src/Command/Generate/FormBaseCommand.php | 18 - src/Command/Generate/FormCommand.php | 330 -------------- src/Command/Generate/HelpCommand.php | 148 ------- src/Command/Generate/ModuleCommand.php | 409 ------------------ src/Command/Generate/ModuleFileCommand.php | 115 ----- src/Command/Generate/PermissionCommand.php | 122 ------ src/Command/Generate/PluginBlockCommand.php | 292 ------------- .../Generate/PluginCKEditorButtonCommand.php | 207 --------- .../Generate/PluginConditionCommand.php | 253 ----------- src/Command/Generate/PluginFieldCommand.php | 346 --------------- .../Generate/PluginFieldFormatterCommand.php | 205 --------- .../Generate/PluginFieldTypeCommand.php | 221 ---------- .../Generate/PluginFieldWidgetCommand.php | 210 --------- .../Generate/PluginImageEffectCommand.php | 185 -------- .../Generate/PluginImageFormatterCommand.php | 172 -------- src/Command/Generate/PluginMailCommand.php | 198 --------- .../Generate/PluginMigrateProcessCommand.php | 147 ------- .../Generate/PluginMigrateSourceCommand.php | 267 ------------ .../Generate/PluginRestResourceCommand.php | 225 ---------- .../Generate/PluginRulesActionCommand.php | 220 ---------- .../Generate/PluginSkeletonCommand.php | 384 ---------------- .../Generate/PluginTypeAnnotationCommand.php | 153 ------- .../Generate/PluginTypeYamlCommand.php | 154 ------- .../Generate/PluginViewsFieldCommand.php | 185 -------- src/Command/Generate/PostUpdateCommand.php | 198 --------- src/Command/Generate/ProfileCommand.php | 270 ------------ .../Generate/RouteSubscriberCommand.php | 158 ------- src/Command/Generate/ServiceCommand.php | 244 ----------- src/Command/Generate/ThemeCommand.php | 383 ---------------- src/Command/Generate/TwigExtensionCommand.php | 192 -------- src/Command/Generate/UpdateCommand.php | 199 --------- .../AuthenticationProviderGenerator.php | 75 ---- src/Generator/BreakPointGenerator.php | 61 --- src/Generator/CacheContextGenerator.php | 64 --- src/Generator/CommandGenerator.php | 94 ---- src/Generator/ControllerGenerator.php | 62 --- src/Generator/EntityBundleGenerator.php | 86 ---- src/Generator/EntityConfigGenerator.php | 109 ----- src/Generator/EntityContentGenerator.php | 291 ------------- src/Generator/EventSubscriberGenerator.php | 66 --- src/Generator/FormAlterGenerator.php | 57 --- src/Generator/FormGenerator.php | 114 ----- src/Generator/HelpGenerator.php | 54 --- src/Generator/ModuleFileGenerator.php | 53 --- src/Generator/ModuleGenerator.php | 188 -------- src/Generator/PermissionGenerator.php | 60 --- src/Generator/PluginBlockGenerator.php | 89 ---- .../PluginCKEditorButtonGenerator.php | 57 --- src/Generator/PluginConditionGenerator.php | 66 --- .../PluginFieldFormatterGenerator.php | 51 --- src/Generator/PluginFieldTypeGenerator.php | 55 --- src/Generator/PluginFieldWidgetGenerator.php | 51 --- src/Generator/PluginImageEffectGenerator.php | 51 --- .../PluginImageFormatterGenerator.php | 50 --- src/Generator/PluginMailGenerator.php | 51 --- .../PluginMigrateProcessGenerator.php | 52 --- .../PluginMigrateSourceGenerator.php | 60 --- src/Generator/PluginRestResourceGenerator.php | 59 --- src/Generator/PluginRulesActionGenerator.php | 65 --- src/Generator/PluginSkeletonGenerator.php | 61 --- .../PluginTypeAnnotationGenerator.php | 85 ---- src/Generator/PluginTypeYamlGenerator.php | 74 ---- src/Generator/PluginViewsFieldGenerator.php | 62 --- src/Generator/PostUpdateGenerator.php | 54 --- src/Generator/ProfileGenerator.php | 83 ---- src/Generator/RouteSubscriberGenerator.php | 62 --- src/Generator/ServiceGenerator.php | 102 ----- src/Generator/ThemeGenerator.php | 118 ----- src/Generator/TwigExtensionGenerator.php | 69 --- src/Generator/UpdateGenerator.php | 55 --- 85 files changed, 6 insertions(+), 12579 deletions(-) delete mode 100644 config/services/generate.yml delete mode 100644 config/services/generator.yml delete mode 100644 src/Command/Generate/AuthenticationProviderCommand.php delete mode 100644 src/Command/Generate/BreakPointCommand.php delete mode 100644 src/Command/Generate/CacheContextCommand.php delete mode 100644 src/Command/Generate/CommandCommand.php delete mode 100644 src/Command/Generate/ConfigFormBaseCommand.php delete mode 100644 src/Command/Generate/ControllerCommand.php delete mode 100644 src/Command/Generate/EntityBundleCommand.php delete mode 100644 src/Command/Generate/EntityCommand.php delete mode 100644 src/Command/Generate/EntityConfigCommand.php delete mode 100644 src/Command/Generate/EntityContentCommand.php delete mode 100644 src/Command/Generate/EventSubscriberCommand.php delete mode 100644 src/Command/Generate/FormAlterCommand.php delete mode 100644 src/Command/Generate/FormBaseCommand.php delete mode 100644 src/Command/Generate/FormCommand.php delete mode 100644 src/Command/Generate/HelpCommand.php delete mode 100644 src/Command/Generate/ModuleCommand.php delete mode 100644 src/Command/Generate/ModuleFileCommand.php delete mode 100644 src/Command/Generate/PermissionCommand.php delete mode 100644 src/Command/Generate/PluginBlockCommand.php delete mode 100644 src/Command/Generate/PluginCKEditorButtonCommand.php delete mode 100644 src/Command/Generate/PluginConditionCommand.php delete mode 100644 src/Command/Generate/PluginFieldCommand.php delete mode 100644 src/Command/Generate/PluginFieldFormatterCommand.php delete mode 100644 src/Command/Generate/PluginFieldTypeCommand.php delete mode 100644 src/Command/Generate/PluginFieldWidgetCommand.php delete mode 100644 src/Command/Generate/PluginImageEffectCommand.php delete mode 100644 src/Command/Generate/PluginImageFormatterCommand.php delete mode 100644 src/Command/Generate/PluginMailCommand.php delete mode 100644 src/Command/Generate/PluginMigrateProcessCommand.php delete mode 100644 src/Command/Generate/PluginMigrateSourceCommand.php delete mode 100644 src/Command/Generate/PluginRestResourceCommand.php delete mode 100644 src/Command/Generate/PluginRulesActionCommand.php delete mode 100644 src/Command/Generate/PluginSkeletonCommand.php delete mode 100644 src/Command/Generate/PluginTypeAnnotationCommand.php delete mode 100644 src/Command/Generate/PluginTypeYamlCommand.php delete mode 100644 src/Command/Generate/PluginViewsFieldCommand.php delete mode 100644 src/Command/Generate/PostUpdateCommand.php delete mode 100644 src/Command/Generate/ProfileCommand.php delete mode 100644 src/Command/Generate/RouteSubscriberCommand.php delete mode 100644 src/Command/Generate/ServiceCommand.php delete mode 100644 src/Command/Generate/ThemeCommand.php delete mode 100644 src/Command/Generate/TwigExtensionCommand.php delete mode 100644 src/Command/Generate/UpdateCommand.php delete mode 100644 src/Generator/AuthenticationProviderGenerator.php delete mode 100644 src/Generator/BreakPointGenerator.php delete mode 100644 src/Generator/CacheContextGenerator.php delete mode 100644 src/Generator/CommandGenerator.php delete mode 100644 src/Generator/ControllerGenerator.php delete mode 100644 src/Generator/EntityBundleGenerator.php delete mode 100644 src/Generator/EntityConfigGenerator.php delete mode 100644 src/Generator/EntityContentGenerator.php delete mode 100644 src/Generator/EventSubscriberGenerator.php delete mode 100644 src/Generator/FormAlterGenerator.php delete mode 100644 src/Generator/FormGenerator.php delete mode 100644 src/Generator/HelpGenerator.php delete mode 100644 src/Generator/ModuleFileGenerator.php delete mode 100644 src/Generator/ModuleGenerator.php delete mode 100644 src/Generator/PermissionGenerator.php delete mode 100644 src/Generator/PluginBlockGenerator.php delete mode 100644 src/Generator/PluginCKEditorButtonGenerator.php delete mode 100644 src/Generator/PluginConditionGenerator.php delete mode 100644 src/Generator/PluginFieldFormatterGenerator.php delete mode 100644 src/Generator/PluginFieldTypeGenerator.php delete mode 100644 src/Generator/PluginFieldWidgetGenerator.php delete mode 100644 src/Generator/PluginImageEffectGenerator.php delete mode 100644 src/Generator/PluginImageFormatterGenerator.php delete mode 100644 src/Generator/PluginMailGenerator.php delete mode 100644 src/Generator/PluginMigrateProcessGenerator.php delete mode 100644 src/Generator/PluginMigrateSourceGenerator.php delete mode 100644 src/Generator/PluginRestResourceGenerator.php delete mode 100644 src/Generator/PluginRulesActionGenerator.php delete mode 100644 src/Generator/PluginSkeletonGenerator.php delete mode 100644 src/Generator/PluginTypeAnnotationGenerator.php delete mode 100644 src/Generator/PluginTypeYamlGenerator.php delete mode 100644 src/Generator/PluginViewsFieldGenerator.php delete mode 100644 src/Generator/PostUpdateGenerator.php delete mode 100644 src/Generator/ProfileGenerator.php delete mode 100644 src/Generator/RouteSubscriberGenerator.php delete mode 100644 src/Generator/ServiceGenerator.php delete mode 100644 src/Generator/ThemeGenerator.php delete mode 100644 src/Generator/TwigExtensionGenerator.php delete mode 100644 src/Generator/UpdateGenerator.php diff --git a/config/services/database.yml b/config/services/database.yml index 573eda99c..2a4f2eb74 100644 --- a/config/services/database.yml +++ b/config/services/database.yml @@ -1,4 +1,10 @@ services: + console.database_settings_generator: + class: Drupal\Console\Generator\DatabaseSettingsGenerator + arguments: ['@kernel'] + tags: + - { name: drupal.generator } + lazy: true console.database_add: class: Drupal\Console\Command\Database\AddCommand arguments: ['@console.database_settings_generator'] diff --git a/config/services/generate.yml b/config/services/generate.yml deleted file mode 100644 index 35b47fa17..000000000 --- a/config/services/generate.yml +++ /dev/null @@ -1,247 +0,0 @@ -services: - console.generate_module: - class: Drupal\Console\Command\Generate\ModuleCommand - arguments: ['@console.module_generator', '@console.validator', '@app.root', '@console.string_converter', '@console.drupal_api'] - tags: - - { name: drupal.command } - lazy: true - console.generate_modulefile: - class: Drupal\Console\Command\Generate\ModuleFileCommand - arguments: ['@console.extension_manager', '@console.modulefile_generator'] - tags: - - { name: drupal.command } - lazy: true - console.generate_authentication_provider: - class: Drupal\Console\Command\Generate\AuthenticationProviderCommand - arguments: ['@console.extension_manager', '@console.authentication_provider_generator', '@console.string_converter'] - tags: - - { name: drupal.command } - lazy: true - console.generate_controller: - class: Drupal\Console\Command\Generate\ControllerCommand - arguments: ['@console.extension_manager', '@console.controller_generator', '@console.string_converter', '@console.validator', '@router.route_provider', '@console.chain_queue'] - tags: - - { name: drupal.command } - lazy: true - console.generate_breakpoint: - class: Drupal\Console\Command\Generate\BreakPointCommand - arguments: ['@console.breakpoint_generator', '@app.root', '@theme_handler', '@console.validator', '@console.string_converter'] - tags: - - { name: drupal.command } - lazy: true - console.generate_help: - class: Drupal\Console\Command\Generate\HelpCommand - arguments: ['@console.help_generator', '@console.site', '@console.extension_manager', '@console.chain_queue'] - tags: - - { name: drupal.command } - lazy: true - console.generate_form: - class: Drupal\Console\Command\Generate\FormBaseCommand - arguments: ['@console.extension_manager', '@console.form_generator', '@console.chain_queue', '@console.string_converter', '@plugin.manager.element_info', '@router.route_provider'] - tags: - - { name: drupal.command } - lazy: true - console.generate_form_alter: - class: Drupal\Console\Command\Generate\FormAlterCommand - arguments: ['@console.extension_manager', '@console.form_alter_generator', '@console.string_converter', '@module_handler', '@plugin.manager.element_info', '@?profiler', '@app.root', '@console.chain_queue'] - tags: - - { name: drupal.command } - lazy: true - console.generate_permissions: - class: Drupal\Console\Command\Generate\PermissionCommand - arguments: ['@console.extension_manager', '@console.string_converter', '@console.permission_generator'] - tags: - - { name: drupal.command } - lazy: true - console.generate_event_subscriber: - class: Drupal\Console\Command\Generate\EventSubscriberCommand - arguments: ['@console.extension_manager', '@console.event_subscriber_generator', '@console.string_converter', '@event_dispatcher', '@console.chain_queue'] - tags: - - { name: drupal.command } - lazy: true - console.generate_form_config: - class: Drupal\Console\Command\Generate\ConfigFormBaseCommand - arguments: ['@console.extension_manager', '@console.form_generator', '@console.string_converter', '@router.route_provider', '@plugin.manager.element_info', '@app.root', '@console.chain_queue'] - tags: - - { name: drupal.command } - lazy: true - console.generate_plugin_type_annotation: - class: Drupal\Console\Command\Generate\PluginTypeAnnotationCommand - arguments: ['@console.extension_manager', '@console.plugin_type_annotation_generator', '@console.string_converter'] - tags: - - { name: drupal.command } - lazy: true - console.generate_plugin_condition: - class: Drupal\Console\Command\Generate\PluginConditionCommand - arguments: ['@console.extension_manager', '@console.plugin_condition_generator', '@console.chain_queue', '@entity_type.repository', '@console.string_converter'] - tags: - - { name: drupal.command } - lazy: true - console.generate_plugin_field: - class: Drupal\Console\Command\Generate\PluginFieldCommand - arguments: ['@console.extension_manager','@console.string_converter', '@console.chain_queue'] - tags: - - { name: drupal.command } - lazy: true - console.generate_plugin_field_formatter: - class: Drupal\Console\Command\Generate\PluginFieldFormatterCommand - arguments: ['@console.extension_manager', '@console.plugin_field_formatter_generator','@console.string_converter', '@plugin.manager.field.field_type', '@console.chain_queue'] - tags: - - { name: drupal.command } - lazy: true - console.generate_plugin_field_type: - class: Drupal\Console\Command\Generate\PluginFieldTypeCommand - arguments: ['@console.extension_manager', '@console.plugin_field_type_generator','@console.string_converter', '@console.chain_queue'] - tags: - - { name: drupal.command } - lazy: true - console.generate_plugin_field_widget: - class: Drupal\Console\Command\Generate\PluginFieldWidgetCommand - arguments: ['@console.extension_manager', '@console.plugin_field_widget_generator','@console.string_converter', '@plugin.manager.field.field_type', '@console.chain_queue'] - tags: - - { name: drupal.command } - lazy: true - console.generate_plugin_image_effect: - class: Drupal\Console\Command\Generate\PluginImageEffectCommand - arguments: ['@console.extension_manager', '@console.plugin_image_effect_generator','@console.string_converter', '@console.chain_queue'] - tags: - - { name: drupal.command } - lazy: true - console.generate_plugin_image_formatter: - class: Drupal\Console\Command\Generate\PluginImageFormatterCommand - arguments: ['@console.extension_manager', '@console.plugin_image_formatter_generator','@console.string_converter', '@console.validator', '@console.chain_queue'] - tags: - - { name: drupal.command } - lazy: true - console.generate_plugin_mail: - class: Drupal\Console\Command\Generate\PluginMailCommand - arguments: ['@console.extension_manager', '@console.plugin_mail_generator','@console.string_converter', '@console.validator', '@console.chain_queue'] - tags: - - { name: drupal.command } - lazy: true - console.generate_plugin_migrate_source: - class: Drupal\Console\Command\Generate\PluginMigrateSourceCommand - arguments: ['@config.factory', '@console.chain_queue', '@console.plugin_migrate_source_generator', '@entity_type.manager', '@console.extension_manager', '@console.validator', '@console.string_converter', '@plugin.manager.element_info'] - tags: - - { name: drupal.command } - lazy: true - console.generate_plugin_migrate_process: - class: Drupal\Console\Command\Generate\PluginMigrateProcessCommand - arguments: [ '@console.plugin_migrate_process_generator', '@console.chain_queue', '@console.extension_manager', '@console.string_converter'] - tags: - - { name: drupal.command } - lazy: true - console.generate_plugin_rest_resource: - class: Drupal\Console\Command\Generate\PluginRestResourceCommand - arguments: ['@console.extension_manager', '@console.plugin_rest_resource_generator','@console.string_converter', '@console.chain_queue'] - tags: - - { name: drupal.command } - lazy: true - console.generate_plugin_rules_action: - class: Drupal\Console\Command\Generate\PluginRulesActionCommand - arguments: ['@console.extension_manager', '@console.plugin_rules_action_generator','@console.string_converter', '@console.chain_queue'] - tags: - - { name: drupal.command } - lazy: true - console.generate_plugin_skeleton: - class: Drupal\Console\Command\Generate\PluginSkeletonCommand - arguments: ['@console.extension_manager', '@console.plugin_skeleton_generator','@console.string_converter', '@console.validator', '@console.chain_queue'] - tags: - - { name: drupal.command } - lazy: true - console.generate_plugin_type_yaml: - class: Drupal\Console\Command\Generate\PluginTypeYamlCommand - arguments: ['@console.extension_manager', '@console.plugin_type_yaml_generator','@console.string_converter'] - tags: - - { name: drupal.command } - lazy: true - console.generate_plugin_views_field: - class: Drupal\Console\Command\Generate\PluginViewsFieldCommand - arguments: ['@console.extension_manager', '@console.plugin_views_field_generator', '@console.site','@console.string_converter','@console.chain_queue'] - tags: - - { name: drupal.command } - lazy: true - console.generate_post_update: - class: Drupal\Console\Command\Generate\PostUpdateCommand - arguments: ['@console.extension_manager', '@console.post_update_generator', '@console.site', '@console.validator','@console.chain_queue'] - tags: - - { name: drupal.command } - lazy: true - console.generate_profile: - class: Drupal\Console\Command\Generate\ProfileCommand - arguments: ['@console.extension_manager', '@console.profile_generator', '@console.string_converter', '@console.validator', '@app.root'] - tags: - - { name: drupal.command } - lazy: true - console.generate_route_subscriber: - class: Drupal\Console\Command\Generate\RouteSubscriberCommand - arguments: ['@console.extension_manager', '@console.route_subscriber_generator', '@console.chain_queue'] - tags: - - { name: drupal.command } - lazy: true - console.generate_service: - class: Drupal\Console\Command\Generate\ServiceCommand - arguments: ['@console.extension_manager', '@console.service_generator', '@console.string_converter', '@console.chain_queue'] - tags: - - { name: drupal.command } - lazy: true - console.generate_theme: - class: Drupal\Console\Command\Generate\ThemeCommand - arguments: ['@console.extension_manager', '@console.theme_generator', '@console.validator', '@app.root', '@theme_handler', '@console.site', '@console.string_converter'] - tags: - - { name: drupal.command } - lazy: true - console.generate_twig_extension: - class: Drupal\Console\Command\Generate\TwigExtensionCommand - arguments: ['@console.extension_manager', '@console.twig_extension_generator', '@console.site', '@console.string_converter', '@console.chain_queue'] - tags: - - { name: drupal.command } - lazy: true - console.generate_update: - class: Drupal\Console\Command\Generate\UpdateCommand - arguments: ['@console.extension_manager', '@console.update_generator', '@console.site', '@console.chain_queue'] - tags: - - { name: drupal.command } - lazy: true - console.generate_pluginblock: - class: Drupal\Console\Command\Generate\PluginBlockCommand - arguments: ['@config.factory', '@console.chain_queue', '@console.pluginblock_generator', '@entity_type.manager', '@console.extension_manager', '@console.validator', '@console.string_converter', '@plugin.manager.element_info'] - tags: - - { name: drupal.command } - lazy: true - console.generate_command: - class: Drupal\Console\Command\Generate\CommandCommand - arguments: ['@console.command_generator', '@console.extension_manager', '@console.validator', '@console.string_converter', '@console.site'] - tags: - - { name: drupal.command } - lazy: true - console.generate_ckeditorbutton: - class: Drupal\Console\Command\Generate\PluginCKEditorButtonCommand - arguments: ['@console.chain_queue', '@console.command_ckeditorbutton', '@console.extension_manager', '@console.string_converter'] - tags: - - { name: drupal.command } - lazy: true - console.generate_entitycontent: - class: Drupal\Console\Command\Generate\EntityContentCommand - arguments: ['@console.chain_queue', '@console.entitycontent_generator', '@console.string_converter', '@console.extension_manager', '@console.validator'] - tags: - - { name: drupal.command } - lazy: true - console.generate_entitybundle: - class: Drupal\Console\Command\Generate\EntityBundleCommand - arguments: ['@console.validator', '@console.entitybundle_generator', '@console.extension_manager'] - tags: - - { name: drupal.command } - lazy: true - console.generate_entityconfig: - class: Drupal\Console\Command\Generate\EntityConfigCommand - arguments: ['@console.extension_manager', '@console.entityconfig_generator', '@console.validator', '@console.string_converter'] - tags: - - { name: drupal.command } - lazy: true - console.generate_cache_context: - class: Drupal\Console\Command\Generate\CacheContextCommand - arguments: [ '@console.cache_context_generator', '@console.chain_queue', '@console.extension_manager', '@console.string_converter'] - tags: - - { name: drupal.command } - lazy: true diff --git a/config/services/generator.yml b/config/services/generator.yml deleted file mode 100644 index aa2b56c7d..000000000 --- a/config/services/generator.yml +++ /dev/null @@ -1,244 +0,0 @@ -services: - console.module_generator: - class: Drupal\Console\Generator\ModuleGenerator - tags: - - { name: drupal.generator } - lazy: true - console.modulefile_generator: - class: Drupal\Console\Generator\ModuleFileGenerator - tags: - - { name: drupal.generator } - lazy: true - console.authentication_provider_generator: - class: Drupal\Console\Generator\AuthenticationProviderGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.help_generator: - class: Drupal\Console\Generator\HelpGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.controller_generator: - class: Drupal\Console\Generator\ControllerGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.breakpoint_generator: - class: Drupal\Console\Generator\BreakPointGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.form_alter_generator: - class: Drupal\Console\Generator\FormAlterGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.permission_generator: - class: Drupal\Console\Generator\PermissionGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.event_subscriber_generator: - class: Drupal\Console\Generator\EventSubscriberGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.form_generator: - class: Drupal\Console\Generator\FormGenerator - arguments: ['@console.extension_manager', '@console.string_converter'] - tags: - - { name: drupal.generator } - lazy: true - console.profile_generator: - class: Drupal\Console\Generator\ProfileGenerator - tags: - - { name: drupal.generator } - lazy: true - console.post_update_generator: - class: Drupal\Console\Generator\PostUpdateGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.plugin_condition_generator: - class: Drupal\Console\Generator\PluginConditionGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.plugin_field_generator: - class: Drupal\Console\Generator\PluginFieldFormatterGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.plugin_field_formatter_generator: - class: Drupal\Console\Generator\PluginFieldFormatterGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.plugin_field_type_generator: - class: Drupal\Console\Generator\PluginFieldTypeGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.plugin_field_widget_generator: - class: Drupal\Console\Generator\PluginFieldWidgetGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.plugin_image_effect_generator: - class: Drupal\Console\Generator\PluginImageEffectGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.plugin_image_formatter_generator: - class: Drupal\Console\Generator\PluginImageFormatterGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.plugin_mail_generator: - class: Drupal\Console\Generator\PluginMailGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.plugin_migrate_source_generator: - class: Drupal\Console\Generator\PluginMigrateSourceGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.plugin_migrate_process_generator: - class: Drupal\Console\Generator\PluginMigrateProcessGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.plugin_rest_resource_generator: - class: Drupal\Console\Generator\PluginRestResourceGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.plugin_rules_action_generator: - class: Drupal\Console\Generator\PluginRulesActionGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.plugin_skeleton_generator: - class: Drupal\Console\Generator\PluginSkeletonGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.plugin_views_field_generator: - class: Drupal\Console\Generator\PluginViewsFieldGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.plugin_type_annotation_generator: - class: Drupal\Console\Generator\PluginTypeAnnotationGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.plugin_type_yaml_generator: - class: Drupal\Console\Generator\PluginTypeYamlGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.route_subscriber_generator: - class: Drupal\Console\Generator\RouteSubscriberGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.service_generator: - class: Drupal\Console\Generator\ServiceGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.theme_generator: - class: Drupal\Console\Generator\ThemeGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.twig_extension_generator: - class: Drupal\Console\Generator\TwigExtensionGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.update_generator: - class: Drupal\Console\Generator\UpdateGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.pluginblock_generator: - class: Drupal\Console\Generator\PluginBlockGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.command_generator: - class: Drupal\Console\Generator\CommandGenerator - arguments: ['@console.extension_manager', '@console.translator_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.command_ckeditorbutton: - class: Drupal\Console\Generator\PluginCKEditorButtonGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.database_settings_generator: - class: Drupal\Console\Generator\DatabaseSettingsGenerator - arguments: ['@kernel'] - tags: - - { name: drupal.generator } - lazy: true - console.entitycontent_generator: - class: Drupal\Console\Generator\EntityContentGenerator - arguments: ['@console.extension_manager', '@console.site', '@console.renderer'] - tags: - - { name: drupal.generator } - lazy: true - console.entitybundle_generator: - class: Drupal\Console\Generator\EntityBundleGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.entityconfig_generator: - class: Drupal\Console\Generator\EntityConfigGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true - console.cache_context_generator: - class: Drupal\Console\Generator\CacheContextGenerator - arguments: ['@console.extension_manager'] - tags: - - { name: drupal.generator } - lazy: true diff --git a/src/Command/Generate/AuthenticationProviderCommand.php b/src/Command/Generate/AuthenticationProviderCommand.php deleted file mode 100644 index 8e6e2a027..000000000 --- a/src/Command/Generate/AuthenticationProviderCommand.php +++ /dev/null @@ -1,158 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->stringConverter = $stringConverter; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('generate:authentication:provider') - ->setDescription($this->trans('commands.generate.authentication.provider.description')) - ->setHelp($this->trans('commands.generate.authentication.provider.help')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) - ->addOption( - 'class', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.authentication.provider.options.class') - ) - ->addOption( - 'provider-id', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.authentication.provider.options.provider-id') - ) - ->setAliases(['gap']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $class = $input->getOption('class'); - $provider_id = $input->getOption('provider-id'); - - $this->generator->generate($module, $class, $provider_id); - - return 0; - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $stringUtils = $this->stringConverter; - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --class option - $class = $input->getOption('class'); - if (!$class) { - $class = $io->ask( - $this->trans( - 'commands.generate.authentication.provider.options.class' - ), - 'DefaultAuthenticationProvider', - function ($value) use ($stringUtils) { - if (!strlen(trim($value))) { - throw new \Exception('The Class name can not be empty'); - } - - return $stringUtils->humanToCamelCase($value); - } - ); - $input->setOption('class', $class); - } - // --provider-id option - $provider_id = $input->getOption('provider-id'); - if (!$provider_id) { - $provider_id = $io->ask( - $this->trans('commands.generate.authentication.provider.options.provider-id'), - $stringUtils->camelCaseToUnderscore($class), - function ($value) use ($stringUtils) { - if (!strlen(trim($value))) { - throw new \Exception('The Class name can not be empty'); - } - - return $stringUtils->camelCaseToUnderscore($value); - } - ); - $input->setOption('provider-id', $provider_id); - } - } -} diff --git a/src/Command/Generate/BreakPointCommand.php b/src/Command/Generate/BreakPointCommand.php deleted file mode 100644 index bb53df8ef..000000000 --- a/src/Command/Generate/BreakPointCommand.php +++ /dev/null @@ -1,172 +0,0 @@ -generator = $generator; - $this->appRoot = $appRoot; - $this->themeHandler = $themeHandler; - $this->validator = $validator; - $this->stringConverter = $stringConverter; - parent::__construct(); - } - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName('generate:breakpoint') - ->setDescription($this->trans('commands.generate.breakpoint.description')) - ->setHelp($this->trans('commands.generate.breakpoint.help')) - ->addOption( - 'theme', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.breakpoint.options.theme') - ) - ->addOption( - 'breakpoints', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.breakpoint.options.breakpoints') - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $validators = $this->validator; - // we must to ensure theme exist - $machine_name = $validators->validateMachineName($input->getOption('theme')); - $theme_path = $drupal_root . $input->getOption('theme'); - $breakpoints = $input->getOption('breakpoints'); - - $this->generator->generate( - $theme_path, - $breakpoints, - $machine_name - ); - - return 0; - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $drupalRoot = $this->appRoot; - - // --base-theme option. - $base_theme = $input->getOption('theme'); - - if (!$base_theme) { - $themeHandler = $this->themeHandler; - $themes = $themeHandler->rebuildThemeData(); - $themes['classy'] =''; - - uasort($themes, 'system_sort_modules_by_info_name'); - - $base_theme = $io->choiceNoList( - $this->trans('commands.generate.breakpoint.questions.theme'), - array_keys($themes) - ); - $input->setOption('theme', $base_theme); - } - - // --breakpoints option. - $breakpoints = $input->getOption('breakpoints'); - if (!$breakpoints) { - $breakpoints = $this->breakpointQuestion($io); - $input->setOption('breakpoints', $breakpoints); - } - } -} diff --git a/src/Command/Generate/CacheContextCommand.php b/src/Command/Generate/CacheContextCommand.php deleted file mode 100644 index 5ca9c0137..000000000 --- a/src/Command/Generate/CacheContextCommand.php +++ /dev/null @@ -1,174 +0,0 @@ -generator = $generator; - $this->chainQueue = $chainQueue; - $this->extensionManager = $extensionManager; - $this->stringConverter = $stringConverter; - parent::__construct(); - } - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName('generate:cache:context') - ->setDescription($this->trans('commands.generate.cache.context.description')) - ->setHelp($this->trans('commands.generate.cache.context.description')) - ->addOption( - 'module', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.common.options.module')) - ->addOption( - 'cache-context', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.cache.context.questions.name') - ) - ->addOption( - 'class', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.cache.context.questions.class') - ) - ->addOption( - 'services', - null, - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.common.options.services') - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $cache_context = $input->getOption('cache-context'); - $class = $input->getOption('class'); - $services = $input->getOption('services'); - - // @see Drupal\Console\Command\Shared\ServicesTrait::buildServices - $buildServices = $this->buildServices($services); - - $this->generator->generate($module, $cache_context, $class, $buildServices); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --cache_context option - $cache_context = $input->getOption('cache-context'); - if (!$cache_context) { - $cache_context = $io->ask( - $this->trans('commands.generate.cache.context.questions.name'), - sprintf('%s', $module) - ); - $input->setOption('cache-context', $cache_context); - } - - // --class option - $class = $input->getOption('class'); - if (!$class) { - $class = $io->ask( - $this->trans('commands.generate.cache.context.questions.class'), - 'DefaultCacheContext' - ); - $input->setOption('class', $class); - } - - // --services option - $services = $input->getOption('services'); - if (!$services) { - // @see Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion - $services = $this->servicesQuestion($io); - $input->setOption('services', $services); - } - } -} diff --git a/src/Command/Generate/CommandCommand.php b/src/Command/Generate/CommandCommand.php deleted file mode 100644 index 3b1901329..000000000 --- a/src/Command/Generate/CommandCommand.php +++ /dev/null @@ -1,224 +0,0 @@ -generator = $generator; - $this->extensionManager = $extensionManager; - $this->validator = $validator; - $this->stringConverter = $stringConverter; - $this->site = $site; - parent::__construct(); - } - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName('generate:command') - ->setDescription($this->trans('commands.generate.command.description')) - ->setHelp($this->trans('commands.generate.command.help')) - ->addOption( - 'extension', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.common.options.extension') - ) - ->addOption( - 'extension-type', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.common.options.extension-type') - ) - ->addOption( - 'class', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.command.options.class') - ) - ->addOption( - 'name', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.command.options.name') - ) - ->addOption( - 'container-aware', - null, - InputOption::VALUE_NONE, - $this->trans('commands.generate.command.options.container-aware') - ) - ->addOption( - 'services', - null, - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.common.options.services') - ) - ->setAliases(['gcm']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $extension = $input->getOption('extension'); - $extensionType = $input->getOption('extension-type'); - $class = $input->getOption('class'); - $name = $input->getOption('name'); - $containerAware = $input->getOption('container-aware'); - $services = $input->getOption('services'); - $yes = $input->hasOption('yes')?$input->getOption('yes'):false; - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io, $yes)) { - return 1; - } - - // @see use Drupal\Console\Command\Shared\ServicesTrait::buildServices - $build_services = $this->buildServices($services); - - $this->generator->generate( - $extension, - $extensionType, - $name, - $class, - $containerAware, - $build_services - ); - - $this->site->removeCachedServicesFile(); - - return 0; - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $extension = $input->getOption('extension'); - if (!$extension) { - $extension = $this->extensionQuestion($io, true, true); - $input->setOption('extension', $extension->getName()); - $input->setOption('extension-type', $extension->getType()); - } - - $extensionType = $input->getOption('extension-type'); - if (!$extensionType) { - $extensionType = $this->extensionTypeQuestion($io); - $input->setOption('extension-type', $extensionType); - } - - $name = $input->getOption('name'); - if (!$name) { - $name = $io->ask( - $this->trans('commands.generate.command.questions.name'), - sprintf('%s:default', $extension->getName()) - ); - $input->setOption('name', $name); - } - - $class = $input->getOption('class'); - if (!$class) { - $class = $io->ask( - $this->trans('commands.generate.command.questions.class'), - 'DefaultCommand', - function ($class) { - return $this->validator->validateCommandName($class); - } - ); - $input->setOption('class', $class); - } - - $containerAware = $input->getOption('container-aware'); - if (!$containerAware) { - $containerAware = $io->confirm( - $this->trans('commands.generate.command.questions.container-aware'), - false - ); - $input->setOption('container-aware', $containerAware); - } - - if (!$containerAware) { - // @see use Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion - $services = $this->servicesQuestion($io); - $input->setOption('services', $services); - } - } -} diff --git a/src/Command/Generate/ConfigFormBaseCommand.php b/src/Command/Generate/ConfigFormBaseCommand.php deleted file mode 100644 index 736180c1c..000000000 --- a/src/Command/Generate/ConfigFormBaseCommand.php +++ /dev/null @@ -1,91 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->stringConverter = $stringConverter; - $this->routeProvider = $routeProvider; - $this->elementInfoManager = $elementInfoManager; - $this->appRoot = $appRoot; - $this->chainQueue = $chainQueue; - parent::__construct($extensionManager, $generator, $chainQueue, $stringConverter, $elementInfoManager, $routeProvider); - } - - protected function configure() - { - $this->setFormType('ConfigFormBase'); - $this->setCommandName('generate:form:config'); - $this->setAliases(['gfc']); - parent::configure(); - } -} diff --git a/src/Command/Generate/ControllerCommand.php b/src/Command/Generate/ControllerCommand.php deleted file mode 100644 index 0a0a08f14..000000000 --- a/src/Command/Generate/ControllerCommand.php +++ /dev/null @@ -1,320 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->stringConverter = $stringConverter; - $this->validator = $validator; - $this->routeProvider = $routeProvider; - $this->chainQueue = $chainQueue; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('generate:controller') - ->setDescription($this->trans('commands.generate.controller.description')) - ->setHelp($this->trans('commands.generate.controller.help')) - ->addOption( - 'module', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.common.options.module') - ) - ->addOption( - 'class', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.controller.options.class') - ) - ->addOption( - 'routes', - null, - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.generate.controller.options.routes') - ) - ->addOption( - 'services', - null, - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.common.options.services') - ) - ->addOption( - 'test', - null, - InputOption::VALUE_NONE, - $this->trans('commands.generate.controller.options.test') - ) - ->setAliases(['gcn']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - $yes = $input->hasOption('yes')?$input->getOption('yes'):false; - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io, $yes)) { - return 1; - } - - $module = $input->getOption('module'); - $class = $input->getOption('class'); - $routes = $input->getOption('routes'); - $test = $input->getOption('test'); - $services = $input->getOption('services'); - - $routes = $this->inlineValueAsArray($routes); - $input->setOption('routes', $routes); - - // @see use Drupal\Console\Command\Shared\ServicesTrait::buildServices - $build_services = $this->buildServices($services); - - //$this->generator->setLearning($learning); - $this->generator->generate( - $module, - $class, - $routes, - $test, - $build_services - ); - - // Run cache rebuild to see changes in Web UI - $this->chainQueue->addCommand('router:rebuild', []); - - return 0; - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --class option - $class = $input->getOption('class'); - if (!$class) { - $class = $io->ask( - $this->trans('commands.generate.controller.questions.class'), - 'DefaultController', - function ($class) { - return $this->validator->validateClassName($class); - } - ); - $input->setOption('class', $class); - } - - $routes = $input->getOption('routes'); - if (!$routes) { - while (true) { - $title = $io->askEmpty( - $this->trans('commands.generate.controller.questions.title'), - function ($title) use ($routes) { - if ($routes && empty(trim($title))) { - return false; - } - - if (!$routes && empty(trim($title))) { - throw new \InvalidArgumentException( - $this->trans( - 'commands.generate.controller.messages.title-empty' - ) - ); - } - - if (in_array($title, array_column($routes, 'title'))) { - throw new \InvalidArgumentException( - sprintf( - $this->trans( - 'commands.generate.controller.messages.title-already-added' - ), - $title - ) - ); - } - - return $title; - } - ); - - if ($title === '') { - break; - } - - $method = $io->ask( - $this->trans('commands.generate.controller.questions.method'), - 'hello', - function ($method) use ($routes) { - if (in_array($method, array_column($routes, 'method'))) { - throw new \InvalidArgumentException( - sprintf( - $this->trans( - 'commands.generate.controller.messages.method-already-added' - ), - $method - ) - ); - } - - return $method; - } - ); - - $path = $io->ask( - $this->trans('commands.generate.controller.questions.path'), - sprintf( - '/%s/'.($method!='hello'?$method:'hello/{name}'), - $module - ), - function ($path) use ($routes) { - if (count($this->routeProvider->getRoutesByPattern($path)) > 0 - || in_array($path, array_column($routes, 'path')) - ) { - throw new \InvalidArgumentException( - sprintf( - $this->trans( - 'commands.generate.controller.messages.path-already-added' - ), - $path - ) - ); - } - - return $path; - } - ); - $classMachineName = $this->stringConverter->camelCaseToMachineName($class); - $routeName = $module . '.' . $classMachineName . '_' . $method; - if ($this->routeProvider->getRoutesByNames([$routeName]) - || in_array($routeName, $routes) - ) { - $routeName .= '_' . rand(0, 100); - } - - $routes[] = [ - 'title' => $title, - 'name' => $routeName, - 'method' => $method, - 'path' => $path - ]; - } - $input->setOption('routes', $routes); - } - - // --test option - $test = $input->getOption('test'); - if (!$test) { - $test = $io->confirm( - $this->trans('commands.generate.controller.questions.test'), - true - ); - - $input->setOption('test', $test); - } - - // --services option - // @see use Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion - $services = $this->servicesQuestion($io); - $input->setOption('services', $services); - } - - /** - * @return \Drupal\Console\Generator\ControllerGenerator - */ - protected function createGenerator() - { - return new ControllerGenerator(); - } -} diff --git a/src/Command/Generate/EntityBundleCommand.php b/src/Command/Generate/EntityBundleCommand.php deleted file mode 100644 index 2a9ef6897..000000000 --- a/src/Command/Generate/EntityBundleCommand.php +++ /dev/null @@ -1,151 +0,0 @@ -validator = $validator; - $this->generator = $generator; - $this->extensionManager = $extensionManager; - parent::__construct(); - } - - - protected function configure() - { - $this - ->setName('generate:entity:bundle') - ->setDescription($this->trans('commands.generate.entity.bundle.description')) - ->setHelp($this->trans('commands.generate.entity.bundle.help')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) - ->addOption( - 'bundle-name', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.entity.bundle.options.bundle-name') - ) - ->addOption( - 'bundle-title', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.entity.bundle.options.bundle-title') - ) - ->setAliases(['geb']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $bundleName = $input->getOption('bundle-name'); - $bundleTitle = $input->getOption('bundle-title'); - - $generator = $this->generator; - //TODO: - // $generator->setLearning($learning); - $generator->generate($module, $bundleName, $bundleTitle); - - return 0; - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --bundle-name option - $bundleName = $input->getOption('bundle-name'); - if (!$bundleName) { - $bundleName = $io->ask( - $this->trans('commands.generate.entity.bundle.questions.bundle-name'), - 'default', - function ($bundleName) { - return $this->validator->validateClassName($bundleName); - } - ); - $input->setOption('bundle-name', $bundleName); - } - - // --bundle-title option - $bundleTitle = $input->getOption('bundle-title'); - if (!$bundleTitle) { - $bundleTitle = $io->ask( - $this->trans('commands.generate.entity.bundle.questions.bundle-title'), - 'default', - function ($bundle_title) { - return $this->validator->validateBundleTitle($bundle_title); - } - ); - $input->setOption('bundle-title', $bundleTitle); - } - } -} diff --git a/src/Command/Generate/EntityCommand.php b/src/Command/Generate/EntityCommand.php deleted file mode 100644 index d5869edc7..000000000 --- a/src/Command/Generate/EntityCommand.php +++ /dev/null @@ -1,176 +0,0 @@ -entityType = $entityType; - } - - /** - * @param $commandName - */ - protected function setCommandName($commandName) - { - $this->commandName = $commandName; - } - - /** - * {@inheritdoc} - */ - protected function configure() - { - $commandKey = str_replace(':', '.', $this->commandName); - - $this - ->setName($this->commandName) - ->setDescription( - sprintf( - $this->trans('commands.'.$commandKey.'.description'), - $this->entityType - ) - ) - ->setHelp( - sprintf( - $this->trans('commands.'.$commandKey.'.help'), - $this->commandName, - $this->entityType - ) - ) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) - ->addOption( - 'entity-class', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.'.$commandKey.'.options.entity-class') - ) - ->addOption( - 'entity-name', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.'.$commandKey.'.options.entity-name') - ) - ->addOption( - 'base-path', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.' . $commandKey . '.options.base-path') - ) - ->addOption( - 'label', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.'.$commandKey.'.options.label') - ); - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - // Operations defined in EntityConfigCommand and EntityContentCommand. - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $commandKey = str_replace(':', '.', $this->commandName); - $utils = $this->stringConverter; - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --entity-class option - $entityClass = $input->getOption('entity-class'); - if (!$entityClass) { - $entityClass = $io->ask( - $this->trans('commands.'.$commandKey.'.questions.entity-class'), - 'DefaultEntity', - function ($entityClass) { - return $this->validator->validateSpaces($entityClass); - } - ); - - $input->setOption('entity-class', $entityClass); - } - - // --entity-name option - $entityName = $input->getOption('entity-name'); - if (!$entityName) { - $entityName = $io->ask( - $this->trans('commands.'.$commandKey.'.questions.entity-name'), - $utils->camelCaseToMachineName($entityClass), - function ($entityName) { - return $this->validator->validateMachineName($entityName); - } - ); - $input->setOption('entity-name', $entityName); - } - - // --label option - $label = $input->getOption('label'); - if (!$label) { - $label = $io->ask( - $this->trans('commands.'.$commandKey.'.questions.label'), - $utils->camelCaseToHuman($entityClass) - ); - $input->setOption('label', $label); - } - - // --base-path option - $base_path = $input->getOption('base-path'); - if (!$base_path) { - $base_path = $this->getDefaultBasePath(); - } - $base_path = $io->ask( - $this->trans('commands.'.$commandKey.'.questions.base-path'), - $base_path - ); - if (substr($base_path, 0, 1) !== '/') { - // Base path must start with a leading '/'. - $base_path = '/' . $base_path; - } - $input->setOption('base-path', $base_path); - } - - /** - * Gets default base path. - * - * @return string - * Default base path. - */ - protected function getDefaultBasePath() - { - return '/admin/structure'; - } -} diff --git a/src/Command/Generate/EntityConfigCommand.php b/src/Command/Generate/EntityConfigCommand.php deleted file mode 100644 index 0f77e100a..000000000 --- a/src/Command/Generate/EntityConfigCommand.php +++ /dev/null @@ -1,101 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->validator = $validator; - $this->stringConverter = $stringConverter; - parent::__construct(); - } - - - protected function configure() - { - $this->setEntityType('EntityConfig'); - $this->setCommandName('generate:entity:config'); - parent::configure(); - - $this->addOption( - 'bundle-of', - null, - InputOption::VALUE_NONE, - $this->trans('commands.generate.entity.config.options.bundle-of') - ) - ->setAliases(['gecg']); - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - parent::interact($input, $output); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $module = $input->getOption('module'); - $entity_class = $input->getOption('entity-class'); - $entity_name = $input->getOption('entity-name'); - $label = $input->getOption('label'); - $bundle_of = $input->getOption('bundle-of'); - $base_path = $input->getOption('base-path'); - - $this - ->generator - ->generate($module, $entity_name, $entity_class, $label, $base_path, $bundle_of); - } -} diff --git a/src/Command/Generate/EntityContentCommand.php b/src/Command/Generate/EntityContentCommand.php deleted file mode 100644 index b664450e2..000000000 --- a/src/Command/Generate/EntityContentCommand.php +++ /dev/null @@ -1,174 +0,0 @@ -chainQueue = $chainQueue; - $this->generator = $generator; - $this->stringConverter = $stringConverter; - $this->extensionManager = $extensionManager; - $this->validator = $validator; - parent::__construct(); - } - - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this->setEntityType('EntityContent'); - $this->setCommandName('generate:entity:content'); - parent::configure(); - - $this->addOption( - 'has-bundles', - null, - InputOption::VALUE_NONE, - $this->trans('commands.generate.entity.content.options.has-bundles') - ); - - $this->addOption( - 'is-translatable', - null, - InputOption::VALUE_NONE, - $this->trans('commands.generate.entity.content.options.is-translatable') - ); - - $this->addOption( - 'revisionable', - null, - InputOption::VALUE_NONE, - $this->trans('commands.generate.entity.content.options.revisionable') - ) - ->setAliases(['gect']); - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - parent::interact($input, $output); - $io = new DrupalStyle($input, $output); - - // --bundle-of option - $bundle_of = $input->getOption('has-bundles'); - if (!$bundle_of) { - $bundle_of = $io->confirm( - $this->trans('commands.generate.entity.content.questions.has-bundles'), - false - ); - $input->setOption('has-bundles', $bundle_of); - } - - // --is-translatable option - $is_translatable = $io->confirm( - $this->trans('commands.generate.entity.content.questions.is-translatable'), - true - ); - $input->setOption('is-translatable', $is_translatable); - - // --revisionable option - $revisionable = $io->confirm( - $this->trans('commands.generate.entity.content.questions.revisionable'), - true - ); - $input->setOption('revisionable', $revisionable); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $module = $input->getOption('module'); - $entity_class = $input->getOption('entity-class'); - $entity_name = $input->getOption('entity-name'); - $label = $input->getOption('label'); - $has_bundles = $input->getOption('has-bundles'); - $base_path = $input->getOption('base-path'); - $learning = $input->hasOption('learning')?$input->getOption('learning'):false; - $bundle_entity_name = $has_bundles ? $entity_name . '_type' : null; - $is_translatable = $input->hasOption('is-translatable') ? $input->getOption('is-translatable') : true; - $revisionable = $input->hasOption('revisionable') ? $input->getOption('revisionable') : false; - - $io = new DrupalStyle($input, $output); - $generator = $this->generator; - - $generator->setIo($io); - //@TODO: - //$generator->setLearning($learning); - - $generator->generate($module, $entity_name, $entity_class, $label, $base_path, $is_translatable, $bundle_entity_name, $revisionable); - - if ($has_bundles) { - $this->chainQueue->addCommand( - 'generate:entity:config', [ - '--module' => $module, - '--entity-class' => $entity_class . 'Type', - '--entity-name' => $entity_name . '_type', - '--label' => $label . ' type', - '--bundle-of' => $entity_name - ] - ); - } - } -} diff --git a/src/Command/Generate/EventSubscriberCommand.php b/src/Command/Generate/EventSubscriberCommand.php deleted file mode 100644 index b4f8b29fb..000000000 --- a/src/Command/Generate/EventSubscriberCommand.php +++ /dev/null @@ -1,197 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->stringConverter = $stringConverter; - $this->eventDispatcher = $eventDispatcher; - $this->chainQueue = $chainQueue; - parent::__construct(); - } - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName('generate:event:subscriber') - ->setDescription($this->trans('commands.generate.event.subscriber.description')) - ->setHelp($this->trans('commands.generate.event.subscriber.description')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) - ->addOption( - 'name', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.service.options.name') - ) - ->addOption( - 'class', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.service.options.class') - ) - ->addOption( - 'events', - null, - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.common.options.events') - ) - ->addOption( - 'services', - null, - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.common.options.services') - ) - ->setAliases(['ges']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $name = $input->getOption('name'); - $class = $input->getOption('class'); - $events = $input->getOption('events'); - $services = $input->getOption('services'); - - // @see Drupal\Console\Command\Shared\ServicesTrait::buildServices - $buildServices = $this->buildServices($services); - - $this->generator->generate($module, $name, $class, $events, $buildServices); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --service-name option - $name = $input->getOption('name'); - if (!$name) { - $name = $io->ask( - $this->trans('commands.generate.service.questions.service-name'), - sprintf('%s.default', $module) - ); - $input->setOption('name', $name); - } - - // --class option - $class = $input->getOption('class'); - if (!$class) { - $class = $io->ask( - $this->trans('commands.generate.event.subscriber.questions.class'), - 'DefaultSubscriber' - ); - $input->setOption('class', $class); - } - - // --events option - $events = $input->getOption('events'); - if (!$events) { - // @see Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion - $events = $this->eventsQuestion($io); - $input->setOption('events', $events); - } - - // --services option - $services = $input->getOption('services'); - if (!$services) { - // @see Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion - $services = $this->servicesQuestion($io); - $input->setOption('services', $services); - } - } -} diff --git a/src/Command/Generate/FormAlterCommand.php b/src/Command/Generate/FormAlterCommand.php deleted file mode 100644 index 4c3d876f7..000000000 --- a/src/Command/Generate/FormAlterCommand.php +++ /dev/null @@ -1,324 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->stringConverter = $stringConverter; - $this->moduleHandler = $moduleHandler; - $this->elementInfoManager = $elementInfoManager; - $this->profiler = $profiler; - $this->appRoot = $appRoot; - $this->chainQueue = $chainQueue; - parent::__construct(); - } - - protected $metadata = [ - 'class' => [], - 'method'=> [], - 'file'=> [], - 'unset' => [] - ]; - - protected function configure() - { - $this - ->setName('generate:form:alter') - ->setDescription( - $this->trans('commands.generate.form.alter.description') - ) - ->setHelp($this->trans('commands.generate.form.alter.help')) - ->addOption( - 'module', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.common.options.module') - ) - ->addOption( - 'form-id', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.form.alter.options.form-id') - ) - ->addOption( - 'inputs', - null, - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.common.options.inputs') - ) - ->setAliases(['gfa']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $formId = $input->getOption('form-id'); - $inputs = $input->getOption('inputs'); - - $function = $module . '_form_' .$formId . '_alter'; - - if ($this->extensionManager->validateModuleFunctionExist($module, $function)) { - throw new \Exception( - sprintf( - $this->trans('commands.generate.form.alter.messages.help-already-implemented'), - $module - ) - ); - } - - //validate if input is an array - if (!is_array($inputs[0])) { - $inputs= $this->explodeInlineArray($inputs); - } - - $this - ->generator - ->generate($module, $formId, $inputs, $this->metadata); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); - - return 0; - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - } - - $input->setOption('module', $module); - - // --form-id option - $formId = $input->getOption('form-id'); - if (!$formId) { - $forms = []; - // Get form ids from webprofiler - if ($this->moduleHandler->moduleExists('webprofiler')) { - $io->info( - $this->trans('commands.generate.form.alter.messages.loading-forms') - ); - $forms = $this->getWebprofilerForms(); - } - - if (!empty($forms)) { - $formId = $io->choiceNoList( - $this->trans('commands.generate.form.alter.options.form-id'), - array_keys($forms) - ); - } - } - - if ($this->moduleHandler->moduleExists('webprofiler') && isset($forms[$formId])) { - $this->metadata['class'] = $forms[$formId]['class']['class']; - $this->metadata['method'] = $forms[$formId]['class']['method']; - $this->metadata['file'] = str_replace( - $this->appRoot, - '', - $forms[$formId]['class']['file'] - ); - - foreach ($forms[$formId]['form'] as $itemKey => $item) { - if ($item['#type'] == 'hidden') { - unset($forms[$formId]['form'][$itemKey]); - } - } - - unset($forms[$formId]['form']['form_build_id']); - unset($forms[$formId]['form']['form_token']); - unset($forms[$formId]['form']['form_id']); - unset($forms[$formId]['form']['actions']); - - $formItems = array_keys($forms[$formId]['form']); - - $formItemsToHide = $io->choice( - $this->trans('commands.generate.form.alter.messages.hide-form-elements'), - $formItems, - null, - true - ); - - $this->metadata['unset'] = array_filter(array_map('trim', $formItemsToHide)); - } - - $input->setOption('form-id', $formId); - - // @see Drupal\Console\Command\Shared\FormTrait::formQuestion - $inputs = $input->getOption('inputs'); - - if (empty($inputs)) { - $io->writeln($this->trans('commands.generate.form.alter.messages.inputs')); - $inputs = $this->formQuestion($io); - } else { - $inputs= $this->explodeInlineArray($inputs); - } - - $input->setOption('inputs', $inputs); - } - - /** - * @{@inheritdoc} - */ - public function explodeInlineArray($inlineInputs) - { - $inputs = []; - foreach ($inlineInputs as $inlineInput) { - $explodeInput = explode(" ", $inlineInput); - $parameters = []; - foreach ($explodeInput as $inlineParameter) { - list($key, $value) = explode(":", $inlineParameter); - if (!empty($value)) { - $parameters[$key] = $value; - } - } - $inputs[] = $parameters; - } - - return $inputs; - } - - protected function createGenerator() - { - return new FormAlterGenerator(); - } - - public function getWebprofilerForms() - { - $tokens = $this->profiler->find(null, null, 1000, null, '', ''); - $forms = []; - foreach ($tokens as $token) { - $token = [$token['token']]; - $profile = $this->profiler->loadProfile($token); - $formCollector = $profile->getCollector('forms'); - $collectedForms = $formCollector->getForms(); - if (empty($forms)) { - $forms = $collectedForms; - } elseif (!empty($collectedForms)) { - $forms = array_merge($forms, $collectedForms); - } - } - return $forms; - } -} diff --git a/src/Command/Generate/FormBaseCommand.php b/src/Command/Generate/FormBaseCommand.php deleted file mode 100644 index 9e75348da..000000000 --- a/src/Command/Generate/FormBaseCommand.php +++ /dev/null @@ -1,18 +0,0 @@ -setFormType('FormBase'); - $this->setCommandName('generate:form'); - parent::configure(); - } -} diff --git a/src/Command/Generate/FormCommand.php b/src/Command/Generate/FormCommand.php deleted file mode 100644 index 6b84175c8..000000000 --- a/src/Command/Generate/FormCommand.php +++ /dev/null @@ -1,330 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->chainQueue = $chainQueue; - $this->stringConverter = $stringConverter; - $this->elementInfoManager = $elementInfoManager; - $this->routeProvider = $routeProvider; - parent::__construct(); - } - - protected function setFormType($formType) - { - return $this->formType = $formType; - } - - protected function setCommandName($commandName) - { - return $this->commandName = $commandName; - } - - protected function configure() - { - $this - ->setName($this->commandName) - ->setDescription( - sprintf( - $this->trans('commands.generate.form.description'), - $this->formType - ) - ) - ->setHelp( - sprintf( - $this->trans('commands.generate.form.help'), - $this->commandName, - $this->formType - ) - ) - ->addOption( - 'module', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.common.options.module') - ) - ->addOption( - 'class', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.form.options.class') - ) - ->addOption( - 'form-id', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.form.options.form-id') - ) - ->addOption( - 'services', - null, - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.common.options.services') - ) - ->addOption( - 'config-file', - null, - InputOption::VALUE_NONE, - $this->trans('commands.generate.form.options.config-file') - ) - ->addOption( - 'inputs', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.common.options.inputs') - ) - ->addOption( - 'path', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.form.options.path') - ) - ->addOption( - 'menu-link-gen', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.form.options.menu-link-gen') - ) - ->addOption( - 'menu-link-title', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.form.options.menu-link-title') - ) - ->addOption( - 'menu-parent', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.form.options.menu-parent') - ) - ->addOption( - 'menu-link-desc', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.form.options.menu-link-desc') - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $module = $input->getOption('module'); - $services = $input->getOption('services'); - $path = $input->getOption('path'); - $config_file = $input->getOption('config-file'); - $class_name = $input->getOption('class'); - $form_id = $input->getOption('form-id'); - $form_type = $this->formType; - $menu_link_gen = $input->getOption('menu-link-gen'); - $menu_parent = $input->getOption('menu-parent'); - $menu_link_title = $input->getOption('menu-link-title'); - $menu_link_desc = $input->getOption('menu-link-desc'); - - // if exist form generate config file - $inputs = $input->getOption('inputs'); - $build_services = $this->buildServices($services); - - $this - ->generator - ->generate($module, $class_name, $form_id, $form_type, $build_services, $config_file, $inputs, $path, $menu_link_gen, $menu_link_title, $menu_parent, $menu_link_desc); - - $this->chainQueue->addCommand('router:rebuild', []); - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --class option - $className = $input->getOption('class'); - if (!$className) { - $className = $io->ask( - $this->trans('commands.generate.form.questions.class'), - 'DefaultForm' - ); - $input->setOption('class', $className); - } - - // --form-id option - $formId = $input->getOption('form-id'); - if (!$formId) { - $formId = $io->ask( - $this->trans('commands.generate.form.questions.form-id'), - $this->stringConverter->camelCaseToMachineName($className) - ); - $input->setOption('form-id', $formId); - } - - // --services option - // @see use Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion - $services = $this->servicesQuestion($io); - $input->setOption('services', $services); - - // --config_file option - $config_file = $input->getOption('config-file'); - - if (!$config_file) { - $config_file = $io->confirm( - $this->trans('commands.generate.form.questions.config-file'), - true - ); - $input->setOption('config-file', $config_file); - } - - // --inputs option - $inputs = $input->getOption('inputs'); - if (!$inputs) { - // @see \Drupal\Console\Command\Shared\FormTrait::formQuestion - $inputs = $this->formQuestion($io); - $input->setOption('inputs', $inputs); - } - - $path = $input->getOption('path'); - if (!$path) { - if ($this->formType == 'ConfigFormBase') { - $form_path = '/admin/config/{{ module_name }}/{{ class_name_short }}'; - $form_path = sprintf( - '/admin/config/%s/%s', - $module, - strtolower($this->stringConverter->removeSuffix($className)) - ); - } else { - $form_path = sprintf( - '/%s/form/%s', - $module, - $this->stringConverter->camelCaseToMachineName($this->stringConverter->removeSuffix($className)) - ); - } - $path = $io->ask( - $this->trans('commands.generate.form.questions.path'), - $form_path, - function ($path) { - if (count($this->routeProvider->getRoutesByPattern($path)) > 0) { - throw new \InvalidArgumentException( - sprintf( - $this->trans( - 'commands.generate.form.messages.path-already-added' - ), - $path - ) - ); - } - - return $path; - } - ); - $input->setOption('path', $path); - } - - // --link option for links.menu - if ($this->formType == 'ConfigFormBase') { - $menu_options = $this->menuQuestion($io, $className); - $menu_link_gen = $input->getOption('menu-link-gen'); - $menu_link_title = $input->getOption('menu-link-title'); - $menu_parent = $input->getOption('menu-parent'); - $menu_link_desc = $input->getOption('menu-link-desc'); - if (!$menu_link_gen || !$menu_link_title || !$menu_parent || !$menu_link_desc) { - $input->setOption('menu-link-gen', $menu_options['menu_link_gen']); - $input->setOption('menu-link-title', $menu_options['menu_link_title']); - $input->setOption('menu-parent', $menu_options['menu_parent']); - $input->setOption('menu-link-desc', $menu_options['menu_link_desc']); - } - } - } -} diff --git a/src/Command/Generate/HelpCommand.php b/src/Command/Generate/HelpCommand.php deleted file mode 100644 index 678ce7143..000000000 --- a/src/Command/Generate/HelpCommand.php +++ /dev/null @@ -1,148 +0,0 @@ -generator = $generator; - $this->site = $site; - $this->extensionManager = $extensionManager; - $this->chainQueue = $chainQueue; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('generate:help') - ->setDescription($this->trans('commands.generate.help.description')) - ->setHelp($this->trans('commands.generate.help.help')) - ->addOption( - 'module', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.common.options.module') - ) - ->addOption( - 'description', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.module.options.description') - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - - if ($this->extensionManager->validateModuleFunctionExist($module, $module . '_help')) { - throw new \Exception( - sprintf( - $this->trans('commands.generate.help.messages.help-already-implemented'), - $module - ) - ); - } - - $description = $input->getOption('description'); - - $this - ->generator - ->generate($module, $description); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); - - return 0; - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $this->site->loadLegacyFile('/core/includes/update.inc'); - $this->site->loadLegacyFile('/core/includes/schema.inc'); - - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - $description = $input->getOption('description'); - if (!$description) { - $description = $io->ask( - $this->trans('commands.generate.module.questions.description'), - 'My Awesome Module' - ); - } - $input->setOption('description', $description); - } -} diff --git a/src/Command/Generate/ModuleCommand.php b/src/Command/Generate/ModuleCommand.php deleted file mode 100644 index 1382b08b3..000000000 --- a/src/Command/Generate/ModuleCommand.php +++ /dev/null @@ -1,409 +0,0 @@ -generator = $generator; - $this->validator = $validator; - $this->appRoot = $appRoot; - $this->stringConverter = $stringConverter; - $this->drupalApi = $drupalApi; - $this->twigtemplate = $twigtemplate; - parent::__construct(); - } - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName('generate:module') - ->setDescription($this->trans('commands.generate.module.description')) - ->setHelp($this->trans('commands.generate.module.help')) - ->addOption( - 'module', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.module.options.module') - ) - ->addOption( - 'machine-name', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.module.options.machine-name') - ) - ->addOption( - 'module-path', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.module.options.module-path') - ) - ->addOption( - 'description', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.module.options.description') - ) - ->addOption( - 'core', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.module.options.core') - ) - ->addOption( - 'package', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.module.options.package') - ) - ->addOption( - 'module-file', - null, - InputOption::VALUE_NONE, - $this->trans('commands.generate.module.options.module-file') - ) - ->addOption( - 'features-bundle', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.module.options.features-bundle') - ) - ->addOption( - 'composer', - null, - InputOption::VALUE_NONE, - $this->trans('commands.generate.module.options.composer') - ) - ->addOption( - 'dependencies', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.module.options.dependencies'), - '' - ) - ->addOption( - 'test', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.module.options.test') - ) - ->addOption( - 'twigtemplate', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.module.options.twigtemplate') - ) - ->setAliases(['gm']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - $yes = $input->hasOption('yes')?$input->getOption('yes'):false; - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io, $yes)) { - return 1; - } - - $module = $this->validator->validateModuleName($input->getOption('module')); - - $modulePath = $this->appRoot . $input->getOption('module-path'); - $modulePath = $this->validator->validateModulePath($modulePath, true); - - $machineName = $this->validator->validateMachineName($input->getOption('machine-name')); - $description = $input->getOption('description'); - $core = $input->getOption('core'); - $package = $input->getOption('package'); - $moduleFile = $input->getOption('module-file'); - $featuresBundle = $input->getOption('features-bundle'); - $composer = $input->getOption('composer'); - $dependencies = $this->validator->validateExtensions( - $input->getOption('dependencies'), - 'module', - $io - ); - $test = $input->getOption('test'); - $twigTemplate = $input->getOption('twigtemplate'); - - $this->generator->generate( - $module, - $machineName, - $modulePath, - $description, - $core, - $package, - $moduleFile, - $featuresBundle, - $composer, - $dependencies, - $test, - $twigTemplate - ); - - return 0; - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $validator = $this->validator; - - try { - $module = $input->getOption('module') ? - $this->validator->validateModuleName( - $input->getOption('module') - ) : null; - } catch (\Exception $error) { - $io->error($error->getMessage()); - - return 1; - } - - if (!$module) { - $module = $io->ask( - $this->trans('commands.generate.module.questions.module'), - null, - function ($module) use ($validator) { - return $validator->validateModuleName($module); - } - ); - $input->setOption('module', $module); - } - - try { - $machineName = $input->getOption('machine-name') ? - $this->validator->validateModuleName( - $input->getOption('machine-name') - ) : null; - } catch (\Exception $error) { - $io->error($error->getMessage()); - } - - if (!$machineName) { - $machineName = $io->ask( - $this->trans('commands.generate.module.questions.machine-name'), - $this->stringConverter->createMachineName($module), - function ($machine_name) use ($validator) { - return $validator->validateMachineName($machine_name); - } - ); - $input->setOption('machine-name', $machineName); - } - - $modulePath = $input->getOption('module-path'); - if (!$modulePath) { - $drupalRoot = $this->appRoot; - $modulePath = $io->ask( - $this->trans('commands.generate.module.questions.module-path'), - '/modules/custom', - function ($modulePath) use ($drupalRoot, $machineName) { - $modulePath = ($modulePath[0] != '/' ? '/' : '').$modulePath; - $fullPath = $drupalRoot.$modulePath.'/'.$machineName; - if (file_exists($fullPath)) { - throw new \InvalidArgumentException( - sprintf( - $this->trans('commands.generate.module.errors.directory-exists'), - $fullPath - ) - ); - } - - return $modulePath; - } - ); - } - $input->setOption('module-path', $modulePath); - - $description = $input->getOption('description'); - if (!$description) { - $description = $io->ask( - $this->trans('commands.generate.module.questions.description'), - 'My Awesome Module' - ); - } - $input->setOption('description', $description); - - $package = $input->getOption('package'); - if (!$package) { - $package = $io->ask( - $this->trans('commands.generate.module.questions.package'), - 'Custom' - ); - } - $input->setOption('package', $package); - - $core = $input->getOption('core'); - if (!$core) { - $core = $io->ask( - $this->trans('commands.generate.module.questions.core'), '8.x', - function ($core) { - // Only allow 8.x and higher as core version. - if (!preg_match('/^([0-9]+)\.x$/', $core, $matches) || ($matches[1] < 8)) { - throw new \InvalidArgumentException( - sprintf( - $this->trans('commands.generate.module.errors.invalid-core'), - $core - ) - ); - } - - return $core; - } - ); - $input->setOption('core', $core); - } - - $moduleFile = $input->getOption('module-file'); - if (!$moduleFile) { - $moduleFile = $io->confirm( - $this->trans('commands.generate.module.questions.module-file'), - true - ); - $input->setOption('module-file', $moduleFile); - } - - $featuresBundle = $input->getOption('features-bundle'); - if (!$featuresBundle) { - $featuresSupport = $io->confirm( - $this->trans('commands.generate.module.questions.features-support'), - false - ); - if ($featuresSupport) { - $featuresBundle = $io->ask( - $this->trans('commands.generate.module.questions.features-bundle'), - 'default' - ); - } - $input->setOption('features-bundle', $featuresBundle); - } - - $composer = $input->getOption('composer'); - if (!$composer) { - $composer = $io->confirm( - $this->trans('commands.generate.module.questions.composer'), - true - ); - $input->setOption('composer', $composer); - } - - $dependencies = $input->getOption('dependencies'); - if (!$dependencies) { - $addDependencies = $io->confirm( - $this->trans('commands.generate.module.questions.dependencies'), - false - ); - if ($addDependencies) { - $dependencies = $io->ask( - $this->trans('commands.generate.module.options.dependencies') - ); - } - $input->setOption('dependencies', $dependencies); - } - - $test = $input->getOption('test'); - if (!$test) { - $test = $io->confirm( - $this->trans('commands.generate.module.questions.test'), - true - ); - $input->setOption('test', $test); - } - - $twigtemplate = $input->getOption('twigtemplate'); - if (!$twigtemplate) { - $twigtemplate = $io->confirm( - $this->trans('commands.generate.module.questions.twigtemplate'), - true - ); - $input->setOption('twigtemplate', $twigtemplate); - } - } - - /** - * @return ModuleGenerator - */ - protected function createGenerator() - { - return new ModuleGenerator(); - } -} diff --git a/src/Command/Generate/ModuleFileCommand.php b/src/Command/Generate/ModuleFileCommand.php deleted file mode 100644 index e28c8ac33..000000000 --- a/src/Command/Generate/ModuleFileCommand.php +++ /dev/null @@ -1,115 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - parent::__construct(); - } - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName('generate:module:file') - ->setDescription($this->trans('commands.generate.module.file.description')) - ->setHelp($this->trans('commands.generate.module.file.help')) - ->addOption( - 'module', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.common.options.module') - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io, $yes)) { - return 1; - } - - $machine_name = $input->getOption('module'); - $file_path = $this->extensionManager->getModule($machine_name)->getPath(); - $generator = $this->generator; - - $generator->generate( - $machine_name, - $file_path - ); - } - - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - } - - $input->setOption('module', $module); - } -} diff --git a/src/Command/Generate/PermissionCommand.php b/src/Command/Generate/PermissionCommand.php deleted file mode 100644 index a7aee3778..000000000 --- a/src/Command/Generate/PermissionCommand.php +++ /dev/null @@ -1,122 +0,0 @@ -extensionManager = $extensionManager; - $this->stringConverter = $stringConverter; - $this->generator = $permissionGenerator; - parent::__construct(); - } - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName('generate:permissions') - ->setDescription($this->trans('commands.generate.permission.description')) - ->setHelp($this->trans('commands.generate.permission.help')) - ->addOption( - 'module', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.common.options.module') - ) - ->addOption( - 'permissions', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.common.options.permissions') - ) - ->setAliases(['gp']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $module = $input->getOption('module'); - $permissions = $input->getOption('permissions'); - $learning = $input->hasOption('learning'); - - - $this->generator->generate($module, $permissions, $learning); - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --permissions option - $permissions = $input->getOption('permissions'); - if (!$permissions) { - // @see \Drupal\Console\Command\Shared\PermissionTrait::permissionQuestion - $permissions = $this->permissionQuestion($io); - $input->setOption('permissions', $permissions); - } - } -} diff --git a/src/Command/Generate/PluginBlockCommand.php b/src/Command/Generate/PluginBlockCommand.php deleted file mode 100644 index 21679d997..000000000 --- a/src/Command/Generate/PluginBlockCommand.php +++ /dev/null @@ -1,292 +0,0 @@ -configFactory = $configFactory; - $this->chainQueue = $chainQueue; - $this->generator = $generator; - $this->entityTypeManager = $entityTypeManager; - $this->extensionManager = $extensionManager; - $this->validator = $validator; - $this->stringConverter = $stringConverter; - $this->elementInfoManager = $elementInfoManager; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('generate:plugin:block') - ->setDescription($this->trans('commands.generate.plugin.block.description')) - ->setHelp($this->trans('commands.generate.plugin.block.help')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) - ->addOption( - 'class', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.block.options.class') - ) - ->addOption( - 'label', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.block.options.label') - ) - ->addOption( - 'plugin-id', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.block.options.plugin-id') - ) - ->addOption( - 'theme-region', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.block.options.theme-region') - ) - ->addOption( - 'inputs', - null, - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.common.options.inputs') - ) - ->addOption( - 'services', - null, - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.common.options.services') - ) - ->setAliases(['gpb']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $class_name = $input->getOption('class'); - $label = $input->getOption('label'); - $plugin_id = $input->getOption('plugin-id'); - $services = $input->getOption('services'); - $theme_region = $input->getOption('theme-region'); - $inputs = $input->getOption('inputs'); - - $theme = $this->configFactory->get('system.theme')->get('default'); - $themeRegions = \system_region_list($theme, REGIONS_VISIBLE); - - if (!empty($theme_region) && !isset($themeRegions[$theme_region])) { - $io->error( - sprintf( - $this->trans('commands.generate.plugin.block.messages.invalid-theme-region'), - $theme_region - ) - ); - - return 1; - } - - // @see use Drupal\Console\Command\Shared\ServicesTrait::buildServices - $build_services = $this->buildServices($services); - - $this->generator - ->generate( - $module, - $class_name, - $label, - $plugin_id, - $build_services, - $inputs - ); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); - - if ($theme_region) { - $block = $this->entityTypeManager - ->getStorage('block') - ->create( - [ - 'id'=> $plugin_id, - 'plugin' => $plugin_id, - 'theme' => $theme - ] - ); - $block->setRegion($theme_region); - $block->save(); - } - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $theme = $this->configFactory->get('system.theme')->get('default'); - $themeRegions = \system_region_list($theme, REGIONS_VISIBLE); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --class option - $class = $input->getOption('class'); - if (!$class) { - $class = $io->ask( - $this->trans('commands.generate.plugin.block.questions.class'), - 'DefaultBlock', - function ($class) { - return $this->validator->validateClassName($class); - } - ); - $input->setOption('class', $class); - } - - // --label option - $label = $input->getOption('label'); - if (!$label) { - $label = $io->ask( - $this->trans('commands.generate.plugin.block.questions.label'), - $this->stringConverter->camelCaseToHuman($class) - ); - $input->setOption('label', $label); - } - - // --plugin-id option - $pluginId = $input->getOption('plugin-id'); - if (!$pluginId) { - $pluginId = $io->ask( - $this->trans('commands.generate.plugin.block.questions.plugin-id'), - $this->stringConverter->camelCaseToUnderscore($class) - ); - $input->setOption('plugin-id', $pluginId); - } - - // --theme-region option - $themeRegion = $input->getOption('theme-region'); - if (!$themeRegion) { - $themeRegion = $io->choiceNoList( - $this->trans('commands.generate.plugin.block.questions.theme-region'), - array_values($themeRegions), - null, - true - ); - $themeRegion = array_search($themeRegion, $themeRegions); - $input->setOption('theme-region', $themeRegion); - } - - // --services option - // @see Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion - $services = $this->servicesQuestion($io); - $input->setOption('services', $services); - - $output->writeln($this->trans('commands.generate.plugin.block.messages.inputs')); - - // @see Drupal\Console\Command\Shared\FormTrait::formQuestion - $inputs = $this->formQuestion($io); - $input->setOption('inputs', $inputs); - } -} diff --git a/src/Command/Generate/PluginCKEditorButtonCommand.php b/src/Command/Generate/PluginCKEditorButtonCommand.php deleted file mode 100644 index 2152dbeac..000000000 --- a/src/Command/Generate/PluginCKEditorButtonCommand.php +++ /dev/null @@ -1,207 +0,0 @@ -chainQueue = $chainQueue; - $this->generator = $generator; - $this->extensionManager = $extensionManager; - $this->stringConverter = $stringConverter; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('generate:plugin:ckeditorbutton') - ->setDescription($this->trans('commands.generate.plugin.ckeditorbutton.description')) - ->setHelp($this->trans('commands.generate.plugin.ckeditorbutton.help')) - ->addOption( - 'module', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.common.options.module') - ) - ->addOption( - 'class', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.plugin.ckeditorbutton.options.class') - ) - ->addOption( - 'label', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.plugin.ckeditorbutton.options.label') - ) - ->addOption( - 'plugin-id', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.plugin.ckeditorbutton.options.plugin-id') - ) - ->addOption( - 'button-name', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.plugin.ckeditorbutton.options.button-name') - ) - ->addOption( - 'button-icon-path', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.plugin.ckeditorbutton.options.button-icon-path') - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $class_name = $input->getOption('class'); - $label = $input->getOption('label'); - $plugin_id = $input->getOption('plugin-id'); - $button_name = $input->getOption('button-name'); - $button_icon_path = $input->getOption('button-icon-path'); - - $this - ->generator - ->generate($module, $class_name, $label, $plugin_id, $button_name, $button_icon_path); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery'], false); - - return 0; - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --class option - $class_name = $input->getOption('class'); - if (!$class_name) { - $class_name = $io->ask( - $this->trans('commands.generate.plugin.ckeditorbutton.questions.class'), - 'DefaultCKEditorButton' - ); - $input->setOption('class', $class_name); - } - - // --label option - $label = $input->getOption('label'); - if (!$label) { - $label = $io->ask( - $this->trans('commands.generate.plugin.ckeditorbutton.questions.label'), - $this->stringConverter->camelCaseToHuman($class_name) - ); - $input->setOption('label', $label); - } - - // --plugin-id option - $plugin_id = $input->getOption('plugin-id'); - if (!$plugin_id) { - $plugin_id = $io->ask( - $this->trans('commands.generate.plugin.ckeditorbutton.questions.plugin-id'), - $this->stringConverter->camelCaseToLowerCase($label) - ); - $input->setOption('plugin-id', $plugin_id); - } - - // --button-name option - $button_name = $input->getOption('button-name'); - if (!$button_name) { - $button_name = $io->ask( - $this->trans('commands.generate.plugin.ckeditorbutton.questions.button-name'), - $this->stringConverter->anyCaseToUcFirst($plugin_id) - ); - $input->setOption('button-name', $button_name); - } - - // --button-icon-path option - $button_icon_path = $input->getOption('button-icon-path'); - if (!$button_icon_path) { - $button_icon_path = $io->ask( - $this->trans('commands.generate.plugin.ckeditorbutton.questions.button-icon-path'), - drupal_get_path('module', $module) . '/js/plugins/' . $plugin_id . '/images/icon.png' - ); - $input->setOption('button-icon-path', $button_icon_path); - } - } -} diff --git a/src/Command/Generate/PluginConditionCommand.php b/src/Command/Generate/PluginConditionCommand.php deleted file mode 100644 index 24bc6da17..000000000 --- a/src/Command/Generate/PluginConditionCommand.php +++ /dev/null @@ -1,253 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->chainQueue = $chainQueue; - $this->entitytyperepository = $entitytyperepository; - $this->stringConverter = $stringConverter; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('generate:plugin:condition') - ->setDescription($this->trans('commands.generate.plugin.condition.description')) - ->setHelp($this->trans('commands.generate.plugin.condition.help')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) - ->addOption( - 'class', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.plugin.condition.options.class') - ) - ->addOption( - 'label', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.plugin.condition.options.label') - ) - ->addOption( - 'plugin-id', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.plugin.condition.options.plugin-id') - ) - ->addOption( - 'context-definition-id', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.plugin.condition.options.context-definition-id') - ) - ->addOption( - 'context-definition-label', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.plugin.condition.options.context-definition-label') - ) - ->addOption( - 'context-definition-required', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.condition.options.context-definition-required') - ) - ->setAliases(['gpc']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $class_name = $input->getOption('class'); - $label = $input->getOption('label'); - $plugin_id = $input->getOption('plugin-id'); - $context_definition_id = $input->getOption('context-definition-id'); - $context_definition_label = $input->getOption('context-definition-label'); - $context_definition_required = $input->getOption('context-definition-required')?'TRUE':'FALSE'; - - $this - ->generator - ->generate($module, $class_name, $label, $plugin_id, $context_definition_id, $context_definition_label, $context_definition_required); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); - - return 0; - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $entityTypeRepository = $this->entitytyperepository; - - $entity_types = $entityTypeRepository->getEntityTypeLabels(true); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - } - $input->setOption('module', $module); - - // --class option - $class = $input->getOption('class'); - if (!$class) { - $class = $io->ask( - $this->trans('commands.generate.plugin.condition.questions.class'), - 'ExampleCondition' - ); - $input->setOption('class', $class); - } - - // --plugin label option - $label = $input->getOption('label'); - if (!$label) { - $label = $io->ask( - $this->trans('commands.generate.plugin.condition.questions.label'), - $this->stringConverter->camelCaseToHuman($class) - ); - $input->setOption('label', $label); - } - - // --plugin-id option - $pluginId = $input->getOption('plugin-id'); - if (!$pluginId) { - $pluginId = $io->ask( - $this->trans('commands.generate.plugin.condition.questions.plugin-id'), - $this->stringConverter->camelCaseToUnderscore($class) - ); - $input->setOption('plugin-id', $pluginId); - } - - $context_definition_id = $input->getOption('context-definition-id'); - if (!$context_definition_id) { - $context_type = ['language' => 'Language', "entity" => "Entity"]; - $context_type_sel = $io->choice( - $this->trans('commands.generate.plugin.condition.questions.context-type'), - array_values($context_type) - ); - $context_type_sel = array_search($context_type_sel, $context_type); - - if ($context_type_sel == 'language') { - $context_definition_id = $context_type_sel; - $context_definition_id_value = ucfirst($context_type_sel); - } else { - $content_entity_types_sel = $io->choice( - $this->trans('commands.generate.plugin.condition.questions.context-entity-type'), - array_keys($entity_types) - ); - - $contextDefinitionIdList = $entity_types[$content_entity_types_sel]; - $context_definition_id_sel = $io->choice( - $this->trans('commands.generate.plugin.condition.questions.context-definition-id'), - array_values($contextDefinitionIdList) - ); - - $context_definition_id_value = array_search( - $context_definition_id_sel, - $contextDefinitionIdList - ); - - $context_definition_id = 'entity:' . $context_definition_id_value; - } - $input->setOption('context-definition-id', $context_definition_id); - } - - $context_definition_label = $input->getOption('context-definition-label'); - if (!$context_definition_label) { - $context_definition_label = $io->ask( - $this->trans('commands.generate.plugin.condition.questions.context-definition-label'), - $context_definition_id_value?:null - ); - $input->setOption('context-definition-label', $context_definition_label); - } - - $context_definition_required = $input->getOption('context-definition-required'); - if (empty($context_definition_required)) { - $context_definition_required = $io->confirm( - $this->trans('commands.generate.plugin.condition.questions.context-definition-required'), - true - ); - $input->setOption('context-definition-required', $context_definition_required); - } - } -} diff --git a/src/Command/Generate/PluginFieldCommand.php b/src/Command/Generate/PluginFieldCommand.php deleted file mode 100644 index 35577216a..000000000 --- a/src/Command/Generate/PluginFieldCommand.php +++ /dev/null @@ -1,346 +0,0 @@ -extensionManager = $extensionManager; - $this->stringConverter = $stringConverter; - $this->chainQueue = $chainQueue; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('generate:plugin:field') - ->setDescription($this->trans('commands.generate.plugin.field.description')) - ->setHelp($this->trans('commands.generate.plugin.field.help')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) - ->addOption( - 'type-class', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.plugin.field.options.type-class') - ) - ->addOption( - 'type-label', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.field.options.type-label') - ) - ->addOption( - 'type-plugin-id', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.field.options.type-plugin-id') - ) - ->addOption( - 'type-description', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.field.options.type-type-description') - ) - ->addOption( - 'formatter-class', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.plugin.field.options.class') - ) - ->addOption( - 'formatter-label', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.field.options.formatter-label') - ) - ->addOption( - 'formatter-plugin-id', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.field.options.formatter-plugin-id') - ) - ->addOption( - 'widget-class', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.plugin.field.options.formatter-class') - ) - ->addOption( - 'widget-label', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.field.options.widget-label') - ) - ->addOption( - 'widget-plugin-id', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.field.options.widget-plugin-id') - ) - ->addOption( - 'field-type', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.field.options.field-type') - ) - ->addOption( - 'default-widget', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.field.options.default-widget') - ) - ->addOption( - 'default-formatter', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.field.options.default-formatter') - ) - ->setAliases(['gpf']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $this->chainQueue - ->addCommand( - 'generate:plugin:fieldtype', [ - '--module' => $input->getOption('module'), - '--class' => $input->getOption('type-class'), - '--label' => $input->getOption('type-label'), - '--plugin-id' => $input->getOption('type-plugin-id'), - '--description' => $input->getOption('type-description'), - '--default-widget' => $input->getOption('default-widget'), - '--default-formatter' => $input->getOption('default-formatter'), - ], - false - ); - - $this->chainQueue - ->addCommand( - 'generate:plugin:fieldwidget', [ - '--module' => $input->getOption('module'), - '--class' => $input->getOption('widget-class'), - '--label' => $input->getOption('widget-label'), - '--plugin-id' => $input->getOption('widget-plugin-id'), - '--field-type' => $input->getOption('field-type'), - ], - false - ); - $this->chainQueue - ->addCommand( - 'generate:plugin:fieldformatter', [ - '--module' => $input->getOption('module'), - '--class' => $input->getOption('formatter-class'), - '--label' => $input->getOption('formatter-label'), - '--plugin-id' => $input->getOption('formatter-plugin-id'), - '--field-type' => $input->getOption('field-type'), - ], - false - ); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery'], false); - - return 0; - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --type-class option - $typeClass = $input->getOption('type-class'); - if (!$typeClass) { - $typeClass = $io->ask( - $this->trans('commands.generate.plugin.field.questions.type-class'), - 'ExampleFieldType' - ); - $input->setOption('type-class', $typeClass); - } - - // --type-label option - $label = $input->getOption('type-label'); - if (!$label) { - $label = $io->ask( - $this->trans('commands.generate.plugin.field.questions.type-label'), - $this->stringConverter->camelCaseToHuman($typeClass) - ); - $input->setOption('type-label', $label); - } - - // --type-plugin-id option - $plugin_id = $input->getOption('type-plugin-id'); - if (!$plugin_id) { - $plugin_id = $io->ask( - $this->trans('commands.generate.plugin.field.questions.type-plugin-id'), - $this->stringConverter->camelCaseToUnderscore($typeClass) - ); - $input->setOption('type-plugin-id', $plugin_id); - } - - // --type-description option - $description = $input->getOption('type-description'); - if (!$description) { - $description = $io->ask( - $this->trans('commands.generate.plugin.field.questions.type-description'), - 'My Field Type' - ); - $input->setOption('type-description', $description); - } - - // --widget-class option - $widgetClass = $input->getOption('widget-class'); - if (!$widgetClass) { - $widgetClass = $io->ask( - $this->trans('commands.generate.plugin.field.questions.widget-class'), - 'ExampleWidgetType' - ); - $input->setOption('widget-class', $widgetClass); - } - - // --widget-label option - $widgetLabel = $input->getOption('widget-label'); - if (!$widgetLabel) { - $widgetLabel = $io->ask( - $this->trans('commands.generate.plugin.field.questions.widget-label'), - $this->stringConverter->camelCaseToHuman($widgetClass) - ); - $input->setOption('widget-label', $widgetLabel); - } - - // --widget-plugin-id option - $widget_plugin_id = $input->getOption('widget-plugin-id'); - if (!$widget_plugin_id) { - $widget_plugin_id = $io->ask( - $this->trans('commands.generate.plugin.field.questions.widget-plugin-id'), - $this->stringConverter->camelCaseToUnderscore($widgetClass) - ); - $input->setOption('widget-plugin-id', $widget_plugin_id); - } - - // --formatter-class option - $formatterClass = $input->getOption('formatter-class'); - if (!$formatterClass) { - $formatterClass = $io->ask( - $this->trans('commands.generate.plugin.field.questions.formatter-class'), - 'ExampleFormatterType' - ); - $input->setOption('formatter-class', $formatterClass); - } - - // --formatter-label option - $formatterLabel = $input->getOption('formatter-label'); - if (!$formatterLabel) { - $formatterLabel = $io->ask( - $this->trans('commands.generate.plugin.field.questions.formatter-label'), - $this->stringConverter->camelCaseToHuman($formatterClass) - ); - $input->setOption('formatter-label', $formatterLabel); - } - - // --formatter-plugin-id option - $formatter_plugin_id = $input->getOption('formatter-plugin-id'); - if (!$formatter_plugin_id) { - $formatter_plugin_id = $io->ask( - $this->trans('commands.generate.plugin.field.questions.formatter-plugin-id'), - $this->stringConverter->camelCaseToUnderscore($formatterClass) - ); - $input->setOption('formatter-plugin-id', $formatter_plugin_id); - } - - // --field-type option - $field_type = $input->getOption('field-type'); - if (!$field_type) { - $field_type = $io->ask( - $this->trans('commands.generate.plugin.field.questions.field-type'), - $plugin_id - ); - $input->setOption('field-type', $field_type); - } - - // --default-widget option - $default_widget = $input->getOption('default-widget'); - if (!$default_widget) { - $default_widget = $io->ask( - $this->trans('commands.generate.plugin.field.questions.default-widget'), - $widget_plugin_id - ); - $input->setOption('default-widget', $default_widget); - } - - // --default-formatter option - $default_formatter = $input->getOption('default-formatter'); - if (!$default_formatter) { - $default_formatter = $io->ask( - $this->trans('commands.generate.plugin.field.questions.default-formatter'), - $formatter_plugin_id - ); - $input->setOption('default-formatter', $default_formatter); - } - } -} diff --git a/src/Command/Generate/PluginFieldFormatterCommand.php b/src/Command/Generate/PluginFieldFormatterCommand.php deleted file mode 100644 index 627ae163e..000000000 --- a/src/Command/Generate/PluginFieldFormatterCommand.php +++ /dev/null @@ -1,205 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->stringConverter = $stringConverter; - $this->fieldTypePluginManager = $fieldTypePluginManager; - $this->chainQueue = $chainQueue; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('generate:plugin:fieldformatter') - ->setDescription($this->trans('commands.generate.plugin.fieldformatter.description')) - ->setHelp($this->trans('commands.generate.plugin.fieldformatter.help')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) - ->addOption( - 'class', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.plugin.fieldformatter.options.class') - ) - ->addOption( - 'label', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.fieldformatter.options.label') - ) - ->addOption( - 'plugin-id', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.fieldformatter.options.plugin-id') - ) - ->addOption( - 'field-type', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.fieldformatter.options.field-type') - ) - ->setAliases(['gpff']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $class_name = $input->getOption('class'); - $label = $input->getOption('label'); - $plugin_id = $input->getOption('plugin-id'); - $field_type = $input->getOption('field-type'); - - $this->generator->generate($module, $class_name, $label, $plugin_id, $field_type); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); - - return 0; - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --class option - $class = $input->getOption('class'); - if (!$class) { - $class = $io->ask( - $this->trans('commands.generate.plugin.fieldformatter.questions.class'), - 'ExampleFieldFormatter' - ); - $input->setOption('class', $class); - } - - // --plugin label option - $label = $input->getOption('label'); - if (!$label) { - $label = $io->ask( - $this->trans('commands.generate.plugin.fieldformatter.questions.label'), - $this->stringConverter->camelCaseToHuman($class) - ); - $input->setOption('label', $label); - } - - // --name option - $plugin_id = $input->getOption('plugin-id'); - if (!$plugin_id) { - $plugin_id = $io->ask( - $this->trans('commands.generate.plugin.fieldformatter.questions.plugin-id'), - $this->stringConverter->camelCaseToUnderscore($class) - ); - $input->setOption('plugin-id', $plugin_id); - } - - // --field type option - $field_type = $input->getOption('field-type'); - if (!$field_type) { - // Gather valid field types. - $field_type_options = []; - foreach ($this->fieldTypePluginManager->getGroupedDefinitions($this->fieldTypePluginManager->getUiDefinitions()) as $category => $field_types) { - foreach ($field_types as $name => $field_type) { - $field_type_options[] = $name; - } - } - - $field_type = $io->choice( - $this->trans('commands.generate.plugin.fieldwidget.questions.field-type'), - $field_type_options - ); - - $input->setOption('field-type', $field_type); - } - } -} diff --git a/src/Command/Generate/PluginFieldTypeCommand.php b/src/Command/Generate/PluginFieldTypeCommand.php deleted file mode 100644 index 49f6b6eef..000000000 --- a/src/Command/Generate/PluginFieldTypeCommand.php +++ /dev/null @@ -1,221 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->stringConverter = $stringConverter; - $this->chainQueue = $chainQueue; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('generate:plugin:fieldtype') - ->setDescription($this->trans('commands.generate.plugin.fieldtype.description')) - ->setHelp($this->trans('commands.generate.plugin.fieldtype.help')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) - ->addOption( - 'class', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.plugin.fieldtype.options.class') - ) - ->addOption( - 'label', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.fieldtype.options.label') - ) - ->addOption( - 'plugin-id', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.fieldtype.options.plugin-id') - ) - ->addOption( - 'description', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.fieldtype.options.description') - ) - ->addOption( - 'default-widget', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.fieldtype.options.default-widget') - ) - ->addOption( - 'default-formatter', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.fieldtype.options.default-formatter') - ) - ->setAliases(['gpft']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $class_name = $input->getOption('class'); - $label = $input->getOption('label'); - $plugin_id = $input->getOption('plugin-id'); - $description = $input->getOption('description'); - $default_widget = $input->getOption('default-widget'); - $default_formatter = $input->getOption('default-formatter'); - - $this->generator - ->generate($module, $class_name, $label, $plugin_id, $description, $default_widget, $default_formatter); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery'], false); - - return 0; - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --class option - $class_name = $input->getOption('class'); - if (!$class_name) { - $class_name = $io->ask( - $this->trans('commands.generate.plugin.fieldtype.questions.class'), - 'ExampleFieldType' - ); - $input->setOption('class', $class_name); - } - - // --label option - $label = $input->getOption('label'); - if (!$label) { - $label = $io->ask( - $this->trans('commands.generate.plugin.fieldtype.questions.label'), - $this->stringConverter->camelCaseToHuman($class_name) - ); - $input->setOption('label', $label); - } - - // --plugin-id option - $plugin_id = $input->getOption('plugin-id'); - if (!$plugin_id) { - $plugin_id = $io->ask( - $this->trans('commands.generate.plugin.fieldtype.questions.plugin-id'), - $this->stringConverter->camelCaseToUnderscore($class_name) - ); - $input->setOption('plugin-id', $plugin_id); - } - - // --description option - $description = $input->getOption('description'); - if (!$description) { - $description = $io->ask( - $this->trans('commands.generate.plugin.fieldtype.questions.description'), - 'My Field Type' - ); - $input->setOption('description', $description); - } - - // --default-widget option - $default_widget = $input->getOption('default-widget'); - if (!$default_widget) { - $default_widget = $io->askEmpty( - $this->trans('commands.generate.plugin.fieldtype.questions.default-widget') - ); - $input->setOption('default-widget', $default_widget); - } - - // --default-formatter option - $default_formatter = $input->getOption('default-formatter'); - if (!$default_formatter) { - $default_formatter = $io->askEmpty( - $this->trans('commands.generate.plugin.fieldtype.questions.default-formatter') - ); - $input->setOption('default-formatter', $default_formatter); - } - } -} diff --git a/src/Command/Generate/PluginFieldWidgetCommand.php b/src/Command/Generate/PluginFieldWidgetCommand.php deleted file mode 100644 index a56213756..000000000 --- a/src/Command/Generate/PluginFieldWidgetCommand.php +++ /dev/null @@ -1,210 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->stringConverter = $stringConverter; - $this->fieldTypePluginManager = $fieldTypePluginManager; - $this->chainQueue = $chainQueue; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('generate:plugin:fieldwidget') - ->setDescription($this->trans('commands.generate.plugin.fieldwidget.description')) - ->setHelp($this->trans('commands.generate.plugin.fieldwidget.help')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) - ->addOption( - 'class', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.plugin.fieldwidget.options.class') - ) - ->addOption( - 'label', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.fieldwidget.options.label') - ) - ->addOption( - 'plugin-id', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.fieldwidget.options.plugin-id') - ) - ->addOption( - 'field-type', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.fieldwidget.options.field-type') - ) - ->setAliases(['gpfw']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $class_name = $input->getOption('class'); - $label = $input->getOption('label'); - $plugin_id = $input->getOption('plugin-id'); - $field_type = $input->getOption('field-type'); - - $this->generator->generate($module, $class_name, $label, $plugin_id, $field_type); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); - - return 0; - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --class option - $class_name = $input->getOption('class'); - if (!$class_name) { - $class_name = $io->ask( - $this->trans('commands.generate.plugin.fieldwidget.questions.class'), - 'ExampleFieldWidget' - ); - $input->setOption('class', $class_name); - } - - // --plugin label option - $label = $input->getOption('label'); - if (!$label) { - $label = $io->ask( - $this->trans('commands.generate.plugin.fieldwidget.questions.label'), - $this->stringConverter->camelCaseToHuman($class_name) - ); - $input->setOption('label', $label); - } - - // --plugin-id option - $plugin_id = $input->getOption('plugin-id'); - if (!$plugin_id) { - $plugin_id = $io->ask( - $this->trans('commands.generate.plugin.fieldwidget.questions.plugin-id'), - $this->stringConverter->camelCaseToUnderscore($class_name) - ); - $input->setOption('plugin-id', $plugin_id); - } - - // --field-type option - $field_type = $input->getOption('field-type'); - if (!$field_type) { - // Gather valid field types. - $field_type_options = []; - foreach ($this->fieldTypePluginManager->getGroupedDefinitions($this->fieldTypePluginManager->getUiDefinitions()) as $category => $field_types) { - foreach ($field_types as $name => $field_type) { - $field_type_options[] = $name; - } - } - - $field_type = $io->choice( - $this->trans('commands.generate.plugin.fieldwidget.questions.field-type'), - $field_type_options - ); - - $input->setOption('field-type', $field_type); - } - } -} diff --git a/src/Command/Generate/PluginImageEffectCommand.php b/src/Command/Generate/PluginImageEffectCommand.php deleted file mode 100644 index cf516e813..000000000 --- a/src/Command/Generate/PluginImageEffectCommand.php +++ /dev/null @@ -1,185 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->stringConverter = $stringConverter; - $this->chainQueue = $chainQueue; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('generate:plugin:imageeffect') - ->setDescription($this->trans('commands.generate.plugin.imageeffect.description')) - ->setHelp($this->trans('commands.generate.plugin.imageeffect.help')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) - ->addOption( - 'class', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.plugin.imageeffect.options.class') - ) - ->addOption( - 'label', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.imageeffect.options.label') - ) - ->addOption( - 'plugin-id', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.imageeffect.options.plugin-id') - ) - ->addOption( - 'description', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.imageeffect.options.description') - ) - ->setAliases(['gpie']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $class_name = $input->getOption('class'); - $label = $input->getOption('label'); - $plugin_id = $input->getOption('plugin-id'); - $description = $input->getOption('description'); - - $this->generator->generate($module, $class_name, $label, $plugin_id, $description); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --class option - $class_name = $input->getOption('class'); - if (!$class_name) { - $class_name = $io->ask( - $this->trans('commands.generate.plugin.imageeffect.questions.class'), - 'DefaultImageEffect' - ); - $input->setOption('class', $class_name); - } - - // --label option - $label = $input->getOption('label'); - if (!$label) { - $label = $io->ask( - $this->trans('commands.generate.plugin.imageeffect.questions.label'), - $this->stringConverter->camelCaseToHuman($class_name) - ); - $input->setOption('label', $label); - } - - // --plugin-id option - $plugin_id = $input->getOption('plugin-id'); - if (!$plugin_id) { - $plugin_id = $io->ask( - $this->trans('commands.generate.plugin.imageeffect.questions.plugin-id'), - $this->stringConverter->camelCaseToUnderscore($class_name) - ); - $input->setOption('plugin-id', $plugin_id); - } - - // --description option - $description = $input->getOption('description'); - if (!$description) { - $description = $io->ask( - $this->trans('commands.generate.plugin.imageeffect.questions.description'), - 'My Image Effect' - ); - $input->setOption('description', $description); - } - } -} diff --git a/src/Command/Generate/PluginImageFormatterCommand.php b/src/Command/Generate/PluginImageFormatterCommand.php deleted file mode 100644 index 5a3cb696f..000000000 --- a/src/Command/Generate/PluginImageFormatterCommand.php +++ /dev/null @@ -1,172 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->stringConverter = $stringConverter; - $this->validator = $validator; - $this->chainQueue = $chainQueue; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('generate:plugin:imageformatter') - ->setDescription($this->trans('commands.generate.plugin.imageformatter.description')) - ->setHelp($this->trans('commands.generate.plugin.imageformatter.help')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) - ->addOption( - 'class', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.plugin.imageformatter.options.class') - ) - ->addOption( - 'label', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.imageformatter.options.label') - ) - ->addOption( - 'plugin-id', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.imageformatter.options.plugin-id') - ) - ->setAliases(['gpif']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $class_name = $input->getOption('class'); - $label = $input->getOption('label'); - $plugin_id = $input->getOption('plugin-id'); - - $this->generator->generate($module, $class_name, $label, $plugin_id); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - } - $input->setOption('module', $module); - - // --class option - $class_name = $input->getOption('class'); - if (!$class_name) { - $class_name = $io->ask( - $this->trans('commands.generate.plugin.imageformatter.questions.class'), - 'ExampleImageFormatter' - ); - $input->setOption('class', $class_name); - } - - // --label option - $label = $input->getOption('label'); - if (!$label) { - $label = $io->ask( - $this->trans('commands.generate.plugin.imageformatter.questions.label'), - $this->stringConverter->camelCaseToHuman($class_name) - ); - $input->setOption('label', $label); - } - - // --plugin-id option - $plugin_id = $input->getOption('plugin-id'); - if (!$plugin_id) { - $plugin_id = $io->ask( - $this->trans('commands.generate.plugin.imageformatter.questions.plugin-id'), - $this->stringConverter->camelCaseToUnderscore($class_name) - ); - $input->setOption('plugin-id', $plugin_id); - } - } -} diff --git a/src/Command/Generate/PluginMailCommand.php b/src/Command/Generate/PluginMailCommand.php deleted file mode 100644 index 48a47d0d6..000000000 --- a/src/Command/Generate/PluginMailCommand.php +++ /dev/null @@ -1,198 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->stringConverter = $stringConverter; - $this->validator = $validator; - $this->chainQueue = $chainQueue; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('generate:plugin:mail') - ->setDescription($this->trans('commands.generate.plugin.mail.description')) - ->setHelp($this->trans('commands.generate.plugin.mail.help')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) - ->addOption( - 'class', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.mail.options.class') - ) - ->addOption( - 'label', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.mail.options.label') - ) - ->addOption( - 'plugin-id', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.mail.options.plugin-id') - ) - ->addOption( - 'services', - null, - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.common.options.services') - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $class_name = $input->getOption('class'); - $label = $input->getOption('label'); - $plugin_id = $input->getOption('plugin-id'); - $services = $input->getOption('services'); - - // @see use Drupal\Console\Command\Shared\ServicesTrait::buildServices - $build_services = $this->buildServices($services); - - $this->generator->generate($module, $class_name, $label, $plugin_id, $build_services); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --class option - $class = $input->getOption('class'); - if (!$class) { - $class = $io->ask( - $this->trans('commands.generate.plugin.mail.options.class'), - 'HtmlFormatterMail', - function ($class) { - return $this->validator->validateClassName($class); - } - ); - $input->setOption('class', $class); - } - - // --label option - $label = $input->getOption('label'); - if (!$label) { - $label = $io->ask( - $this->trans('commands.generate.plugin.mail.options.label'), - $this->stringConverter->camelCaseToHuman($class) - ); - $input->setOption('label', $label); - } - - // --plugin-id option - $pluginId = $input->getOption('plugin-id'); - if (!$pluginId) { - $pluginId = $io->ask( - $this->trans('commands.generate.plugin.mail.options.plugin-id'), - $this->stringConverter->camelCaseToUnderscore($class) - ); - $input->setOption('plugin-id', $pluginId); - } - - // --services option - // @see Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion - $services = $this->servicesQuestion($io); - $input->setOption('services', $services); - } -} diff --git a/src/Command/Generate/PluginMigrateProcessCommand.php b/src/Command/Generate/PluginMigrateProcessCommand.php deleted file mode 100644 index 20ba70a60..000000000 --- a/src/Command/Generate/PluginMigrateProcessCommand.php +++ /dev/null @@ -1,147 +0,0 @@ -generator = $generator; - $this->chainQueue = $chainQueue; - $this->extensionManager = $extensionManager; - $this->stringConverter = $stringConverter; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('generate:plugin:migrate:process') - ->setDescription($this->trans('commands.generate.plugin.migrate.process.description')) - ->setHelp($this->trans('commands.generate.plugin.migrate.process.help')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) - ->addOption( - 'class', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.migrate.process.options.class') - ) - ->addOption( - 'plugin-id', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.migrate.process.options.plugin-id') - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $class_name = $input->getOption('class'); - $plugin_id = $input->getOption('plugin-id'); - - $this->generator->generate($module, $class_name, $plugin_id); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // 'module-name' option. - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // 'class-name' option - $class = $input->getOption('class'); - if (!$class) { - $class = $io->ask( - $this->trans('commands.generate.plugin.migrate.process.questions.class'), - ucfirst($this->stringConverter->underscoreToCamelCase($module)) - ); - $input->setOption('class', $class); - } - - // 'plugin-id' option. - $pluginId = $input->getOption('plugin-id'); - if (!$pluginId) { - $pluginId = $io->ask( - $this->trans('commands.generate.plugin.migrate.source.questions.plugin-id'), - $this->stringConverter->camelCaseToUnderscore($class) - ); - $input->setOption('plugin-id', $pluginId); - } - } -} diff --git a/src/Command/Generate/PluginMigrateSourceCommand.php b/src/Command/Generate/PluginMigrateSourceCommand.php deleted file mode 100644 index 5de03cccf..000000000 --- a/src/Command/Generate/PluginMigrateSourceCommand.php +++ /dev/null @@ -1,267 +0,0 @@ -configFactory = $configFactory; - $this->chainQueue = $chainQueue; - $this->generator = $generator; - $this->entityTypeManager = $entityTypeManager; - $this->extensionManager = $extensionManager; - $this->validator = $validator; - $this->stringConverter = $stringConverter; - $this->elementInfoManager = $elementInfoManager; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('generate:plugin:migrate:source') - ->setDescription($this->trans('commands.generate.plugin.migrate.source.description')) - ->setHelp($this->trans('commands.generate.plugin.migrate.source.help')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) - ->addOption( - 'class', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.migrate.source.options.class') - ) - ->addOption( - 'plugin-id', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.migrate.source.options.plugin-id') - ) - ->addOption( - 'table', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.migrate.source.options.table') - ) - ->addOption( - 'alias', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.migrate.source.options.alias') - ) - ->addOption( - 'group-by', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.migrate.source.options.group-by') - ) - ->addOption( - 'fields', - null, - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.generate.plugin.migrate.source.options.fields') - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $class_name = $input->getOption('class'); - $plugin_id = $input->getOption('plugin-id'); - $table = $input->getOption('table'); - $alias = $input->getOption('alias'); - $group_by = $input->getOption('group-by'); - $fields = $input->getOption('fields'); - - $this->generator - ->generate( - $module, - $class_name, - $plugin_id, - $table, - $alias, - $group_by, - $fields - ); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - $class = $input->getOption('class'); - if (!$class) { - $class = $io->ask( - $this->trans('commands.generate.plugin.migrate.source.questions.class'), - ucfirst($this->stringConverter->underscoreToCamelCase($module)), - function ($class) { - return $this->validator->validateClassName($class); - } - ); - $input->setOption('class', $class); - } - - $pluginId = $input->getOption('plugin-id'); - if (!$pluginId) { - $pluginId = $io->ask( - $this->trans('commands.generate.plugin.migrate.source.questions.plugin-id'), - $this->stringConverter->camelCaseToUnderscore($class) - ); - $input->setOption('plugin-id', $pluginId); - } - - $table = $input->getOption('table'); - if (!$table) { - $table = $io->ask( - $this->trans('commands.generate.plugin.migrate.source.questions.table'), - '' - ); - $input->setOption('table', $table); - } - - $alias = $input->getOption('alias'); - if (!$alias) { - $alias = $io->ask( - $this->trans('commands.generate.plugin.migrate.source.questions.alias'), - substr($table, 0, 1) - ); - $input->setOption('alias', $alias); - } - - $groupBy = $input->getOption('group-by'); - if ($groupBy == '') { - $groupBy = $io->ask( - $this->trans('commands.generate.plugin.migrate.source.questions.group-by'), - false - ); - $input->setOption('group-by', $groupBy); - } - - $fields = $input->getOption('fields'); - if (!$fields) { - $fields = []; - while (true) { - $id = $io->ask( - $this->trans('commands.generate.plugin.migrate.source.questions.fields.id'), - false - ); - if (!$id) { - break; - } - $description = $io->ask( - $this->trans('commands.generate.plugin.migrate.source.questions.fields.description'), - $id - ); - $fields[] = [ - 'id' => $id, - 'description' => $description, - ]; - } - $input->setOption('fields', $fields); - } - } -} diff --git a/src/Command/Generate/PluginRestResourceCommand.php b/src/Command/Generate/PluginRestResourceCommand.php deleted file mode 100644 index c11e9685d..000000000 --- a/src/Command/Generate/PluginRestResourceCommand.php +++ /dev/null @@ -1,225 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->stringConverter = $stringConverter; - $this->chainQueue = $chainQueue; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('generate:plugin:rest:resource') - ->setDescription($this->trans('commands.generate.plugin.rest.resource.description')) - ->setHelp($this->trans('commands.generate.plugin.rest.resource.help')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) - ->addOption( - 'class', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.rest.resource.options.class') - ) - ->addOption( - 'name', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.service.options.name') - ) - ->addOption( - 'plugin-id', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.rest.resource.options.plugin-id') - ) - ->addOption( - 'plugin-label', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.rest.resource.options.plugin-label') - ) - ->addOption( - 'plugin-url', - null, - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.generate.plugin.rest.resource.options.plugin-url') - ) - ->addOption( - 'plugin-states', - null, - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.generate.plugin.rest.resource.options.plugin-states') - ) - ->setAliases(['gprr']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $class_name = $input->getOption('class'); - $plugin_id = $input->getOption('plugin-id'); - $plugin_label = $input->getOption('plugin-label'); - $plugin_url = $input->getOption('plugin-url'); - $plugin_states = $input->getOption('plugin-states'); - - $this->generator->generate($module, $class_name, $plugin_label, $plugin_id, $plugin_url, $plugin_states); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); - - return 0; - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --class option - $class_name = $input->getOption('class'); - if (!$class_name) { - $stringUtils = $this->stringConverter; - $class_name = $io->ask( - $this->trans('commands.generate.plugin.rest.resource.questions.class'), - 'DefaultRestResource', - function ($class_name) use ($stringUtils) { - if (!strlen(trim($class_name))) { - throw new \Exception('The Class name can not be empty'); - } - - return $stringUtils->humanToCamelCase($class_name); - } - ); - $input->setOption('class', $class_name); - } - - // --plugin-id option - $plugin_id = $input->getOption('plugin-id'); - if (!$plugin_id) { - $plugin_id = $io->ask( - $this->trans('commands.generate.plugin.rest.resource.questions.plugin-id'), - $this->stringConverter->camelCaseToUnderscore($class_name) - ); - $input->setOption('plugin-id', $plugin_id); - } - - // --plugin-label option - $plugin_label = $input->getOption('plugin-label'); - if (!$plugin_label) { - $plugin_label = $io->ask( - $this->trans('commands.generate.plugin.rest.resource.questions.plugin-label'), - $this->stringConverter->camelCaseToHuman($class_name) - ); - $input->setOption('plugin-label', $plugin_label); - } - - // --plugin-url option - $plugin_url = $input->getOption('plugin-url'); - if (!$plugin_url) { - $plugin_url = $io->ask( - $this->trans('commands.generate.plugin.rest.resource.questions.plugin-url') - ); - $input->setOption('plugin-url', $plugin_url); - } - - // --plugin-states option - $plugin_states = $input->getOption('plugin-states'); - if (!$plugin_states) { - $states = ['GET', 'PUT', 'POST', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS']; - $plugin_states = $io->choice( - $this->trans('commands.generate.plugin.rest.resource.questions.plugin-states'), - $states, - null, - true - ); - - $input->setOption('plugin-states', $plugin_states); - } - } -} diff --git a/src/Command/Generate/PluginRulesActionCommand.php b/src/Command/Generate/PluginRulesActionCommand.php deleted file mode 100644 index 6a063f2b7..000000000 --- a/src/Command/Generate/PluginRulesActionCommand.php +++ /dev/null @@ -1,220 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->stringConverter = $stringConverter; - $this->chainQueue = $chainQueue; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('generate:plugin:rulesaction') - ->setDescription($this->trans('commands.generate.plugin.rulesaction.description')) - ->setHelp($this->trans('commands.generate.plugin.rulesaction.help')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) - ->addOption( - 'class', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.rulesaction.options.class') - ) - ->addOption( - 'label', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.rulesaction.options.label') - ) - ->addOption( - 'plugin-id', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.rulesaction.options.plugin-id') - ) - ->addOption('type', null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.rulesaction.options.type')) - ->addOption( - 'category', - null, - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.generate.plugin.rulesaction.options.category') - ) - ->addOption( - 'context', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.rulesaction.options.context') - ) - ->setAliases(['gpra']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $class_name = $input->getOption('class'); - $label = $input->getOption('label'); - $plugin_id = $input->getOption('plugin-id'); - $type = $input->getOption('type'); - $category = $input->getOption('category'); - $context = $input->getOption('context'); - - $this->generator->generate($module, $class_name, $label, $plugin_id, $category, $context, $type); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); - - return 0; - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --class option - $class_name = $input->getOption('class'); - if (!$class_name) { - $class_name = $io->ask( - $this->trans('commands.generate.plugin.rulesaction.options.class'), - 'DefaultAction' - ); - $input->setOption('class', $class_name); - } - - // --label option - $label = $input->getOption('label'); - if (!$label) { - $label = $io->ask( - $this->trans('commands.generate.plugin.rulesaction.options.label'), - $this->stringConverter->camelCaseToHuman($class_name) - ); - $input->setOption('label', $label); - } - - // --plugin-id option - $plugin_id = $input->getOption('plugin-id'); - if (!$plugin_id) { - $plugin_id = $io->ask( - $this->trans('commands.generate.plugin.rulesaction.options.plugin-id'), - $this->stringConverter->camelCaseToUnderscore($class_name) - ); - $input->setOption('plugin-id', $plugin_id); - } - - // --type option - $type = $input->getOption('type'); - if (!$type) { - $type = $io->ask( - $this->trans('commands.generate.plugin.rulesaction.options.type'), - 'user' - ); - $input->setOption('type', $type); - } - - // --category option - $category = $input->getOption('category'); - if (!$category) { - $category = $io->ask( - $this->trans('commands.generate.plugin.rulesaction.options.category'), - $this->stringConverter->camelCaseToUnderscore($class_name) - ); - $input->setOption('category', $category); - } - - // --context option - $context = $input->getOption('context'); - if (!$context) { - $context = $io->ask( - $this->trans('commands.generate.plugin.rulesaction.options.context'), - $this->stringConverter->camelCaseToUnderscore($class_name) - ); - $input->setOption('context', $context); - } - } -} diff --git a/src/Command/Generate/PluginSkeletonCommand.php b/src/Command/Generate/PluginSkeletonCommand.php deleted file mode 100644 index f1fb5ee18..000000000 --- a/src/Command/Generate/PluginSkeletonCommand.php +++ /dev/null @@ -1,384 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->stringConverter = $stringConverter; - $this->validator = $validator; - $this->chainQueue = $chainQueue; - parent::__construct(); - } - - protected $pluginGeneratorsImplemented = [ - 'block' => 'generate:plugin:block', - 'ckeditor.plugin' => 'generate:plugin:ckeditorbutton', - 'condition' => 'generate:plugin:condition', - 'field.formatter' => 'generate:plugin:fieldformatter', - 'field.field_type' => 'generate:plugin:fieldtype', - 'field.widget' =>'generate:plugin:fieldwidget', - 'image.effect' => 'generate:plugin:imageeffect', - 'mail' => 'generate:plugin:mail' - ]; - - protected function configure() - { - $this - ->setName('generate:plugin:skeleton') - ->setDescription($this->trans('commands.generate.plugin.skeleton.description')) - ->setHelp($this->trans('commands.generate.plugin.skeleton.help')) - ->addOption( - 'module', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.common.options.module') - ) - ->addOption( - 'plugin-id', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.plugin.options.plugin-id') - ) - ->addOption( - 'class', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.block.options.class') - ) - ->addOption( - 'services', - null, - InputOption::VALUE_OPTIONAL| InputOption::VALUE_IS_ARRAY, - $this->trans('commands.common.options.services') - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - $plugins = $this->getPlugins(); - - // @see use Drupal\Console\Command\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - - $pluginId = $input->getOption('plugin-id'); - $plugin = ucfirst($this->stringConverter->underscoreToCamelCase($pluginId)); - - // Confirm that plugin.manager is available - if (!$this->validator->validatePluginManagerServiceExist($pluginId, $plugins)) { - throw new \Exception( - sprintf( - $this->trans('commands.generate.plugin.skeleton.messages.plugin-dont-exist'), - $pluginId - ) - ); - } - - if (array_key_exists($pluginId, $this->pluginGeneratorsImplemented)) { - $io->warning( - sprintf( - $this->trans('commands.generate.plugin.skeleton.messages.plugin-generator-implemented'), - $pluginId, - $this->pluginGeneratorsImplemented[$pluginId] - ) - ); - } - - $className = $input->getOption('class'); - $services = $input->getOption('services'); - - // @see use Drupal\Console\Command\Shared\ServicesTrait::buildServices - $buildServices = $this->buildServices($services); - $pluginMetaData = $this->getPluginMetadata($pluginId); - - $this->generator->generate($module, $pluginId, $plugin, $className, $pluginMetaData, $buildServices); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); - - return 0; - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - $pluginId = $input->getOption('plugin-id'); - if (!$pluginId) { - $plugins = $this->getPlugins(); - $pluginId = $io->choiceNoList( - $this->trans('commands.generate.plugin.skeleton.questions.plugin'), - $plugins - ); - $input->setOption('plugin-id', $pluginId); - } - - if (array_key_exists($pluginId, $this->pluginGeneratorsImplemented)) { - $io->warning( - sprintf( - $this->trans('commands.generate.plugin.skeleton.messages.plugin-dont-exist'), - $pluginId, - $this->pluginGeneratorsImplemented[$pluginId] - ) - ); - } - - // --class option - $class = $input->getOption('class'); - if (!$class) { - $class = $io->ask( - $this->trans('commands.generate.plugin.skeleton.options.class'), - sprintf('%s%s', 'Default', ucfirst($this->stringConverter->underscoreToCamelCase($pluginId))), - function ($class) { - return $this->validator->validateClassName($class); - } - ); - $input->setOption('class', $class); - } - - // --services option - // @see Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion - $services = $input->getOption('services'); - if (!$services) { - $services = $this->servicesQuestion($io); - $input->setOption('services', $services); - } - } - - protected function getPluginMetadata($pluginId) - { - $pluginMetaData = [ - 'serviceId' => 'plugin.manager.' . $pluginId, - ]; - - // Load service and create reflection - $service = \Drupal::service($pluginMetaData['serviceId']); - - $reflectionClass = new \ReflectionClass($service); - - // Get list of properties with $reflectionClass->getProperties(); - $pluginManagerProperties = [ - 'subdir' => 'subdir', - 'pluginInterface' => 'pluginInterface', - 'pluginDefinitionAnnotationName' => 'pluginAnnotation', - ]; - - foreach ($pluginManagerProperties as $propertyName => $key) { - if (!$reflectionClass->hasProperty($propertyName)) { - $pluginMetaData[$key] = ''; - continue; - } - - $property = $reflectionClass->getProperty($propertyName); - $property->setAccessible(true); - $pluginMetaData[$key] = $property->getValue($service); - } - - if (empty($pluginMetaData['pluginInterface'])) { - $pluginMetaData['pluginInterfaceMethods'] = []; - } else { - $pluginMetaData['pluginInterfaceMethods'] = $this->getClassMethods($pluginMetaData['pluginInterface']); - } - - if (isset($pluginMetaData['pluginAnnotation']) && class_exists($pluginMetaData['pluginAnnotation'])) { - $pluginMetaData['pluginAnnotationProperties'] = $this->getPluginAnnotationProperties($pluginMetaData['pluginAnnotation']); - } else { - $pluginMetaData['pluginAnnotationProperties'] = []; - } - - return $pluginMetaData; - } - - /** - * Get data for the methods of a class. - * - * @param $class - * The fully-qualified name of class. - * - * @return - * An array keyed by method name, where each value is an array containing: - * - 'name: The name of the method. - * - 'declaration': The function declaration line. - * - 'description': The description from the method's docblock first line. - */ - protected function getClassMethods($class) - { - // Get a reflection class. - $classReflection = new \ReflectionClass($class); - $methods = $classReflection->getMethods(); - - $metaData = []; - $methodData = []; - - foreach ($methods as $method) { - $methodData['name'] = $method->getName(); - - $filename = $method->getFileName(); - $source = file($filename); - $startLine = $method->getStartLine(); - - $methodData['declaration'] = substr(trim($source[$startLine - 1]), 0, -1); - - $methodDocComment = explode("\n", $method->getDocComment()); - foreach ($methodDocComment as $line) { - if (substr($line, 0, 5) == ' * ') { - $methodData['description'] = substr($line, 5); - break; - } - } - - $metaData[$method->getName()] = $methodData; - } - - return $metaData; - } - - /** - * Get the list of properties from an annotation class. - * - * @param $pluginAnnotationClass - * The fully-qualified name of the plugin annotation class. - * - * @return - * An array keyed by property name, where each value is an array containing: - * - 'name: The name of the property. - * - 'description': The description from the property's docblock first line. - */ - protected function getPluginAnnotationProperties($pluginAnnotationClass) - { - // Get a reflection class for the annotation class. - // Each property of the annotation class describes a property for the - // plugin annotation. - $annotationReflection = new \ReflectionClass($pluginAnnotationClass); - $propertiesReflection = $annotationReflection->getProperties(\ReflectionProperty::IS_PUBLIC); - - $pluginProperties = []; - $annotationPropertyMetadata = []; - - foreach ($propertiesReflection as $propertyReflection) { - $annotationPropertyMetadata['name'] = $propertyReflection->name; - - $propertyDocblock = $propertyReflection->getDocComment(); - $propertyDocblockLines = explode("\n", $propertyDocblock); - foreach ($propertyDocblockLines as $line) { - if (substr($line, 0, 3) == '/**') { - continue; - } - - // Take the first actual docblock line to be the description. - if (!isset($annotationPropertyMetadata['description']) && substr($line, 0, 5) == ' * ') { - $annotationPropertyMetadata['description'] = substr($line, 5); - } - - // Look for a @var token, to tell us the type of the property. - if (substr($line, 0, 10) == ' * @var ') { - $annotationPropertyMetadata['type'] = substr($line, 10); - } - } - - $pluginProperties[$propertyReflection->name] = $annotationPropertyMetadata; - } - - return $pluginProperties; - } - - protected function getPlugins() - { - $plugins = []; - - foreach ($this->container->getServiceIds() as $serviceId) { - if (strpos($serviceId, 'plugin.manager.') === 0) { - $plugins[] = substr($serviceId, 15); - } - } - - return $plugins; - } -} diff --git a/src/Command/Generate/PluginTypeAnnotationCommand.php b/src/Command/Generate/PluginTypeAnnotationCommand.php deleted file mode 100644 index 93bd76d82..000000000 --- a/src/Command/Generate/PluginTypeAnnotationCommand.php +++ /dev/null @@ -1,153 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->stringConverter = $stringConverter; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('generate:plugin:type:annotation') - ->setDescription($this->trans('commands.generate.plugin.type.annotation.description')) - ->setHelp($this->trans('commands.generate.plugin.type.annotation.help')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) - ->addOption( - 'class', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.type.annotation.options.class') - ) - ->addOption( - 'machine-name', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.type.annotation.options.plugin-id') - ) - ->addOption( - 'label', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.type.annotation.options.label') - ) - ->setAliases(['gpta']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $module = $input->getOption('module'); - $class_name = $input->getOption('class'); - $machine_name = $input->getOption('machine-name'); - $label = $input->getOption('label'); - - $this->generator->generate($module, $class_name, $machine_name, $label); - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --class option - $class_name = $input->getOption('class'); - if (!$class_name) { - $class_name = $io->ask( - $this->trans('commands.generate.plugin.type.annotation.options.class'), - 'ExamplePlugin' - ); - $input->setOption('class', $class_name); - } - - // --machine-name option - $machine_name = $input->getOption('machine-name'); - if (!$machine_name) { - $machine_name = $io->ask( - $this->trans('commands.generate.plugin.type.annotation.options.machine-name'), - $this->stringConverter->camelCaseToUnderscore($class_name) - ); - $input->setOption('machine-name', $machine_name); - } - - // --label option - $label = $input->getOption('label'); - if (!$label) { - $label = $io->ask( - $this->trans('commands.generate.plugin.type.annotation.options.label'), - $this->stringConverter->camelCaseToHuman($class_name) - ); - $input->setOption('label', $label); - } - } -} diff --git a/src/Command/Generate/PluginTypeYamlCommand.php b/src/Command/Generate/PluginTypeYamlCommand.php deleted file mode 100644 index 3674b6ec4..000000000 --- a/src/Command/Generate/PluginTypeYamlCommand.php +++ /dev/null @@ -1,154 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->stringConverter = $stringConverter; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('generate:plugin:type:yaml') - ->setDescription($this->trans('commands.generate.plugin.type.yaml.description')) - ->setHelp($this->trans('commands.generate.plugin.type.yaml.help')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) - ->addOption( - 'class', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.type.yaml.options.class') - ) - ->addOption( - 'plugin-name', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.type.yaml.options.plugin-name') - ) - ->addOption( - 'plugin-file-name', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.type.yaml.options.plugin-file-name') - ) - ->setAliases(['gpty']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $module = $input->getOption('module'); - $class_name = $input->getOption('class'); - $plugin_name = $input->getOption('plugin-name'); - $plugin_file_name = $input->getOption('plugin-file-name'); - - $this->generator->generate($module, $class_name, $plugin_name, $plugin_file_name); - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --class option - $class_name = $input->getOption('class'); - if (!$class_name) { - $class_name = $io->ask( - $this->trans('commands.generate.plugin.type.yaml.options.class'), - 'ExamplePlugin' - ); - $input->setOption('class', $class_name); - } - - // --plugin-name option - $plugin_name = $input->getOption('plugin-name'); - if (!$plugin_name) { - $plugin_name = $io->ask( - $this->trans('commands.generate.plugin.type.yaml.options.plugin-name'), - $this->stringConverter->camelCaseToUnderscore($class_name) - ); - $input->setOption('plugin-name', $plugin_name); - } - - // --plugin-file-name option - $plugin_file_name = $input->getOption('plugin-file-name'); - if (!$plugin_file_name) { - $plugin_file_name = $io->ask( - $this->trans('commands.generate.plugin.type.yaml.options.plugin-file-name'), - strtr($plugin_name, '_-', '..') - ); - $input->setOption('plugin-file-name', $plugin_file_name); - } - } -} diff --git a/src/Command/Generate/PluginViewsFieldCommand.php b/src/Command/Generate/PluginViewsFieldCommand.php deleted file mode 100644 index b91b08ad8..000000000 --- a/src/Command/Generate/PluginViewsFieldCommand.php +++ /dev/null @@ -1,185 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->site = $site; - $this->stringConverter = $stringConverter; - $this->chainQueue = $chainQueue; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('generate:plugin:views:field') - ->setDescription($this->trans('commands.generate.plugin.views.field.description')) - ->setHelp($this->trans('commands.generate.plugin.views.field.help')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) - ->addOption( - 'class', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.plugin.views.field.options.class') - ) - ->addOption( - 'title', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.views.field.options.title') - ) - ->addOption( - 'description', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.views.field.options.description') - ) - ->setAliases(['gpvf']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $class_name = $input->getOption('class'); - $class_machine_name = $this->stringConverter->camelCaseToUnderscore($class_name); - $title = $input->getOption('title'); - $description = $input->getOption('description'); - - $this->generator->generate($module, $class_machine_name, $class_name, $title, $description); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); - - return 0; - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --class option - $class_name = $input->getOption('class'); - if (!$class_name) { - $class_name = $io->ask( - $this->trans('commands.generate.plugin.views.field.questions.class'), - 'CustomViewsField' - ); - } - $input->setOption('class', $class_name); - - // --title option - $title = $input->getOption('title'); - if (!$title) { - $title = $io->ask( - $this->trans('commands.generate.plugin.views.field.questions.title'), - $this->stringConverter->camelCaseToHuman($class_name) - ); - $input->setOption('title', $title); - } - - // --description option - $description = $input->getOption('description'); - if (!$description) { - $description = $io->ask( - $this->trans('commands.generate.plugin.views.field.questions.description'), - $this->trans('commands.generate.plugin.views.field.questions.description_default') - ); - $input->setOption('description', $description); - } - } - - protected function createGenerator() - { - return new PluginViewsFieldGenerator(); - } -} diff --git a/src/Command/Generate/PostUpdateCommand.php b/src/Command/Generate/PostUpdateCommand.php deleted file mode 100644 index 180a70c0d..000000000 --- a/src/Command/Generate/PostUpdateCommand.php +++ /dev/null @@ -1,198 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->site = $site; - $this->validator = $validator; - $this->chainQueue = $chainQueue; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('generate:post:update') - ->setDescription($this->trans('commands.generate.post:update.description')) - ->setHelp($this->trans('commands.generate.post.update.help')) - ->addOption( - 'module', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.common.options.module') - ) - ->addOption( - 'post-update-name', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.post.update.options.post-update-name') - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $postUpdateName = $input->getOption('post-update-name'); - - $this->validatePostUpdateName($module, $postUpdateName); - - $this->generator->generate($module, $postUpdateName); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); - - return 0; - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $this->site->loadLegacyFile('/core/includes/update.inc'); - $this->site->loadLegacyFile('/core/includes/schema.inc'); - - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - $postUpdateName = $input->getOption('post-update-name'); - if (!$postUpdateName) { - $postUpdateName = $io->ask( - $this->trans('commands.generate.post.update.questions.post-update-name'), - '', - function ($postUpdateName) { - return $this->validator->validateSpaces($postUpdateName); - } - ); - - $input->setOption('post-update-name', $postUpdateName); - } - } - - - protected function createGenerator() - { - return new PostUpdateGenerator(); - } - - protected function getLastUpdate($module) - { - $this->site->loadLegacyFile('/core/includes/update.inc'); - $this->site->loadLegacyFile('/core/includes/schema.inc'); - - $updates = update_get_update_list(); - - if (empty($updates[$module]['pending'])) { - $lastUpdateSchema = drupal_get_schema_versions($module); - } else { - $lastUpdateSchema = reset(array_keys($updates[$module]['pending'], max($updates[$module]['pending']))); - } - - return $lastUpdateSchema; - } - - protected function validatePostUpdateName($module, $postUpdateName) - { - if (!$this->validator->validateSpaces($postUpdateName)) { - throw new \InvalidArgumentException( - sprintf( - $this->trans('commands.generate.post.update.messages.wrong-post-update-name'), - $postUpdateName - ) - ); - } - - if ($this->extensionManager->validateModuleFunctionExist($module, $module . '_post_update_' . $postUpdateName, $module . '.post_update.php')) { - throw new \InvalidArgumentException( - sprintf( - $this->trans('commands.generate.post.update.messages.post-update-name-already-implemented'), - $postUpdateName - ) - ); - } - } -} diff --git a/src/Command/Generate/ProfileCommand.php b/src/Command/Generate/ProfileCommand.php deleted file mode 100644 index 5dfbe1509..000000000 --- a/src/Command/Generate/ProfileCommand.php +++ /dev/null @@ -1,270 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->stringConverter = $stringConverter; - $this->validator = $validator; - $this->appRoot = $appRoot; - parent::__construct(); - } - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName('generate:profile') - ->setDescription($this->trans('commands.generate.profile.description')) - ->setHelp($this->trans('commands.generate.profile.help')) - ->addOption( - 'profile', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.profile.options.profile') - ) - ->addOption( - 'machine-name', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.profile.options.machine-name') - ) - ->addOption( - 'description', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.profile.options.description') - ) - ->addOption( - 'core', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.profile.options.core') - ) - ->addOption( - 'dependencies', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.profile.options.dependencies'), - '' - ) - ->addOption( - 'themes', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.profile.options.themes'), - '' - ) - ->addOption( - 'distribution', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.profile.options.distribution') - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - if (!$this->confirmGeneration($io)) { - return 1; - } - - $profile = $this->validator->validateModuleName($input->getOption('profile')); - $machine_name = $this->validator->validateMachineName($input->getOption('machine-name')); - $description = $input->getOption('description'); - $core = $input->getOption('core'); - $dependencies = $this->validator->validateExtensions($input->getOption('dependencies'), 'module', $io); - $themes = $this->validator->validateExtensions($input->getOption('themes'), 'theme', $io); - $distribution = $input->getOption('distribution'); - $profile_path = $this->appRoot . '/profiles'; - - $this->generator->generate( - $profile, - $machine_name, - $profile_path, - $description, - $core, - $dependencies, - $themes, - $distribution - ); - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - //$stringUtils = $this->getStringHelper(); - $validators = $this->validator; - - try { - // A profile is technically also a module, so we can use the same - // validator to check the name. - $profile = $input->getOption('profile') ? $validators->validateModuleName($input->getOption('profile')) : null; - } catch (\Exception $error) { - $io->error($error->getMessage()); - - return 1; - } - - if (!$profile) { - $profile = $io->ask( - $this->trans('commands.generate.profile.questions.profile'), - '', - function ($profile) use ($validators) { - return $validators->validateModuleName($profile); - } - ); - $input->setOption('profile', $profile); - } - - try { - $machine_name = $input->getOption('machine-name') ? $validators->validateModuleName($input->getOption('machine-name')) : null; - } catch (\Exception $error) { - $io->error($error->getMessage()); - - return 1; - } - - if (!$machine_name) { - $machine_name = $io->ask( - $this->trans('commands.generate.profile.questions.machine-name'), - $this->stringConverter->createMachineName($profile), - function ($machine_name) use ($validators) { - return $validators->validateMachineName($machine_name); - } - ); - $input->setOption('machine-name', $machine_name); - } - - $description = $input->getOption('description'); - if (!$description) { - $description = $io->ask( - $this->trans('commands.generate.profile.questions.description'), - 'My Useful Profile' - ); - $input->setOption('description', $description); - } - - $core = $input->getOption('core'); - if (!$core) { - $core = $io->ask( - $this->trans('commands.generate.profile.questions.core'), - '8.x' - ); - $input->setOption('core', $core); - } - - $dependencies = $input->getOption('dependencies'); - if (!$dependencies) { - if ($io->confirm( - $this->trans('commands.generate.profile.questions.dependencies'), - true - ) - ) { - $dependencies = $io->ask( - $this->trans('commands.generate.profile.options.dependencies'), - '' - ); - } - $input->setOption('dependencies', $dependencies); - } - - $distribution = $input->getOption('distribution'); - if (!$distribution) { - if ($io->confirm( - $this->trans('commands.generate.profile.questions.distribution'), - false - ) - ) { - $distribution = $io->ask( - $this->trans('commands.generate.profile.options.distribution'), - 'My Kick-ass Distribution' - ); - $input->setOption('distribution', $distribution); - } - } - } - - /** - * @return ProfileGenerator - */ - protected function createGenerator() - { - return new ProfileGenerator(); - } -} diff --git a/src/Command/Generate/RouteSubscriberCommand.php b/src/Command/Generate/RouteSubscriberCommand.php deleted file mode 100644 index 1085ea469..000000000 --- a/src/Command/Generate/RouteSubscriberCommand.php +++ /dev/null @@ -1,158 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->chainQueue = $chainQueue; - parent::__construct(); - } - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName('generate:routesubscriber') - ->setDescription($this->trans('commands.generate.routesubscriber.description')) - ->setHelp($this->trans('commands.generate.routesubscriber.description')) - ->addOption( - 'module', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.common.options.module') - ) - ->addOption( - 'name', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.routesubscriber.options.name') - ) - ->addOption( - 'class', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.routesubscriber.options.class') - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $output = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($output)) { - return 1; - } - - $module = $input->getOption('module'); - $name = $input->getOption('name'); - $class = $input->getOption('class'); - - $this->generator->generate($module, $name, $class); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); - - return 0; - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --name option - $name = $input->getOption('name'); - if (!$name) { - $name = $io->ask( - $this->trans('commands.generate.routesubscriber.questions.name'), - $module.'.route_subscriber' - ); - $input->setOption('name', $name); - } - - // --class option - $class = $input->getOption('class'); - if (!$class) { - $class = $io->ask( - $this->trans('commands.generate.routesubscriber.questions.class'), - 'RouteSubscriber' - ); - $input->setOption('class', $class); - } - } - - protected function createGenerator() - { - return new RouteSubscriberGenerator(); - } -} diff --git a/src/Command/Generate/ServiceCommand.php b/src/Command/Generate/ServiceCommand.php deleted file mode 100644 index 859bcfe1b..000000000 --- a/src/Command/Generate/ServiceCommand.php +++ /dev/null @@ -1,244 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->stringConverter = $stringConverter; - $this->chainQueue = $chainQueue; - parent::__construct(); - } - - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName('generate:service') - ->setDescription($this->trans('commands.generate.service.description')) - ->setHelp($this->trans('commands.generate.service.description')) - ->addOption( - 'module', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.common.options.module') - ) - ->addOption( - 'name', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.service.options.name') - ) - ->addOption( - 'class', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.service.options.class') - ) - ->addOption( - 'interface', - null, - InputOption::VALUE_NONE, - $this->trans('commands.common.service.options.interface') - ) - ->addOption( - 'interface-name', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.common.service.options.interface-name') - ) - ->addOption( - 'services', - null, - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.common.options.services') - ) - ->addOption( - 'path-service', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.service.options.path') - ) - ->setAliases(['gs']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $name = $input->getOption('name'); - $class = $input->getOption('class'); - $interface = $input->getOption('interface'); - $interface_name = $input->getOption('interface-name'); - $services = $input->getOption('services'); - $path_service = $input->getOption('path-service'); - - $available_services = $this->container->getServiceIds(); - - if (in_array($name, array_values($available_services))) { - throw new \Exception( - sprintf( - $this->trans('commands.generate.service.messages.service-already-taken'), - $module - ) - ); - } - - // @see Drupal\Console\Command\Shared\ServicesTrait::buildServices - $build_services = $this->buildServices($services); - $this->generator->generate($module, $name, $class, $interface, $interface_name, $build_services, $path_service); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); - - return 0; - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - //--name option - $name = $input->getOption('name'); - if (!$name) { - $name = $io->ask( - $this->trans('commands.generate.service.questions.service-name'), - $module.'.default' - ); - $input->setOption('name', $name); - } - - // --class option - $class = $input->getOption('class'); - if (!$class) { - $class = $io->ask( - $this->trans('commands.generate.service.questions.class'), - 'DefaultService' - ); - $input->setOption('class', $class); - } - - // --interface option - $interface = $input->getOption('interface'); - if (!$interface) { - $interface = $io->confirm( - $this->trans('commands.generate.service.questions.interface'), - true - ); - $input->setOption('interface', $interface); - } - - // --interface_name option - $interface_name = $input->getOption('interface-name'); - if ($interface && !$interface_name) { - $interface_name = $io->askEmpty( - $this->trans('commands.generate.service.questions.interface-name') - ); - $input->setOption('interface-name', $interface_name); - } - - // --services option - $services = $input->getOption('services'); - if (!$services) { - // @see Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion - $services = $this->servicesQuestion($io); - $input->setOption('services', $services); - } - - // --path_service option - $path_service = $input->getOption('path-service'); - if (!$path_service) { - $path_service = $io->ask( - $this->trans('commands.generate.service.questions.path'), - '/modules/custom/' . $module . '/src/' - ); - $input->setOption('path-service', $path_service); - } - } -} diff --git a/src/Command/Generate/ThemeCommand.php b/src/Command/Generate/ThemeCommand.php deleted file mode 100644 index 8c598baf2..000000000 --- a/src/Command/Generate/ThemeCommand.php +++ /dev/null @@ -1,383 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->validator = $validator; - $this->appRoot = $appRoot; - $this->themeHandler = $themeHandler; - $this->site = $site; - $this->stringConverter = $stringConverter; - parent::__construct(); - } - - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName('generate:theme') - ->setDescription($this->trans('commands.generate.theme.description')) - ->setHelp($this->trans('commands.generate.theme.help')) - ->addOption( - 'theme', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.theme.options.module') - ) - ->addOption( - 'machine-name', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.theme.options.machine-name') - ) - ->addOption( - 'theme-path', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.theme.options.module-path') - ) - ->addOption( - 'description', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.theme.options.description') - ) - ->addOption('core', null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.theme.options.core')) - ->addOption( - 'package', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.theme.options.package') - ) - ->addOption( - 'global-library', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.theme.options.global-library') - ) - ->addOption( - 'libraries', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.theme.options.libraries') - ) - ->addOption( - 'base-theme', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.theme.options.base-theme') - ) - ->addOption( - 'regions', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.theme.options.regions') - ) - ->addOption( - 'breakpoints', - null, - InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.theme.options.breakpoints') - ) - ->setAliases(['gt']); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $theme = $this->validator->validateModuleName($input->getOption('theme')); - $theme_path = $this->appRoot . $input->getOption('theme-path'); - $theme_path = $this->validator->validateModulePath($theme_path, true); - - $machine_name = $this->validator->validateMachineName($input->getOption('machine-name')); - $description = $input->getOption('description'); - $core = $input->getOption('core'); - $package = $input->getOption('package'); - $base_theme = $input->getOption('base-theme'); - $global_library = $input->getOption('global-library'); - $libraries = $input->getOption('libraries'); - $regions = $input->getOption('regions'); - $breakpoints = $input->getOption('breakpoints'); - - $this->generator->generate( - $theme, - $machine_name, - $theme_path, - $description, - $core, - $package, - $base_theme, - $global_library, - $libraries, - $regions, - $breakpoints - ); - - return 0; - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - try { - $theme = $input->getOption('theme') ? $this->validator->validateModuleName($input->getOption('theme')) : null; - } catch (\Exception $error) { - $io->error($error->getMessage()); - - return 1; - } - - if (!$theme) { - $validators = $this->validator; - $theme = $io->ask( - $this->trans('commands.generate.theme.questions.theme'), - '', - function ($theme) use ($validators) { - return $validators->validateModuleName($theme); - } - ); - $input->setOption('theme', $theme); - } - - try { - $machine_name = $input->getOption('machine-name') ? $this->validator->validateModule($input->getOption('machine-name')) : null; - } catch (\Exception $error) { - $io->error($error->getMessage()); - - return 1; - } - - if (!$machine_name) { - $machine_name = $io->ask( - $this->trans('commands.generate.theme.questions.machine-name'), - $this->stringConverter->createMachineName($theme), - function ($machine_name) use ($validators) { - return $validators->validateMachineName($machine_name); - } - ); - $input->setOption('machine-name', $machine_name); - } - - $theme_path = $input->getOption('theme-path'); - if (!$theme_path) { - $drupalRoot = $this->appRoot; - $theme_path = $io->ask( - $this->trans('commands.generate.theme.questions.theme-path'), - '/themes/custom', - function ($theme_path) use ($drupalRoot, $machine_name) { - $theme_path = ($theme_path[0] != '/' ? '/' : '') . $theme_path; - $full_path = $drupalRoot . $theme_path . '/' . $machine_name; - if (file_exists($full_path)) { - throw new \InvalidArgumentException( - sprintf( - $this->trans('commands.generate.theme.errors.directory-exists'), - $full_path - ) - ); - } else { - return $theme_path; - } - } - ); - $input->setOption('theme-path', $theme_path); - } - - $description = $input->getOption('description'); - if (!$description) { - $description = $io->ask( - $this->trans('commands.generate.theme.questions.description'), - 'My Awesome theme' - ); - $input->setOption('description', $description); - } - - $package = $input->getOption('package'); - if (!$package) { - $package = $io->ask( - $this->trans('commands.generate.theme.questions.package'), - 'Other' - ); - $input->setOption('package', $package); - } - - $core = $input->getOption('core'); - if (!$core) { - $core = $io->ask( - $this->trans('commands.generate.theme.questions.core'), - '8.x' - ); - $input->setOption('core', $core); - } - - $base_theme = $input->getOption('base-theme'); - if (!$base_theme) { - $themes = $this->themeHandler->rebuildThemeData(); - $themes['false'] =''; - - uasort($themes, 'system_sort_modules_by_info_name'); - - $base_theme = $io->choiceNoList( - $this->trans('commands.generate.theme.options.base-theme'), - array_keys($themes) - ); - $input->setOption('base-theme', $base_theme); - } - - $global_library = $input->getOption('global-library'); - if (!$global_library) { - $global_library = $io->ask( - $this->trans('commands.generate.theme.questions.global-library'), - 'global-styling' - ); - $input->setOption('global-library', $global_library); - } - - - // --libraries option. - $libraries = $input->getOption('libraries'); - if (!$libraries) { - if ($io->confirm( - $this->trans('commands.generate.theme.questions.library-add'), - true - ) - ) { - // @see \Drupal\Console\Command\Shared\ThemeRegionTrait::libraryQuestion - $libraries = $this->libraryQuestion($io); - $input->setOption('libraries', $libraries); - } - } - - // --regions option. - $regions = $input->getOption('regions'); - if (!$regions) { - if ($io->confirm( - $this->trans('commands.generate.theme.questions.regions'), - true - ) - ) { - // @see \Drupal\Console\Command\Shared\ThemeRegionTrait::regionQuestion - $regions = $this->regionQuestion($io); - $input->setOption('regions', $regions); - } - } - - // --breakpoints option. - $breakpoints = $input->getOption('breakpoints'); - if (!$breakpoints) { - if ($io->confirm( - $this->trans('commands.generate.theme.questions.breakpoints'), - true - ) - ) { - // @see \Drupal\Console\Command\Shared\ThemeRegionTrait::regionQuestion - $breakpoints = $this->breakpointQuestion($io); - $input->setOption('breakpoints', $breakpoints); - } - } - } -} diff --git a/src/Command/Generate/TwigExtensionCommand.php b/src/Command/Generate/TwigExtensionCommand.php deleted file mode 100644 index 182f408b8..000000000 --- a/src/Command/Generate/TwigExtensionCommand.php +++ /dev/null @@ -1,192 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->site = $site; - $this->stringConverter = $stringConverter; - $this->chainQueue = $chainQueue; - parent::__construct(); - } - - /** - * {@inheritdoc} - */ - protected function configure() - { - $this - ->setName('generate:twig:extension') - ->setDescription($this->trans('commands.generate.twig.extension.description')) - ->setHelp($this->trans('commands.generate.twig.extension.help')) - ->addOption( - 'module', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.common.options.module') - ) - ->addOption( - 'name', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.twig.extension.options.name') - ) - ->addOption( - 'class', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.common.options.class') - ) - ->addOption( - 'services', - null, - InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - $this->trans('commands.common.options.services') - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $name = $input->getOption('name'); - $class = $input->getOption('class'); - $services = $input->getOption('services'); - // Add renderer service as first parameter. - array_unshift($services, 'renderer'); - - // @see Drupal\Console\Command\Shared\ServicesTrait::buildServices - $build_services = $this->buildServices($services); - - $this->generator->generate($module, $name, $class, $build_services); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); - - return 0; - } - - /** - * {@inheritdoc} - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // --module option - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - // --name option - $name = $input->getOption('name'); - if (!$name) { - $name = $io->ask( - $this->trans('commands.generate.twig.extension.questions.twig-extension'), - $module.'.twig.extension' - ); - $input->setOption('name', $name); - } - - // --class option - $class = $input->getOption('class'); - if (!$class) { - $class = $io->ask( - $this->trans('commands.common.options.class'), - 'DefaultTwigExtension' - ); - $input->setOption('class', $class); - } - - // --services option - $services = $input->getOption('services'); - if (!$services) { - // @see Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion - $services = $this->servicesQuestion($io); - $input->setOption('services', $services); - } - } -} diff --git a/src/Command/Generate/UpdateCommand.php b/src/Command/Generate/UpdateCommand.php deleted file mode 100644 index 923970a7e..000000000 --- a/src/Command/Generate/UpdateCommand.php +++ /dev/null @@ -1,199 +0,0 @@ -extensionManager = $extensionManager; - $this->generator = $generator; - $this->site = $site; - $this->chainQueue = $chainQueue; - parent::__construct(); - } - - protected function configure() - { - $this - ->setName('generate:update') - ->setDescription($this->trans('commands.generate.update.description')) - ->setHelp($this->trans('commands.generate.update.help')) - ->addOption( - 'module', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.common.options.module') - ) - ->addOption( - 'update-n', - null, - InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.update.options.update-n') - ); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io)) { - return 1; - } - - $module = $input->getOption('module'); - $updateNumber = $input->getOption('update-n'); - - $lastUpdateSchema = $this->getLastUpdate($module); - - if ($updateNumber <= $lastUpdateSchema) { - throw new \InvalidArgumentException( - sprintf( - $this->trans('commands.generate.update.messages.wrong-update-n'), - $updateNumber - ) - ); - } - - $this->generator->generate($module, $updateNumber); - - $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); - - return 0; - } - - protected function interact(InputInterface $input, OutputInterface $output) - { - $io = new DrupalStyle($input, $output); - - $this->site->loadLegacyFile('/core/includes/update.inc'); - $this->site->loadLegacyFile('/core/includes/schema.inc'); - - $module = $input->getOption('module'); - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setOption('module', $module); - } - - $lastUpdateSchema = $this->getLastUpdate($module); - $nextUpdateSchema = $lastUpdateSchema ? ($lastUpdateSchema + 1): 8001; - - $updateNumber = $input->getOption('update-n'); - if (!$updateNumber) { - $updateNumber = $io->ask( - $this->trans('commands.generate.update.questions.update-n'), - $nextUpdateSchema, - function ($updateNumber) use ($lastUpdateSchema) { - if (!is_numeric($updateNumber)) { - throw new \InvalidArgumentException( - sprintf( - $this->trans('commands.generate.update.messages.wrong-update-n'), - $updateNumber - ) - ); - } else { - if ($updateNumber <= $lastUpdateSchema) { - throw new \InvalidArgumentException( - sprintf( - $this->trans('commands.generate.update.messages.wrong-update-n'), - $updateNumber - ) - ); - } - return $updateNumber; - } - } - ); - - $input->setOption('update-n', $updateNumber); - } - } - - - protected function createGenerator() - { - return new UpdateGenerator(); - } - - protected function getLastUpdate($module) - { - $this->site->loadLegacyFile('/core/includes/update.inc'); - $this->site->loadLegacyFile('/core/includes/schema.inc'); - - $updates = update_get_update_list(); - - if (empty($updates[$module]['pending'])) { - $lastUpdateSchema = drupal_get_schema_versions($module); - $lastUpdateSchema = $lastUpdateSchema[0]; - } else { - $lastUpdateSchema = reset(array_keys($updates[$module]['pending'], max($updates[$module]['pending']))); - } - - return $lastUpdateSchema; - } -} diff --git a/src/Generator/AuthenticationProviderGenerator.php b/src/Generator/AuthenticationProviderGenerator.php deleted file mode 100644 index 4fd53df28..000000000 --- a/src/Generator/AuthenticationProviderGenerator.php +++ /dev/null @@ -1,75 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator Plugin Block. - * - * @param $module - * @param $class - * @param $provider_id - */ - public function generate($module, $class, $provider_id) - { - $parameters = [ - 'module' => $module, - 'class' => $class, - ]; - - $this->renderFile( - 'module/src/Authentication/Provider/authentication-provider.php.twig', - $this->extensionManager->getModule($module)->getAuthenticationPath('Provider'). '/' . $class . '.php', - $parameters - ); - - $parameters = [ - 'module' => $module, - 'class' => $class, - 'class_path' => sprintf('Drupal\%s\Authentication\Provider\%s', $module, $class), - 'name' => 'authentication.'.$module, - 'services' => [ - ['name' => 'config.factory'], - ['name' => 'entity_type.manager'], - ], - 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'), - 'tags' => [ - 'name' => 'authentication_provider', - 'provider_id' => $provider_id, - 'priority' => '100', - ], - ]; - - $this->renderFile( - 'module/services.yml.twig', - $this->extensionManager->getModule($module)->getPath() . '/' . $module . '.services.yml', - $parameters, - FILE_APPEND - ); - } -} diff --git a/src/Generator/BreakPointGenerator.php b/src/Generator/BreakPointGenerator.php deleted file mode 100644 index 7e91e0e35..000000000 --- a/src/Generator/BreakPointGenerator.php +++ /dev/null @@ -1,61 +0,0 @@ -extensionManager = $extensionManager; - } - - - /** - * Generator BreakPoint. - * - * @param $theme - * @param $breakpoints - * @param $machine_name - */ - public function generate($theme, $breakpoints, $machine_name) - { - $parameters = [ - 'theme' => $theme, - 'breakpoints' => $breakpoints, - 'machine_name' => $machine_name - ]; - - $theme_path = $this->extensionManager->getTheme($theme)->getPath(); - - $this->renderFile( - 'theme/breakpoints.yml.twig', - $theme_path .'/'.$machine_name.'.breakpoints.yml', - $parameters, - FILE_APPEND - ); - } -} diff --git a/src/Generator/CacheContextGenerator.php b/src/Generator/CacheContextGenerator.php deleted file mode 100644 index da87ee974..000000000 --- a/src/Generator/CacheContextGenerator.php +++ /dev/null @@ -1,64 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator Service. - * - * @param string $module Module name - * @param string $cache_context Cache context name - * @param string $class Class name - * @param array $services List of services - */ - public function generate($module, $cache_context, $class, $services) - { - $parameters = [ - 'module' => $module, - 'name' => 'cache_context.' . $cache_context, - 'class' => $class, - 'services' => $services, - 'class_path' => sprintf('Drupal\%s\CacheContext\%s', $module, $class), - 'tags' => ['name' => 'cache.context'], - 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'), - ]; - - $this->renderFile( - 'module/src/cache-context.php.twig', - $this->extensionManager->getModule($module)->getSourcePath().'/CacheContext/'.$class.'.php', - $parameters - ); - - $this->renderFile( - 'module/services.yml.twig', - $this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml', - $parameters, - FILE_APPEND - ); - } -} diff --git a/src/Generator/CommandGenerator.php b/src/Generator/CommandGenerator.php deleted file mode 100644 index ff01bd572..000000000 --- a/src/Generator/CommandGenerator.php +++ /dev/null @@ -1,94 +0,0 @@ -extensionManager = $extensionManager; - $this->translatorManager = $translatorManager; - } - - /** - * Generate. - * - * @param string $extension Extension name - * @param string $extensionType Extension type - * @param string $name Command name - * @param string $class Class name - * @param boolean $containerAware Container Aware command - * @param array $services Services array - */ - public function generate($extension, $extensionType, $name, $class, $containerAware, $services) - { - $command_key = str_replace(':', '.', $name); - - $extensionObject = $this->extensionManager->getDrupalExtension($extensionType, $extension); - - $parameters = [ - 'extension' => $extension, - 'extensionType' => $extensionType, - 'name' => $name, - 'class_name' => $class, - 'container_aware' => $containerAware, - 'command_key' => $command_key, - 'services' => $services, - 'tags' => ['name' => 'drupal.command'], - 'class_path' => sprintf('Drupal\%s\Command\%s', $extension, $class), - 'file_exists' => file_exists($extensionObject->getPath().'/console.services.yml'), - ]; - - $this->renderFile( - 'module/src/Command/command.php.twig', - $extensionObject->getCommandDirectory().$class.'.php', - $parameters - ); - - $parameters['name'] = $extension.'.'.str_replace(':', '_', $name); - - $this->renderFile( - 'module/services.yml.twig', - $extensionObject->getPath() .'/console.services.yml', - $parameters, - FILE_APPEND - ); - - $this->renderFile( - 'module/src/Command/console/translations/en/command.yml.twig', - $extensionObject->getPath().'/console/translations/en/'.$command_key.'.yml' - ); - } -} diff --git a/src/Generator/ControllerGenerator.php b/src/Generator/ControllerGenerator.php deleted file mode 100644 index bb95974d8..000000000 --- a/src/Generator/ControllerGenerator.php +++ /dev/null @@ -1,62 +0,0 @@ -extensionManager = $extensionManager; - } - - public function generate($module, $class, $routes, $test, $services) - { - $parameters = [ - 'class_name' => $class, - 'services' => $services, - 'module' => $module, - 'routes' => $routes, - //'learning' => $this->isLearning(), - ]; - - $this->renderFile( - 'module/src/Controller/controller.php.twig', - $this->extensionManager->getModule($module)->getControllerPath().'/'.$class.'.php', - $parameters - ); - - $this->renderFile( - 'module/routing-controller.yml.twig', - $this->extensionManager->getModule($module)->getPath().'/'.$module.'.routing.yml', - $parameters, - FILE_APPEND - ); - - if ($test) { - $this->renderFile( - 'module/Tests/Controller/controller.php.twig', - $this->extensionManager->getModule($module)->getTestPath('Controller').'/'.$class.'Test.php', - $parameters - ); - } - } -} diff --git a/src/Generator/EntityBundleGenerator.php b/src/Generator/EntityBundleGenerator.php deleted file mode 100644 index 18e6ac6c5..000000000 --- a/src/Generator/EntityBundleGenerator.php +++ /dev/null @@ -1,86 +0,0 @@ -extensionManager = $extensionManager; - } - - public function generate($module, $bundleName, $bundleTitle) - { - $parameters = [ - 'module' => $module, - 'bundle_name' => $bundleName, - 'bundle_title' => $bundleTitle, - //TODO: - //'learning' => $this->isLearning(), - ]; - - /** - * Generate core.entity_form_display.node.{ bundle_name }.default.yml - */ - $this->renderFile( - 'module/src/Entity/Bundle/core.entity_form_display.node.default.yml.twig', - $this->extensionManager->getModule($module)->getPath() . '/config/install/core.entity_form_display.node.' . $bundleName . '.default.yml', - $parameters - ); - - /** - * Generate core.entity_view_display.node.{ bundle_name }.default.yml - */ - $this->renderFile( - 'module/src/Entity/Bundle/core.entity_view_display.node.default.yml.twig', - $this->extensionManager->getModule($module)->getPath() . '/config/install/core.entity_view_display.node.' . $bundleName . '.default.yml', - $parameters - ); - - /** - * Generate core.entity_view_display.node.{ bundle_name }.teaser.yml - */ - $this->renderFile( - 'module/src/Entity/Bundle/core.entity_view_display.node.teaser.yml.twig', - $this->extensionManager->getModule($module)->getPath() . '/config/install/core.entity_view_display.node.' . $bundleName . '.teaser.yml', - $parameters - ); - - /** - * Generate field.field.node.{ bundle_name }.body.yml - */ - $this->renderFile( - 'module/src/Entity/Bundle/field.field.node.body.yml.twig', - $this->extensionManager->getModule($module)->getPath() . '/config/install/field.field.node.' . $bundleName . '.body.yml', - $parameters - ); - - /** - * Generate node.type.{ bundle_name }.yml - */ - $this->renderFile( - 'module/src/Entity/Bundle/node.type.yml.twig', - $this->extensionManager->getModule($module)->getPath() . '/config/install/node.type.' . $bundleName . '.yml', - $parameters - ); - } -} diff --git a/src/Generator/EntityConfigGenerator.php b/src/Generator/EntityConfigGenerator.php deleted file mode 100644 index 3a4f752b2..000000000 --- a/src/Generator/EntityConfigGenerator.php +++ /dev/null @@ -1,109 +0,0 @@ -extensionManager = $extensionManager; - } - - - /** - * Generator Entity. - * - * @param string $module Module name - * @param string $entity_name Entity machine name - * @param string $entity_class Entity class name - * @param string $label Entity label - * @param string $base_path Base path - * @param string $bundle_of Entity machine name of the content entity this config entity acts as a bundle for. - */ - public function generate($module, $entity_name, $entity_class, $label, $base_path, $bundle_of = null) - { - $parameters = [ - 'module' => $module, - 'entity_name' => $entity_name, - 'entity_class' => $entity_class, - 'label' => $label, - 'bundle_of' => $bundle_of, - 'base_path' => $base_path, - ]; - - $this->renderFile( - 'module/config/schema/entity.schema.yml.twig', - $this->extensionManager->getModule($module)->getPath().'/config/schema/'.$entity_name.'.schema.yml', - $parameters - ); - - $this->renderFile( - 'module/links.menu-entity-config.yml.twig', - $this->extensionManager->getModule($module)->getPath().'/'.$module.'.links.menu.yml', - $parameters, - FILE_APPEND - ); - - $this->renderFile( - 'module/links.action-entity.yml.twig', - $this->extensionManager->getModule($module)->getPath().'/'.$module.'.links.action.yml', - $parameters, - FILE_APPEND - ); - - $this->renderFile( - 'module/src/Entity/interface-entity.php.twig', - $this->extensionManager->getModule($module)->getEntityPath().'/'.$entity_class.'Interface.php', - $parameters - ); - - $this->renderFile( - 'module/src/Entity/entity.php.twig', - $this->extensionManager->getModule($module)->getEntityPath().'/'.$entity_class.'.php', - $parameters - ); - - $this->renderFile( - 'module/src/entity-route-provider.php.twig', - $this->extensionManager->getModule($module)->getSourcePath().'/'.$entity_class.'HtmlRouteProvider.php', - $parameters - ); - - $this->renderFile( - 'module/src/Form/entity.php.twig', - $this->extensionManager->getModule($module)->getFormPath().'/'.$entity_class.'Form.php', - $parameters - ); - - $this->renderFile( - 'module/src/Form/entity-delete.php.twig', - $this->extensionManager->getModule($module)->getFormPath().'/'.$entity_class.'DeleteForm.php', - $parameters - ); - - $this->renderFile( - 'module/src/entity-listbuilder.php.twig', - $this->extensionManager->getModule($module)->getSourcePath().'/'.$entity_class.'ListBuilder.php', - $parameters - ); - } -} diff --git a/src/Generator/EntityContentGenerator.php b/src/Generator/EntityContentGenerator.php deleted file mode 100644 index 3c9f98cce..000000000 --- a/src/Generator/EntityContentGenerator.php +++ /dev/null @@ -1,291 +0,0 @@ -extensionManager = $extensionManager; - $this->site = $site; - $this->twigrenderer = $twigrenderer; - } - - public function setIo($io) - { - $this->io = $io; - } - - - /** - * Generator Entity. - * - * @param string $module Module name - * @param string $entity_name Entity machine name - * @param string $entity_class Entity class name - * @param string $label Entity label - * @param string $base_path Base path - * @param string $is_translatable Translation configuration - * @param string $bundle_entity_type (Config) entity type acting as bundle - * @param bool $revisionable Revision configuration - */ - public function generate($module, $entity_name, $entity_class, $label, $base_path, $is_translatable, $bundle_entity_type = null, $revisionable = false) - { - $parameters = [ - 'module' => $module, - 'entity_name' => $entity_name, - 'entity_class' => $entity_class, - 'label' => $label, - 'bundle_entity_type' => $bundle_entity_type, - 'base_path' => $base_path, - 'is_translatable' => $is_translatable, - 'revisionable' => $revisionable, - ]; - - $this->renderFile( - 'module/permissions-entity-content.yml.twig', - $this->extensionManager->getModule($module)->getPath().'/'.$module.'.permissions.yml', - $parameters, - FILE_APPEND - ); - - $this->renderFile( - 'module/links.menu-entity-content.yml.twig', - $this->extensionManager->getModule($module)->getPath().'/'.$module.'.links.menu.yml', - $parameters, - FILE_APPEND - ); - - $this->renderFile( - 'module/links.task-entity-content.yml.twig', - $this->extensionManager->getModule($module)->getPath().'/'.$module.'.links.task.yml', - $parameters, - FILE_APPEND - ); - - $this->renderFile( - 'module/links.action-entity-content.yml.twig', - $this->extensionManager->getModule($module)->getPath().'/'.$module.'.links.action.yml', - $parameters, - FILE_APPEND - ); - - $this->renderFile( - 'module/src/accesscontrolhandler-entity-content.php.twig', - $this->extensionManager->getModule($module)->getSourcePath().'/'.$entity_class.'AccessControlHandler.php', - $parameters - ); - - if ($is_translatable) { - $this->renderFile( - 'module/src/entity-translation-handler.php.twig', - $this->extensionManager->getModule($module)->getSourcePath().'/'.$entity_class.'TranslationHandler.php', - $parameters - ); - } - - $this->renderFile( - 'module/src/Entity/interface-entity-content.php.twig', - $this->extensionManager->getModule($module)->getEntityPath().'/'.$entity_class.'Interface.php', - $parameters - ); - - $this->renderFile( - 'module/src/Entity/entity-content.php.twig', - $this->extensionManager->getModule($module)->getEntityPath().'/'.$entity_class.'.php', - $parameters - ); - - $this->renderFile( - 'module/src/entity-content-route-provider.php.twig', - $this->extensionManager->getModule($module)->getSourcePath().'/'.$entity_class.'HtmlRouteProvider.php', - $parameters - ); - - $this->renderFile( - 'module/src/Entity/entity-content-views-data.php.twig', - $this->extensionManager->getModule($module)->getEntityPath().'/'.$entity_class.'ViewsData.php', - $parameters - ); - - $this->renderFile( - 'module/src/listbuilder-entity-content.php.twig', - $this->extensionManager->getModule($module)->getSourcePath().'/'.$entity_class.'ListBuilder.php', - $parameters - ); - - $this->renderFile( - 'module/src/Entity/Form/entity-settings.php.twig', - $this->extensionManager->getModule($module)->getFormPath().'/'.$entity_class.'SettingsForm.php', - $parameters - ); - - $this->renderFile( - 'module/src/Entity/Form/entity-content.php.twig', - $this->extensionManager->getModule($module)->getFormPath().'/'.$entity_class.'Form.php', - $parameters - ); - - $this->renderFile( - 'module/src/Entity/Form/entity-content-delete.php.twig', - $this->extensionManager->getModule($module)->getFormPath().'/'.$entity_class.'DeleteForm.php', - $parameters - ); - - $this->renderFile( - 'module/entity-content-page.php.twig', - $this->extensionManager->getModule($module)->getPath().'/'.$entity_name.'.page.inc', - $parameters - ); - - $this->renderFile( - 'module/templates/entity-html.twig', - $this->extensionManager->getModule($module)->getTemplatePath().'/'.$entity_name.'.html.twig', - $parameters - ); - - if ($revisionable) { - $this->renderFile( - 'module/src/Entity/Form/entity-content-revision-delete.php.twig', - $this->extensionManager->getModule($module)->getFormPath() .'/'.$entity_class.'RevisionDeleteForm.php', - $parameters - ); - $this->renderFile( - 'module/src/Entity/Form/entity-content-revision-revert-translation.php.twig', - $this->extensionManager->getModule($module)->getFormPath() .'/'.$entity_class.'RevisionRevertTranslationForm.php', - $parameters - ); - $this->renderFile( - 'module/src/Entity/Form/entity-content-revision-revert.php.twig', - $this->extensionManager->getModule($module)->getFormPath().'/'.$entity_class.'RevisionRevertForm.php', - $parameters - ); - $this->renderFile( - 'module/src/entity-storage.php.twig', - $this->extensionManager->getModule($module)->getSourcePath() .'/'.$entity_class.'Storage.php', - $parameters - ); - $this->renderFile( - 'module/src/interface-entity-storage.php.twig', - $this->extensionManager->getModule($module)->getSourcePath() .'/'.$entity_class.'StorageInterface.php', - $parameters - ); - $this->renderFile( - 'module/src/Controller/entity-controller.php.twig', - $this->extensionManager->getModule($module)->getControllerPath() .'/'.$entity_class.'Controller.php', - $parameters - ); - } - - if ($bundle_entity_type) { - $this->renderFile( - 'module/templates/entity-with-bundle-content-add-list-html.twig', - $this->extensionManager->getModule($module)->getTemplatePath().'/'.str_replace('_', '-', $entity_name).'-content-add-list.html.twig', - $parameters - ); - - // Check for hook_theme() in module file and warn ... - $module_filename = $this->extensionManager->getModule($module)->getPath().'/'.$module.'.module'; - // Check if the module file exists. - if (!file_exists($module_filename)) { - $this->renderFile( - 'module/module.twig', - $this->extensionManager->getModule($module)->getPath().'/'.$module . '.module', - [ - 'machine_name' => $module, - 'description' => '', - ] - ); - } - $module_file_contents = file_get_contents($module_filename); - if (strpos($module_file_contents, 'function ' . $module . '_theme') !== false) { - $this->io->warning( - [ - "It looks like you have a hook_theme already declared", - "Please manually merge the two hook_theme() implementations in", - $module_filename - ] - ); - } - - $this->renderFile( - 'module/src/Entity/entity-content-with-bundle.theme.php.twig', - $this->extensionManager->getModule($module)->getPath().'/'.$module.'.module', - $parameters, - FILE_APPEND - ); - - if (strpos($module_file_contents, 'function ' . $module . '_theme_suggestions_' . $entity_name) !== false) { - $this->io->warning( - [ - "It looks like you have a hook_theme_suggestions_HOOK already declared", - "Please manually merge the two hook_theme_suggestions_HOOK() implementations in", - $module_filename - ] - ); - } - - $this->renderFile( - 'module/src/Entity/entity-content-with-bundle.theme_hook_suggestions.php.twig', - $this->extensionManager->getModule($module)->getPath().'/'.$module.'.module', - $parameters, - FILE_APPEND - ); - } - - $content = $this->twigrenderer->render( - 'module/src/Entity/entity-content.theme.php.twig', - $parameters - ); - - - //@TODO: - /** - if ($this->isLearning()) { - $this->io->commentBlock( - [ - 'Add this to your hook_theme:', - $content - ] - ); - } - */ - } -} diff --git a/src/Generator/EventSubscriberGenerator.php b/src/Generator/EventSubscriberGenerator.php deleted file mode 100644 index f53178be2..000000000 --- a/src/Generator/EventSubscriberGenerator.php +++ /dev/null @@ -1,66 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator Service. - * - * @param string $module Module name - * @param string $name Service name - * @param string $class Class name - * @param string $events - * @param array $services List of services - */ - public function generate($module, $name, $class, $events, $services) - { - $parameters = [ - 'module' => $module, - 'name' => $name, - 'class' => $class, - 'class_path' => sprintf('Drupal\%s\EventSubscriber\%s', $module, $class), - 'events' => $events, - 'services' => $services, - 'tags' => ['name' => 'event_subscriber'], - 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'), - ]; - - $this->renderFile( - 'module/src/event-subscriber.php.twig', - $this->extensionManager->getModule($module)->getSourcePath().'/EventSubscriber/'.$class.'.php', - $parameters - ); - - $this->renderFile( - 'module/services.yml.twig', - $this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml', - $parameters, - FILE_APPEND - ); - } -} diff --git a/src/Generator/FormAlterGenerator.php b/src/Generator/FormAlterGenerator.php deleted file mode 100644 index 19fba6d82..000000000 --- a/src/Generator/FormAlterGenerator.php +++ /dev/null @@ -1,57 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator Plugin Block. - * - * @param $module - * @param $form_id - * @param $inputs - * @param $metadata - */ - public function generate($module, $form_id, $inputs, $metadata) - { - $parameters = [ - 'module' => $module, - 'form_id' => $form_id, - 'inputs' => $inputs, - 'metadata' => $metadata - ]; - - $module_path = $this->extensionManager->getModule($module)->getPath(); - - $this->renderFile( - 'module/src/Form/form-alter.php.twig', - $module_path .'/'.$module.'.module', - $parameters, - FILE_APPEND - ); - } -} diff --git a/src/Generator/FormGenerator.php b/src/Generator/FormGenerator.php deleted file mode 100644 index d19897480..000000000 --- a/src/Generator/FormGenerator.php +++ /dev/null @@ -1,114 +0,0 @@ -extensionManager = $extensionManager; - $this->stringConverter = $stringConverter; - } - - /** - * @param $module - * @param $class_name - * @param $services - * @param $config_file - * @param $inputs - * @param $form_id - * @param $form_type - * @param $path - * @param $menu_link_gen - * @param $menu_link_title - * @param $menu_parent - * @param $menu_link_desc - */ - public function generate($module, $class_name, $form_id, $form_type, $services, $config_file, $inputs, $path, $menu_link_gen, $menu_link_title, $menu_parent, $menu_link_desc) - { - $class_name_short = strtolower( - $this->stringConverter->removeSuffix($class_name) - ); - - $parameters = [ - 'class_name' => $class_name, - 'services' => $services, - 'config_file' => $config_file, - 'inputs' => $inputs, - 'module_name' => $module, - 'form_id' => $form_id, - 'path' => $path, - 'route_name' => $class_name, - 'menu_link_title' => $menu_link_title, - 'menu_parent' => $menu_parent, - 'menu_link_desc' => $menu_link_desc, - 'class_name_short' => $class_name_short - ]; - - if ($form_type == 'ConfigFormBase') { - $template = 'module/src/Form/form-config.php.twig'; - $parameters['config_form'] = true; - } else { - $template = 'module/src/Form/form.php.twig'; - $parameters['config_form'] = false; - } - - $this->renderFile( - 'module/routing-form.yml.twig', - $this->extensionManager->getModule($module)->getPath() .'/'.$module.'.routing.yml', - $parameters, - FILE_APPEND - ); - - $this->renderFile( - $template, - $this->extensionManager->getModule($module)->getFormPath() .'/'.$class_name.'.php', - $parameters - ); - - // Render defaults YML file. - if ($config_file == true) { - $this->renderFile( - 'module/config/install/field.default.yml.twig', - $this->extensionManager->getModule($module)->getPath() .'/config/install/'.$module.'.'.$class_name_short.'.yml', - $parameters - ); - } - - if ($menu_link_gen == true) { - $this->renderFile( - 'module/links.menu.yml.twig', - $this->extensionManager->getModule($module)->getPath() . '/' . $module . '.links.menu.yml', - $parameters, - FILE_APPEND - ); - } - } -} diff --git a/src/Generator/HelpGenerator.php b/src/Generator/HelpGenerator.php deleted file mode 100644 index 420240c19..000000000 --- a/src/Generator/HelpGenerator.php +++ /dev/null @@ -1,54 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator Post Update Name function. - * - * @param $module - * @param $description - */ - public function generate($module, $description) - { - $module_path = $this->extensionManager->getModule($module)->getPath(); - - $parameters = [ - 'machine_name' => $module, - 'description' => $description, - 'file_exists' => file_exists($module_path .'/'.$module.'.module'), - ]; - - $this->renderFile( - 'module/help.php.twig', - $module_path .'/'.$module.'.module', - $parameters, - FILE_APPEND - ); - } -} diff --git a/src/Generator/ModuleFileGenerator.php b/src/Generator/ModuleFileGenerator.php deleted file mode 100644 index 8f8e84e47..000000000 --- a/src/Generator/ModuleFileGenerator.php +++ /dev/null @@ -1,53 +0,0 @@ - $machine_name, - 'file_path' => $file_path , - ]; - - if ($machine_name) { - $this->renderFile( - 'module/module-file.twig', - $file_path . '/' . $machine_name . '.module', - $parameters - ); - } - } -} diff --git a/src/Generator/ModuleGenerator.php b/src/Generator/ModuleGenerator.php deleted file mode 100644 index f7c2ed0a7..000000000 --- a/src/Generator/ModuleGenerator.php +++ /dev/null @@ -1,188 +0,0 @@ - $module, - 'machine_name' => $machineName, - 'type' => 'module', - 'core' => $core, - 'description' => $description, - 'package' => $package, - 'dependencies' => $dependencies, - 'test' => $test, - 'twigtemplate' => $twigtemplate, - ]; - - $this->renderFile( - 'module/info.yml.twig', - $dir.'/'.$machineName.'.info.yml', - $parameters - ); - - if (!empty($featuresBundle)) { - $this->renderFile( - 'module/features.yml.twig', - $dir.'/'.$machineName.'.features.yml', - [ - 'bundle' => $featuresBundle, - ] - ); - } - - if ($moduleFile) { - // Generate '.module' file. - $this->createModuleFile($dir, $parameters); - } - - if ($composer) { - $this->renderFile( - 'module/composer.json.twig', - $dir.'/'.'composer.json', - $parameters - ); - } - - if ($test) { - $this->renderFile( - 'module/src/Tests/load-test.php.twig', - $dir . '/tests/src/Functional/' . 'LoadTest.php', - $parameters - ); - } - if ($twigtemplate) { - // If module file is not created earlier, create now. - if (!$moduleFile) { - // Generate '.module' file. - $this->createModuleFile($dir, $parameters); - } - $this->renderFile( - 'module/module-twig-template-append.twig', - $dir .'/' . $machineName . '.module', - $parameters, - FILE_APPEND - ); - $dir .= '/templates/'; - if (file_exists($dir)) { - if (!is_dir($dir)) { - throw new \RuntimeException( - sprintf( - 'Unable to generate the templates directory as the target directory "%s" exists but is a file.', - realpath($dir) - ) - ); - } - $files = scandir($dir); - if ($files != ['.', '..']) { - throw new \RuntimeException( - sprintf( - 'Unable to generate the templates directory as the target directory "%s" is not empty.', - realpath($dir) - ) - ); - } - if (!is_writable($dir)) { - throw new \RuntimeException( - sprintf( - 'Unable to generate the templates directory as the target directory "%s" is not writable.', - realpath($dir) - ) - ); - } - } - $this->renderFile( - 'module/twig-template-file.twig', - $dir . str_replace("_", "-", $machineName) . '.html.twig', - $parameters - ); - } - } - - /** - * Generate the '.module' file. - * - * @param string $dir - * The directory name. - * @param array $parameters - * The parameter array. - */ - protected function createModuleFile($dir, $parameters) - { - $this->renderFile( - 'module/module.twig', - $dir . '/' . $parameters['machine_name'] . '.module', - $parameters - ); - } -} diff --git a/src/Generator/PermissionGenerator.php b/src/Generator/PermissionGenerator.php deleted file mode 100644 index 643b1f4ba..000000000 --- a/src/Generator/PermissionGenerator.php +++ /dev/null @@ -1,60 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * @param $module - * @param $permissions - * @param $learning - */ - public function generate($module, $permissions, $learning) - { - $parameters = [ - 'module_name' => $module, - 'permissions' => $permissions, - ]; - - $this->renderFile( - 'module/permission.yml.twig', - $this->extensionManager->getModule($module)->getPath().'/'.$module.'.permissions.yml', - $parameters, - FILE_APPEND - ); - - $content = $this->renderer->render( - 'module/permission-routing.yml.twig', - $parameters - ); - - if ($learning) { - echo 'You can use this permission in the routing file like this:'.PHP_EOL; - echo $content; - } - } -} diff --git a/src/Generator/PluginBlockGenerator.php b/src/Generator/PluginBlockGenerator.php deleted file mode 100644 index 3755ae193..000000000 --- a/src/Generator/PluginBlockGenerator.php +++ /dev/null @@ -1,89 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator Plugin Block. - * - * @param $module - * @param $class_name - * @param $label - * @param $plugin_id - * @param $services - */ - public function generate($module, $class_name, $label, $plugin_id, $services, $inputs) - { - // Consider the type when determining a default value. Figure out what - // the code looks like for the default value tht we need to generate. - foreach ($inputs as &$input) { - $default_code = '$this->t(\'\')'; - if ($input['default_value'] == '') { - switch ($input['type']) { - case 'checkbox': - case 'number': - case 'weight': - case 'radio': - $default_code = 0; - break; - - case 'radios': - case 'checkboxes': - $default_code = 'array()'; - break; - } - } elseif (substr($input['default_value'], 0, 1) == '$') { - // If they want to put in code, let them, they're programmers. - $default_code = $input['default_value']; - } elseif (is_numeric($input['default_value'])) { - $default_code = $input['default_value']; - } elseif (preg_match('/^(true|false)$/i', $input['default_value'])) { - // Coding Standards - $default_code = strtoupper($input['default_value']); - } else { - $default_code = '$this->t(\'' . $input['default_value'] . '\')'; - } - $input['default_code'] = $default_code; - } - - $parameters = [ - 'module' => $module, - 'class_name' => $class_name, - 'label' => $label, - 'plugin_id' => $plugin_id, - 'services' => $services, - 'inputs' => $inputs, - ]; - - $this->renderFile( - 'module/src/Plugin/Block/block.php.twig', - $this->extensionManager->getPluginPath($module, 'Block').'/'.$class_name.'.php', - $parameters - ); - } -} diff --git a/src/Generator/PluginCKEditorButtonGenerator.php b/src/Generator/PluginCKEditorButtonGenerator.php deleted file mode 100644 index bcbef106b..000000000 --- a/src/Generator/PluginCKEditorButtonGenerator.php +++ /dev/null @@ -1,57 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator Plugin CKEditor Button. - * - * @param string $module Module name - * @param string $class_name Plugin Class name - * @param string $label Plugin label - * @param string $plugin_id Plugin id - * @param string $button_name Button name - */ - public function generate($module, $class_name, $label, $plugin_id, $button_name, $button_icon_path) - { - $parameters = [ - 'module' => $module, - 'class_name' => $class_name, - 'label' => $label, - 'plugin_id' => $plugin_id, - 'button_name' => $button_name, - 'button_icon_path' => $button_icon_path, - ]; - - $this->renderFile( - 'module/src/Plugin/CKEditorPlugin/ckeditorbutton.php.twig', - $this->extensionManager->getPluginPath($module, 'CKEditorPlugin') . '/' . $class_name . '.php', - $parameters - ); - } -} diff --git a/src/Generator/PluginConditionGenerator.php b/src/Generator/PluginConditionGenerator.php deleted file mode 100644 index 3b6fa9ad8..000000000 --- a/src/Generator/PluginConditionGenerator.php +++ /dev/null @@ -1,66 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator Plugin Field Formatter. - * - * @param string $module Module name - * @param string $class_name Plugin condition Class name - * @param string $label Plugin condition label - * @param string $plugin_id Plugin condition id - * @param string $context_definition_id Plugin condition context definition id - * @param string $context_definition_label Plugin condition context definition label - * @param bool $context_definition_required Plugin condition context definition required - */ - public function generate($module, $class_name, $label, $plugin_id, $context_definition_id, $context_definition_label, $context_definition_required) - { - $parameters = [ - 'module' => $module, - 'class_name' => $class_name, - 'label' => $label, - 'plugin_id' => $plugin_id, - 'context_definition_id' => $context_definition_id, - 'context_definition_label' => $context_definition_label, - 'context_definition_required' => $context_definition_required, - 'context_id' => str_replace('entity:', '', $context_definition_id) - ]; - - $this->renderFile( - 'module/src/Plugin/Condition/condition.php.twig', - $this->extensionManager->getPluginPath($module, 'Condition') . '/' . $class_name . '.php', - $parameters - ); - } -} diff --git a/src/Generator/PluginFieldFormatterGenerator.php b/src/Generator/PluginFieldFormatterGenerator.php deleted file mode 100644 index b97fee7e3..000000000 --- a/src/Generator/PluginFieldFormatterGenerator.php +++ /dev/null @@ -1,51 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator Plugin Field Formatter. - * - * @param string $module Module name - * @param string $class_name Plugin Class name - * @param string $label Plugin label - * @param string $plugin_id Plugin id - * @param string $field_type Field type this formatter supports - */ - public function generate($module, $class_name, $label, $plugin_id, $field_type) - { - $parameters = [ - 'module' => $module, - 'class_name' => $class_name, - 'label' => $label, - 'plugin_id' => $plugin_id, - 'field_type' => $field_type, - ]; - - $this->renderFile( - 'module/src/Plugin/Field/FieldFormatter/fieldformatter.php.twig', - $this->extensionManager->getPluginPath($module, 'Field/FieldFormatter') . '/' . $class_name . '.php', - $parameters - ); - } -} diff --git a/src/Generator/PluginFieldTypeGenerator.php b/src/Generator/PluginFieldTypeGenerator.php deleted file mode 100644 index 75f832a9d..000000000 --- a/src/Generator/PluginFieldTypeGenerator.php +++ /dev/null @@ -1,55 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator Plugin Field Type. - * - * @param string $module Module name - * @param string $class_name Plugin Class name - * @param string $label Plugin label - * @param string $plugin_id Plugin id - * @param string $description Plugin description - * @param string $default_widget Default widget this field type used supports - * @param string $default_formatter Default formatter this field type used supports - */ - public function generate($module, $class_name, $label, $plugin_id, $description, $default_widget, $default_formatter) - { - $parameters = [ - 'module' => $module, - 'class_name' => $class_name, - 'label' => $label, - 'plugin_id' => $plugin_id, - 'description' => $description, - 'default_widget' => $default_widget, - 'default_formatter' => $default_formatter, - ]; - - $this->renderFile( - 'module/src/Plugin/Field/FieldType/fieldtype.php.twig', - $this->extensionManager->getPluginPath($module, 'Field/FieldType') . '/' . $class_name . '.php', - $parameters - ); - } -} diff --git a/src/Generator/PluginFieldWidgetGenerator.php b/src/Generator/PluginFieldWidgetGenerator.php deleted file mode 100644 index 3e252e296..000000000 --- a/src/Generator/PluginFieldWidgetGenerator.php +++ /dev/null @@ -1,51 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator Plugin Field Formatter. - * - * @param string $module Module name - * @param string $class_name Plugin Class name - * @param string $label Plugin label - * @param string $plugin_id Plugin id - * @param string $field_type Field type this widget supports - */ - public function generate($module, $class_name, $label, $plugin_id, $field_type) - { - $parameters = [ - 'module' => $module, - 'class_name' => $class_name, - 'label' => $label, - 'plugin_id' => $plugin_id, - 'field_type' => $field_type, - ]; - - $this->renderFile( - 'module/src/Plugin/Field/FieldWidget/fieldwidget.php.twig', - $this->extensionManager->getPluginPath($module, 'Field/FieldWidget') . '/' . $class_name . '.php', - $parameters - ); - } -} diff --git a/src/Generator/PluginImageEffectGenerator.php b/src/Generator/PluginImageEffectGenerator.php deleted file mode 100644 index fa56ef27b..000000000 --- a/src/Generator/PluginImageEffectGenerator.php +++ /dev/null @@ -1,51 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator Plugin Image Effect. - * - * @param string $module Module name - * @param string $class_name Plugin Class name - * @param string $plugin_label Plugin label - * @param string $plugin_id Plugin id - * @param string $description Plugin description - */ - public function generate($module, $class_name, $label, $plugin_id, $description) - { - $parameters = [ - 'module' => $module, - 'class_name' => $class_name, - 'label' => $label, - 'plugin_id' => $plugin_id, - 'description' => $description, - ]; - - $this->renderFile( - 'module/src/Plugin/ImageEffect/imageeffect.php.twig', - $this->extensionManager->getPluginPath($module, 'ImageEffect') .'/'.$class_name.'.php', - $parameters - ); - } -} diff --git a/src/Generator/PluginImageFormatterGenerator.php b/src/Generator/PluginImageFormatterGenerator.php deleted file mode 100644 index e71e739eb..000000000 --- a/src/Generator/PluginImageFormatterGenerator.php +++ /dev/null @@ -1,50 +0,0 @@ -extensionManager = $extensionManager; - } - - - /** - * Generator Plugin Image Formatter. - * - * @param string $module Module name - * @param string $class_name Plugin Class name - * @param string $label Plugin label - * @param string $plugin_id Plugin id - */ - public function generate($module, $class_name, $label, $plugin_id) - { - $parameters = [ - 'module' => $module, - 'class_name' => $class_name, - 'label' => $label, - 'plugin_id' => $plugin_id, - ]; - - $this->renderFile( - 'module/src/Plugin/Field/FieldFormatter/imageformatter.php.twig', - $this->extensionManager->getPluginPath($module, 'Field/FieldFormatter') . '/' . $class_name . '.php', - $parameters - ); - } -} diff --git a/src/Generator/PluginMailGenerator.php b/src/Generator/PluginMailGenerator.php deleted file mode 100644 index 0c053b5d8..000000000 --- a/src/Generator/PluginMailGenerator.php +++ /dev/null @@ -1,51 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator Plugin Block. - * - * @param $module - * @param $class_name - * @param $label - * @param $plugin_id - * @param $services - */ - public function generate($module, $class_name, $label, $plugin_id, $services) - { - $parameters = [ - 'module' => $module, - 'class_name' => $class_name, - 'label' => $label, - 'plugin_id' => $plugin_id, - 'services' => $services, - ]; - - $this->renderFile( - 'module/src/Plugin/Mail/mail.php.twig', - $this->extensionManager->getPluginPath($module, 'Mail') .'/'.$class_name.'.php', - $parameters - ); - } -} diff --git a/src/Generator/PluginMigrateProcessGenerator.php b/src/Generator/PluginMigrateProcessGenerator.php deleted file mode 100644 index 227a5eda8..000000000 --- a/src/Generator/PluginMigrateProcessGenerator.php +++ /dev/null @@ -1,52 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generate Migrate Source plugin code. - * - * @param $module - * @param $class_name - * @param $plugin_id - */ - public function generate($module, $class_name, $plugin_id) - { - $parameters = [ - 'module' => $module, - 'class_name' => $class_name, - 'plugin_id' => $plugin_id, - ]; - - $this->renderFile( - 'module/src/Plugin/migrate/process/process.php.twig', - $this->extensionManager->getPluginPath($module, 'migrate').'/process/'.$class_name.'.php', - $parameters - ); - } -} diff --git a/src/Generator/PluginMigrateSourceGenerator.php b/src/Generator/PluginMigrateSourceGenerator.php deleted file mode 100644 index 123fab82c..000000000 --- a/src/Generator/PluginMigrateSourceGenerator.php +++ /dev/null @@ -1,60 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generate Migrate Source plugin code. - * - * @param $module - * @param $class_name - * @param $plugin_id - * @param $table - * @param $alias - * @param $group_by - * @param fields - */ - public function generate($module, $class_name, $plugin_id, $table, $alias, $group_by, $fields) - { - $parameters = [ - 'module' => $module, - 'class_name' => $class_name, - 'plugin_id' => $plugin_id, - 'table' => $table, - 'alias' => $alias, - 'group_by' => $group_by, - 'fields' => $fields, - ]; - - $this->renderFile( - 'module/src/Plugin/migrate/source/source.php.twig', - $this->extensionManager->getPluginPath($module, 'migrate').'/source/'.$class_name.'.php', - $parameters - ); - } -} diff --git a/src/Generator/PluginRestResourceGenerator.php b/src/Generator/PluginRestResourceGenerator.php deleted file mode 100644 index 05518ce81..000000000 --- a/src/Generator/PluginRestResourceGenerator.php +++ /dev/null @@ -1,59 +0,0 @@ -extensionManager = $extensionManager; - } - - - /** - * Generator Plugin Block. - * - * @param $module - * @param $class_name - * @param $plugin_label - * @param $plugin_id - * @param $plugin_url - * @param $plugin_states - */ - public function generate($module, $class_name, $plugin_label, $plugin_id, $plugin_url, $plugin_states) - { - $parameters = [ - 'module_name' => $module, - 'class_name' => $class_name, - 'plugin_label' => $plugin_label, - 'plugin_id' => $plugin_id, - 'plugin_url' => $plugin_url, - 'plugin_states' => $plugin_states, - ]; - - $this->renderFile( - 'module/src/Plugin/Rest/Resource/rest.php.twig', - $this->extensionManager->getPluginPath($module, 'rest') .'/resource/'.$class_name.'.php', - $parameters - ); - } -} diff --git a/src/Generator/PluginRulesActionGenerator.php b/src/Generator/PluginRulesActionGenerator.php deleted file mode 100644 index a60ee380c..000000000 --- a/src/Generator/PluginRulesActionGenerator.php +++ /dev/null @@ -1,65 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator Plugin RulesAction. - * - * @param $module - * @param $class_name - * @param $label - * @param $plugin_id - * @param $category - * @param $context - */ - public function generate($module, $class_name, $label, $plugin_id, $category, $context, $type) - { - $parameters = [ - 'module' => $module, - 'class_name' => $class_name, - 'label' => $label, - 'plugin_id' => $plugin_id, - 'category' => $category, - 'context' => $context, - 'type' => $type, - ]; - - $this->renderFile( - 'module/src/Plugin/Action/rulesaction.php.twig', - $this->extensionManager->getPluginPath($module, 'Action').'/'.$class_name.'.php', - $parameters - ); - - $this->renderFile( - 'module/system.action.action.yml.twig', - $this->extensionManager->getModule($module)->getPath() .'/config/install/system.action.'.$plugin_id.'.yml', - $parameters - ); - } -} diff --git a/src/Generator/PluginSkeletonGenerator.php b/src/Generator/PluginSkeletonGenerator.php deleted file mode 100644 index 1e80864f4..000000000 --- a/src/Generator/PluginSkeletonGenerator.php +++ /dev/null @@ -1,61 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator Post Update Name function. - * - * @param $module - * @param $pluginId - * @param $plugin - * @param $className - * @param $pluginMetaData - * @param $services - */ - public function generate($module, $pluginId, $plugin, $className, $pluginMetaData, $services) - { - $module_path = $this->extensionManager->getModule($module)->getPath(); - - $parameters = [ - 'module' => $module, - 'plugin_id' => $pluginId, - 'plugin' => $plugin, - 'class_name' => $className, - 'services' => $services, - 'plugin_annotation' => array_pop(explode('\\', $pluginMetaData['pluginAnnotation'])), - 'plugin_interface' => array_pop(explode('\\', $pluginMetaData['pluginInterface'])) - ]; - - $this->renderFile( - 'module/src/Plugin/skeleton.php.twig', - $module_path .'/src/'. $pluginMetaData['subdir'] . '/' . $className .'.php', - array_merge($parameters, $pluginMetaData) - ); - } -} diff --git a/src/Generator/PluginTypeAnnotationGenerator.php b/src/Generator/PluginTypeAnnotationGenerator.php deleted file mode 100644 index 2a5181f17..000000000 --- a/src/Generator/PluginTypeAnnotationGenerator.php +++ /dev/null @@ -1,85 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator for Plugin type with annotation discovery. - * - * @param $module - * @param $class_name - * @param $machine_name - * @param $label - */ - public function generate($module, $class_name, $machine_name, $label) - { - $parameters = [ - 'module' => $module, - 'class_name' => $class_name, - 'machine_name' => $machine_name, - 'label' => $label, - 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'), - ]; - - $directory = $this->extensionManager->getModule($module)->getSourcePath() . '/Plugin/' . $class_name; - - if (!is_dir($directory)) { - mkdir($directory, 0777, true); - } - - $this->renderFile( - 'module/src/Annotation/plugin-type.php.twig', - $this->extensionManager->getModule($module)->getSourcePath() . '/Annotation/' . $class_name . '.php', - $parameters - ); - - $this->renderFile( - 'module/src/plugin-type-annotation-base.php.twig', - $this->extensionManager->getModule($module)->getSourcePath() .'/Plugin/' . $class_name . 'Base.php', - $parameters - ); - - $this->renderFile( - 'module/src/plugin-type-annotation-interface.php.twig', - $this->extensionManager->getModule($module)->getSourcePath() .'/Plugin/' . $class_name . 'Interface.php', - $parameters - ); - - $this->renderFile( - 'module/src/plugin-type-annotation-manager.php.twig', - $this->extensionManager->getModule($module)->getSourcePath() .'/Plugin/' . $class_name . 'Manager.php', - $parameters - ); - $this->renderFile( - 'module/plugin-annotation-services.yml.twig', - $this->extensionManager->getModule($module)->getPath() . '/' . $module . '.services.yml', - $parameters, - FILE_APPEND - ); - } -} diff --git a/src/Generator/PluginTypeYamlGenerator.php b/src/Generator/PluginTypeYamlGenerator.php deleted file mode 100644 index 8dd2807fb..000000000 --- a/src/Generator/PluginTypeYamlGenerator.php +++ /dev/null @@ -1,74 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator for Plugin type with Yaml discovery. - * - * @param $module - * @param $plugin_class - * @param $plugin_name - * @param $plugin_file_name - */ - public function generate($module, $plugin_class, $plugin_name, $plugin_file_name) - { - $parameters = [ - 'module' => $module, - 'plugin_class' => $plugin_class, - 'plugin_name' => $plugin_name, - 'plugin_file_name' => $plugin_file_name, - 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() . '/' . $module . '.services.yml'), - ]; - - $this->renderFile( - 'module/src/yaml-plugin-manager.php.twig', - $this->extensionManager->getModule($module)->getSourcePath() . '/' . $plugin_class . 'Manager.php', - $parameters - ); - - $this->renderFile( - 'module/src/yaml-plugin-manager-interface.php.twig', - $this->extensionManager->getModule($module)->getSourcePath() . '/' . $plugin_class . 'ManagerInterface.php', - $parameters - ); - - $this->renderFile( - 'module/plugin-yaml-services.yml.twig', - $this->extensionManager->getModule($module)->getPath() . '/' . $module . '.services.yml', - $parameters, - FILE_APPEND - ); - - $this->renderFile( - 'module/plugin.yml.twig', - $this->extensionManager->getModule($module)->getPath() . '/' . $module . '.' . $plugin_file_name . '.yml', - $parameters - ); - } -} diff --git a/src/Generator/PluginViewsFieldGenerator.php b/src/Generator/PluginViewsFieldGenerator.php deleted file mode 100644 index 3d0d03681..000000000 --- a/src/Generator/PluginViewsFieldGenerator.php +++ /dev/null @@ -1,62 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator Plugin Field Formatter. - * - * @param string $module Module name - * @param string $class_name Plugin Class name - * @param string $label Plugin label - * @param string $plugin_id Plugin id - * @param string $field_type Field type this formatter supports - */ - public function generate($module, $class_machine_name, $class_name, $title, $description) - { - $parameters = [ - 'module' => $module, - 'class_machine_name' => $class_machine_name, - 'class_name' => $class_name, - 'title' => $title, - 'description' => $description, - ]; - - $this->renderFile( - 'module/module.views.inc.twig', - $this->extensionManager->getModule($module)->getPath() . '/' . $module . '.views.inc', - $parameters - ); - - $this->renderFile( - 'module/src/Plugin/Views/field/field.php.twig', - $this->extensionManager->getPluginPath($module, 'views/field') . '/' . $class_name . '.php', - $parameters - ); - } -} diff --git a/src/Generator/PostUpdateGenerator.php b/src/Generator/PostUpdateGenerator.php deleted file mode 100644 index c3c10db7b..000000000 --- a/src/Generator/PostUpdateGenerator.php +++ /dev/null @@ -1,54 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator Post Update Name function. - * - * @param $module - * @param $post_update_name - */ - public function generate($module, $post_update_name) - { - $module_path = $this->extensionManager->getModule($module)->getPath(); - - $parameters = [ - 'module' => $module, - 'post_update_name' => $post_update_name, - 'file_exists' => file_exists($module_path .'/'.$module.'.post_update.php'), - ]; - - $this->renderFile( - 'module/post-update.php.twig', - $module_path .'/'.$module.'.post_update.php', - $parameters, - FILE_APPEND - ); - } -} diff --git a/src/Generator/ProfileGenerator.php b/src/Generator/ProfileGenerator.php deleted file mode 100644 index 8d0857c1a..000000000 --- a/src/Generator/ProfileGenerator.php +++ /dev/null @@ -1,83 +0,0 @@ - $profile, - 'machine_name' => $machine_name, - 'type' => 'profile', - 'core' => $core, - 'description' => $description, - 'dependencies' => $dependencies, - 'themes' => $themes, - 'distribution' => $distribution, - ]; - - $this->renderFile( - 'profile/info.yml.twig', - $dir . '/' . $machine_name . '.info.yml', - $parameters - ); - - $this->renderFile( - 'profile/profile.twig', - $dir . '/' . $machine_name . '.profile', - $parameters - ); - - $this->renderFile( - 'profile/install.twig', - $dir . '/' . $machine_name . '.install', - $parameters - ); - } -} diff --git a/src/Generator/RouteSubscriberGenerator.php b/src/Generator/RouteSubscriberGenerator.php deleted file mode 100644 index 388991f37..000000000 --- a/src/Generator/RouteSubscriberGenerator.php +++ /dev/null @@ -1,62 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator Service. - * - * @param string $module Module name - * @param string $name Service name - * @param string $class Class name - */ - public function generate($module, $name, $class) - { - $parameters = [ - 'module' => $module, - 'name' => $name, - 'class' => $class, - 'class_path' => sprintf('Drupal\%s\Routing\%s', $module, $class), - 'tags' => ['name' => 'event_subscriber'], - 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'), - ]; - - $this->renderFile( - 'module/src/Routing/route-subscriber.php.twig', - $this->extensionManager->getModule($module)->getRoutingPath().'/'.$class.'.php', - $parameters - ); - - $this->renderFile( - 'module/services.yml.twig', - $this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml', - $parameters, - FILE_APPEND - ); - } -} diff --git a/src/Generator/ServiceGenerator.php b/src/Generator/ServiceGenerator.php deleted file mode 100644 index 855839f80..000000000 --- a/src/Generator/ServiceGenerator.php +++ /dev/null @@ -1,102 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator Service. - * - * @param string $module Module name - * @param string $name Service name - * @param string $class Class name - * @param string $interface If TRUE an interface for this service is generated - * @param array $services List of services - * @param string $path_service Path of services - */ - public function generate($module, $name, $class, $interface, $interface_name, $services, $path_service) - { - $interface = $interface ? ($interface_name ?: $class . 'Interface') : false; - $parameters = [ - 'module' => $module, - 'name' => $name, - 'class' => $class, - 'class_path' => sprintf('Drupal\%s\%s', $module, $class), - 'interface' => $interface, - 'services' => $services, - 'path_service' => $path_service, - 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'), - ]; - - $this->renderFile( - 'module/services.yml.twig', - $this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml', - $parameters, - FILE_APPEND - ); - - $this->renderFile( - 'module/src/service.php.twig', - $this->setDirectory($path_service, 'service.php.twig', $module, $class), - $parameters - ); - - if ($interface) { - $this->renderFile( - 'module/src/service-interface.php.twig', - $this->setDirectory($path_service, 'interface.php.twig', $module, $interface), - $parameters - ); - } - } - - protected function setDirectory($target, $template, $module, $class) - { - $default_path = '/modules/custom/' . $module . '/src/'; - $directory = ''; - - switch ($template) { - case 'service.php.twig': - $default_target = $this->extensionManager->getModule($module)->getPath() .'/src/'.$class.'.php'; - $custom_target = $this->extensionManager->getModule($module)->getPath() .'/'.$target.'/'.$class.'.php'; - - $directory = (strcmp($target, $default_path) == 0) ? $default_target : $custom_target; - break; - case 'interface.php.twig': - $default_target = $this->extensionManager->getModule($module)->getPath() .'/src/'.$class.'.php'; - $custom_target = $this->extensionManager->getModule($module)->getPath() .'/'.$target.'/'.$class.'.php'; - - $directory = (strcmp($target, $default_path) == 0) ? $default_target : $custom_target; - break; - default: - // code... - break; - } - - return $directory; - } -} diff --git a/src/Generator/ThemeGenerator.php b/src/Generator/ThemeGenerator.php deleted file mode 100644 index 78342bf98..000000000 --- a/src/Generator/ThemeGenerator.php +++ /dev/null @@ -1,118 +0,0 @@ -extensionManager = $extensionManager; - } - - public function generate( - $theme, - $machine_name, - $dir, - $description, - $core, - $package, - $base_theme, - $global_library, - $libraries, - $regions, - $breakpoints - ) { - $dir .= '/' . $machine_name; - if (file_exists($dir)) { - if (!is_dir($dir)) { - throw new \RuntimeException( - sprintf( - 'Unable to generate the bundle as the target directory "%s" exists but is a file.', - realpath($dir) - ) - ); - } - $files = scandir($dir); - if ($files != ['.', '..']) { - throw new \RuntimeException( - sprintf( - 'Unable to generate the bundle as the target directory "%s" is not empty.', - realpath($dir) - ) - ); - } - if (!is_writable($dir)) { - throw new \RuntimeException( - sprintf( - 'Unable to generate the bundle as the target directory "%s" is not writable.', - realpath($dir) - ) - ); - } - } - - $parameters = [ - 'theme' => $theme, - 'machine_name' => $machine_name, - 'type' => 'theme', - 'core' => $core, - 'description' => $description, - 'package' => $package, - 'base_theme' => $base_theme, - 'global_library' => $global_library, - 'libraries' => $libraries, - 'regions' => $regions, - 'breakpoints' => $breakpoints, - ]; - - $this->renderFile( - 'theme/info.yml.twig', - $dir . '/' . $machine_name . '.info.yml', - $parameters - ); - - $this->renderFile( - 'theme/theme.twig', - $dir . '/' . $machine_name . '.theme', - $parameters - ); - - if ($libraries) { - $this->renderFile( - 'theme/libraries.yml.twig', - $dir . '/' . $machine_name . '.libraries.yml', - $parameters - ); - } - - if ($breakpoints) { - $this->renderFile( - 'theme/breakpoints.yml.twig', - $dir . '/' . $machine_name . '.breakpoints.yml', - $parameters - ); - } - } -} diff --git a/src/Generator/TwigExtensionGenerator.php b/src/Generator/TwigExtensionGenerator.php deleted file mode 100644 index 91c522023..000000000 --- a/src/Generator/TwigExtensionGenerator.php +++ /dev/null @@ -1,69 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator Service. - * - * @param string $module Module name - * @param string $name Service name - * @param string $class Class name - * @param array $services List of services - */ - public function generate($module, $name, $class, $services) - { - $parameters = [ - 'module' => $module, - 'name' => $name, - 'class' => $class, - 'class_path' => sprintf('Drupal\%s\TwigExtension\%s', $module, $class), - 'services' => $services, - 'tags' => ['name' => 'twig.extension'], - 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'), - ]; - - $this->renderFile( - 'module/services.yml.twig', - $this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml', - $parameters, - FILE_APPEND - ); - - $this->renderFile( - 'module/src/TwigExtension/twig-extension.php.twig', - $this->extensionManager->getModule($module)->getPath() .'/src/TwigExtension/'.$class.'.php', - $parameters - ); - } -} diff --git a/src/Generator/UpdateGenerator.php b/src/Generator/UpdateGenerator.php deleted file mode 100644 index 55180668d..000000000 --- a/src/Generator/UpdateGenerator.php +++ /dev/null @@ -1,55 +0,0 @@ -extensionManager = $extensionManager; - } - - /** - * Generator Update N function. - * - * @param $module - * @param $update_number - */ - public function generate($module, $update_number) - { - $modulePath = $this->extensionManager->getModule($module)->getPath(); - $updateFile = $modulePath .'/'.$module.'.install'; - - $parameters = [ - 'module' => $module, - 'update_number' => $update_number, - 'file_exists' => file_exists($updateFile) - ]; - - $this->renderFile( - 'module/update.php.twig', - $updateFile, - $parameters, - FILE_APPEND - ); - } -} From 5e580f9888dd77e321177c67b338133030baa776 Mon Sep 17 00:00:00 2001 From: eiriksm Date: Thu, 13 Jul 2017 02:47:15 +0200 Subject: [PATCH 286/321] Point travis badge and link to correct job (#3412) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d4480197d..b1acb6be2 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Drupal Console ============================================= [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/hechoendrupal/DrupalConsole) -[![Build Status](https://travis-ci.org/hechoendrupal/DrupalConsole.svg?branch=master)](https://travis-ci.org/hechoendrupal/DrupalConsole) +[![Build Status](https://travis-ci.org/hechoendrupal/drupal-console.svg?branch=master)](https://travis-ci.org/hechoendrupal/drupal-console) [![Latest Stable Version](https://poser.pugx.org/drupal/console/v/stable.svg)](https://packagist.org/packages/drupal/console) [![Latest Unstable Version](https://poser.pugx.org/drupal/console/v/unstable.svg)](https://packagist.org/packages/drupal/console) [![Software License](https://img.shields.io/badge/license-GPL%202.0+-blue.svg)](https://packagist.org/packages/drupal/console) From e3923239ae46e756af168c38d3d8663663503065 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Wed, 12 Jul 2017 18:14:53 -0700 Subject: [PATCH 287/321] [console] Add drupal/console-generate dependency. (#3424) --- composer.json | 3 +++ composer.lock | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index c825cee0c..8a6e1f2e3 100644 --- a/composer.json +++ b/composer.json @@ -61,5 +61,8 @@ "prefer-stable": true, "autoload": { "psr-4": {"Drupal\\Console\\": "src"} + }, + "require-dev": { + "drupal/console-generate": "dev-master" } } diff --git a/composer.lock b/composer.lock index 996933354..542370b90 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "b5375a537301f3ae536a38eb17ace817", + "content-hash": "de6d7204e86489445ed0bf7a70d70059", "packages": [ { "name": "alchemy/zippy", @@ -2668,10 +2668,53 @@ "time": "2015-12-17T08:42:14+00:00" } ], - "packages-dev": [], + "packages-dev": [ + { + "name": "drupal/console-generate", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/hechoendrupal/drupal-console-generate.git", + "reference": "a93f7fdcbb774efe56311600ace993b938859bf2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-generate/zipball/a93f7fdcbb774efe56311600ace993b938859bf2", + "reference": "a93f7fdcbb774efe56311600ace993b938859bf2", + "shasum": "" + }, + "require-dev": { + "drupal/console-core": "~1.0" + }, + "type": "drupal-console-library", + "autoload": { + "psr-4": { + "Drupal\\Console\\Generate\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0+" + ], + "authors": [ + { + "name": "Jesus Manuel Olivas", + "email": "jesus.olivas@gmail.com" + }, + { + "name": "enzo - Eduardo Garcia", + "email": "enzos@weknowinc.com" + } + ], + "description": "Drupal Console generate commands", + "time": "2017-07-12 19:39:29" + } + ], "aliases": [], "minimum-stability": "dev", - "stability-flags": [], + "stability-flags": { + "drupal/console-generate": 20 + }, "prefer-stable": true, "prefer-lowest": false, "platform": { From c3a368b170b2c6fc57a482b375fd642da76a3d45 Mon Sep 17 00:00:00 2001 From: Miguel Date: Thu, 13 Jul 2017 00:58:57 -0600 Subject: [PATCH 288/321] Updated taxonomy:term:delete command. (#3426) --- src/Command/Taxonomy/DeleteTermCommand.php | 101 +++++++++++++++------ 1 file changed, 73 insertions(+), 28 deletions(-) diff --git a/src/Command/Taxonomy/DeleteTermCommand.php b/src/Command/Taxonomy/DeleteTermCommand.php index 62e2ff955..443f9cacd 100644 --- a/src/Command/Taxonomy/DeleteTermCommand.php +++ b/src/Command/Taxonomy/DeleteTermCommand.php @@ -40,65 +40,110 @@ public function __construct(EntityTypeManagerInterface $entityTypeManager) } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected function configure() { $this ->setName('taxonomy:term:delete') ->setDescription($this->trans('commands.taxonomy.term.delete.description')) - ->addArgument( - 'vid', - InputArgument::REQUIRED - ); + ->addArgument('vid', InputArgument::REQUIRED); } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected function execute(InputInterface $input, OutputInterface $output) { $vid = $input->getArgument('vid'); $io = new DrupalStyle($input, $output); + if ($vid === 'all') { + $vid = $vid; + } elseif (!in_array($vid, array_keys($this->getVocabularies()))) { + + $io->error( + sprintf( + $this->trans('commands.taxonomy.term.delete.messages.invalid-vocabulary'), + $vid + ) + ); + return; + + } $this->deleteExistingTerms($vid, $io); + } - return 0; + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --vid argument + $vid = $input->getArgument('vid'); + if (!$vid) { + $vid = $io->choiceNoList( + $this->trans('commands.taxonomy.term.delete.vid'), + array_keys($this->getVocabularies()) + ); + $input->setArgument('vid', $vid); + } } /** - * Destroy all existing terms before import - * - * @param $vid - * @param $io - */ + * Destroy all existing terms + * @param $vid + * @param $io + */ private function deleteExistingTerms($vid = null, DrupalStyle $io) { - //Load the vid + $termStorage = $this->entityTypeManager->getStorage('taxonomy_term'); - $vocabularies = $this->entityTypeManager->getStorage('taxonomy_vocabulary') - ->loadMultiple(); + //Load all vocabularies + $vocabularies = $this->getVocabularies(); - if ($vid !== 'all') { - $vid = [$vid]; - } else { + if ($vid === 'all') { $vid = array_keys($vocabularies); + } else { + $vid = [$vid]; } foreach ($vid as $item) { - if (!isset($vocabularies[$item])) { - $io->error("Invalid vid: {$item}."); - } $vocabulary = $vocabularies[$item]; $terms = $termStorage->loadTree($vocabulary->id()); - foreach ($terms as $term) { - $treal = $termStorage->load($term->tid); - if ($treal !== null) { - $io->info("Deleting '{$term->name}' and all translations."); - $treal->delete(); + if (empty($terms)) { + $io->error( + sprintf( + $this->trans('commands.taxonomy.term.delete.messages.nothing'), + $item + ) + ); + + } else { + foreach ($terms as $term) { + $treal = $termStorage->load($term->tid); + + if ($treal !== null) { + $io->info( + sprintf( + $this->trans('commands.taxonomy.term.delete.messages.processing'), + $term->name + ) + ); + $treal->delete(); + } } + } } } + + private function getVocabularies() + { + return $this->entityTypeManager->getStorage('taxonomy_vocabulary') + ->loadMultiple(); + } } From e07a79ec27cf3f71970c223fd4ce06adad7bfc7b Mon Sep 17 00:00:00 2001 From: acidaniel Date: Thu, 13 Jul 2017 02:04:42 -0500 Subject: [PATCH 289/321] Adding Missing Aliases and fixing existing ones. (#3423) --- src/Application.php | 4 ++-- src/Command/Config/DeleteCommand.php | 2 +- src/Command/Config/DiffCommand.php | 2 +- src/Command/Config/EditCommand.php | 2 +- src/Command/Config/ValidateCommand.php | 2 +- src/Command/Create/CommentsCommand.php | 2 +- src/Command/Create/NodesCommand.php | 2 +- src/Command/Create/TermsCommand.php | 2 +- src/Command/Create/UsersCommand.php | 2 +- src/Command/Create/VocabulariesCommand.php | 2 +- src/Command/Cron/ExecuteCommand.php | 2 +- src/Command/Cron/ReleaseCommand.php | 2 +- src/Command/Database/AddCommand.php | 3 ++- src/Command/Database/ClientCommand.php | 3 ++- src/Command/Database/ConnectCommand.php | 3 ++- src/Command/Database/DropCommand.php | 3 ++- src/Command/Database/DumpCommand.php | 3 ++- src/Command/Database/LogClearCommand.php | 2 +- src/Command/Database/LogPollCommand.php | 2 +- src/Command/Database/QueryCommand.php | 3 ++- src/Command/Database/RestoreCommand.php | 3 ++- src/Command/Debug/BreakpointsCommand.php | 2 +- src/Command/Debug/CacheContextCommand.php | 3 ++- src/Command/Debug/ConfigCommand.php | 2 +- src/Command/Debug/ConfigSettingsCommand.php | 3 ++- src/Command/Debug/ConfigValidateCommand.php | 2 +- src/Command/Debug/CronCommand.php | 3 ++- src/Command/Debug/DatabaseTableCommand.php | 3 ++- src/Command/Debug/EntityCommand.php | 2 +- src/Command/Debug/EventCommand.php | 3 ++- src/Command/Debug/ImageStylesCommand.php | 3 ++- src/Command/Debug/LibrariesCommand.php | 2 +- src/Command/Debug/ModuleCommand.php | 2 +- src/Command/Debug/MultisiteCommand.php | 2 +- src/Command/Debug/PermissionCommand.php | 2 +- src/Command/Debug/PluginCommand.php | 2 +- src/Command/Debug/QueueCommand.php | 3 ++- src/Command/Debug/RouterCommand.php | 2 +- src/Command/Debug/ThemeCommand.php | 2 +- src/Command/Debug/UpdateCommand.php | 2 +- src/Command/Debug/UserCommand.php | 2 +- src/Command/Debug/ViewsPluginsCommand.php | 2 +- src/Command/DevelDumperCommand.php | 2 +- src/Command/Entity/DeleteCommand.php | 2 +- src/Command/Field/InfoCommand.php | 2 +- src/Command/Image/StylesFlushCommand.php | 2 +- src/Command/Module/InstallDependencyCommand.php | 2 +- src/Command/Module/PathCommand.php | 2 +- src/Command/Module/UpdateCommand.php | 2 +- src/Command/Multisite/NewCommand.php | 2 +- src/Command/Node/AccessRebuildCommand.php | 2 +- src/Command/Queue/RunCommand.php | 2 +- src/Command/Router/RebuildCommand.php | 2 +- src/Command/Site/ImportLocalCommand.php | 3 ++- src/Command/Site/StatisticsCommand.php | 3 ++- src/Command/State/DeleteCommand.php | 2 +- src/Command/State/OverrideCommand.php | 2 +- src/Command/Taxonomy/DeleteTermCommand.php | 5 ++++- src/Command/Theme/PathCommand.php | 2 +- src/Command/User/CreateCommand.php | 2 +- src/Command/User/DeleteCommand.php | 2 +- src/Command/User/LoginCleanAttemptsCommand.php | 2 +- src/Command/User/LoginUrlCommand.php | 2 +- src/Command/User/PasswordHashCommand.php | 2 +- src/Command/User/PasswordResetCommand.php | 2 +- src/Command/User/RoleCommand.php | 2 +- src/Command/Views/DisableCommand.php | 2 +- 67 files changed, 87 insertions(+), 68 deletions(-) diff --git a/src/Application.php b/src/Application.php index 3dd0209ab..af5e13c7c 100644 --- a/src/Application.php +++ b/src/Application.php @@ -206,10 +206,10 @@ private function registerCommands() } if (array_key_exists($command->getName(), $aliases)) { - $commandAliases = array_merge( + $commandAliases = array_unique(array_merge( $command->getAliases(), $aliases[$command->getName()] - ); + )); if (!is_array($commandAliases)) { $commandAliases = [$commandAliases]; } diff --git a/src/Command/Config/DeleteCommand.php b/src/Command/Config/DeleteCommand.php index 7ab29c664..99ce41e8b 100644 --- a/src/Command/Config/DeleteCommand.php +++ b/src/Command/Config/DeleteCommand.php @@ -73,7 +73,7 @@ protected function configure() 'name', InputArgument::OPTIONAL, $this->trans('commands.config.delete.arguments.name') - ); + )->setAliases(['cd']); } /** diff --git a/src/Command/Config/DiffCommand.php b/src/Command/Config/DiffCommand.php index c8afc9705..c97513940 100644 --- a/src/Command/Config/DiffCommand.php +++ b/src/Command/Config/DiffCommand.php @@ -79,7 +79,7 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.config.diff.options.reverse') - ); + )->setAliases(['cdi']); } /** diff --git a/src/Command/Config/EditCommand.php b/src/Command/Config/EditCommand.php index ad218e358..bd5ad9576 100644 --- a/src/Command/Config/EditCommand.php +++ b/src/Command/Config/EditCommand.php @@ -76,7 +76,7 @@ protected function configure() InputArgument::OPTIONAL, $this->trans('commands.config.edit.arguments.editor') ) - ->setAliases(['cdit']); + ->setAliases(['ced']); } /** diff --git a/src/Command/Config/ValidateCommand.php b/src/Command/Config/ValidateCommand.php index f15a202ac..bf9f5faf3 100644 --- a/src/Command/Config/ValidateCommand.php +++ b/src/Command/Config/ValidateCommand.php @@ -38,7 +38,7 @@ protected function configure() ->addArgument( 'name', InputArgument::REQUIRED - ); + )->setAliases(['cv']); } /** diff --git a/src/Command/Create/CommentsCommand.php b/src/Command/Create/CommentsCommand.php index ff04f0584..c919e16b5 100644 --- a/src/Command/Create/CommentsCommand.php +++ b/src/Command/Create/CommentsCommand.php @@ -72,7 +72,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.create.comments.options.time-range') - ); + )->setAliases(['cc']); } /** diff --git a/src/Command/Create/NodesCommand.php b/src/Command/Create/NodesCommand.php index 36f3d98a4..2c8d6f09e 100644 --- a/src/Command/Create/NodesCommand.php +++ b/src/Command/Create/NodesCommand.php @@ -95,7 +95,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.create.nodes.options.language') - ); + )->setAliases(['cn']); } /** diff --git a/src/Command/Create/TermsCommand.php b/src/Command/Create/TermsCommand.php index a2bd1ab3b..95fe45fe1 100644 --- a/src/Command/Create/TermsCommand.php +++ b/src/Command/Create/TermsCommand.php @@ -80,7 +80,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.create.terms.options.name-words') - ); + )->setAliases(['ct']); } /** diff --git a/src/Command/Create/UsersCommand.php b/src/Command/Create/UsersCommand.php index 4fc6c1f74..908bb7002 100644 --- a/src/Command/Create/UsersCommand.php +++ b/src/Command/Create/UsersCommand.php @@ -82,7 +82,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.create.users.options.time-range') - ); + )->setAliases(['cu']); } /** diff --git a/src/Command/Create/VocabulariesCommand.php b/src/Command/Create/VocabulariesCommand.php index 4af224444..707996188 100644 --- a/src/Command/Create/VocabulariesCommand.php +++ b/src/Command/Create/VocabulariesCommand.php @@ -59,7 +59,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.create.vocabularies.options.name-words') - ); + )->setAliases(['cv']); } /** diff --git a/src/Command/Cron/ExecuteCommand.php b/src/Command/Cron/ExecuteCommand.php index 6fdb3caac..497398d6b 100644 --- a/src/Command/Cron/ExecuteCommand.php +++ b/src/Command/Cron/ExecuteCommand.php @@ -76,7 +76,7 @@ protected function configure() InputArgument::IS_ARRAY | InputArgument::OPTIONAL, $this->trans('commands.common.options.module') ) - ->setAliases(['cre']); + ->setAliases(['cex']); } /** diff --git a/src/Command/Cron/ReleaseCommand.php b/src/Command/Cron/ReleaseCommand.php index 0d54a5c8f..63d450f65 100644 --- a/src/Command/Cron/ReleaseCommand.php +++ b/src/Command/Cron/ReleaseCommand.php @@ -53,7 +53,7 @@ protected function configure() $this ->setName('cron:release') ->setDescription($this->trans('commands.cron.release.description')) - ->setAliases(['crr']); + ->setAliases(['cre']); } /** diff --git a/src/Command/Database/AddCommand.php b/src/Command/Database/AddCommand.php index 1e2087a10..ee9f3591d 100644 --- a/src/Command/Database/AddCommand.php +++ b/src/Command/Database/AddCommand.php @@ -90,7 +90,8 @@ protected function configure() InputOption::VALUE_OPTIONAL, $this->trans('commands.database.add.options.driver') ) - ->setHelp($this->trans('commands.database.add.help')); + ->setHelp($this->trans('commands.database.add.help')) + ->setAliases(['dba']); } /** * {@inheritdoc} diff --git a/src/Command/Database/ClientCommand.php b/src/Command/Database/ClientCommand.php index 93b2d6574..a36af091b 100644 --- a/src/Command/Database/ClientCommand.php +++ b/src/Command/Database/ClientCommand.php @@ -35,7 +35,8 @@ protected function configure() $this->trans('commands.database.client.arguments.database'), 'default' ) - ->setHelp($this->trans('commands.database.client.help')); + ->setHelp($this->trans('commands.database.client.help')) + ->setAliases(['dbc']); } /** diff --git a/src/Command/Database/ConnectCommand.php b/src/Command/Database/ConnectCommand.php index 1908cb0e0..caedf4fe6 100644 --- a/src/Command/Database/ConnectCommand.php +++ b/src/Command/Database/ConnectCommand.php @@ -34,7 +34,8 @@ protected function configure() $this->trans('commands.database.connect.arguments.database'), 'default' ) - ->setHelp($this->trans('commands.database.connect.help')); + ->setHelp($this->trans('commands.database.connect.help')) + ->setAliases(['dbco']); } /** diff --git a/src/Command/Database/DropCommand.php b/src/Command/Database/DropCommand.php index 651f5fda4..09b67fd22 100644 --- a/src/Command/Database/DropCommand.php +++ b/src/Command/Database/DropCommand.php @@ -56,7 +56,8 @@ protected function configure() $this->trans('commands.database.drop.arguments.database'), 'default' ) - ->setHelp($this->trans('commands.database.drop.help')); + ->setHelp($this->trans('commands.database.drop.help')) + ->setAliases(['dbd']); } /** diff --git a/src/Command/Database/DumpCommand.php b/src/Command/Database/DumpCommand.php index b867b517b..403f195f2 100644 --- a/src/Command/Database/DumpCommand.php +++ b/src/Command/Database/DumpCommand.php @@ -70,7 +70,8 @@ protected function configure() InputOption::VALUE_NONE, $this->trans('commands.database.dump.options.gz') ) - ->setHelp($this->trans('commands.database.dump.help')); + ->setHelp($this->trans('commands.database.dump.help')) + ->setAliases(['dbdu']); } /** diff --git a/src/Command/Database/LogClearCommand.php b/src/Command/Database/LogClearCommand.php index c8e96eb36..266a62bcb 100644 --- a/src/Command/Database/LogClearCommand.php +++ b/src/Command/Database/LogClearCommand.php @@ -68,7 +68,7 @@ protected function configure() InputOption::VALUE_OPTIONAL, $this->trans('commands.database.log.clear.options.user-id') ) - ->setAliases(['dbc']); + ->setAliases(['dblc']); } /** diff --git a/src/Command/Database/LogPollCommand.php b/src/Command/Database/LogPollCommand.php index 46a0d6257..eee78b5cc 100644 --- a/src/Command/Database/LogPollCommand.php +++ b/src/Command/Database/LogPollCommand.php @@ -50,7 +50,7 @@ protected function configure() InputArgument::OPTIONAL, $this->trans('commands.database.log.poll.arguments.duration'), '10' - ); + )->setAliases(['dblp']); } /** diff --git a/src/Command/Database/QueryCommand.php b/src/Command/Database/QueryCommand.php index d5ee1139e..ea9479be9 100644 --- a/src/Command/Database/QueryCommand.php +++ b/src/Command/Database/QueryCommand.php @@ -54,7 +54,8 @@ protected function configure() ->addOption('vertical', null, InputOption::VALUE_NONE, $this->trans('commands.database.query.options.vertical')) ->addOption('batch', null, InputOption::VALUE_NONE, $this->trans('commands.database.query.options.batch')) - ->setHelp($this->trans('commands.database.query.help')); + ->setHelp($this->trans('commands.database.query.help')) + ->setAliases(['dbq']); } /** diff --git a/src/Command/Database/RestoreCommand.php b/src/Command/Database/RestoreCommand.php index d94b336d9..4e6c8d6d7 100644 --- a/src/Command/Database/RestoreCommand.php +++ b/src/Command/Database/RestoreCommand.php @@ -58,7 +58,8 @@ protected function configure() InputOption::VALUE_REQUIRED, $this->trans('commands.database.restore.options.file') ) - ->setHelp($this->trans('commands.database.restore.help')); + ->setHelp($this->trans('commands.database.restore.help')) + ->setAliases(['dbr']); } /** diff --git a/src/Command/Debug/BreakpointsCommand.php b/src/Command/Debug/BreakpointsCommand.php index 41b7730fa..0c6f5603e 100644 --- a/src/Command/Debug/BreakpointsCommand.php +++ b/src/Command/Debug/BreakpointsCommand.php @@ -64,7 +64,7 @@ protected function configure() 'group', InputArgument::OPTIONAL, $this->trans('commands.debug.breakpoints.options.group-name') - ); + )->setAliases(['dbre']); } /** diff --git a/src/Command/Debug/CacheContextCommand.php b/src/Command/Debug/CacheContextCommand.php index d1aa713fc..5ffa1cd08 100644 --- a/src/Command/Debug/CacheContextCommand.php +++ b/src/Command/Debug/CacheContextCommand.php @@ -29,7 +29,8 @@ protected function configure() { $this ->setName('debug:cache:context') - ->setDescription($this->trans('commands.debug.cache.context.description')); + ->setDescription($this->trans('commands.debug.cache.context.description')) + ->setAliases(['dcc']); } /** diff --git a/src/Command/Debug/ConfigCommand.php b/src/Command/Debug/ConfigCommand.php index 4e5e0f278..d7d4527fb 100644 --- a/src/Command/Debug/ConfigCommand.php +++ b/src/Command/Debug/ConfigCommand.php @@ -59,7 +59,7 @@ protected function configure() InputArgument::OPTIONAL, $this->trans('commands.debug.config.arguments.name') ) - ->setAliases(['cde']); + ->setAliases(['dc']); } /** diff --git a/src/Command/Debug/ConfigSettingsCommand.php b/src/Command/Debug/ConfigSettingsCommand.php index 9dfe2d4b1..0ce42485e 100644 --- a/src/Command/Debug/ConfigSettingsCommand.php +++ b/src/Command/Debug/ConfigSettingsCommand.php @@ -48,7 +48,8 @@ protected function configure() $this ->setName('debug:config:settings') ->setDescription($this->trans('commands.debug.config.settings.description')) - ->setHelp($this->trans('commands.debug.config.settings.help')); + ->setHelp($this->trans('commands.debug.config.settings.help')) + ->setAliases(['dcs']); } /** diff --git a/src/Command/Debug/ConfigValidateCommand.php b/src/Command/Debug/ConfigValidateCommand.php index ab31d2c6f..451679a74 100644 --- a/src/Command/Debug/ConfigValidateCommand.php +++ b/src/Command/Debug/ConfigValidateCommand.php @@ -50,7 +50,7 @@ protected function configure() 'schema-name', 'sch', InputOption::VALUE_REQUIRED - ); + )->setAliases(['dcv']); } /** diff --git a/src/Command/Debug/CronCommand.php b/src/Command/Debug/CronCommand.php index be6740f91..623d989b3 100644 --- a/src/Command/Debug/CronCommand.php +++ b/src/Command/Debug/CronCommand.php @@ -41,7 +41,8 @@ protected function configure() { $this ->setName('debug:cron') - ->setDescription($this->trans('commands.debug.cron.description')); + ->setDescription($this->trans('commands.debug.cron.description')) + ->setAliases(['dcr']); } /** diff --git a/src/Command/Debug/DatabaseTableCommand.php b/src/Command/Debug/DatabaseTableCommand.php index dd96613c0..8746b4a69 100644 --- a/src/Command/Debug/DatabaseTableCommand.php +++ b/src/Command/Debug/DatabaseTableCommand.php @@ -74,7 +74,8 @@ protected function configure() $this->trans('commands.debug.database.table.arguments.table'), null ) - ->setHelp($this->trans('commands.debug.database.table.help')); + ->setHelp($this->trans('commands.debug.database.table.help')) + ->setAliases(['ddt']); } /** diff --git a/src/Command/Debug/EntityCommand.php b/src/Command/Debug/EntityCommand.php index 6f1c25ddd..803f9f275 100644 --- a/src/Command/Debug/EntityCommand.php +++ b/src/Command/Debug/EntityCommand.php @@ -55,7 +55,7 @@ protected function configure() 'entity-type', InputArgument::OPTIONAL, $this->trans('commands.debug.entity.arguments.entity-type') - ); + )->setAliases(['de']); } /** diff --git a/src/Command/Debug/EventCommand.php b/src/Command/Debug/EventCommand.php index f3584a909..5d27e01a6 100644 --- a/src/Command/Debug/EventCommand.php +++ b/src/Command/Debug/EventCommand.php @@ -51,7 +51,8 @@ protected function configure() $this->trans('commands.debug.event.arguments.event'), null ) - ->setHelp($this->trans('commands.debug.event.blerp')); + ->setHelp($this->trans('commands.debug.event.blerp')) + ->setAliases(['dev']); } /** diff --git a/src/Command/Debug/ImageStylesCommand.php b/src/Command/Debug/ImageStylesCommand.php index a330ebbaa..0bf1bb6a9 100644 --- a/src/Command/Debug/ImageStylesCommand.php +++ b/src/Command/Debug/ImageStylesCommand.php @@ -46,7 +46,8 @@ protected function configure() { $this ->setName('debug:image:styles') - ->setDescription($this->trans('commands.debug.image.styles.description')); + ->setDescription($this->trans('commands.debug.image.styles.description')) + ->setAliases(['dis']); } /** diff --git a/src/Command/Debug/LibrariesCommand.php b/src/Command/Debug/LibrariesCommand.php index b1a3c85cf..41875a71f 100644 --- a/src/Command/Debug/LibrariesCommand.php +++ b/src/Command/Debug/LibrariesCommand.php @@ -75,7 +75,7 @@ protected function configure() 'group', InputArgument::OPTIONAL, $this->trans('commands.debug.libraries.options.name') - ); + )->setAliases(['dl']); } /** diff --git a/src/Command/Debug/ModuleCommand.php b/src/Command/Debug/ModuleCommand.php index ee1b8f6c2..4a8767abc 100644 --- a/src/Command/Debug/ModuleCommand.php +++ b/src/Command/Debug/ModuleCommand.php @@ -79,7 +79,7 @@ protected function configure() InputOption::VALUE_OPTIONAL, $this->trans('commands.debug.module.options.type') ) - ->setAliases(['mod']); + ->setAliases(['dm']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Debug/MultisiteCommand.php b/src/Command/Debug/MultisiteCommand.php index a05a2177e..333af16b0 100644 --- a/src/Command/Debug/MultisiteCommand.php +++ b/src/Command/Debug/MultisiteCommand.php @@ -44,7 +44,7 @@ public function configure() ->setName('debug:multisite') ->setDescription($this->trans('commands.debug.multisite.description')) ->setHelp($this->trans('commands.debug.multisite.help')) - ->setAliases(['msd']); + ->setAliases(['dmu']); ; } diff --git a/src/Command/Debug/PermissionCommand.php b/src/Command/Debug/PermissionCommand.php index d94fe62e5..8481ab8b2 100644 --- a/src/Command/Debug/PermissionCommand.php +++ b/src/Command/Debug/PermissionCommand.php @@ -34,7 +34,7 @@ protected function configure() 'role', InputArgument::OPTIONAL, $this->trans('commands.debug.permission.arguments.role') - ); + )->setAliases(['dp']); } /** diff --git a/src/Command/Debug/PluginCommand.php b/src/Command/Debug/PluginCommand.php index 58240874e..408c94d4e 100644 --- a/src/Command/Debug/PluginCommand.php +++ b/src/Command/Debug/PluginCommand.php @@ -40,7 +40,7 @@ protected function configure() 'id', InputArgument::OPTIONAL, $this->trans('commands.debug.plugin.arguments.id') - ); + )->setAliases(['dpl']); } /** diff --git a/src/Command/Debug/QueueCommand.php b/src/Command/Debug/QueueCommand.php index 13a051cf3..69af8bdff 100644 --- a/src/Command/Debug/QueueCommand.php +++ b/src/Command/Debug/QueueCommand.php @@ -46,7 +46,8 @@ protected function configure() { $this ->setName('debug:queue') - ->setDescription($this->trans('commands.debug.queue.description')); + ->setDescription($this->trans('commands.debug.queue.description')) + ->setAliases(['dq']); } /** diff --git a/src/Command/Debug/RouterCommand.php b/src/Command/Debug/RouterCommand.php index 42e65ff33..a5e28fda8 100644 --- a/src/Command/Debug/RouterCommand.php +++ b/src/Command/Debug/RouterCommand.php @@ -46,7 +46,7 @@ protected function configure() InputArgument::OPTIONAL | InputArgument::IS_ARRAY, $this->trans('commands.debug.router.arguments.route-name') ) - ->setAliases(['rod']); + ->setAliases(['dr']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Debug/ThemeCommand.php b/src/Command/Debug/ThemeCommand.php index 3485e9100..601228947 100644 --- a/src/Command/Debug/ThemeCommand.php +++ b/src/Command/Debug/ThemeCommand.php @@ -55,7 +55,7 @@ protected function configure() InputArgument::OPTIONAL, $this->trans('commands.debug.theme.arguments.theme') ) - ->setAliases(['tde']); + ->setAliases(['dt']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Debug/UpdateCommand.php b/src/Command/Debug/UpdateCommand.php index 5cdca2e76..f61a3684e 100644 --- a/src/Command/Debug/UpdateCommand.php +++ b/src/Command/Debug/UpdateCommand.php @@ -52,7 +52,7 @@ protected function configure() $this ->setName('debug:update') ->setDescription($this->trans('commands.debug.update.description')) - ->setAliases(['upd']); + ->setAliases(['du']); } /** diff --git a/src/Command/Debug/UserCommand.php b/src/Command/Debug/UserCommand.php index c30df8109..a453c578e 100644 --- a/src/Command/Debug/UserCommand.php +++ b/src/Command/Debug/UserCommand.php @@ -96,7 +96,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.debug.user.options.limit') - ); + )->setAliases(['dus']); } /** diff --git a/src/Command/Debug/ViewsPluginsCommand.php b/src/Command/Debug/ViewsPluginsCommand.php index 7a3e9884c..728e465b8 100644 --- a/src/Command/Debug/ViewsPluginsCommand.php +++ b/src/Command/Debug/ViewsPluginsCommand.php @@ -35,7 +35,7 @@ protected function configure() 'type', InputArgument::OPTIONAL, $this->trans('commands.debug.views.plugins.arguments.type') - ); + )->setAliases(['dvp']); } /** diff --git a/src/Command/DevelDumperCommand.php b/src/Command/DevelDumperCommand.php index 4748f4ea9..97a246b9d 100644 --- a/src/Command/DevelDumperCommand.php +++ b/src/Command/DevelDumperCommand.php @@ -55,7 +55,7 @@ protected function configure() 'dumper', InputArgument::OPTIONAL, $this->trans('Name of the devel dumper plugin') - ); + )->setAliases(['dd']); } /** diff --git a/src/Command/Entity/DeleteCommand.php b/src/Command/Entity/DeleteCommand.php index 895db67d6..561e5a5b6 100644 --- a/src/Command/Entity/DeleteCommand.php +++ b/src/Command/Entity/DeleteCommand.php @@ -60,7 +60,7 @@ protected function configure() 'entity-id', InputArgument::REQUIRED, $this->trans('commands.entity.delete.arguments.entity-id') - ); + )->setAliases(['ed']); } /** diff --git a/src/Command/Field/InfoCommand.php b/src/Command/Field/InfoCommand.php index 7810be768..7637429b0 100644 --- a/src/Command/Field/InfoCommand.php +++ b/src/Command/Field/InfoCommand.php @@ -75,7 +75,7 @@ public function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.field.info.options.bundle') - ); + )->setAliases(['fi']); } /** diff --git a/src/Command/Image/StylesFlushCommand.php b/src/Command/Image/StylesFlushCommand.php index afc963ef3..cd85dea71 100644 --- a/src/Command/Image/StylesFlushCommand.php +++ b/src/Command/Image/StylesFlushCommand.php @@ -43,7 +43,7 @@ protected function configure() 'styles', InputArgument::IS_ARRAY | InputArgument::REQUIRED, $this->trans('commands.image.styles.flush.options.image-style') - ); + )->setAliases(['isf']); } /** diff --git a/src/Command/Module/InstallDependencyCommand.php b/src/Command/Module/InstallDependencyCommand.php index 56ca8694a..a3ba0481b 100644 --- a/src/Command/Module/InstallDependencyCommand.php +++ b/src/Command/Module/InstallDependencyCommand.php @@ -84,7 +84,7 @@ protected function configure() 'module', InputArgument::IS_ARRAY, $this->trans('commands.module.install.dependencies.arguments.module') - ); + )->setAliases(['mdi']); } /** diff --git a/src/Command/Module/PathCommand.php b/src/Command/Module/PathCommand.php index ff1500852..8ce3adae7 100644 --- a/src/Command/Module/PathCommand.php +++ b/src/Command/Module/PathCommand.php @@ -53,7 +53,7 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.module.path.options.absolute') - ); + )->setAliases(['mp']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Module/UpdateCommand.php b/src/Command/Module/UpdateCommand.php index a443fa851..60cbaccfe 100644 --- a/src/Command/Module/UpdateCommand.php +++ b/src/Command/Module/UpdateCommand.php @@ -68,7 +68,7 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.module.update.options.simulate') - ); + )->setAliases(['mu']); } /** diff --git a/src/Command/Multisite/NewCommand.php b/src/Command/Multisite/NewCommand.php index e783d4b5c..ecb9d4168 100644 --- a/src/Command/Multisite/NewCommand.php +++ b/src/Command/Multisite/NewCommand.php @@ -74,7 +74,7 @@ public function configure() InputOption::VALUE_NONE, $this->trans('commands.multisite.new.options.copy-default') ) - ->setAliases(['sn']); + ->setAliases(['mn']); } /** diff --git a/src/Command/Node/AccessRebuildCommand.php b/src/Command/Node/AccessRebuildCommand.php index b950e2d65..e8abf86a6 100644 --- a/src/Command/Node/AccessRebuildCommand.php +++ b/src/Command/Node/AccessRebuildCommand.php @@ -53,7 +53,7 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.node.access.rebuild.options.batch') - ); + )->setAliases(['nar']); } /** diff --git a/src/Command/Queue/RunCommand.php b/src/Command/Queue/RunCommand.php index e2df4760c..7fac3e05d 100644 --- a/src/Command/Queue/RunCommand.php +++ b/src/Command/Queue/RunCommand.php @@ -63,7 +63,7 @@ protected function configure() 'name', InputArgument::OPTIONAL, $this->trans('commands.queue.run.arguments.name') - ); + )->setAliases(['qr']); } /** diff --git a/src/Command/Router/RebuildCommand.php b/src/Command/Router/RebuildCommand.php index 1faca8cad..e1b06ef73 100644 --- a/src/Command/Router/RebuildCommand.php +++ b/src/Command/Router/RebuildCommand.php @@ -39,7 +39,7 @@ protected function configure() $this ->setName('router:rebuild') ->setDescription($this->trans('commands.router.rebuild.description')) - ->setAliases(['ror']); + ->setAliases(['rr']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Site/ImportLocalCommand.php b/src/Command/Site/ImportLocalCommand.php index 5a31a46ea..9b030cbed 100644 --- a/src/Command/Site/ImportLocalCommand.php +++ b/src/Command/Site/ImportLocalCommand.php @@ -76,7 +76,8 @@ protected function configure() InputOption::VALUE_OPTIONAL, $this->trans('commands.site.import.local.options.environment') ) - ->setHelp($this->trans('commands.site.import.local.help')); + ->setHelp($this->trans('commands.site.import.local.help')) + ->setAliases(['sil']); ; } diff --git a/src/Command/Site/StatisticsCommand.php b/src/Command/Site/StatisticsCommand.php index bd6f7bff1..4a4a6aede 100644 --- a/src/Command/Site/StatisticsCommand.php +++ b/src/Command/Site/StatisticsCommand.php @@ -75,7 +75,8 @@ public function configure() $this ->setName('site:statistics') ->setDescription($this->trans('commands.site.statistics.description')) - ->setHelp($this->trans('commands.site.statistics.help')); + ->setHelp($this->trans('commands.site.statistics.help')) + ->setAliases(['sst']); ; } diff --git a/src/Command/State/DeleteCommand.php b/src/Command/State/DeleteCommand.php index 402f878aa..c2a93eb4f 100644 --- a/src/Command/State/DeleteCommand.php +++ b/src/Command/State/DeleteCommand.php @@ -56,7 +56,7 @@ protected function configure() 'name', InputArgument::OPTIONAL, $this->trans('commands.state.delete.arguments.name') - ); + )->setAliases('sd'); } /** diff --git a/src/Command/State/OverrideCommand.php b/src/Command/State/OverrideCommand.php index b7a8932bb..edda1aff8 100644 --- a/src/Command/State/OverrideCommand.php +++ b/src/Command/State/OverrideCommand.php @@ -69,7 +69,7 @@ protected function configure() 'value', InputArgument::OPTIONAL, $this->trans('commands.state.override.arguments.value') - ); + )->setAliases(['so']); } /** * {@inheritdoc} diff --git a/src/Command/Taxonomy/DeleteTermCommand.php b/src/Command/Taxonomy/DeleteTermCommand.php index 443f9cacd..4d4b09bf0 100644 --- a/src/Command/Taxonomy/DeleteTermCommand.php +++ b/src/Command/Taxonomy/DeleteTermCommand.php @@ -47,7 +47,10 @@ protected function configure() $this ->setName('taxonomy:term:delete') ->setDescription($this->trans('commands.taxonomy.term.delete.description')) - ->addArgument('vid', InputArgument::REQUIRED); + ->addArgument( + 'vid', + InputArgument::REQUIRED + )->setAliases('ttd'); } /** diff --git a/src/Command/Theme/PathCommand.php b/src/Command/Theme/PathCommand.php index 68ad53bd7..98dbad9df 100644 --- a/src/Command/Theme/PathCommand.php +++ b/src/Command/Theme/PathCommand.php @@ -53,7 +53,7 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.theme.path.options.absolute') - ); + )->setAliases(['tp']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/User/CreateCommand.php b/src/Command/User/CreateCommand.php index 0a5480e28..d1bd21d0d 100644 --- a/src/Command/User/CreateCommand.php +++ b/src/Command/User/CreateCommand.php @@ -103,7 +103,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.user.create.options.status') - ); + )->setAliases(['uc']); } /** diff --git a/src/Command/User/DeleteCommand.php b/src/Command/User/DeleteCommand.php index 3a4b88d25..0992e0d90 100644 --- a/src/Command/User/DeleteCommand.php +++ b/src/Command/User/DeleteCommand.php @@ -78,7 +78,7 @@ protected function configure() null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, $this->trans('commands.user.delete.options.roles') - ); + )->setAliases(['ud']); } /** diff --git a/src/Command/User/LoginCleanAttemptsCommand.php b/src/Command/User/LoginCleanAttemptsCommand.php index 3acf20e5e..434282321 100644 --- a/src/Command/User/LoginCleanAttemptsCommand.php +++ b/src/Command/User/LoginCleanAttemptsCommand.php @@ -52,7 +52,7 @@ protected function configure() InputArgument::REQUIRED, $this->trans('commands.user.login.clear.attempts.options.user-id') ) - ->setAliases(['uslca']); + ->setAliases(['ulca']); } /** diff --git a/src/Command/User/LoginUrlCommand.php b/src/Command/User/LoginUrlCommand.php index c164db46a..97d4e08fb 100644 --- a/src/Command/User/LoginUrlCommand.php +++ b/src/Command/User/LoginUrlCommand.php @@ -54,7 +54,7 @@ protected function configure() $this->trans('commands.user.login.url.options.user-id'), null ) - ->setAliases(['uslu']); + ->setAliases(['ulu']); } /** diff --git a/src/Command/User/PasswordHashCommand.php b/src/Command/User/PasswordHashCommand.php index 386b54ad5..bc9e62490 100644 --- a/src/Command/User/PasswordHashCommand.php +++ b/src/Command/User/PasswordHashCommand.php @@ -51,7 +51,7 @@ protected function configure() InputArgument::IS_ARRAY, $this->trans('commands.user.password.hash.options.password') ) - ->setAliases(['usph']); + ->setAliases(['uph']); } /** diff --git a/src/Command/User/PasswordResetCommand.php b/src/Command/User/PasswordResetCommand.php index 4ef5d620c..2eab398d5 100644 --- a/src/Command/User/PasswordResetCommand.php +++ b/src/Command/User/PasswordResetCommand.php @@ -66,7 +66,7 @@ protected function configure() InputArgument::REQUIRED, $this->trans('commands.user.password.reset.options.password') ) - ->setAliases(['uspr']); + ->setAliases(['upr']); } /** diff --git a/src/Command/User/RoleCommand.php b/src/Command/User/RoleCommand.php index d0cc19733..dbce8e411 100644 --- a/src/Command/User/RoleCommand.php +++ b/src/Command/User/RoleCommand.php @@ -62,7 +62,7 @@ protected function configure() 'role', InputOption::VALUE_REQUIRED, $this->trans('commands.user.role.role') - ); + )->setAliases(['ur']); } /** diff --git a/src/Command/Views/DisableCommand.php b/src/Command/Views/DisableCommand.php index 85a386e88..4a0dddcb1 100644 --- a/src/Command/Views/DisableCommand.php +++ b/src/Command/Views/DisableCommand.php @@ -63,7 +63,7 @@ protected function configure() InputArgument::OPTIONAL, $this->trans('commands.views.debug.arguments.view-id') ) - ->setAliases(['vdi']); + ->setAliases(['vd']); } /** From 8719cc2e1e43ce5916a327e2c920bf76a2e737ca Mon Sep 17 00:00:00 2001 From: Miguel Date: Thu, 13 Jul 2017 01:14:23 -0600 Subject: [PATCH 290/321] Updated theme:path command. (#3425) --- config/services/theme.yml | 2 +- src/Command/Theme/PathCommand.php | 39 ++++++++++++++++++++++++------- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/config/services/theme.yml b/config/services/theme.yml index c66cc79aa..c4df2771c 100644 --- a/config/services/theme.yml +++ b/config/services/theme.yml @@ -13,7 +13,7 @@ services: lazy: true console.theme_path: class: Drupal\Console\Command\Theme\PathCommand - arguments: ['@console.extension_manager'] + arguments: ['@console.extension_manager','@theme_handler'] tags: - { name: drupal.command } lazy: true diff --git a/src/Command/Theme/PathCommand.php b/src/Command/Theme/PathCommand.php index 98dbad9df..0ce12c09f 100644 --- a/src/Command/Theme/PathCommand.php +++ b/src/Command/Theme/PathCommand.php @@ -14,27 +14,34 @@ use Symfony\Component\Console\Command\Command; use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Extension\Manager; -use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Core\Extension\ThemeHandler; class PathCommand extends Command { use CommandTrait; - use ModuleTrait; + /** * @var Manager */ protected $extensionManager; + /** + * @var ThemeHandler + */ + protected $themeHandler; + /** * PathCommand constructor. * * @param Manager $extensionManager + * @param ThemeHandler $themeHandler */ - public function __construct(Manager $extensionManager) + public function __construct(Manager $extensionManager, ThemeHandler $themeHandler) { $this->extensionManager = $extensionManager; + $this->themeHandler = $themeHandler; parent::__construct(); } @@ -46,7 +53,7 @@ protected function configure() ->addArgument( 'theme', InputArgument::REQUIRED, - $this->trans('commands.theme.path.arguments.module') + $this->trans('commands.theme.path.arguments.theme') ) ->addOption( 'absolute', @@ -59,11 +66,19 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); - $theme = $input->getArgument('theme'); $fullPath = $input->getOption('absolute'); + if (!in_array($theme, $this->getThemeList())) { + $io->error( + sprintf( + 'Invalid theme name: %s', + $theme + ) + ); + return; + } $theme = $this->extensionManager->getTheme($theme); $io->info( @@ -78,12 +93,18 @@ protected function interact(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); - // --module argument + // --theme argument $theme = $input->getArgument('theme'); if (!$theme) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - $input->setArgument('theme', $module); + $theme = $io->choiceNoList( + $this->trans('commands.theme.path.arguments.theme'), + $this->getThemeList() + ); + $input->setArgument('theme', $theme); } } + + protected function getThemeList(){ + return array_keys($this->themeHandler->rebuildThemeData()); + } } From 4746fb3c2e63fd8b2ac5e7224778979185e7ee27 Mon Sep 17 00:00:00 2001 From: David Pagini Date: Thu, 13 Jul 2017 03:40:52 -0400 Subject: [PATCH 291/321] Allow inherited ModuleInstaller classes. (#3408) --- src/Command/Module/InstallDependencyCommand.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Command/Module/InstallDependencyCommand.php b/src/Command/Module/InstallDependencyCommand.php index a3ba0481b..492436086 100644 --- a/src/Command/Module/InstallDependencyCommand.php +++ b/src/Command/Module/InstallDependencyCommand.php @@ -18,7 +18,7 @@ use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\Site; use Drupal\Console\Utils\Validator; -use Drupal\Core\ProxyClass\Extension\ModuleInstaller; +use Drupal\Core\Extension\ModuleInstallerInterface; use Drupal\Console\Core\Utils\ChainQueue; /** @@ -38,13 +38,13 @@ class InstallDependencyCommand extends Command protected $site; /** - * @var Validator -*/ + * @var Validator + */ protected $validator; /** - * @var ModuleInstaller -*/ + * @var ModuleInstallerInterface + */ protected $moduleInstaller; /** @@ -57,12 +57,13 @@ class InstallDependencyCommand extends Command * * @param Site $site * @param Validator $validator + * @param ModuleInstallerInterface $moduleInstaller * @param ChainQueue $chainQueue */ public function __construct( Site $site, Validator $validator, - ModuleInstaller $moduleInstaller, + ModuleInstallerInterface $moduleInstaller, ChainQueue $chainQueue ) { $this->site = $site; From 3d75678ef5fad96fc4355dff3e804c8b88e91ec5 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 13 Jul 2017 00:49:06 -0700 Subject: [PATCH 292/321] [console] remove drupal/console-generate dependency. (#3427) --- composer.json | 3 - composer.lock | 175 +++++++++++++++++++------------------------------- 2 files changed, 66 insertions(+), 112 deletions(-) diff --git a/composer.json b/composer.json index 8a6e1f2e3..c825cee0c 100644 --- a/composer.json +++ b/composer.json @@ -61,8 +61,5 @@ "prefer-stable": true, "autoload": { "psr-4": {"Drupal\\Console\\": "src"} - }, - "require-dev": { - "drupal/console-generate": "dev-master" } } diff --git a/composer.lock b/composer.lock index 542370b90..a43f3a4fc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "de6d7204e86489445ed0bf7a70d70059", + "content-hash": "b5375a537301f3ae536a38eb17ace817", "packages": [ { "name": "alchemy/zippy", @@ -752,16 +752,16 @@ }, { "name": "drupal/console-extend-plugin", - "version": "0.8.0", + "version": "0.9.1", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-extend-plugin.git", - "reference": "d69ffe413259781c4257ab42bd79c9da9042e87e" + "reference": "ae2a76680f93c0fea31bbcafc6b0bcc234bb2fb4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-extend-plugin/zipball/d69ffe413259781c4257ab42bd79c9da9042e87e", - "reference": "d69ffe413259781c4257ab42bd79c9da9042e87e", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-extend-plugin/zipball/ae2a76680f93c0fea31bbcafc6b0bcc234bb2fb4", + "reference": "ae2a76680f93c0fea31bbcafc6b0bcc234bb2fb4", "shasum": "" }, "require": { @@ -789,7 +789,7 @@ } ], "description": "Drupal Console Extend Plugin", - "time": "2017-06-08T16:06:59+00:00" + "time": "2017-07-07T05:12:50+00:00" }, { "name": "gabordemooij/redbean", @@ -1144,16 +1144,16 @@ }, { "name": "nikic/php-parser", - "version": "v3.0.5", + "version": "v3.0.6", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "2b9e2f71b722f7c53918ab0c25f7646c2013f17d" + "reference": "0808939f81c1347a3c8a82a5925385a08074b0f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/2b9e2f71b722f7c53918ab0c25f7646c2013f17d", - "reference": "2b9e2f71b722f7c53918ab0c25f7646c2013f17d", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0808939f81c1347a3c8a82a5925385a08074b0f1", + "reference": "0808939f81c1347a3c8a82a5925385a08074b0f1", "shasum": "" }, "require": { @@ -1191,7 +1191,7 @@ "parser", "php" ], - "time": "2017-03-05T18:23:57+00:00" + "time": "2017-06-28T20:53:48+00:00" }, { "name": "psr/http-message", @@ -1292,16 +1292,16 @@ }, { "name": "psy/psysh", - "version": "v0.8.8", + "version": "v0.8.9", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "fe65c30cbc55c71e61ba3a38b5a581149be31b8e" + "reference": "58a31cc4404c8f632d8c557bc72056af2d3a83db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/fe65c30cbc55c71e61ba3a38b5a581149be31b8e", - "reference": "fe65c30cbc55c71e61ba3a38b5a581149be31b8e", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/58a31cc4404c8f632d8c557bc72056af2d3a83db", + "reference": "58a31cc4404c8f632d8c557bc72056af2d3a83db", "shasum": "" }, "require": { @@ -1361,7 +1361,7 @@ "interactive", "shell" ], - "time": "2017-06-24T06:16:19+00:00" + "time": "2017-07-06T14:53:52+00:00" }, { "name": "stecman/symfony-console-completion", @@ -1410,7 +1410,7 @@ }, { "name": "symfony/config", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/config.git", @@ -1466,16 +1466,16 @@ }, { "name": "symfony/console", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "3ef6ef64abecd566d551d9e7f6393ac6e93b2462" + "reference": "46e65f8d98c9ab629bbfcc16a4ff023f61c37fb2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/3ef6ef64abecd566d551d9e7f6393ac6e93b2462", - "reference": "3ef6ef64abecd566d551d9e7f6393ac6e93b2462", + "url": "https://api.github.com/repos/symfony/console/zipball/46e65f8d98c9ab629bbfcc16a4ff023f61c37fb2", + "reference": "46e65f8d98c9ab629bbfcc16a4ff023f61c37fb2", "shasum": "" }, "require": { @@ -1523,11 +1523,11 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-06-02T14:36:56+00:00" + "time": "2017-07-03T08:04:30+00:00" }, { "name": "symfony/css-selector", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", @@ -1580,7 +1580,7 @@ }, { "name": "symfony/debug", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", @@ -1637,16 +1637,16 @@ }, { "name": "symfony/dependency-injection", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "b4a4b8f6ae1d69a6b2c0c31623bbc474121ee075" + "reference": "66d2e252262749e0f3c735c183e4562c72ffb8c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/b4a4b8f6ae1d69a6b2c0c31623bbc474121ee075", - "reference": "b4a4b8f6ae1d69a6b2c0c31623bbc474121ee075", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/66d2e252262749e0f3c735c183e4562c72ffb8c8", + "reference": "66d2e252262749e0f3c735c183e4562c72ffb8c8", "shasum": "" }, "require": { @@ -1696,11 +1696,11 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2017-06-02T14:36:56+00:00" + "time": "2017-06-14T00:55:24+00:00" }, { "name": "symfony/dom-crawler", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", @@ -1756,7 +1756,7 @@ }, { "name": "symfony/event-dispatcher", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -1816,7 +1816,7 @@ }, { "name": "symfony/expression-language", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/expression-language.git", @@ -1865,16 +1865,16 @@ }, { "name": "symfony/filesystem", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "19c11158da8d110cc5289c063bf2ec4cc1ce9e7c" + "reference": "b8c9c18eacc525c980d27c7a2c8fd1e09e0ed4c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/19c11158da8d110cc5289c063bf2ec4cc1ce9e7c", - "reference": "19c11158da8d110cc5289c063bf2ec4cc1ce9e7c", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/b8c9c18eacc525c980d27c7a2c8fd1e09e0ed4c7", + "reference": "b8c9c18eacc525c980d27c7a2c8fd1e09e0ed4c7", "shasum": "" }, "require": { @@ -1910,11 +1910,11 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2017-05-28T14:07:33+00:00" + "time": "2017-06-20T23:27:56+00:00" }, { "name": "symfony/finder", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -1963,16 +1963,16 @@ }, { "name": "symfony/http-foundation", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "de8d8e83b9ec898e14ef8db84cee5919753b2ae5" + "reference": "2b592ca5fe2ad7ee8a92d409d2b830277ad58231" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/de8d8e83b9ec898e14ef8db84cee5919753b2ae5", - "reference": "de8d8e83b9ec898e14ef8db84cee5919753b2ae5", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/2b592ca5fe2ad7ee8a92d409d2b830277ad58231", + "reference": "2b592ca5fe2ad7ee8a92d409d2b830277ad58231", "shasum": "" }, "require": { @@ -2014,7 +2014,7 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2017-06-01T20:52:29+00:00" + "time": "2017-06-20T23:27:56+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -2191,16 +2191,16 @@ }, { "name": "symfony/process", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "d54232f5682fda2f8bbebff7c81b864646867ab9" + "reference": "57e52a0a6a80ea0aec4fc1b785a7920a95cb88a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/d54232f5682fda2f8bbebff7c81b864646867ab9", - "reference": "d54232f5682fda2f8bbebff7c81b864646867ab9", + "url": "https://api.github.com/repos/symfony/process/zipball/57e52a0a6a80ea0aec4fc1b785a7920a95cb88a8", + "reference": "57e52a0a6a80ea0aec4fc1b785a7920a95cb88a8", "shasum": "" }, "require": { @@ -2236,20 +2236,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-05-08T01:19:21+00:00" + "time": "2017-07-03T08:04:30+00:00" }, { "name": "symfony/translation", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "14db4cc1172a722aaa3b558bfa8eff593b43cd46" + "reference": "a89af885b8c6d0142c79a02ca9cc059ed25d40d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/14db4cc1172a722aaa3b558bfa8eff593b43cd46", - "reference": "14db4cc1172a722aaa3b558bfa8eff593b43cd46", + "url": "https://api.github.com/repos/symfony/translation/zipball/a89af885b8c6d0142c79a02ca9cc059ed25d40d8", + "reference": "a89af885b8c6d0142c79a02ca9cc059ed25d40d8", "shasum": "" }, "require": { @@ -2300,20 +2300,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2017-06-01T20:52:29+00:00" + "time": "2017-06-24T16:44:49+00:00" }, { "name": "symfony/var-dumper", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "347c4247a3e40018810b476fcd5dec36d46d08dc" + "reference": "9ee920bba1d2ce877496dcafca7cbffff4dbe08a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/347c4247a3e40018810b476fcd5dec36d46d08dc", - "reference": "347c4247a3e40018810b476fcd5dec36d46d08dc", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/9ee920bba1d2ce877496dcafca7cbffff4dbe08a", + "reference": "9ee920bba1d2ce877496dcafca7cbffff4dbe08a", "shasum": "" }, "require": { @@ -2368,11 +2368,11 @@ "debug", "dump" ], - "time": "2017-06-02T09:10:29+00:00" + "time": "2017-07-05T13:02:37+00:00" }, { "name": "symfony/yaml", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", @@ -2421,16 +2421,16 @@ }, { "name": "twig/twig", - "version": "v1.34.3", + "version": "v1.34.4", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "451c6f4197e113e24c1c85bc3fc8c2d77adeff2e" + "reference": "f878bab48edb66ad9c6ed626bf817f60c6c096ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/451c6f4197e113e24c1c85bc3fc8c2d77adeff2e", - "reference": "451c6f4197e113e24c1c85bc3fc8c2d77adeff2e", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/f878bab48edb66ad9c6ed626bf817f60c6c096ee", + "reference": "f878bab48edb66ad9c6ed626bf817f60c6c096ee", "shasum": "" }, "require": { @@ -2482,7 +2482,7 @@ "keywords": [ "templating" ], - "time": "2017-06-07T18:45:17+00:00" + "time": "2017-07-04T13:19:31+00:00" }, { "name": "vlucas/phpdotenv", @@ -2668,53 +2668,10 @@ "time": "2015-12-17T08:42:14+00:00" } ], - "packages-dev": [ - { - "name": "drupal/console-generate", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/hechoendrupal/drupal-console-generate.git", - "reference": "a93f7fdcbb774efe56311600ace993b938859bf2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-generate/zipball/a93f7fdcbb774efe56311600ace993b938859bf2", - "reference": "a93f7fdcbb774efe56311600ace993b938859bf2", - "shasum": "" - }, - "require-dev": { - "drupal/console-core": "~1.0" - }, - "type": "drupal-console-library", - "autoload": { - "psr-4": { - "Drupal\\Console\\Generate\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "Jesus Manuel Olivas", - "email": "jesus.olivas@gmail.com" - }, - { - "name": "enzo - Eduardo Garcia", - "email": "enzos@weknowinc.com" - } - ], - "description": "Drupal Console generate commands", - "time": "2017-07-12 19:39:29" - } - ], + "packages-dev": [], "aliases": [], "minimum-stability": "dev", - "stability-flags": { - "drupal/console-generate": 20 - }, + "stability-flags": [], "prefer-stable": true, "prefer-lowest": false, "platform": { From c1047f3c6d7e2b8bc7db8116966810e80637b71c Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 13 Jul 2017 00:59:19 -0700 Subject: [PATCH 293/321] [console] Set alias as array. (#3428) --- src/Command/State/DeleteCommand.php | 2 +- src/Command/Taxonomy/DeleteTermCommand.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Command/State/DeleteCommand.php b/src/Command/State/DeleteCommand.php index c2a93eb4f..a99ee38a4 100644 --- a/src/Command/State/DeleteCommand.php +++ b/src/Command/State/DeleteCommand.php @@ -56,7 +56,7 @@ protected function configure() 'name', InputArgument::OPTIONAL, $this->trans('commands.state.delete.arguments.name') - )->setAliases('sd'); + )->setAliases(['sd']); } /** diff --git a/src/Command/Taxonomy/DeleteTermCommand.php b/src/Command/Taxonomy/DeleteTermCommand.php index 4d4b09bf0..98832b488 100644 --- a/src/Command/Taxonomy/DeleteTermCommand.php +++ b/src/Command/Taxonomy/DeleteTermCommand.php @@ -50,7 +50,7 @@ protected function configure() ->addArgument( 'vid', InputArgument::REQUIRED - )->setAliases('ttd'); + )->setAliases(['ttd']); } /** From a3f6b7d009b4aa8a3858a691146916a1b598597d Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 13 Jul 2017 01:25:06 -0700 Subject: [PATCH 294/321] [console] Fix alias names. (#3429) --- src/Command/Create/CommentsCommand.php | 2 +- src/Command/Create/NodesCommand.php | 2 +- src/Command/Create/TermsCommand.php | 2 +- src/Command/Create/UsersCommand.php | 2 +- src/Command/Create/VocabulariesCommand.php | 2 +- src/Command/Cron/ExecuteCommand.php | 2 +- src/Command/Cron/ReleaseCommand.php | 2 +- src/Command/Features/ImportCommand.php | 3 ++- src/Command/Field/InfoCommand.php | 2 +- src/Command/Module/DownloadCommand.php | 2 +- src/Command/Module/InstallDependencyCommand.php | 8 ++++---- src/Command/Module/PathCommand.php | 2 +- src/Command/Module/UpdateCommand.php | 2 +- src/Command/Multisite/NewCommand.php | 2 +- src/Command/Rest/DisableCommand.php | 2 +- src/Command/State/DeleteCommand.php | 2 +- src/Command/State/OverrideCommand.php | 2 +- src/Command/Test/RunCommand.php | 2 +- src/Command/Theme/DownloadCommand.php | 2 +- src/Command/Theme/InstallCommand.php | 2 +- src/Command/Theme/PathCommand.php | 9 +++++---- src/Command/Theme/UninstallCommand.php | 2 +- src/Command/Update/EntitiesCommand.php | 4 +++- src/Command/Update/ExecuteCommand.php | 2 +- 24 files changed, 34 insertions(+), 30 deletions(-) diff --git a/src/Command/Create/CommentsCommand.php b/src/Command/Create/CommentsCommand.php index c919e16b5..ec8e310a5 100644 --- a/src/Command/Create/CommentsCommand.php +++ b/src/Command/Create/CommentsCommand.php @@ -72,7 +72,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.create.comments.options.time-range') - )->setAliases(['cc']); + )->setAliases(['crc']); } /** diff --git a/src/Command/Create/NodesCommand.php b/src/Command/Create/NodesCommand.php index 2c8d6f09e..0fd33f93f 100644 --- a/src/Command/Create/NodesCommand.php +++ b/src/Command/Create/NodesCommand.php @@ -95,7 +95,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.create.nodes.options.language') - )->setAliases(['cn']); + )->setAliases(['crn']); } /** diff --git a/src/Command/Create/TermsCommand.php b/src/Command/Create/TermsCommand.php index 95fe45fe1..96cc757f7 100644 --- a/src/Command/Create/TermsCommand.php +++ b/src/Command/Create/TermsCommand.php @@ -80,7 +80,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.create.terms.options.name-words') - )->setAliases(['ct']); + )->setAliases(['crt']); } /** diff --git a/src/Command/Create/UsersCommand.php b/src/Command/Create/UsersCommand.php index 908bb7002..89e91f299 100644 --- a/src/Command/Create/UsersCommand.php +++ b/src/Command/Create/UsersCommand.php @@ -82,7 +82,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.create.users.options.time-range') - )->setAliases(['cu']); + )->setAliases(['cru']); } /** diff --git a/src/Command/Create/VocabulariesCommand.php b/src/Command/Create/VocabulariesCommand.php index 707996188..65087d2f1 100644 --- a/src/Command/Create/VocabulariesCommand.php +++ b/src/Command/Create/VocabulariesCommand.php @@ -59,7 +59,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.create.vocabularies.options.name-words') - )->setAliases(['cv']); + )->setAliases(['crv']); } /** diff --git a/src/Command/Cron/ExecuteCommand.php b/src/Command/Cron/ExecuteCommand.php index 497398d6b..6e6edb636 100644 --- a/src/Command/Cron/ExecuteCommand.php +++ b/src/Command/Cron/ExecuteCommand.php @@ -76,7 +76,7 @@ protected function configure() InputArgument::IS_ARRAY | InputArgument::OPTIONAL, $this->trans('commands.common.options.module') ) - ->setAliases(['cex']); + ->setAliases(['croe']); } /** diff --git a/src/Command/Cron/ReleaseCommand.php b/src/Command/Cron/ReleaseCommand.php index 63d450f65..a4a0ff067 100644 --- a/src/Command/Cron/ReleaseCommand.php +++ b/src/Command/Cron/ReleaseCommand.php @@ -53,7 +53,7 @@ protected function configure() $this ->setName('cron:release') ->setDescription($this->trans('commands.cron.release.description')) - ->setAliases(['cre']); + ->setAliases(['cror']); } /** diff --git a/src/Command/Features/ImportCommand.php b/src/Command/Features/ImportCommand.php index 275859fb1..e315b9d90 100644 --- a/src/Command/Features/ImportCommand.php +++ b/src/Command/Features/ImportCommand.php @@ -49,7 +49,8 @@ protected function configure() 'packages', InputArgument::IS_ARRAY, $this->trans('commands.features.import.arguments.packages') - ); + )->setAliases(['fei']); + ; } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Field/InfoCommand.php b/src/Command/Field/InfoCommand.php index 7637429b0..002359d48 100644 --- a/src/Command/Field/InfoCommand.php +++ b/src/Command/Field/InfoCommand.php @@ -75,7 +75,7 @@ public function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.field.info.options.bundle') - )->setAliases(['fi']); + )->setAliases(['fii']); } /** diff --git a/src/Command/Module/DownloadCommand.php b/src/Command/Module/DownloadCommand.php index c6ebf70f2..8640f4027 100644 --- a/src/Command/Module/DownloadCommand.php +++ b/src/Command/Module/DownloadCommand.php @@ -138,7 +138,7 @@ protected function configure() InputOption::VALUE_NONE, $this->trans('commands.module.install.options.unstable') ) - ->setAliases(['md']); + ->setAliases(['mod']); } /** diff --git a/src/Command/Module/InstallDependencyCommand.php b/src/Command/Module/InstallDependencyCommand.php index 492436086..884a2be7b 100644 --- a/src/Command/Module/InstallDependencyCommand.php +++ b/src/Command/Module/InstallDependencyCommand.php @@ -55,10 +55,10 @@ class InstallDependencyCommand extends Command /** * InstallCommand constructor. * - * @param Site $site - * @param Validator $validator + * @param Site $site + * @param Validator $validator * @param ModuleInstallerInterface $moduleInstaller - * @param ChainQueue $chainQueue + * @param ChainQueue $chainQueue */ public function __construct( Site $site, @@ -85,7 +85,7 @@ protected function configure() 'module', InputArgument::IS_ARRAY, $this->trans('commands.module.install.dependencies.arguments.module') - )->setAliases(['mdi']); + )->setAliases(['modi']); } /** diff --git a/src/Command/Module/PathCommand.php b/src/Command/Module/PathCommand.php index 8ce3adae7..a32f6cf42 100644 --- a/src/Command/Module/PathCommand.php +++ b/src/Command/Module/PathCommand.php @@ -53,7 +53,7 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.module.path.options.absolute') - )->setAliases(['mp']); + )->setAliases(['mop']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/Module/UpdateCommand.php b/src/Command/Module/UpdateCommand.php index 60cbaccfe..349c51417 100644 --- a/src/Command/Module/UpdateCommand.php +++ b/src/Command/Module/UpdateCommand.php @@ -68,7 +68,7 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.module.update.options.simulate') - )->setAliases(['mu']); + )->setAliases(['mou']); } /** diff --git a/src/Command/Multisite/NewCommand.php b/src/Command/Multisite/NewCommand.php index ecb9d4168..008bb09c2 100644 --- a/src/Command/Multisite/NewCommand.php +++ b/src/Command/Multisite/NewCommand.php @@ -74,7 +74,7 @@ public function configure() InputOption::VALUE_NONE, $this->trans('commands.multisite.new.options.copy-default') ) - ->setAliases(['mn']); + ->setAliases(['mun']); } /** diff --git a/src/Command/Rest/DisableCommand.php b/src/Command/Rest/DisableCommand.php index a13477167..a2778574b 100644 --- a/src/Command/Rest/DisableCommand.php +++ b/src/Command/Rest/DisableCommand.php @@ -64,7 +64,7 @@ protected function configure() InputArgument::OPTIONAL, $this->trans('commands.rest.debug.arguments.resource-id') ) - ->setAliases(['redi']); + ->setAliases(['red']); } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/Command/State/DeleteCommand.php b/src/Command/State/DeleteCommand.php index a99ee38a4..5c3bf1596 100644 --- a/src/Command/State/DeleteCommand.php +++ b/src/Command/State/DeleteCommand.php @@ -56,7 +56,7 @@ protected function configure() 'name', InputArgument::OPTIONAL, $this->trans('commands.state.delete.arguments.name') - )->setAliases(['sd']); + )->setAliases(['std']); } /** diff --git a/src/Command/State/OverrideCommand.php b/src/Command/State/OverrideCommand.php index edda1aff8..dc1f88d99 100644 --- a/src/Command/State/OverrideCommand.php +++ b/src/Command/State/OverrideCommand.php @@ -69,7 +69,7 @@ protected function configure() 'value', InputArgument::OPTIONAL, $this->trans('commands.state.override.arguments.value') - )->setAliases(['so']); + )->setAliases(['sto']); } /** * {@inheritdoc} diff --git a/src/Command/Test/RunCommand.php b/src/Command/Test/RunCommand.php index 0539ad0e6..492bb1e30 100644 --- a/src/Command/Test/RunCommand.php +++ b/src/Command/Test/RunCommand.php @@ -93,7 +93,7 @@ protected function configure() InputOption::VALUE_REQUIRED, $this->trans('commands.test.run.arguments.url') ) - ->setAliases(['tr']); + ->setAliases(['ter']); } /* diff --git a/src/Command/Theme/DownloadCommand.php b/src/Command/Theme/DownloadCommand.php index 315602701..0f01f2c37 100644 --- a/src/Command/Theme/DownloadCommand.php +++ b/src/Command/Theme/DownloadCommand.php @@ -82,7 +82,7 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.theme.download.options.composer') - )->setAliases(['td']); + )->setAliases(['thd']); } /** diff --git a/src/Command/Theme/InstallCommand.php b/src/Command/Theme/InstallCommand.php index 61d348ae6..77ce74796 100644 --- a/src/Command/Theme/InstallCommand.php +++ b/src/Command/Theme/InstallCommand.php @@ -71,7 +71,7 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.theme.install.options.set-default') - )->setAliases(['ti']); + )->setAliases(['thi']); } /** diff --git a/src/Command/Theme/PathCommand.php b/src/Command/Theme/PathCommand.php index 0ce12c09f..131c16525 100644 --- a/src/Command/Theme/PathCommand.php +++ b/src/Command/Theme/PathCommand.php @@ -35,8 +35,8 @@ class PathCommand extends Command /** * PathCommand constructor. * - * @param Manager $extensionManager - * @param ThemeHandler $themeHandler + * @param Manager $extensionManager + * @param ThemeHandler $themeHandler */ public function __construct(Manager $extensionManager, ThemeHandler $themeHandler) { @@ -60,7 +60,7 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.theme.path.options.absolute') - )->setAliases(['tp']); + )->setAliases(['thp']); } protected function execute(InputInterface $input, OutputInterface $output) @@ -104,7 +104,8 @@ protected function interact(InputInterface $input, OutputInterface $output) } } - protected function getThemeList(){ + protected function getThemeList() + { return array_keys($this->themeHandler->rebuildThemeData()); } } diff --git a/src/Command/Theme/UninstallCommand.php b/src/Command/Theme/UninstallCommand.php index fdadd2cb8..f553b6df2 100644 --- a/src/Command/Theme/UninstallCommand.php +++ b/src/Command/Theme/UninstallCommand.php @@ -65,7 +65,7 @@ protected function configure() InputArgument::IS_ARRAY, $this->trans('commands.theme.uninstall.options.module') ) - ->setAliases(['tu']); + ->setAliases(['thu']); } /** diff --git a/src/Command/Update/EntitiesCommand.php b/src/Command/Update/EntitiesCommand.php index 85b5007a4..bf28b81f0 100644 --- a/src/Command/Update/EntitiesCommand.php +++ b/src/Command/Update/EntitiesCommand.php @@ -67,7 +67,9 @@ protected function configure() { $this ->setName('update:entities') - ->setDescription($this->trans('commands.update.entities.description')); + ->setDescription($this->trans('commands.update.entities.description')) + ->setAliases(['upe']); + ; } /** diff --git a/src/Command/Update/ExecuteCommand.php b/src/Command/Update/ExecuteCommand.php index 7181012ac..82d102f37 100644 --- a/src/Command/Update/ExecuteCommand.php +++ b/src/Command/Update/ExecuteCommand.php @@ -110,7 +110,7 @@ protected function configure() InputArgument::OPTIONAL, $this->trans('commands.update.execute.options.update-n') ) - ->setAliases(['upe']); + ->setAliases(['upex']); } /** From 24c79aa0c100563bb91bd73c3f938d50f87e9555 Mon Sep 17 00:00:00 2001 From: enzo - Eduardo Garcia Date: Thu, 13 Jul 2017 18:45:46 +1000 Subject: [PATCH 295/321] Restore generate command and generators (#3430) * Removed generate commands and generators * Revert "Removed generate commands and generators (#3417)" This reverts commit 1dea474267555f569ca7f1d8d61396918be99bfb. --- config/services/database.yml | 6 - config/services/generate.yml | 247 +++++++++++ config/services/generator.yml | 244 +++++++++++ .../AuthenticationProviderCommand.php | 158 +++++++ src/Command/Generate/BreakPointCommand.php | 172 ++++++++ src/Command/Generate/CacheContextCommand.php | 174 ++++++++ src/Command/Generate/CommandCommand.php | 224 ++++++++++ .../Generate/ConfigFormBaseCommand.php | 91 ++++ src/Command/Generate/ControllerCommand.php | 320 ++++++++++++++ src/Command/Generate/EntityBundleCommand.php | 151 +++++++ src/Command/Generate/EntityCommand.php | 176 ++++++++ src/Command/Generate/EntityConfigCommand.php | 101 +++++ src/Command/Generate/EntityContentCommand.php | 174 ++++++++ .../Generate/EventSubscriberCommand.php | 197 +++++++++ src/Command/Generate/FormAlterCommand.php | 324 ++++++++++++++ src/Command/Generate/FormBaseCommand.php | 18 + src/Command/Generate/FormCommand.php | 330 ++++++++++++++ src/Command/Generate/HelpCommand.php | 148 +++++++ src/Command/Generate/ModuleCommand.php | 409 ++++++++++++++++++ src/Command/Generate/ModuleFileCommand.php | 115 +++++ src/Command/Generate/PermissionCommand.php | 122 ++++++ src/Command/Generate/PluginBlockCommand.php | 292 +++++++++++++ .../Generate/PluginCKEditorButtonCommand.php | 207 +++++++++ .../Generate/PluginConditionCommand.php | 253 +++++++++++ src/Command/Generate/PluginFieldCommand.php | 346 +++++++++++++++ .../Generate/PluginFieldFormatterCommand.php | 205 +++++++++ .../Generate/PluginFieldTypeCommand.php | 221 ++++++++++ .../Generate/PluginFieldWidgetCommand.php | 210 +++++++++ .../Generate/PluginImageEffectCommand.php | 185 ++++++++ .../Generate/PluginImageFormatterCommand.php | 172 ++++++++ src/Command/Generate/PluginMailCommand.php | 198 +++++++++ .../Generate/PluginMigrateProcessCommand.php | 147 +++++++ .../Generate/PluginMigrateSourceCommand.php | 267 ++++++++++++ .../Generate/PluginRestResourceCommand.php | 225 ++++++++++ .../Generate/PluginRulesActionCommand.php | 220 ++++++++++ .../Generate/PluginSkeletonCommand.php | 384 ++++++++++++++++ .../Generate/PluginTypeAnnotationCommand.php | 153 +++++++ .../Generate/PluginTypeYamlCommand.php | 154 +++++++ .../Generate/PluginViewsFieldCommand.php | 185 ++++++++ src/Command/Generate/PostUpdateCommand.php | 198 +++++++++ src/Command/Generate/ProfileCommand.php | 270 ++++++++++++ .../Generate/RouteSubscriberCommand.php | 158 +++++++ src/Command/Generate/ServiceCommand.php | 244 +++++++++++ src/Command/Generate/ThemeCommand.php | 383 ++++++++++++++++ src/Command/Generate/TwigExtensionCommand.php | 192 ++++++++ src/Command/Generate/UpdateCommand.php | 199 +++++++++ .../AuthenticationProviderGenerator.php | 75 ++++ src/Generator/BreakPointGenerator.php | 61 +++ src/Generator/CacheContextGenerator.php | 64 +++ src/Generator/CommandGenerator.php | 94 ++++ src/Generator/ControllerGenerator.php | 62 +++ src/Generator/EntityBundleGenerator.php | 86 ++++ src/Generator/EntityConfigGenerator.php | 109 +++++ src/Generator/EntityContentGenerator.php | 291 +++++++++++++ src/Generator/EventSubscriberGenerator.php | 66 +++ src/Generator/FormAlterGenerator.php | 57 +++ src/Generator/FormGenerator.php | 114 +++++ src/Generator/HelpGenerator.php | 54 +++ src/Generator/ModuleFileGenerator.php | 53 +++ src/Generator/ModuleGenerator.php | 188 ++++++++ src/Generator/PermissionGenerator.php | 60 +++ src/Generator/PluginBlockGenerator.php | 89 ++++ .../PluginCKEditorButtonGenerator.php | 57 +++ src/Generator/PluginConditionGenerator.php | 66 +++ .../PluginFieldFormatterGenerator.php | 51 +++ src/Generator/PluginFieldTypeGenerator.php | 55 +++ src/Generator/PluginFieldWidgetGenerator.php | 51 +++ src/Generator/PluginImageEffectGenerator.php | 51 +++ .../PluginImageFormatterGenerator.php | 50 +++ src/Generator/PluginMailGenerator.php | 51 +++ .../PluginMigrateProcessGenerator.php | 52 +++ .../PluginMigrateSourceGenerator.php | 60 +++ src/Generator/PluginRestResourceGenerator.php | 59 +++ src/Generator/PluginRulesActionGenerator.php | 65 +++ src/Generator/PluginSkeletonGenerator.php | 61 +++ .../PluginTypeAnnotationGenerator.php | 85 ++++ src/Generator/PluginTypeYamlGenerator.php | 74 ++++ src/Generator/PluginViewsFieldGenerator.php | 62 +++ src/Generator/PostUpdateGenerator.php | 54 +++ src/Generator/ProfileGenerator.php | 83 ++++ src/Generator/RouteSubscriberGenerator.php | 62 +++ src/Generator/ServiceGenerator.php | 102 +++++ src/Generator/ThemeGenerator.php | 118 +++++ src/Generator/TwigExtensionGenerator.php | 69 +++ src/Generator/UpdateGenerator.php | 55 +++ 85 files changed, 12579 insertions(+), 6 deletions(-) create mode 100644 config/services/generate.yml create mode 100644 config/services/generator.yml create mode 100644 src/Command/Generate/AuthenticationProviderCommand.php create mode 100644 src/Command/Generate/BreakPointCommand.php create mode 100644 src/Command/Generate/CacheContextCommand.php create mode 100644 src/Command/Generate/CommandCommand.php create mode 100644 src/Command/Generate/ConfigFormBaseCommand.php create mode 100644 src/Command/Generate/ControllerCommand.php create mode 100644 src/Command/Generate/EntityBundleCommand.php create mode 100644 src/Command/Generate/EntityCommand.php create mode 100644 src/Command/Generate/EntityConfigCommand.php create mode 100644 src/Command/Generate/EntityContentCommand.php create mode 100644 src/Command/Generate/EventSubscriberCommand.php create mode 100644 src/Command/Generate/FormAlterCommand.php create mode 100644 src/Command/Generate/FormBaseCommand.php create mode 100644 src/Command/Generate/FormCommand.php create mode 100644 src/Command/Generate/HelpCommand.php create mode 100644 src/Command/Generate/ModuleCommand.php create mode 100644 src/Command/Generate/ModuleFileCommand.php create mode 100644 src/Command/Generate/PermissionCommand.php create mode 100644 src/Command/Generate/PluginBlockCommand.php create mode 100644 src/Command/Generate/PluginCKEditorButtonCommand.php create mode 100644 src/Command/Generate/PluginConditionCommand.php create mode 100644 src/Command/Generate/PluginFieldCommand.php create mode 100644 src/Command/Generate/PluginFieldFormatterCommand.php create mode 100644 src/Command/Generate/PluginFieldTypeCommand.php create mode 100644 src/Command/Generate/PluginFieldWidgetCommand.php create mode 100644 src/Command/Generate/PluginImageEffectCommand.php create mode 100644 src/Command/Generate/PluginImageFormatterCommand.php create mode 100644 src/Command/Generate/PluginMailCommand.php create mode 100644 src/Command/Generate/PluginMigrateProcessCommand.php create mode 100644 src/Command/Generate/PluginMigrateSourceCommand.php create mode 100644 src/Command/Generate/PluginRestResourceCommand.php create mode 100644 src/Command/Generate/PluginRulesActionCommand.php create mode 100644 src/Command/Generate/PluginSkeletonCommand.php create mode 100644 src/Command/Generate/PluginTypeAnnotationCommand.php create mode 100644 src/Command/Generate/PluginTypeYamlCommand.php create mode 100644 src/Command/Generate/PluginViewsFieldCommand.php create mode 100644 src/Command/Generate/PostUpdateCommand.php create mode 100644 src/Command/Generate/ProfileCommand.php create mode 100644 src/Command/Generate/RouteSubscriberCommand.php create mode 100644 src/Command/Generate/ServiceCommand.php create mode 100644 src/Command/Generate/ThemeCommand.php create mode 100644 src/Command/Generate/TwigExtensionCommand.php create mode 100644 src/Command/Generate/UpdateCommand.php create mode 100644 src/Generator/AuthenticationProviderGenerator.php create mode 100644 src/Generator/BreakPointGenerator.php create mode 100644 src/Generator/CacheContextGenerator.php create mode 100644 src/Generator/CommandGenerator.php create mode 100644 src/Generator/ControllerGenerator.php create mode 100644 src/Generator/EntityBundleGenerator.php create mode 100644 src/Generator/EntityConfigGenerator.php create mode 100644 src/Generator/EntityContentGenerator.php create mode 100644 src/Generator/EventSubscriberGenerator.php create mode 100644 src/Generator/FormAlterGenerator.php create mode 100644 src/Generator/FormGenerator.php create mode 100644 src/Generator/HelpGenerator.php create mode 100644 src/Generator/ModuleFileGenerator.php create mode 100644 src/Generator/ModuleGenerator.php create mode 100644 src/Generator/PermissionGenerator.php create mode 100644 src/Generator/PluginBlockGenerator.php create mode 100644 src/Generator/PluginCKEditorButtonGenerator.php create mode 100644 src/Generator/PluginConditionGenerator.php create mode 100644 src/Generator/PluginFieldFormatterGenerator.php create mode 100644 src/Generator/PluginFieldTypeGenerator.php create mode 100644 src/Generator/PluginFieldWidgetGenerator.php create mode 100644 src/Generator/PluginImageEffectGenerator.php create mode 100644 src/Generator/PluginImageFormatterGenerator.php create mode 100644 src/Generator/PluginMailGenerator.php create mode 100644 src/Generator/PluginMigrateProcessGenerator.php create mode 100644 src/Generator/PluginMigrateSourceGenerator.php create mode 100644 src/Generator/PluginRestResourceGenerator.php create mode 100644 src/Generator/PluginRulesActionGenerator.php create mode 100644 src/Generator/PluginSkeletonGenerator.php create mode 100644 src/Generator/PluginTypeAnnotationGenerator.php create mode 100644 src/Generator/PluginTypeYamlGenerator.php create mode 100644 src/Generator/PluginViewsFieldGenerator.php create mode 100644 src/Generator/PostUpdateGenerator.php create mode 100644 src/Generator/ProfileGenerator.php create mode 100644 src/Generator/RouteSubscriberGenerator.php create mode 100644 src/Generator/ServiceGenerator.php create mode 100644 src/Generator/ThemeGenerator.php create mode 100644 src/Generator/TwigExtensionGenerator.php create mode 100644 src/Generator/UpdateGenerator.php diff --git a/config/services/database.yml b/config/services/database.yml index 2a4f2eb74..573eda99c 100644 --- a/config/services/database.yml +++ b/config/services/database.yml @@ -1,10 +1,4 @@ services: - console.database_settings_generator: - class: Drupal\Console\Generator\DatabaseSettingsGenerator - arguments: ['@kernel'] - tags: - - { name: drupal.generator } - lazy: true console.database_add: class: Drupal\Console\Command\Database\AddCommand arguments: ['@console.database_settings_generator'] diff --git a/config/services/generate.yml b/config/services/generate.yml new file mode 100644 index 000000000..35b47fa17 --- /dev/null +++ b/config/services/generate.yml @@ -0,0 +1,247 @@ +services: + console.generate_module: + class: Drupal\Console\Command\Generate\ModuleCommand + arguments: ['@console.module_generator', '@console.validator', '@app.root', '@console.string_converter', '@console.drupal_api'] + tags: + - { name: drupal.command } + lazy: true + console.generate_modulefile: + class: Drupal\Console\Command\Generate\ModuleFileCommand + arguments: ['@console.extension_manager', '@console.modulefile_generator'] + tags: + - { name: drupal.command } + lazy: true + console.generate_authentication_provider: + class: Drupal\Console\Command\Generate\AuthenticationProviderCommand + arguments: ['@console.extension_manager', '@console.authentication_provider_generator', '@console.string_converter'] + tags: + - { name: drupal.command } + lazy: true + console.generate_controller: + class: Drupal\Console\Command\Generate\ControllerCommand + arguments: ['@console.extension_manager', '@console.controller_generator', '@console.string_converter', '@console.validator', '@router.route_provider', '@console.chain_queue'] + tags: + - { name: drupal.command } + lazy: true + console.generate_breakpoint: + class: Drupal\Console\Command\Generate\BreakPointCommand + arguments: ['@console.breakpoint_generator', '@app.root', '@theme_handler', '@console.validator', '@console.string_converter'] + tags: + - { name: drupal.command } + lazy: true + console.generate_help: + class: Drupal\Console\Command\Generate\HelpCommand + arguments: ['@console.help_generator', '@console.site', '@console.extension_manager', '@console.chain_queue'] + tags: + - { name: drupal.command } + lazy: true + console.generate_form: + class: Drupal\Console\Command\Generate\FormBaseCommand + arguments: ['@console.extension_manager', '@console.form_generator', '@console.chain_queue', '@console.string_converter', '@plugin.manager.element_info', '@router.route_provider'] + tags: + - { name: drupal.command } + lazy: true + console.generate_form_alter: + class: Drupal\Console\Command\Generate\FormAlterCommand + arguments: ['@console.extension_manager', '@console.form_alter_generator', '@console.string_converter', '@module_handler', '@plugin.manager.element_info', '@?profiler', '@app.root', '@console.chain_queue'] + tags: + - { name: drupal.command } + lazy: true + console.generate_permissions: + class: Drupal\Console\Command\Generate\PermissionCommand + arguments: ['@console.extension_manager', '@console.string_converter', '@console.permission_generator'] + tags: + - { name: drupal.command } + lazy: true + console.generate_event_subscriber: + class: Drupal\Console\Command\Generate\EventSubscriberCommand + arguments: ['@console.extension_manager', '@console.event_subscriber_generator', '@console.string_converter', '@event_dispatcher', '@console.chain_queue'] + tags: + - { name: drupal.command } + lazy: true + console.generate_form_config: + class: Drupal\Console\Command\Generate\ConfigFormBaseCommand + arguments: ['@console.extension_manager', '@console.form_generator', '@console.string_converter', '@router.route_provider', '@plugin.manager.element_info', '@app.root', '@console.chain_queue'] + tags: + - { name: drupal.command } + lazy: true + console.generate_plugin_type_annotation: + class: Drupal\Console\Command\Generate\PluginTypeAnnotationCommand + arguments: ['@console.extension_manager', '@console.plugin_type_annotation_generator', '@console.string_converter'] + tags: + - { name: drupal.command } + lazy: true + console.generate_plugin_condition: + class: Drupal\Console\Command\Generate\PluginConditionCommand + arguments: ['@console.extension_manager', '@console.plugin_condition_generator', '@console.chain_queue', '@entity_type.repository', '@console.string_converter'] + tags: + - { name: drupal.command } + lazy: true + console.generate_plugin_field: + class: Drupal\Console\Command\Generate\PluginFieldCommand + arguments: ['@console.extension_manager','@console.string_converter', '@console.chain_queue'] + tags: + - { name: drupal.command } + lazy: true + console.generate_plugin_field_formatter: + class: Drupal\Console\Command\Generate\PluginFieldFormatterCommand + arguments: ['@console.extension_manager', '@console.plugin_field_formatter_generator','@console.string_converter', '@plugin.manager.field.field_type', '@console.chain_queue'] + tags: + - { name: drupal.command } + lazy: true + console.generate_plugin_field_type: + class: Drupal\Console\Command\Generate\PluginFieldTypeCommand + arguments: ['@console.extension_manager', '@console.plugin_field_type_generator','@console.string_converter', '@console.chain_queue'] + tags: + - { name: drupal.command } + lazy: true + console.generate_plugin_field_widget: + class: Drupal\Console\Command\Generate\PluginFieldWidgetCommand + arguments: ['@console.extension_manager', '@console.plugin_field_widget_generator','@console.string_converter', '@plugin.manager.field.field_type', '@console.chain_queue'] + tags: + - { name: drupal.command } + lazy: true + console.generate_plugin_image_effect: + class: Drupal\Console\Command\Generate\PluginImageEffectCommand + arguments: ['@console.extension_manager', '@console.plugin_image_effect_generator','@console.string_converter', '@console.chain_queue'] + tags: + - { name: drupal.command } + lazy: true + console.generate_plugin_image_formatter: + class: Drupal\Console\Command\Generate\PluginImageFormatterCommand + arguments: ['@console.extension_manager', '@console.plugin_image_formatter_generator','@console.string_converter', '@console.validator', '@console.chain_queue'] + tags: + - { name: drupal.command } + lazy: true + console.generate_plugin_mail: + class: Drupal\Console\Command\Generate\PluginMailCommand + arguments: ['@console.extension_manager', '@console.plugin_mail_generator','@console.string_converter', '@console.validator', '@console.chain_queue'] + tags: + - { name: drupal.command } + lazy: true + console.generate_plugin_migrate_source: + class: Drupal\Console\Command\Generate\PluginMigrateSourceCommand + arguments: ['@config.factory', '@console.chain_queue', '@console.plugin_migrate_source_generator', '@entity_type.manager', '@console.extension_manager', '@console.validator', '@console.string_converter', '@plugin.manager.element_info'] + tags: + - { name: drupal.command } + lazy: true + console.generate_plugin_migrate_process: + class: Drupal\Console\Command\Generate\PluginMigrateProcessCommand + arguments: [ '@console.plugin_migrate_process_generator', '@console.chain_queue', '@console.extension_manager', '@console.string_converter'] + tags: + - { name: drupal.command } + lazy: true + console.generate_plugin_rest_resource: + class: Drupal\Console\Command\Generate\PluginRestResourceCommand + arguments: ['@console.extension_manager', '@console.plugin_rest_resource_generator','@console.string_converter', '@console.chain_queue'] + tags: + - { name: drupal.command } + lazy: true + console.generate_plugin_rules_action: + class: Drupal\Console\Command\Generate\PluginRulesActionCommand + arguments: ['@console.extension_manager', '@console.plugin_rules_action_generator','@console.string_converter', '@console.chain_queue'] + tags: + - { name: drupal.command } + lazy: true + console.generate_plugin_skeleton: + class: Drupal\Console\Command\Generate\PluginSkeletonCommand + arguments: ['@console.extension_manager', '@console.plugin_skeleton_generator','@console.string_converter', '@console.validator', '@console.chain_queue'] + tags: + - { name: drupal.command } + lazy: true + console.generate_plugin_type_yaml: + class: Drupal\Console\Command\Generate\PluginTypeYamlCommand + arguments: ['@console.extension_manager', '@console.plugin_type_yaml_generator','@console.string_converter'] + tags: + - { name: drupal.command } + lazy: true + console.generate_plugin_views_field: + class: Drupal\Console\Command\Generate\PluginViewsFieldCommand + arguments: ['@console.extension_manager', '@console.plugin_views_field_generator', '@console.site','@console.string_converter','@console.chain_queue'] + tags: + - { name: drupal.command } + lazy: true + console.generate_post_update: + class: Drupal\Console\Command\Generate\PostUpdateCommand + arguments: ['@console.extension_manager', '@console.post_update_generator', '@console.site', '@console.validator','@console.chain_queue'] + tags: + - { name: drupal.command } + lazy: true + console.generate_profile: + class: Drupal\Console\Command\Generate\ProfileCommand + arguments: ['@console.extension_manager', '@console.profile_generator', '@console.string_converter', '@console.validator', '@app.root'] + tags: + - { name: drupal.command } + lazy: true + console.generate_route_subscriber: + class: Drupal\Console\Command\Generate\RouteSubscriberCommand + arguments: ['@console.extension_manager', '@console.route_subscriber_generator', '@console.chain_queue'] + tags: + - { name: drupal.command } + lazy: true + console.generate_service: + class: Drupal\Console\Command\Generate\ServiceCommand + arguments: ['@console.extension_manager', '@console.service_generator', '@console.string_converter', '@console.chain_queue'] + tags: + - { name: drupal.command } + lazy: true + console.generate_theme: + class: Drupal\Console\Command\Generate\ThemeCommand + arguments: ['@console.extension_manager', '@console.theme_generator', '@console.validator', '@app.root', '@theme_handler', '@console.site', '@console.string_converter'] + tags: + - { name: drupal.command } + lazy: true + console.generate_twig_extension: + class: Drupal\Console\Command\Generate\TwigExtensionCommand + arguments: ['@console.extension_manager', '@console.twig_extension_generator', '@console.site', '@console.string_converter', '@console.chain_queue'] + tags: + - { name: drupal.command } + lazy: true + console.generate_update: + class: Drupal\Console\Command\Generate\UpdateCommand + arguments: ['@console.extension_manager', '@console.update_generator', '@console.site', '@console.chain_queue'] + tags: + - { name: drupal.command } + lazy: true + console.generate_pluginblock: + class: Drupal\Console\Command\Generate\PluginBlockCommand + arguments: ['@config.factory', '@console.chain_queue', '@console.pluginblock_generator', '@entity_type.manager', '@console.extension_manager', '@console.validator', '@console.string_converter', '@plugin.manager.element_info'] + tags: + - { name: drupal.command } + lazy: true + console.generate_command: + class: Drupal\Console\Command\Generate\CommandCommand + arguments: ['@console.command_generator', '@console.extension_manager', '@console.validator', '@console.string_converter', '@console.site'] + tags: + - { name: drupal.command } + lazy: true + console.generate_ckeditorbutton: + class: Drupal\Console\Command\Generate\PluginCKEditorButtonCommand + arguments: ['@console.chain_queue', '@console.command_ckeditorbutton', '@console.extension_manager', '@console.string_converter'] + tags: + - { name: drupal.command } + lazy: true + console.generate_entitycontent: + class: Drupal\Console\Command\Generate\EntityContentCommand + arguments: ['@console.chain_queue', '@console.entitycontent_generator', '@console.string_converter', '@console.extension_manager', '@console.validator'] + tags: + - { name: drupal.command } + lazy: true + console.generate_entitybundle: + class: Drupal\Console\Command\Generate\EntityBundleCommand + arguments: ['@console.validator', '@console.entitybundle_generator', '@console.extension_manager'] + tags: + - { name: drupal.command } + lazy: true + console.generate_entityconfig: + class: Drupal\Console\Command\Generate\EntityConfigCommand + arguments: ['@console.extension_manager', '@console.entityconfig_generator', '@console.validator', '@console.string_converter'] + tags: + - { name: drupal.command } + lazy: true + console.generate_cache_context: + class: Drupal\Console\Command\Generate\CacheContextCommand + arguments: [ '@console.cache_context_generator', '@console.chain_queue', '@console.extension_manager', '@console.string_converter'] + tags: + - { name: drupal.command } + lazy: true diff --git a/config/services/generator.yml b/config/services/generator.yml new file mode 100644 index 000000000..aa2b56c7d --- /dev/null +++ b/config/services/generator.yml @@ -0,0 +1,244 @@ +services: + console.module_generator: + class: Drupal\Console\Generator\ModuleGenerator + tags: + - { name: drupal.generator } + lazy: true + console.modulefile_generator: + class: Drupal\Console\Generator\ModuleFileGenerator + tags: + - { name: drupal.generator } + lazy: true + console.authentication_provider_generator: + class: Drupal\Console\Generator\AuthenticationProviderGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.help_generator: + class: Drupal\Console\Generator\HelpGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.controller_generator: + class: Drupal\Console\Generator\ControllerGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.breakpoint_generator: + class: Drupal\Console\Generator\BreakPointGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.form_alter_generator: + class: Drupal\Console\Generator\FormAlterGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.permission_generator: + class: Drupal\Console\Generator\PermissionGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.event_subscriber_generator: + class: Drupal\Console\Generator\EventSubscriberGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.form_generator: + class: Drupal\Console\Generator\FormGenerator + arguments: ['@console.extension_manager', '@console.string_converter'] + tags: + - { name: drupal.generator } + lazy: true + console.profile_generator: + class: Drupal\Console\Generator\ProfileGenerator + tags: + - { name: drupal.generator } + lazy: true + console.post_update_generator: + class: Drupal\Console\Generator\PostUpdateGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.plugin_condition_generator: + class: Drupal\Console\Generator\PluginConditionGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.plugin_field_generator: + class: Drupal\Console\Generator\PluginFieldFormatterGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.plugin_field_formatter_generator: + class: Drupal\Console\Generator\PluginFieldFormatterGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.plugin_field_type_generator: + class: Drupal\Console\Generator\PluginFieldTypeGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.plugin_field_widget_generator: + class: Drupal\Console\Generator\PluginFieldWidgetGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.plugin_image_effect_generator: + class: Drupal\Console\Generator\PluginImageEffectGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.plugin_image_formatter_generator: + class: Drupal\Console\Generator\PluginImageFormatterGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.plugin_mail_generator: + class: Drupal\Console\Generator\PluginMailGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.plugin_migrate_source_generator: + class: Drupal\Console\Generator\PluginMigrateSourceGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.plugin_migrate_process_generator: + class: Drupal\Console\Generator\PluginMigrateProcessGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.plugin_rest_resource_generator: + class: Drupal\Console\Generator\PluginRestResourceGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.plugin_rules_action_generator: + class: Drupal\Console\Generator\PluginRulesActionGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.plugin_skeleton_generator: + class: Drupal\Console\Generator\PluginSkeletonGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.plugin_views_field_generator: + class: Drupal\Console\Generator\PluginViewsFieldGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.plugin_type_annotation_generator: + class: Drupal\Console\Generator\PluginTypeAnnotationGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.plugin_type_yaml_generator: + class: Drupal\Console\Generator\PluginTypeYamlGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.route_subscriber_generator: + class: Drupal\Console\Generator\RouteSubscriberGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.service_generator: + class: Drupal\Console\Generator\ServiceGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.theme_generator: + class: Drupal\Console\Generator\ThemeGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.twig_extension_generator: + class: Drupal\Console\Generator\TwigExtensionGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.update_generator: + class: Drupal\Console\Generator\UpdateGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.pluginblock_generator: + class: Drupal\Console\Generator\PluginBlockGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.command_generator: + class: Drupal\Console\Generator\CommandGenerator + arguments: ['@console.extension_manager', '@console.translator_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.command_ckeditorbutton: + class: Drupal\Console\Generator\PluginCKEditorButtonGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.database_settings_generator: + class: Drupal\Console\Generator\DatabaseSettingsGenerator + arguments: ['@kernel'] + tags: + - { name: drupal.generator } + lazy: true + console.entitycontent_generator: + class: Drupal\Console\Generator\EntityContentGenerator + arguments: ['@console.extension_manager', '@console.site', '@console.renderer'] + tags: + - { name: drupal.generator } + lazy: true + console.entitybundle_generator: + class: Drupal\Console\Generator\EntityBundleGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.entityconfig_generator: + class: Drupal\Console\Generator\EntityConfigGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true + console.cache_context_generator: + class: Drupal\Console\Generator\CacheContextGenerator + arguments: ['@console.extension_manager'] + tags: + - { name: drupal.generator } + lazy: true diff --git a/src/Command/Generate/AuthenticationProviderCommand.php b/src/Command/Generate/AuthenticationProviderCommand.php new file mode 100644 index 000000000..8e6e2a027 --- /dev/null +++ b/src/Command/Generate/AuthenticationProviderCommand.php @@ -0,0 +1,158 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->stringConverter = $stringConverter; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:authentication:provider') + ->setDescription($this->trans('commands.generate.authentication.provider.description')) + ->setHelp($this->trans('commands.generate.authentication.provider.help')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'class', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.authentication.provider.options.class') + ) + ->addOption( + 'provider-id', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.authentication.provider.options.provider-id') + ) + ->setAliases(['gap']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $class = $input->getOption('class'); + $provider_id = $input->getOption('provider-id'); + + $this->generator->generate($module, $class, $provider_id); + + return 0; + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $stringUtils = $this->stringConverter; + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --class option + $class = $input->getOption('class'); + if (!$class) { + $class = $io->ask( + $this->trans( + 'commands.generate.authentication.provider.options.class' + ), + 'DefaultAuthenticationProvider', + function ($value) use ($stringUtils) { + if (!strlen(trim($value))) { + throw new \Exception('The Class name can not be empty'); + } + + return $stringUtils->humanToCamelCase($value); + } + ); + $input->setOption('class', $class); + } + // --provider-id option + $provider_id = $input->getOption('provider-id'); + if (!$provider_id) { + $provider_id = $io->ask( + $this->trans('commands.generate.authentication.provider.options.provider-id'), + $stringUtils->camelCaseToUnderscore($class), + function ($value) use ($stringUtils) { + if (!strlen(trim($value))) { + throw new \Exception('The Class name can not be empty'); + } + + return $stringUtils->camelCaseToUnderscore($value); + } + ); + $input->setOption('provider-id', $provider_id); + } + } +} diff --git a/src/Command/Generate/BreakPointCommand.php b/src/Command/Generate/BreakPointCommand.php new file mode 100644 index 000000000..bb53df8ef --- /dev/null +++ b/src/Command/Generate/BreakPointCommand.php @@ -0,0 +1,172 @@ +generator = $generator; + $this->appRoot = $appRoot; + $this->themeHandler = $themeHandler; + $this->validator = $validator; + $this->stringConverter = $stringConverter; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('generate:breakpoint') + ->setDescription($this->trans('commands.generate.breakpoint.description')) + ->setHelp($this->trans('commands.generate.breakpoint.help')) + ->addOption( + 'theme', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.breakpoint.options.theme') + ) + ->addOption( + 'breakpoints', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.breakpoint.options.breakpoints') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $validators = $this->validator; + // we must to ensure theme exist + $machine_name = $validators->validateMachineName($input->getOption('theme')); + $theme_path = $drupal_root . $input->getOption('theme'); + $breakpoints = $input->getOption('breakpoints'); + + $this->generator->generate( + $theme_path, + $breakpoints, + $machine_name + ); + + return 0; + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $drupalRoot = $this->appRoot; + + // --base-theme option. + $base_theme = $input->getOption('theme'); + + if (!$base_theme) { + $themeHandler = $this->themeHandler; + $themes = $themeHandler->rebuildThemeData(); + $themes['classy'] =''; + + uasort($themes, 'system_sort_modules_by_info_name'); + + $base_theme = $io->choiceNoList( + $this->trans('commands.generate.breakpoint.questions.theme'), + array_keys($themes) + ); + $input->setOption('theme', $base_theme); + } + + // --breakpoints option. + $breakpoints = $input->getOption('breakpoints'); + if (!$breakpoints) { + $breakpoints = $this->breakpointQuestion($io); + $input->setOption('breakpoints', $breakpoints); + } + } +} diff --git a/src/Command/Generate/CacheContextCommand.php b/src/Command/Generate/CacheContextCommand.php new file mode 100644 index 000000000..5ca9c0137 --- /dev/null +++ b/src/Command/Generate/CacheContextCommand.php @@ -0,0 +1,174 @@ +generator = $generator; + $this->chainQueue = $chainQueue; + $this->extensionManager = $extensionManager; + $this->stringConverter = $stringConverter; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('generate:cache:context') + ->setDescription($this->trans('commands.generate.cache.context.description')) + ->setHelp($this->trans('commands.generate.cache.context.description')) + ->addOption( + 'module', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.common.options.module')) + ->addOption( + 'cache-context', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.cache.context.questions.name') + ) + ->addOption( + 'class', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.cache.context.questions.class') + ) + ->addOption( + 'services', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.common.options.services') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $cache_context = $input->getOption('cache-context'); + $class = $input->getOption('class'); + $services = $input->getOption('services'); + + // @see Drupal\Console\Command\Shared\ServicesTrait::buildServices + $buildServices = $this->buildServices($services); + + $this->generator->generate($module, $cache_context, $class, $buildServices); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --cache_context option + $cache_context = $input->getOption('cache-context'); + if (!$cache_context) { + $cache_context = $io->ask( + $this->trans('commands.generate.cache.context.questions.name'), + sprintf('%s', $module) + ); + $input->setOption('cache-context', $cache_context); + } + + // --class option + $class = $input->getOption('class'); + if (!$class) { + $class = $io->ask( + $this->trans('commands.generate.cache.context.questions.class'), + 'DefaultCacheContext' + ); + $input->setOption('class', $class); + } + + // --services option + $services = $input->getOption('services'); + if (!$services) { + // @see Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion + $services = $this->servicesQuestion($io); + $input->setOption('services', $services); + } + } +} diff --git a/src/Command/Generate/CommandCommand.php b/src/Command/Generate/CommandCommand.php new file mode 100644 index 000000000..3b1901329 --- /dev/null +++ b/src/Command/Generate/CommandCommand.php @@ -0,0 +1,224 @@ +generator = $generator; + $this->extensionManager = $extensionManager; + $this->validator = $validator; + $this->stringConverter = $stringConverter; + $this->site = $site; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('generate:command') + ->setDescription($this->trans('commands.generate.command.description')) + ->setHelp($this->trans('commands.generate.command.help')) + ->addOption( + 'extension', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.common.options.extension') + ) + ->addOption( + 'extension-type', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.common.options.extension-type') + ) + ->addOption( + 'class', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.command.options.class') + ) + ->addOption( + 'name', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.command.options.name') + ) + ->addOption( + 'container-aware', + null, + InputOption::VALUE_NONE, + $this->trans('commands.generate.command.options.container-aware') + ) + ->addOption( + 'services', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.common.options.services') + ) + ->setAliases(['gcm']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $extension = $input->getOption('extension'); + $extensionType = $input->getOption('extension-type'); + $class = $input->getOption('class'); + $name = $input->getOption('name'); + $containerAware = $input->getOption('container-aware'); + $services = $input->getOption('services'); + $yes = $input->hasOption('yes')?$input->getOption('yes'):false; + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io, $yes)) { + return 1; + } + + // @see use Drupal\Console\Command\Shared\ServicesTrait::buildServices + $build_services = $this->buildServices($services); + + $this->generator->generate( + $extension, + $extensionType, + $name, + $class, + $containerAware, + $build_services + ); + + $this->site->removeCachedServicesFile(); + + return 0; + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $extension = $input->getOption('extension'); + if (!$extension) { + $extension = $this->extensionQuestion($io, true, true); + $input->setOption('extension', $extension->getName()); + $input->setOption('extension-type', $extension->getType()); + } + + $extensionType = $input->getOption('extension-type'); + if (!$extensionType) { + $extensionType = $this->extensionTypeQuestion($io); + $input->setOption('extension-type', $extensionType); + } + + $name = $input->getOption('name'); + if (!$name) { + $name = $io->ask( + $this->trans('commands.generate.command.questions.name'), + sprintf('%s:default', $extension->getName()) + ); + $input->setOption('name', $name); + } + + $class = $input->getOption('class'); + if (!$class) { + $class = $io->ask( + $this->trans('commands.generate.command.questions.class'), + 'DefaultCommand', + function ($class) { + return $this->validator->validateCommandName($class); + } + ); + $input->setOption('class', $class); + } + + $containerAware = $input->getOption('container-aware'); + if (!$containerAware) { + $containerAware = $io->confirm( + $this->trans('commands.generate.command.questions.container-aware'), + false + ); + $input->setOption('container-aware', $containerAware); + } + + if (!$containerAware) { + // @see use Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion + $services = $this->servicesQuestion($io); + $input->setOption('services', $services); + } + } +} diff --git a/src/Command/Generate/ConfigFormBaseCommand.php b/src/Command/Generate/ConfigFormBaseCommand.php new file mode 100644 index 000000000..736180c1c --- /dev/null +++ b/src/Command/Generate/ConfigFormBaseCommand.php @@ -0,0 +1,91 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->stringConverter = $stringConverter; + $this->routeProvider = $routeProvider; + $this->elementInfoManager = $elementInfoManager; + $this->appRoot = $appRoot; + $this->chainQueue = $chainQueue; + parent::__construct($extensionManager, $generator, $chainQueue, $stringConverter, $elementInfoManager, $routeProvider); + } + + protected function configure() + { + $this->setFormType('ConfigFormBase'); + $this->setCommandName('generate:form:config'); + $this->setAliases(['gfc']); + parent::configure(); + } +} diff --git a/src/Command/Generate/ControllerCommand.php b/src/Command/Generate/ControllerCommand.php new file mode 100644 index 000000000..0a0a08f14 --- /dev/null +++ b/src/Command/Generate/ControllerCommand.php @@ -0,0 +1,320 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->stringConverter = $stringConverter; + $this->validator = $validator; + $this->routeProvider = $routeProvider; + $this->chainQueue = $chainQueue; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:controller') + ->setDescription($this->trans('commands.generate.controller.description')) + ->setHelp($this->trans('commands.generate.controller.help')) + ->addOption( + 'module', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.common.options.module') + ) + ->addOption( + 'class', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.controller.options.class') + ) + ->addOption( + 'routes', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.generate.controller.options.routes') + ) + ->addOption( + 'services', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.common.options.services') + ) + ->addOption( + 'test', + null, + InputOption::VALUE_NONE, + $this->trans('commands.generate.controller.options.test') + ) + ->setAliases(['gcn']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + $yes = $input->hasOption('yes')?$input->getOption('yes'):false; + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io, $yes)) { + return 1; + } + + $module = $input->getOption('module'); + $class = $input->getOption('class'); + $routes = $input->getOption('routes'); + $test = $input->getOption('test'); + $services = $input->getOption('services'); + + $routes = $this->inlineValueAsArray($routes); + $input->setOption('routes', $routes); + + // @see use Drupal\Console\Command\Shared\ServicesTrait::buildServices + $build_services = $this->buildServices($services); + + //$this->generator->setLearning($learning); + $this->generator->generate( + $module, + $class, + $routes, + $test, + $build_services + ); + + // Run cache rebuild to see changes in Web UI + $this->chainQueue->addCommand('router:rebuild', []); + + return 0; + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --class option + $class = $input->getOption('class'); + if (!$class) { + $class = $io->ask( + $this->trans('commands.generate.controller.questions.class'), + 'DefaultController', + function ($class) { + return $this->validator->validateClassName($class); + } + ); + $input->setOption('class', $class); + } + + $routes = $input->getOption('routes'); + if (!$routes) { + while (true) { + $title = $io->askEmpty( + $this->trans('commands.generate.controller.questions.title'), + function ($title) use ($routes) { + if ($routes && empty(trim($title))) { + return false; + } + + if (!$routes && empty(trim($title))) { + throw new \InvalidArgumentException( + $this->trans( + 'commands.generate.controller.messages.title-empty' + ) + ); + } + + if (in_array($title, array_column($routes, 'title'))) { + throw new \InvalidArgumentException( + sprintf( + $this->trans( + 'commands.generate.controller.messages.title-already-added' + ), + $title + ) + ); + } + + return $title; + } + ); + + if ($title === '') { + break; + } + + $method = $io->ask( + $this->trans('commands.generate.controller.questions.method'), + 'hello', + function ($method) use ($routes) { + if (in_array($method, array_column($routes, 'method'))) { + throw new \InvalidArgumentException( + sprintf( + $this->trans( + 'commands.generate.controller.messages.method-already-added' + ), + $method + ) + ); + } + + return $method; + } + ); + + $path = $io->ask( + $this->trans('commands.generate.controller.questions.path'), + sprintf( + '/%s/'.($method!='hello'?$method:'hello/{name}'), + $module + ), + function ($path) use ($routes) { + if (count($this->routeProvider->getRoutesByPattern($path)) > 0 + || in_array($path, array_column($routes, 'path')) + ) { + throw new \InvalidArgumentException( + sprintf( + $this->trans( + 'commands.generate.controller.messages.path-already-added' + ), + $path + ) + ); + } + + return $path; + } + ); + $classMachineName = $this->stringConverter->camelCaseToMachineName($class); + $routeName = $module . '.' . $classMachineName . '_' . $method; + if ($this->routeProvider->getRoutesByNames([$routeName]) + || in_array($routeName, $routes) + ) { + $routeName .= '_' . rand(0, 100); + } + + $routes[] = [ + 'title' => $title, + 'name' => $routeName, + 'method' => $method, + 'path' => $path + ]; + } + $input->setOption('routes', $routes); + } + + // --test option + $test = $input->getOption('test'); + if (!$test) { + $test = $io->confirm( + $this->trans('commands.generate.controller.questions.test'), + true + ); + + $input->setOption('test', $test); + } + + // --services option + // @see use Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion + $services = $this->servicesQuestion($io); + $input->setOption('services', $services); + } + + /** + * @return \Drupal\Console\Generator\ControllerGenerator + */ + protected function createGenerator() + { + return new ControllerGenerator(); + } +} diff --git a/src/Command/Generate/EntityBundleCommand.php b/src/Command/Generate/EntityBundleCommand.php new file mode 100644 index 000000000..2a9ef6897 --- /dev/null +++ b/src/Command/Generate/EntityBundleCommand.php @@ -0,0 +1,151 @@ +validator = $validator; + $this->generator = $generator; + $this->extensionManager = $extensionManager; + parent::__construct(); + } + + + protected function configure() + { + $this + ->setName('generate:entity:bundle') + ->setDescription($this->trans('commands.generate.entity.bundle.description')) + ->setHelp($this->trans('commands.generate.entity.bundle.help')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'bundle-name', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.entity.bundle.options.bundle-name') + ) + ->addOption( + 'bundle-title', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.entity.bundle.options.bundle-title') + ) + ->setAliases(['geb']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $bundleName = $input->getOption('bundle-name'); + $bundleTitle = $input->getOption('bundle-title'); + + $generator = $this->generator; + //TODO: + // $generator->setLearning($learning); + $generator->generate($module, $bundleName, $bundleTitle); + + return 0; + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --bundle-name option + $bundleName = $input->getOption('bundle-name'); + if (!$bundleName) { + $bundleName = $io->ask( + $this->trans('commands.generate.entity.bundle.questions.bundle-name'), + 'default', + function ($bundleName) { + return $this->validator->validateClassName($bundleName); + } + ); + $input->setOption('bundle-name', $bundleName); + } + + // --bundle-title option + $bundleTitle = $input->getOption('bundle-title'); + if (!$bundleTitle) { + $bundleTitle = $io->ask( + $this->trans('commands.generate.entity.bundle.questions.bundle-title'), + 'default', + function ($bundle_title) { + return $this->validator->validateBundleTitle($bundle_title); + } + ); + $input->setOption('bundle-title', $bundleTitle); + } + } +} diff --git a/src/Command/Generate/EntityCommand.php b/src/Command/Generate/EntityCommand.php new file mode 100644 index 000000000..d5869edc7 --- /dev/null +++ b/src/Command/Generate/EntityCommand.php @@ -0,0 +1,176 @@ +entityType = $entityType; + } + + /** + * @param $commandName + */ + protected function setCommandName($commandName) + { + $this->commandName = $commandName; + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $commandKey = str_replace(':', '.', $this->commandName); + + $this + ->setName($this->commandName) + ->setDescription( + sprintf( + $this->trans('commands.'.$commandKey.'.description'), + $this->entityType + ) + ) + ->setHelp( + sprintf( + $this->trans('commands.'.$commandKey.'.help'), + $this->commandName, + $this->entityType + ) + ) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'entity-class', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.'.$commandKey.'.options.entity-class') + ) + ->addOption( + 'entity-name', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.'.$commandKey.'.options.entity-name') + ) + ->addOption( + 'base-path', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.' . $commandKey . '.options.base-path') + ) + ->addOption( + 'label', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.'.$commandKey.'.options.label') + ); + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + // Operations defined in EntityConfigCommand and EntityContentCommand. + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $commandKey = str_replace(':', '.', $this->commandName); + $utils = $this->stringConverter; + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --entity-class option + $entityClass = $input->getOption('entity-class'); + if (!$entityClass) { + $entityClass = $io->ask( + $this->trans('commands.'.$commandKey.'.questions.entity-class'), + 'DefaultEntity', + function ($entityClass) { + return $this->validator->validateSpaces($entityClass); + } + ); + + $input->setOption('entity-class', $entityClass); + } + + // --entity-name option + $entityName = $input->getOption('entity-name'); + if (!$entityName) { + $entityName = $io->ask( + $this->trans('commands.'.$commandKey.'.questions.entity-name'), + $utils->camelCaseToMachineName($entityClass), + function ($entityName) { + return $this->validator->validateMachineName($entityName); + } + ); + $input->setOption('entity-name', $entityName); + } + + // --label option + $label = $input->getOption('label'); + if (!$label) { + $label = $io->ask( + $this->trans('commands.'.$commandKey.'.questions.label'), + $utils->camelCaseToHuman($entityClass) + ); + $input->setOption('label', $label); + } + + // --base-path option + $base_path = $input->getOption('base-path'); + if (!$base_path) { + $base_path = $this->getDefaultBasePath(); + } + $base_path = $io->ask( + $this->trans('commands.'.$commandKey.'.questions.base-path'), + $base_path + ); + if (substr($base_path, 0, 1) !== '/') { + // Base path must start with a leading '/'. + $base_path = '/' . $base_path; + } + $input->setOption('base-path', $base_path); + } + + /** + * Gets default base path. + * + * @return string + * Default base path. + */ + protected function getDefaultBasePath() + { + return '/admin/structure'; + } +} diff --git a/src/Command/Generate/EntityConfigCommand.php b/src/Command/Generate/EntityConfigCommand.php new file mode 100644 index 000000000..0f77e100a --- /dev/null +++ b/src/Command/Generate/EntityConfigCommand.php @@ -0,0 +1,101 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->validator = $validator; + $this->stringConverter = $stringConverter; + parent::__construct(); + } + + + protected function configure() + { + $this->setEntityType('EntityConfig'); + $this->setCommandName('generate:entity:config'); + parent::configure(); + + $this->addOption( + 'bundle-of', + null, + InputOption::VALUE_NONE, + $this->trans('commands.generate.entity.config.options.bundle-of') + ) + ->setAliases(['gecg']); + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + parent::interact($input, $output); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $module = $input->getOption('module'); + $entity_class = $input->getOption('entity-class'); + $entity_name = $input->getOption('entity-name'); + $label = $input->getOption('label'); + $bundle_of = $input->getOption('bundle-of'); + $base_path = $input->getOption('base-path'); + + $this + ->generator + ->generate($module, $entity_name, $entity_class, $label, $base_path, $bundle_of); + } +} diff --git a/src/Command/Generate/EntityContentCommand.php b/src/Command/Generate/EntityContentCommand.php new file mode 100644 index 000000000..b664450e2 --- /dev/null +++ b/src/Command/Generate/EntityContentCommand.php @@ -0,0 +1,174 @@ +chainQueue = $chainQueue; + $this->generator = $generator; + $this->stringConverter = $stringConverter; + $this->extensionManager = $extensionManager; + $this->validator = $validator; + parent::__construct(); + } + + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setEntityType('EntityContent'); + $this->setCommandName('generate:entity:content'); + parent::configure(); + + $this->addOption( + 'has-bundles', + null, + InputOption::VALUE_NONE, + $this->trans('commands.generate.entity.content.options.has-bundles') + ); + + $this->addOption( + 'is-translatable', + null, + InputOption::VALUE_NONE, + $this->trans('commands.generate.entity.content.options.is-translatable') + ); + + $this->addOption( + 'revisionable', + null, + InputOption::VALUE_NONE, + $this->trans('commands.generate.entity.content.options.revisionable') + ) + ->setAliases(['gect']); + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + parent::interact($input, $output); + $io = new DrupalStyle($input, $output); + + // --bundle-of option + $bundle_of = $input->getOption('has-bundles'); + if (!$bundle_of) { + $bundle_of = $io->confirm( + $this->trans('commands.generate.entity.content.questions.has-bundles'), + false + ); + $input->setOption('has-bundles', $bundle_of); + } + + // --is-translatable option + $is_translatable = $io->confirm( + $this->trans('commands.generate.entity.content.questions.is-translatable'), + true + ); + $input->setOption('is-translatable', $is_translatable); + + // --revisionable option + $revisionable = $io->confirm( + $this->trans('commands.generate.entity.content.questions.revisionable'), + true + ); + $input->setOption('revisionable', $revisionable); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $module = $input->getOption('module'); + $entity_class = $input->getOption('entity-class'); + $entity_name = $input->getOption('entity-name'); + $label = $input->getOption('label'); + $has_bundles = $input->getOption('has-bundles'); + $base_path = $input->getOption('base-path'); + $learning = $input->hasOption('learning')?$input->getOption('learning'):false; + $bundle_entity_name = $has_bundles ? $entity_name . '_type' : null; + $is_translatable = $input->hasOption('is-translatable') ? $input->getOption('is-translatable') : true; + $revisionable = $input->hasOption('revisionable') ? $input->getOption('revisionable') : false; + + $io = new DrupalStyle($input, $output); + $generator = $this->generator; + + $generator->setIo($io); + //@TODO: + //$generator->setLearning($learning); + + $generator->generate($module, $entity_name, $entity_class, $label, $base_path, $is_translatable, $bundle_entity_name, $revisionable); + + if ($has_bundles) { + $this->chainQueue->addCommand( + 'generate:entity:config', [ + '--module' => $module, + '--entity-class' => $entity_class . 'Type', + '--entity-name' => $entity_name . '_type', + '--label' => $label . ' type', + '--bundle-of' => $entity_name + ] + ); + } + } +} diff --git a/src/Command/Generate/EventSubscriberCommand.php b/src/Command/Generate/EventSubscriberCommand.php new file mode 100644 index 000000000..b4f8b29fb --- /dev/null +++ b/src/Command/Generate/EventSubscriberCommand.php @@ -0,0 +1,197 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->stringConverter = $stringConverter; + $this->eventDispatcher = $eventDispatcher; + $this->chainQueue = $chainQueue; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('generate:event:subscriber') + ->setDescription($this->trans('commands.generate.event.subscriber.description')) + ->setHelp($this->trans('commands.generate.event.subscriber.description')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'name', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.service.options.name') + ) + ->addOption( + 'class', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.service.options.class') + ) + ->addOption( + 'events', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.common.options.events') + ) + ->addOption( + 'services', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.common.options.services') + ) + ->setAliases(['ges']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $name = $input->getOption('name'); + $class = $input->getOption('class'); + $events = $input->getOption('events'); + $services = $input->getOption('services'); + + // @see Drupal\Console\Command\Shared\ServicesTrait::buildServices + $buildServices = $this->buildServices($services); + + $this->generator->generate($module, $name, $class, $events, $buildServices); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --service-name option + $name = $input->getOption('name'); + if (!$name) { + $name = $io->ask( + $this->trans('commands.generate.service.questions.service-name'), + sprintf('%s.default', $module) + ); + $input->setOption('name', $name); + } + + // --class option + $class = $input->getOption('class'); + if (!$class) { + $class = $io->ask( + $this->trans('commands.generate.event.subscriber.questions.class'), + 'DefaultSubscriber' + ); + $input->setOption('class', $class); + } + + // --events option + $events = $input->getOption('events'); + if (!$events) { + // @see Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion + $events = $this->eventsQuestion($io); + $input->setOption('events', $events); + } + + // --services option + $services = $input->getOption('services'); + if (!$services) { + // @see Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion + $services = $this->servicesQuestion($io); + $input->setOption('services', $services); + } + } +} diff --git a/src/Command/Generate/FormAlterCommand.php b/src/Command/Generate/FormAlterCommand.php new file mode 100644 index 000000000..4c3d876f7 --- /dev/null +++ b/src/Command/Generate/FormAlterCommand.php @@ -0,0 +1,324 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->stringConverter = $stringConverter; + $this->moduleHandler = $moduleHandler; + $this->elementInfoManager = $elementInfoManager; + $this->profiler = $profiler; + $this->appRoot = $appRoot; + $this->chainQueue = $chainQueue; + parent::__construct(); + } + + protected $metadata = [ + 'class' => [], + 'method'=> [], + 'file'=> [], + 'unset' => [] + ]; + + protected function configure() + { + $this + ->setName('generate:form:alter') + ->setDescription( + $this->trans('commands.generate.form.alter.description') + ) + ->setHelp($this->trans('commands.generate.form.alter.help')) + ->addOption( + 'module', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.common.options.module') + ) + ->addOption( + 'form-id', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.form.alter.options.form-id') + ) + ->addOption( + 'inputs', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.common.options.inputs') + ) + ->setAliases(['gfa']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $formId = $input->getOption('form-id'); + $inputs = $input->getOption('inputs'); + + $function = $module . '_form_' .$formId . '_alter'; + + if ($this->extensionManager->validateModuleFunctionExist($module, $function)) { + throw new \Exception( + sprintf( + $this->trans('commands.generate.form.alter.messages.help-already-implemented'), + $module + ) + ); + } + + //validate if input is an array + if (!is_array($inputs[0])) { + $inputs= $this->explodeInlineArray($inputs); + } + + $this + ->generator + ->generate($module, $formId, $inputs, $this->metadata); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + return 0; + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + } + + $input->setOption('module', $module); + + // --form-id option + $formId = $input->getOption('form-id'); + if (!$formId) { + $forms = []; + // Get form ids from webprofiler + if ($this->moduleHandler->moduleExists('webprofiler')) { + $io->info( + $this->trans('commands.generate.form.alter.messages.loading-forms') + ); + $forms = $this->getWebprofilerForms(); + } + + if (!empty($forms)) { + $formId = $io->choiceNoList( + $this->trans('commands.generate.form.alter.options.form-id'), + array_keys($forms) + ); + } + } + + if ($this->moduleHandler->moduleExists('webprofiler') && isset($forms[$formId])) { + $this->metadata['class'] = $forms[$formId]['class']['class']; + $this->metadata['method'] = $forms[$formId]['class']['method']; + $this->metadata['file'] = str_replace( + $this->appRoot, + '', + $forms[$formId]['class']['file'] + ); + + foreach ($forms[$formId]['form'] as $itemKey => $item) { + if ($item['#type'] == 'hidden') { + unset($forms[$formId]['form'][$itemKey]); + } + } + + unset($forms[$formId]['form']['form_build_id']); + unset($forms[$formId]['form']['form_token']); + unset($forms[$formId]['form']['form_id']); + unset($forms[$formId]['form']['actions']); + + $formItems = array_keys($forms[$formId]['form']); + + $formItemsToHide = $io->choice( + $this->trans('commands.generate.form.alter.messages.hide-form-elements'), + $formItems, + null, + true + ); + + $this->metadata['unset'] = array_filter(array_map('trim', $formItemsToHide)); + } + + $input->setOption('form-id', $formId); + + // @see Drupal\Console\Command\Shared\FormTrait::formQuestion + $inputs = $input->getOption('inputs'); + + if (empty($inputs)) { + $io->writeln($this->trans('commands.generate.form.alter.messages.inputs')); + $inputs = $this->formQuestion($io); + } else { + $inputs= $this->explodeInlineArray($inputs); + } + + $input->setOption('inputs', $inputs); + } + + /** + * @{@inheritdoc} + */ + public function explodeInlineArray($inlineInputs) + { + $inputs = []; + foreach ($inlineInputs as $inlineInput) { + $explodeInput = explode(" ", $inlineInput); + $parameters = []; + foreach ($explodeInput as $inlineParameter) { + list($key, $value) = explode(":", $inlineParameter); + if (!empty($value)) { + $parameters[$key] = $value; + } + } + $inputs[] = $parameters; + } + + return $inputs; + } + + protected function createGenerator() + { + return new FormAlterGenerator(); + } + + public function getWebprofilerForms() + { + $tokens = $this->profiler->find(null, null, 1000, null, '', ''); + $forms = []; + foreach ($tokens as $token) { + $token = [$token['token']]; + $profile = $this->profiler->loadProfile($token); + $formCollector = $profile->getCollector('forms'); + $collectedForms = $formCollector->getForms(); + if (empty($forms)) { + $forms = $collectedForms; + } elseif (!empty($collectedForms)) { + $forms = array_merge($forms, $collectedForms); + } + } + return $forms; + } +} diff --git a/src/Command/Generate/FormBaseCommand.php b/src/Command/Generate/FormBaseCommand.php new file mode 100644 index 000000000..9e75348da --- /dev/null +++ b/src/Command/Generate/FormBaseCommand.php @@ -0,0 +1,18 @@ +setFormType('FormBase'); + $this->setCommandName('generate:form'); + parent::configure(); + } +} diff --git a/src/Command/Generate/FormCommand.php b/src/Command/Generate/FormCommand.php new file mode 100644 index 000000000..6b84175c8 --- /dev/null +++ b/src/Command/Generate/FormCommand.php @@ -0,0 +1,330 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->chainQueue = $chainQueue; + $this->stringConverter = $stringConverter; + $this->elementInfoManager = $elementInfoManager; + $this->routeProvider = $routeProvider; + parent::__construct(); + } + + protected function setFormType($formType) + { + return $this->formType = $formType; + } + + protected function setCommandName($commandName) + { + return $this->commandName = $commandName; + } + + protected function configure() + { + $this + ->setName($this->commandName) + ->setDescription( + sprintf( + $this->trans('commands.generate.form.description'), + $this->formType + ) + ) + ->setHelp( + sprintf( + $this->trans('commands.generate.form.help'), + $this->commandName, + $this->formType + ) + ) + ->addOption( + 'module', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.common.options.module') + ) + ->addOption( + 'class', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.form.options.class') + ) + ->addOption( + 'form-id', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.form.options.form-id') + ) + ->addOption( + 'services', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.common.options.services') + ) + ->addOption( + 'config-file', + null, + InputOption::VALUE_NONE, + $this->trans('commands.generate.form.options.config-file') + ) + ->addOption( + 'inputs', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.common.options.inputs') + ) + ->addOption( + 'path', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.form.options.path') + ) + ->addOption( + 'menu-link-gen', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.form.options.menu-link-gen') + ) + ->addOption( + 'menu-link-title', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.form.options.menu-link-title') + ) + ->addOption( + 'menu-parent', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.form.options.menu-parent') + ) + ->addOption( + 'menu-link-desc', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.form.options.menu-link-desc') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $module = $input->getOption('module'); + $services = $input->getOption('services'); + $path = $input->getOption('path'); + $config_file = $input->getOption('config-file'); + $class_name = $input->getOption('class'); + $form_id = $input->getOption('form-id'); + $form_type = $this->formType; + $menu_link_gen = $input->getOption('menu-link-gen'); + $menu_parent = $input->getOption('menu-parent'); + $menu_link_title = $input->getOption('menu-link-title'); + $menu_link_desc = $input->getOption('menu-link-desc'); + + // if exist form generate config file + $inputs = $input->getOption('inputs'); + $build_services = $this->buildServices($services); + + $this + ->generator + ->generate($module, $class_name, $form_id, $form_type, $build_services, $config_file, $inputs, $path, $menu_link_gen, $menu_link_title, $menu_parent, $menu_link_desc); + + $this->chainQueue->addCommand('router:rebuild', []); + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --class option + $className = $input->getOption('class'); + if (!$className) { + $className = $io->ask( + $this->trans('commands.generate.form.questions.class'), + 'DefaultForm' + ); + $input->setOption('class', $className); + } + + // --form-id option + $formId = $input->getOption('form-id'); + if (!$formId) { + $formId = $io->ask( + $this->trans('commands.generate.form.questions.form-id'), + $this->stringConverter->camelCaseToMachineName($className) + ); + $input->setOption('form-id', $formId); + } + + // --services option + // @see use Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion + $services = $this->servicesQuestion($io); + $input->setOption('services', $services); + + // --config_file option + $config_file = $input->getOption('config-file'); + + if (!$config_file) { + $config_file = $io->confirm( + $this->trans('commands.generate.form.questions.config-file'), + true + ); + $input->setOption('config-file', $config_file); + } + + // --inputs option + $inputs = $input->getOption('inputs'); + if (!$inputs) { + // @see \Drupal\Console\Command\Shared\FormTrait::formQuestion + $inputs = $this->formQuestion($io); + $input->setOption('inputs', $inputs); + } + + $path = $input->getOption('path'); + if (!$path) { + if ($this->formType == 'ConfigFormBase') { + $form_path = '/admin/config/{{ module_name }}/{{ class_name_short }}'; + $form_path = sprintf( + '/admin/config/%s/%s', + $module, + strtolower($this->stringConverter->removeSuffix($className)) + ); + } else { + $form_path = sprintf( + '/%s/form/%s', + $module, + $this->stringConverter->camelCaseToMachineName($this->stringConverter->removeSuffix($className)) + ); + } + $path = $io->ask( + $this->trans('commands.generate.form.questions.path'), + $form_path, + function ($path) { + if (count($this->routeProvider->getRoutesByPattern($path)) > 0) { + throw new \InvalidArgumentException( + sprintf( + $this->trans( + 'commands.generate.form.messages.path-already-added' + ), + $path + ) + ); + } + + return $path; + } + ); + $input->setOption('path', $path); + } + + // --link option for links.menu + if ($this->formType == 'ConfigFormBase') { + $menu_options = $this->menuQuestion($io, $className); + $menu_link_gen = $input->getOption('menu-link-gen'); + $menu_link_title = $input->getOption('menu-link-title'); + $menu_parent = $input->getOption('menu-parent'); + $menu_link_desc = $input->getOption('menu-link-desc'); + if (!$menu_link_gen || !$menu_link_title || !$menu_parent || !$menu_link_desc) { + $input->setOption('menu-link-gen', $menu_options['menu_link_gen']); + $input->setOption('menu-link-title', $menu_options['menu_link_title']); + $input->setOption('menu-parent', $menu_options['menu_parent']); + $input->setOption('menu-link-desc', $menu_options['menu_link_desc']); + } + } + } +} diff --git a/src/Command/Generate/HelpCommand.php b/src/Command/Generate/HelpCommand.php new file mode 100644 index 000000000..678ce7143 --- /dev/null +++ b/src/Command/Generate/HelpCommand.php @@ -0,0 +1,148 @@ +generator = $generator; + $this->site = $site; + $this->extensionManager = $extensionManager; + $this->chainQueue = $chainQueue; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:help') + ->setDescription($this->trans('commands.generate.help.description')) + ->setHelp($this->trans('commands.generate.help.help')) + ->addOption( + 'module', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.common.options.module') + ) + ->addOption( + 'description', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.module.options.description') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + + if ($this->extensionManager->validateModuleFunctionExist($module, $module . '_help')) { + throw new \Exception( + sprintf( + $this->trans('commands.generate.help.messages.help-already-implemented'), + $module + ) + ); + } + + $description = $input->getOption('description'); + + $this + ->generator + ->generate($module, $description); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + return 0; + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $this->site->loadLegacyFile('/core/includes/update.inc'); + $this->site->loadLegacyFile('/core/includes/schema.inc'); + + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + $description = $input->getOption('description'); + if (!$description) { + $description = $io->ask( + $this->trans('commands.generate.module.questions.description'), + 'My Awesome Module' + ); + } + $input->setOption('description', $description); + } +} diff --git a/src/Command/Generate/ModuleCommand.php b/src/Command/Generate/ModuleCommand.php new file mode 100644 index 000000000..1382b08b3 --- /dev/null +++ b/src/Command/Generate/ModuleCommand.php @@ -0,0 +1,409 @@ +generator = $generator; + $this->validator = $validator; + $this->appRoot = $appRoot; + $this->stringConverter = $stringConverter; + $this->drupalApi = $drupalApi; + $this->twigtemplate = $twigtemplate; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('generate:module') + ->setDescription($this->trans('commands.generate.module.description')) + ->setHelp($this->trans('commands.generate.module.help')) + ->addOption( + 'module', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.module.options.module') + ) + ->addOption( + 'machine-name', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.module.options.machine-name') + ) + ->addOption( + 'module-path', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.module.options.module-path') + ) + ->addOption( + 'description', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.module.options.description') + ) + ->addOption( + 'core', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.module.options.core') + ) + ->addOption( + 'package', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.module.options.package') + ) + ->addOption( + 'module-file', + null, + InputOption::VALUE_NONE, + $this->trans('commands.generate.module.options.module-file') + ) + ->addOption( + 'features-bundle', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.module.options.features-bundle') + ) + ->addOption( + 'composer', + null, + InputOption::VALUE_NONE, + $this->trans('commands.generate.module.options.composer') + ) + ->addOption( + 'dependencies', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.module.options.dependencies'), + '' + ) + ->addOption( + 'test', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.module.options.test') + ) + ->addOption( + 'twigtemplate', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.module.options.twigtemplate') + ) + ->setAliases(['gm']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + $yes = $input->hasOption('yes')?$input->getOption('yes'):false; + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io, $yes)) { + return 1; + } + + $module = $this->validator->validateModuleName($input->getOption('module')); + + $modulePath = $this->appRoot . $input->getOption('module-path'); + $modulePath = $this->validator->validateModulePath($modulePath, true); + + $machineName = $this->validator->validateMachineName($input->getOption('machine-name')); + $description = $input->getOption('description'); + $core = $input->getOption('core'); + $package = $input->getOption('package'); + $moduleFile = $input->getOption('module-file'); + $featuresBundle = $input->getOption('features-bundle'); + $composer = $input->getOption('composer'); + $dependencies = $this->validator->validateExtensions( + $input->getOption('dependencies'), + 'module', + $io + ); + $test = $input->getOption('test'); + $twigTemplate = $input->getOption('twigtemplate'); + + $this->generator->generate( + $module, + $machineName, + $modulePath, + $description, + $core, + $package, + $moduleFile, + $featuresBundle, + $composer, + $dependencies, + $test, + $twigTemplate + ); + + return 0; + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $validator = $this->validator; + + try { + $module = $input->getOption('module') ? + $this->validator->validateModuleName( + $input->getOption('module') + ) : null; + } catch (\Exception $error) { + $io->error($error->getMessage()); + + return 1; + } + + if (!$module) { + $module = $io->ask( + $this->trans('commands.generate.module.questions.module'), + null, + function ($module) use ($validator) { + return $validator->validateModuleName($module); + } + ); + $input->setOption('module', $module); + } + + try { + $machineName = $input->getOption('machine-name') ? + $this->validator->validateModuleName( + $input->getOption('machine-name') + ) : null; + } catch (\Exception $error) { + $io->error($error->getMessage()); + } + + if (!$machineName) { + $machineName = $io->ask( + $this->trans('commands.generate.module.questions.machine-name'), + $this->stringConverter->createMachineName($module), + function ($machine_name) use ($validator) { + return $validator->validateMachineName($machine_name); + } + ); + $input->setOption('machine-name', $machineName); + } + + $modulePath = $input->getOption('module-path'); + if (!$modulePath) { + $drupalRoot = $this->appRoot; + $modulePath = $io->ask( + $this->trans('commands.generate.module.questions.module-path'), + '/modules/custom', + function ($modulePath) use ($drupalRoot, $machineName) { + $modulePath = ($modulePath[0] != '/' ? '/' : '').$modulePath; + $fullPath = $drupalRoot.$modulePath.'/'.$machineName; + if (file_exists($fullPath)) { + throw new \InvalidArgumentException( + sprintf( + $this->trans('commands.generate.module.errors.directory-exists'), + $fullPath + ) + ); + } + + return $modulePath; + } + ); + } + $input->setOption('module-path', $modulePath); + + $description = $input->getOption('description'); + if (!$description) { + $description = $io->ask( + $this->trans('commands.generate.module.questions.description'), + 'My Awesome Module' + ); + } + $input->setOption('description', $description); + + $package = $input->getOption('package'); + if (!$package) { + $package = $io->ask( + $this->trans('commands.generate.module.questions.package'), + 'Custom' + ); + } + $input->setOption('package', $package); + + $core = $input->getOption('core'); + if (!$core) { + $core = $io->ask( + $this->trans('commands.generate.module.questions.core'), '8.x', + function ($core) { + // Only allow 8.x and higher as core version. + if (!preg_match('/^([0-9]+)\.x$/', $core, $matches) || ($matches[1] < 8)) { + throw new \InvalidArgumentException( + sprintf( + $this->trans('commands.generate.module.errors.invalid-core'), + $core + ) + ); + } + + return $core; + } + ); + $input->setOption('core', $core); + } + + $moduleFile = $input->getOption('module-file'); + if (!$moduleFile) { + $moduleFile = $io->confirm( + $this->trans('commands.generate.module.questions.module-file'), + true + ); + $input->setOption('module-file', $moduleFile); + } + + $featuresBundle = $input->getOption('features-bundle'); + if (!$featuresBundle) { + $featuresSupport = $io->confirm( + $this->trans('commands.generate.module.questions.features-support'), + false + ); + if ($featuresSupport) { + $featuresBundle = $io->ask( + $this->trans('commands.generate.module.questions.features-bundle'), + 'default' + ); + } + $input->setOption('features-bundle', $featuresBundle); + } + + $composer = $input->getOption('composer'); + if (!$composer) { + $composer = $io->confirm( + $this->trans('commands.generate.module.questions.composer'), + true + ); + $input->setOption('composer', $composer); + } + + $dependencies = $input->getOption('dependencies'); + if (!$dependencies) { + $addDependencies = $io->confirm( + $this->trans('commands.generate.module.questions.dependencies'), + false + ); + if ($addDependencies) { + $dependencies = $io->ask( + $this->trans('commands.generate.module.options.dependencies') + ); + } + $input->setOption('dependencies', $dependencies); + } + + $test = $input->getOption('test'); + if (!$test) { + $test = $io->confirm( + $this->trans('commands.generate.module.questions.test'), + true + ); + $input->setOption('test', $test); + } + + $twigtemplate = $input->getOption('twigtemplate'); + if (!$twigtemplate) { + $twigtemplate = $io->confirm( + $this->trans('commands.generate.module.questions.twigtemplate'), + true + ); + $input->setOption('twigtemplate', $twigtemplate); + } + } + + /** + * @return ModuleGenerator + */ + protected function createGenerator() + { + return new ModuleGenerator(); + } +} diff --git a/src/Command/Generate/ModuleFileCommand.php b/src/Command/Generate/ModuleFileCommand.php new file mode 100644 index 000000000..e28c8ac33 --- /dev/null +++ b/src/Command/Generate/ModuleFileCommand.php @@ -0,0 +1,115 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('generate:module:file') + ->setDescription($this->trans('commands.generate.module.file.description')) + ->setHelp($this->trans('commands.generate.module.file.help')) + ->addOption( + 'module', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.common.options.module') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io, $yes)) { + return 1; + } + + $machine_name = $input->getOption('module'); + $file_path = $this->extensionManager->getModule($machine_name)->getPath(); + $generator = $this->generator; + + $generator->generate( + $machine_name, + $file_path + ); + } + + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + } + + $input->setOption('module', $module); + } +} diff --git a/src/Command/Generate/PermissionCommand.php b/src/Command/Generate/PermissionCommand.php new file mode 100644 index 000000000..a7aee3778 --- /dev/null +++ b/src/Command/Generate/PermissionCommand.php @@ -0,0 +1,122 @@ +extensionManager = $extensionManager; + $this->stringConverter = $stringConverter; + $this->generator = $permissionGenerator; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('generate:permissions') + ->setDescription($this->trans('commands.generate.permission.description')) + ->setHelp($this->trans('commands.generate.permission.help')) + ->addOption( + 'module', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.common.options.module') + ) + ->addOption( + 'permissions', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.common.options.permissions') + ) + ->setAliases(['gp']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $module = $input->getOption('module'); + $permissions = $input->getOption('permissions'); + $learning = $input->hasOption('learning'); + + + $this->generator->generate($module, $permissions, $learning); + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --permissions option + $permissions = $input->getOption('permissions'); + if (!$permissions) { + // @see \Drupal\Console\Command\Shared\PermissionTrait::permissionQuestion + $permissions = $this->permissionQuestion($io); + $input->setOption('permissions', $permissions); + } + } +} diff --git a/src/Command/Generate/PluginBlockCommand.php b/src/Command/Generate/PluginBlockCommand.php new file mode 100644 index 000000000..21679d997 --- /dev/null +++ b/src/Command/Generate/PluginBlockCommand.php @@ -0,0 +1,292 @@ +configFactory = $configFactory; + $this->chainQueue = $chainQueue; + $this->generator = $generator; + $this->entityTypeManager = $entityTypeManager; + $this->extensionManager = $extensionManager; + $this->validator = $validator; + $this->stringConverter = $stringConverter; + $this->elementInfoManager = $elementInfoManager; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:plugin:block') + ->setDescription($this->trans('commands.generate.plugin.block.description')) + ->setHelp($this->trans('commands.generate.plugin.block.help')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'class', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.block.options.class') + ) + ->addOption( + 'label', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.block.options.label') + ) + ->addOption( + 'plugin-id', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.block.options.plugin-id') + ) + ->addOption( + 'theme-region', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.block.options.theme-region') + ) + ->addOption( + 'inputs', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.common.options.inputs') + ) + ->addOption( + 'services', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.common.options.services') + ) + ->setAliases(['gpb']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $class_name = $input->getOption('class'); + $label = $input->getOption('label'); + $plugin_id = $input->getOption('plugin-id'); + $services = $input->getOption('services'); + $theme_region = $input->getOption('theme-region'); + $inputs = $input->getOption('inputs'); + + $theme = $this->configFactory->get('system.theme')->get('default'); + $themeRegions = \system_region_list($theme, REGIONS_VISIBLE); + + if (!empty($theme_region) && !isset($themeRegions[$theme_region])) { + $io->error( + sprintf( + $this->trans('commands.generate.plugin.block.messages.invalid-theme-region'), + $theme_region + ) + ); + + return 1; + } + + // @see use Drupal\Console\Command\Shared\ServicesTrait::buildServices + $build_services = $this->buildServices($services); + + $this->generator + ->generate( + $module, + $class_name, + $label, + $plugin_id, + $build_services, + $inputs + ); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + if ($theme_region) { + $block = $this->entityTypeManager + ->getStorage('block') + ->create( + [ + 'id'=> $plugin_id, + 'plugin' => $plugin_id, + 'theme' => $theme + ] + ); + $block->setRegion($theme_region); + $block->save(); + } + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $theme = $this->configFactory->get('system.theme')->get('default'); + $themeRegions = \system_region_list($theme, REGIONS_VISIBLE); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --class option + $class = $input->getOption('class'); + if (!$class) { + $class = $io->ask( + $this->trans('commands.generate.plugin.block.questions.class'), + 'DefaultBlock', + function ($class) { + return $this->validator->validateClassName($class); + } + ); + $input->setOption('class', $class); + } + + // --label option + $label = $input->getOption('label'); + if (!$label) { + $label = $io->ask( + $this->trans('commands.generate.plugin.block.questions.label'), + $this->stringConverter->camelCaseToHuman($class) + ); + $input->setOption('label', $label); + } + + // --plugin-id option + $pluginId = $input->getOption('plugin-id'); + if (!$pluginId) { + $pluginId = $io->ask( + $this->trans('commands.generate.plugin.block.questions.plugin-id'), + $this->stringConverter->camelCaseToUnderscore($class) + ); + $input->setOption('plugin-id', $pluginId); + } + + // --theme-region option + $themeRegion = $input->getOption('theme-region'); + if (!$themeRegion) { + $themeRegion = $io->choiceNoList( + $this->trans('commands.generate.plugin.block.questions.theme-region'), + array_values($themeRegions), + null, + true + ); + $themeRegion = array_search($themeRegion, $themeRegions); + $input->setOption('theme-region', $themeRegion); + } + + // --services option + // @see Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion + $services = $this->servicesQuestion($io); + $input->setOption('services', $services); + + $output->writeln($this->trans('commands.generate.plugin.block.messages.inputs')); + + // @see Drupal\Console\Command\Shared\FormTrait::formQuestion + $inputs = $this->formQuestion($io); + $input->setOption('inputs', $inputs); + } +} diff --git a/src/Command/Generate/PluginCKEditorButtonCommand.php b/src/Command/Generate/PluginCKEditorButtonCommand.php new file mode 100644 index 000000000..2152dbeac --- /dev/null +++ b/src/Command/Generate/PluginCKEditorButtonCommand.php @@ -0,0 +1,207 @@ +chainQueue = $chainQueue; + $this->generator = $generator; + $this->extensionManager = $extensionManager; + $this->stringConverter = $stringConverter; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:plugin:ckeditorbutton') + ->setDescription($this->trans('commands.generate.plugin.ckeditorbutton.description')) + ->setHelp($this->trans('commands.generate.plugin.ckeditorbutton.help')) + ->addOption( + 'module', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.common.options.module') + ) + ->addOption( + 'class', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.plugin.ckeditorbutton.options.class') + ) + ->addOption( + 'label', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.plugin.ckeditorbutton.options.label') + ) + ->addOption( + 'plugin-id', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.plugin.ckeditorbutton.options.plugin-id') + ) + ->addOption( + 'button-name', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.plugin.ckeditorbutton.options.button-name') + ) + ->addOption( + 'button-icon-path', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.plugin.ckeditorbutton.options.button-icon-path') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $class_name = $input->getOption('class'); + $label = $input->getOption('label'); + $plugin_id = $input->getOption('plugin-id'); + $button_name = $input->getOption('button-name'); + $button_icon_path = $input->getOption('button-icon-path'); + + $this + ->generator + ->generate($module, $class_name, $label, $plugin_id, $button_name, $button_icon_path); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery'], false); + + return 0; + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --class option + $class_name = $input->getOption('class'); + if (!$class_name) { + $class_name = $io->ask( + $this->trans('commands.generate.plugin.ckeditorbutton.questions.class'), + 'DefaultCKEditorButton' + ); + $input->setOption('class', $class_name); + } + + // --label option + $label = $input->getOption('label'); + if (!$label) { + $label = $io->ask( + $this->trans('commands.generate.plugin.ckeditorbutton.questions.label'), + $this->stringConverter->camelCaseToHuman($class_name) + ); + $input->setOption('label', $label); + } + + // --plugin-id option + $plugin_id = $input->getOption('plugin-id'); + if (!$plugin_id) { + $plugin_id = $io->ask( + $this->trans('commands.generate.plugin.ckeditorbutton.questions.plugin-id'), + $this->stringConverter->camelCaseToLowerCase($label) + ); + $input->setOption('plugin-id', $plugin_id); + } + + // --button-name option + $button_name = $input->getOption('button-name'); + if (!$button_name) { + $button_name = $io->ask( + $this->trans('commands.generate.plugin.ckeditorbutton.questions.button-name'), + $this->stringConverter->anyCaseToUcFirst($plugin_id) + ); + $input->setOption('button-name', $button_name); + } + + // --button-icon-path option + $button_icon_path = $input->getOption('button-icon-path'); + if (!$button_icon_path) { + $button_icon_path = $io->ask( + $this->trans('commands.generate.plugin.ckeditorbutton.questions.button-icon-path'), + drupal_get_path('module', $module) . '/js/plugins/' . $plugin_id . '/images/icon.png' + ); + $input->setOption('button-icon-path', $button_icon_path); + } + } +} diff --git a/src/Command/Generate/PluginConditionCommand.php b/src/Command/Generate/PluginConditionCommand.php new file mode 100644 index 000000000..24bc6da17 --- /dev/null +++ b/src/Command/Generate/PluginConditionCommand.php @@ -0,0 +1,253 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->chainQueue = $chainQueue; + $this->entitytyperepository = $entitytyperepository; + $this->stringConverter = $stringConverter; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:plugin:condition') + ->setDescription($this->trans('commands.generate.plugin.condition.description')) + ->setHelp($this->trans('commands.generate.plugin.condition.help')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'class', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.plugin.condition.options.class') + ) + ->addOption( + 'label', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.plugin.condition.options.label') + ) + ->addOption( + 'plugin-id', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.plugin.condition.options.plugin-id') + ) + ->addOption( + 'context-definition-id', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.plugin.condition.options.context-definition-id') + ) + ->addOption( + 'context-definition-label', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.plugin.condition.options.context-definition-label') + ) + ->addOption( + 'context-definition-required', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.condition.options.context-definition-required') + ) + ->setAliases(['gpc']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $class_name = $input->getOption('class'); + $label = $input->getOption('label'); + $plugin_id = $input->getOption('plugin-id'); + $context_definition_id = $input->getOption('context-definition-id'); + $context_definition_label = $input->getOption('context-definition-label'); + $context_definition_required = $input->getOption('context-definition-required')?'TRUE':'FALSE'; + + $this + ->generator + ->generate($module, $class_name, $label, $plugin_id, $context_definition_id, $context_definition_label, $context_definition_required); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + return 0; + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $entityTypeRepository = $this->entitytyperepository; + + $entity_types = $entityTypeRepository->getEntityTypeLabels(true); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + } + $input->setOption('module', $module); + + // --class option + $class = $input->getOption('class'); + if (!$class) { + $class = $io->ask( + $this->trans('commands.generate.plugin.condition.questions.class'), + 'ExampleCondition' + ); + $input->setOption('class', $class); + } + + // --plugin label option + $label = $input->getOption('label'); + if (!$label) { + $label = $io->ask( + $this->trans('commands.generate.plugin.condition.questions.label'), + $this->stringConverter->camelCaseToHuman($class) + ); + $input->setOption('label', $label); + } + + // --plugin-id option + $pluginId = $input->getOption('plugin-id'); + if (!$pluginId) { + $pluginId = $io->ask( + $this->trans('commands.generate.plugin.condition.questions.plugin-id'), + $this->stringConverter->camelCaseToUnderscore($class) + ); + $input->setOption('plugin-id', $pluginId); + } + + $context_definition_id = $input->getOption('context-definition-id'); + if (!$context_definition_id) { + $context_type = ['language' => 'Language', "entity" => "Entity"]; + $context_type_sel = $io->choice( + $this->trans('commands.generate.plugin.condition.questions.context-type'), + array_values($context_type) + ); + $context_type_sel = array_search($context_type_sel, $context_type); + + if ($context_type_sel == 'language') { + $context_definition_id = $context_type_sel; + $context_definition_id_value = ucfirst($context_type_sel); + } else { + $content_entity_types_sel = $io->choice( + $this->trans('commands.generate.plugin.condition.questions.context-entity-type'), + array_keys($entity_types) + ); + + $contextDefinitionIdList = $entity_types[$content_entity_types_sel]; + $context_definition_id_sel = $io->choice( + $this->trans('commands.generate.plugin.condition.questions.context-definition-id'), + array_values($contextDefinitionIdList) + ); + + $context_definition_id_value = array_search( + $context_definition_id_sel, + $contextDefinitionIdList + ); + + $context_definition_id = 'entity:' . $context_definition_id_value; + } + $input->setOption('context-definition-id', $context_definition_id); + } + + $context_definition_label = $input->getOption('context-definition-label'); + if (!$context_definition_label) { + $context_definition_label = $io->ask( + $this->trans('commands.generate.plugin.condition.questions.context-definition-label'), + $context_definition_id_value?:null + ); + $input->setOption('context-definition-label', $context_definition_label); + } + + $context_definition_required = $input->getOption('context-definition-required'); + if (empty($context_definition_required)) { + $context_definition_required = $io->confirm( + $this->trans('commands.generate.plugin.condition.questions.context-definition-required'), + true + ); + $input->setOption('context-definition-required', $context_definition_required); + } + } +} diff --git a/src/Command/Generate/PluginFieldCommand.php b/src/Command/Generate/PluginFieldCommand.php new file mode 100644 index 000000000..35577216a --- /dev/null +++ b/src/Command/Generate/PluginFieldCommand.php @@ -0,0 +1,346 @@ +extensionManager = $extensionManager; + $this->stringConverter = $stringConverter; + $this->chainQueue = $chainQueue; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:plugin:field') + ->setDescription($this->trans('commands.generate.plugin.field.description')) + ->setHelp($this->trans('commands.generate.plugin.field.help')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'type-class', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.plugin.field.options.type-class') + ) + ->addOption( + 'type-label', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.field.options.type-label') + ) + ->addOption( + 'type-plugin-id', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.field.options.type-plugin-id') + ) + ->addOption( + 'type-description', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.field.options.type-type-description') + ) + ->addOption( + 'formatter-class', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.plugin.field.options.class') + ) + ->addOption( + 'formatter-label', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.field.options.formatter-label') + ) + ->addOption( + 'formatter-plugin-id', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.field.options.formatter-plugin-id') + ) + ->addOption( + 'widget-class', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.plugin.field.options.formatter-class') + ) + ->addOption( + 'widget-label', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.field.options.widget-label') + ) + ->addOption( + 'widget-plugin-id', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.field.options.widget-plugin-id') + ) + ->addOption( + 'field-type', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.field.options.field-type') + ) + ->addOption( + 'default-widget', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.field.options.default-widget') + ) + ->addOption( + 'default-formatter', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.field.options.default-formatter') + ) + ->setAliases(['gpf']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $this->chainQueue + ->addCommand( + 'generate:plugin:fieldtype', [ + '--module' => $input->getOption('module'), + '--class' => $input->getOption('type-class'), + '--label' => $input->getOption('type-label'), + '--plugin-id' => $input->getOption('type-plugin-id'), + '--description' => $input->getOption('type-description'), + '--default-widget' => $input->getOption('default-widget'), + '--default-formatter' => $input->getOption('default-formatter'), + ], + false + ); + + $this->chainQueue + ->addCommand( + 'generate:plugin:fieldwidget', [ + '--module' => $input->getOption('module'), + '--class' => $input->getOption('widget-class'), + '--label' => $input->getOption('widget-label'), + '--plugin-id' => $input->getOption('widget-plugin-id'), + '--field-type' => $input->getOption('field-type'), + ], + false + ); + $this->chainQueue + ->addCommand( + 'generate:plugin:fieldformatter', [ + '--module' => $input->getOption('module'), + '--class' => $input->getOption('formatter-class'), + '--label' => $input->getOption('formatter-label'), + '--plugin-id' => $input->getOption('formatter-plugin-id'), + '--field-type' => $input->getOption('field-type'), + ], + false + ); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery'], false); + + return 0; + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --type-class option + $typeClass = $input->getOption('type-class'); + if (!$typeClass) { + $typeClass = $io->ask( + $this->trans('commands.generate.plugin.field.questions.type-class'), + 'ExampleFieldType' + ); + $input->setOption('type-class', $typeClass); + } + + // --type-label option + $label = $input->getOption('type-label'); + if (!$label) { + $label = $io->ask( + $this->trans('commands.generate.plugin.field.questions.type-label'), + $this->stringConverter->camelCaseToHuman($typeClass) + ); + $input->setOption('type-label', $label); + } + + // --type-plugin-id option + $plugin_id = $input->getOption('type-plugin-id'); + if (!$plugin_id) { + $plugin_id = $io->ask( + $this->trans('commands.generate.plugin.field.questions.type-plugin-id'), + $this->stringConverter->camelCaseToUnderscore($typeClass) + ); + $input->setOption('type-plugin-id', $plugin_id); + } + + // --type-description option + $description = $input->getOption('type-description'); + if (!$description) { + $description = $io->ask( + $this->trans('commands.generate.plugin.field.questions.type-description'), + 'My Field Type' + ); + $input->setOption('type-description', $description); + } + + // --widget-class option + $widgetClass = $input->getOption('widget-class'); + if (!$widgetClass) { + $widgetClass = $io->ask( + $this->trans('commands.generate.plugin.field.questions.widget-class'), + 'ExampleWidgetType' + ); + $input->setOption('widget-class', $widgetClass); + } + + // --widget-label option + $widgetLabel = $input->getOption('widget-label'); + if (!$widgetLabel) { + $widgetLabel = $io->ask( + $this->trans('commands.generate.plugin.field.questions.widget-label'), + $this->stringConverter->camelCaseToHuman($widgetClass) + ); + $input->setOption('widget-label', $widgetLabel); + } + + // --widget-plugin-id option + $widget_plugin_id = $input->getOption('widget-plugin-id'); + if (!$widget_plugin_id) { + $widget_plugin_id = $io->ask( + $this->trans('commands.generate.plugin.field.questions.widget-plugin-id'), + $this->stringConverter->camelCaseToUnderscore($widgetClass) + ); + $input->setOption('widget-plugin-id', $widget_plugin_id); + } + + // --formatter-class option + $formatterClass = $input->getOption('formatter-class'); + if (!$formatterClass) { + $formatterClass = $io->ask( + $this->trans('commands.generate.plugin.field.questions.formatter-class'), + 'ExampleFormatterType' + ); + $input->setOption('formatter-class', $formatterClass); + } + + // --formatter-label option + $formatterLabel = $input->getOption('formatter-label'); + if (!$formatterLabel) { + $formatterLabel = $io->ask( + $this->trans('commands.generate.plugin.field.questions.formatter-label'), + $this->stringConverter->camelCaseToHuman($formatterClass) + ); + $input->setOption('formatter-label', $formatterLabel); + } + + // --formatter-plugin-id option + $formatter_plugin_id = $input->getOption('formatter-plugin-id'); + if (!$formatter_plugin_id) { + $formatter_plugin_id = $io->ask( + $this->trans('commands.generate.plugin.field.questions.formatter-plugin-id'), + $this->stringConverter->camelCaseToUnderscore($formatterClass) + ); + $input->setOption('formatter-plugin-id', $formatter_plugin_id); + } + + // --field-type option + $field_type = $input->getOption('field-type'); + if (!$field_type) { + $field_type = $io->ask( + $this->trans('commands.generate.plugin.field.questions.field-type'), + $plugin_id + ); + $input->setOption('field-type', $field_type); + } + + // --default-widget option + $default_widget = $input->getOption('default-widget'); + if (!$default_widget) { + $default_widget = $io->ask( + $this->trans('commands.generate.plugin.field.questions.default-widget'), + $widget_plugin_id + ); + $input->setOption('default-widget', $default_widget); + } + + // --default-formatter option + $default_formatter = $input->getOption('default-formatter'); + if (!$default_formatter) { + $default_formatter = $io->ask( + $this->trans('commands.generate.plugin.field.questions.default-formatter'), + $formatter_plugin_id + ); + $input->setOption('default-formatter', $default_formatter); + } + } +} diff --git a/src/Command/Generate/PluginFieldFormatterCommand.php b/src/Command/Generate/PluginFieldFormatterCommand.php new file mode 100644 index 000000000..627ae163e --- /dev/null +++ b/src/Command/Generate/PluginFieldFormatterCommand.php @@ -0,0 +1,205 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->stringConverter = $stringConverter; + $this->fieldTypePluginManager = $fieldTypePluginManager; + $this->chainQueue = $chainQueue; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:plugin:fieldformatter') + ->setDescription($this->trans('commands.generate.plugin.fieldformatter.description')) + ->setHelp($this->trans('commands.generate.plugin.fieldformatter.help')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'class', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.plugin.fieldformatter.options.class') + ) + ->addOption( + 'label', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.fieldformatter.options.label') + ) + ->addOption( + 'plugin-id', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.fieldformatter.options.plugin-id') + ) + ->addOption( + 'field-type', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.fieldformatter.options.field-type') + ) + ->setAliases(['gpff']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $class_name = $input->getOption('class'); + $label = $input->getOption('label'); + $plugin_id = $input->getOption('plugin-id'); + $field_type = $input->getOption('field-type'); + + $this->generator->generate($module, $class_name, $label, $plugin_id, $field_type); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + return 0; + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --class option + $class = $input->getOption('class'); + if (!$class) { + $class = $io->ask( + $this->trans('commands.generate.plugin.fieldformatter.questions.class'), + 'ExampleFieldFormatter' + ); + $input->setOption('class', $class); + } + + // --plugin label option + $label = $input->getOption('label'); + if (!$label) { + $label = $io->ask( + $this->trans('commands.generate.plugin.fieldformatter.questions.label'), + $this->stringConverter->camelCaseToHuman($class) + ); + $input->setOption('label', $label); + } + + // --name option + $plugin_id = $input->getOption('plugin-id'); + if (!$plugin_id) { + $plugin_id = $io->ask( + $this->trans('commands.generate.plugin.fieldformatter.questions.plugin-id'), + $this->stringConverter->camelCaseToUnderscore($class) + ); + $input->setOption('plugin-id', $plugin_id); + } + + // --field type option + $field_type = $input->getOption('field-type'); + if (!$field_type) { + // Gather valid field types. + $field_type_options = []; + foreach ($this->fieldTypePluginManager->getGroupedDefinitions($this->fieldTypePluginManager->getUiDefinitions()) as $category => $field_types) { + foreach ($field_types as $name => $field_type) { + $field_type_options[] = $name; + } + } + + $field_type = $io->choice( + $this->trans('commands.generate.plugin.fieldwidget.questions.field-type'), + $field_type_options + ); + + $input->setOption('field-type', $field_type); + } + } +} diff --git a/src/Command/Generate/PluginFieldTypeCommand.php b/src/Command/Generate/PluginFieldTypeCommand.php new file mode 100644 index 000000000..49f6b6eef --- /dev/null +++ b/src/Command/Generate/PluginFieldTypeCommand.php @@ -0,0 +1,221 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->stringConverter = $stringConverter; + $this->chainQueue = $chainQueue; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:plugin:fieldtype') + ->setDescription($this->trans('commands.generate.plugin.fieldtype.description')) + ->setHelp($this->trans('commands.generate.plugin.fieldtype.help')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'class', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.plugin.fieldtype.options.class') + ) + ->addOption( + 'label', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.fieldtype.options.label') + ) + ->addOption( + 'plugin-id', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.fieldtype.options.plugin-id') + ) + ->addOption( + 'description', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.fieldtype.options.description') + ) + ->addOption( + 'default-widget', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.fieldtype.options.default-widget') + ) + ->addOption( + 'default-formatter', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.fieldtype.options.default-formatter') + ) + ->setAliases(['gpft']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $class_name = $input->getOption('class'); + $label = $input->getOption('label'); + $plugin_id = $input->getOption('plugin-id'); + $description = $input->getOption('description'); + $default_widget = $input->getOption('default-widget'); + $default_formatter = $input->getOption('default-formatter'); + + $this->generator + ->generate($module, $class_name, $label, $plugin_id, $description, $default_widget, $default_formatter); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery'], false); + + return 0; + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --class option + $class_name = $input->getOption('class'); + if (!$class_name) { + $class_name = $io->ask( + $this->trans('commands.generate.plugin.fieldtype.questions.class'), + 'ExampleFieldType' + ); + $input->setOption('class', $class_name); + } + + // --label option + $label = $input->getOption('label'); + if (!$label) { + $label = $io->ask( + $this->trans('commands.generate.plugin.fieldtype.questions.label'), + $this->stringConverter->camelCaseToHuman($class_name) + ); + $input->setOption('label', $label); + } + + // --plugin-id option + $plugin_id = $input->getOption('plugin-id'); + if (!$plugin_id) { + $plugin_id = $io->ask( + $this->trans('commands.generate.plugin.fieldtype.questions.plugin-id'), + $this->stringConverter->camelCaseToUnderscore($class_name) + ); + $input->setOption('plugin-id', $plugin_id); + } + + // --description option + $description = $input->getOption('description'); + if (!$description) { + $description = $io->ask( + $this->trans('commands.generate.plugin.fieldtype.questions.description'), + 'My Field Type' + ); + $input->setOption('description', $description); + } + + // --default-widget option + $default_widget = $input->getOption('default-widget'); + if (!$default_widget) { + $default_widget = $io->askEmpty( + $this->trans('commands.generate.plugin.fieldtype.questions.default-widget') + ); + $input->setOption('default-widget', $default_widget); + } + + // --default-formatter option + $default_formatter = $input->getOption('default-formatter'); + if (!$default_formatter) { + $default_formatter = $io->askEmpty( + $this->trans('commands.generate.plugin.fieldtype.questions.default-formatter') + ); + $input->setOption('default-formatter', $default_formatter); + } + } +} diff --git a/src/Command/Generate/PluginFieldWidgetCommand.php b/src/Command/Generate/PluginFieldWidgetCommand.php new file mode 100644 index 000000000..a56213756 --- /dev/null +++ b/src/Command/Generate/PluginFieldWidgetCommand.php @@ -0,0 +1,210 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->stringConverter = $stringConverter; + $this->fieldTypePluginManager = $fieldTypePluginManager; + $this->chainQueue = $chainQueue; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:plugin:fieldwidget') + ->setDescription($this->trans('commands.generate.plugin.fieldwidget.description')) + ->setHelp($this->trans('commands.generate.plugin.fieldwidget.help')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'class', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.plugin.fieldwidget.options.class') + ) + ->addOption( + 'label', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.fieldwidget.options.label') + ) + ->addOption( + 'plugin-id', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.fieldwidget.options.plugin-id') + ) + ->addOption( + 'field-type', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.fieldwidget.options.field-type') + ) + ->setAliases(['gpfw']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $class_name = $input->getOption('class'); + $label = $input->getOption('label'); + $plugin_id = $input->getOption('plugin-id'); + $field_type = $input->getOption('field-type'); + + $this->generator->generate($module, $class_name, $label, $plugin_id, $field_type); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + return 0; + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --class option + $class_name = $input->getOption('class'); + if (!$class_name) { + $class_name = $io->ask( + $this->trans('commands.generate.plugin.fieldwidget.questions.class'), + 'ExampleFieldWidget' + ); + $input->setOption('class', $class_name); + } + + // --plugin label option + $label = $input->getOption('label'); + if (!$label) { + $label = $io->ask( + $this->trans('commands.generate.plugin.fieldwidget.questions.label'), + $this->stringConverter->camelCaseToHuman($class_name) + ); + $input->setOption('label', $label); + } + + // --plugin-id option + $plugin_id = $input->getOption('plugin-id'); + if (!$plugin_id) { + $plugin_id = $io->ask( + $this->trans('commands.generate.plugin.fieldwidget.questions.plugin-id'), + $this->stringConverter->camelCaseToUnderscore($class_name) + ); + $input->setOption('plugin-id', $plugin_id); + } + + // --field-type option + $field_type = $input->getOption('field-type'); + if (!$field_type) { + // Gather valid field types. + $field_type_options = []; + foreach ($this->fieldTypePluginManager->getGroupedDefinitions($this->fieldTypePluginManager->getUiDefinitions()) as $category => $field_types) { + foreach ($field_types as $name => $field_type) { + $field_type_options[] = $name; + } + } + + $field_type = $io->choice( + $this->trans('commands.generate.plugin.fieldwidget.questions.field-type'), + $field_type_options + ); + + $input->setOption('field-type', $field_type); + } + } +} diff --git a/src/Command/Generate/PluginImageEffectCommand.php b/src/Command/Generate/PluginImageEffectCommand.php new file mode 100644 index 000000000..cf516e813 --- /dev/null +++ b/src/Command/Generate/PluginImageEffectCommand.php @@ -0,0 +1,185 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->stringConverter = $stringConverter; + $this->chainQueue = $chainQueue; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:plugin:imageeffect') + ->setDescription($this->trans('commands.generate.plugin.imageeffect.description')) + ->setHelp($this->trans('commands.generate.plugin.imageeffect.help')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'class', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.plugin.imageeffect.options.class') + ) + ->addOption( + 'label', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.imageeffect.options.label') + ) + ->addOption( + 'plugin-id', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.imageeffect.options.plugin-id') + ) + ->addOption( + 'description', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.imageeffect.options.description') + ) + ->setAliases(['gpie']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $class_name = $input->getOption('class'); + $label = $input->getOption('label'); + $plugin_id = $input->getOption('plugin-id'); + $description = $input->getOption('description'); + + $this->generator->generate($module, $class_name, $label, $plugin_id, $description); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --class option + $class_name = $input->getOption('class'); + if (!$class_name) { + $class_name = $io->ask( + $this->trans('commands.generate.plugin.imageeffect.questions.class'), + 'DefaultImageEffect' + ); + $input->setOption('class', $class_name); + } + + // --label option + $label = $input->getOption('label'); + if (!$label) { + $label = $io->ask( + $this->trans('commands.generate.plugin.imageeffect.questions.label'), + $this->stringConverter->camelCaseToHuman($class_name) + ); + $input->setOption('label', $label); + } + + // --plugin-id option + $plugin_id = $input->getOption('plugin-id'); + if (!$plugin_id) { + $plugin_id = $io->ask( + $this->trans('commands.generate.plugin.imageeffect.questions.plugin-id'), + $this->stringConverter->camelCaseToUnderscore($class_name) + ); + $input->setOption('plugin-id', $plugin_id); + } + + // --description option + $description = $input->getOption('description'); + if (!$description) { + $description = $io->ask( + $this->trans('commands.generate.plugin.imageeffect.questions.description'), + 'My Image Effect' + ); + $input->setOption('description', $description); + } + } +} diff --git a/src/Command/Generate/PluginImageFormatterCommand.php b/src/Command/Generate/PluginImageFormatterCommand.php new file mode 100644 index 000000000..5a3cb696f --- /dev/null +++ b/src/Command/Generate/PluginImageFormatterCommand.php @@ -0,0 +1,172 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->stringConverter = $stringConverter; + $this->validator = $validator; + $this->chainQueue = $chainQueue; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:plugin:imageformatter') + ->setDescription($this->trans('commands.generate.plugin.imageformatter.description')) + ->setHelp($this->trans('commands.generate.plugin.imageformatter.help')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'class', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.plugin.imageformatter.options.class') + ) + ->addOption( + 'label', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.imageformatter.options.label') + ) + ->addOption( + 'plugin-id', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.imageformatter.options.plugin-id') + ) + ->setAliases(['gpif']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $class_name = $input->getOption('class'); + $label = $input->getOption('label'); + $plugin_id = $input->getOption('plugin-id'); + + $this->generator->generate($module, $class_name, $label, $plugin_id); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + } + $input->setOption('module', $module); + + // --class option + $class_name = $input->getOption('class'); + if (!$class_name) { + $class_name = $io->ask( + $this->trans('commands.generate.plugin.imageformatter.questions.class'), + 'ExampleImageFormatter' + ); + $input->setOption('class', $class_name); + } + + // --label option + $label = $input->getOption('label'); + if (!$label) { + $label = $io->ask( + $this->trans('commands.generate.plugin.imageformatter.questions.label'), + $this->stringConverter->camelCaseToHuman($class_name) + ); + $input->setOption('label', $label); + } + + // --plugin-id option + $plugin_id = $input->getOption('plugin-id'); + if (!$plugin_id) { + $plugin_id = $io->ask( + $this->trans('commands.generate.plugin.imageformatter.questions.plugin-id'), + $this->stringConverter->camelCaseToUnderscore($class_name) + ); + $input->setOption('plugin-id', $plugin_id); + } + } +} diff --git a/src/Command/Generate/PluginMailCommand.php b/src/Command/Generate/PluginMailCommand.php new file mode 100644 index 000000000..48a47d0d6 --- /dev/null +++ b/src/Command/Generate/PluginMailCommand.php @@ -0,0 +1,198 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->stringConverter = $stringConverter; + $this->validator = $validator; + $this->chainQueue = $chainQueue; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:plugin:mail') + ->setDescription($this->trans('commands.generate.plugin.mail.description')) + ->setHelp($this->trans('commands.generate.plugin.mail.help')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'class', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.mail.options.class') + ) + ->addOption( + 'label', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.mail.options.label') + ) + ->addOption( + 'plugin-id', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.mail.options.plugin-id') + ) + ->addOption( + 'services', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.common.options.services') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $class_name = $input->getOption('class'); + $label = $input->getOption('label'); + $plugin_id = $input->getOption('plugin-id'); + $services = $input->getOption('services'); + + // @see use Drupal\Console\Command\Shared\ServicesTrait::buildServices + $build_services = $this->buildServices($services); + + $this->generator->generate($module, $class_name, $label, $plugin_id, $build_services); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --class option + $class = $input->getOption('class'); + if (!$class) { + $class = $io->ask( + $this->trans('commands.generate.plugin.mail.options.class'), + 'HtmlFormatterMail', + function ($class) { + return $this->validator->validateClassName($class); + } + ); + $input->setOption('class', $class); + } + + // --label option + $label = $input->getOption('label'); + if (!$label) { + $label = $io->ask( + $this->trans('commands.generate.plugin.mail.options.label'), + $this->stringConverter->camelCaseToHuman($class) + ); + $input->setOption('label', $label); + } + + // --plugin-id option + $pluginId = $input->getOption('plugin-id'); + if (!$pluginId) { + $pluginId = $io->ask( + $this->trans('commands.generate.plugin.mail.options.plugin-id'), + $this->stringConverter->camelCaseToUnderscore($class) + ); + $input->setOption('plugin-id', $pluginId); + } + + // --services option + // @see Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion + $services = $this->servicesQuestion($io); + $input->setOption('services', $services); + } +} diff --git a/src/Command/Generate/PluginMigrateProcessCommand.php b/src/Command/Generate/PluginMigrateProcessCommand.php new file mode 100644 index 000000000..20ba70a60 --- /dev/null +++ b/src/Command/Generate/PluginMigrateProcessCommand.php @@ -0,0 +1,147 @@ +generator = $generator; + $this->chainQueue = $chainQueue; + $this->extensionManager = $extensionManager; + $this->stringConverter = $stringConverter; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:plugin:migrate:process') + ->setDescription($this->trans('commands.generate.plugin.migrate.process.description')) + ->setHelp($this->trans('commands.generate.plugin.migrate.process.help')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'class', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.migrate.process.options.class') + ) + ->addOption( + 'plugin-id', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.migrate.process.options.plugin-id') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $class_name = $input->getOption('class'); + $plugin_id = $input->getOption('plugin-id'); + + $this->generator->generate($module, $class_name, $plugin_id); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // 'module-name' option. + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // 'class-name' option + $class = $input->getOption('class'); + if (!$class) { + $class = $io->ask( + $this->trans('commands.generate.plugin.migrate.process.questions.class'), + ucfirst($this->stringConverter->underscoreToCamelCase($module)) + ); + $input->setOption('class', $class); + } + + // 'plugin-id' option. + $pluginId = $input->getOption('plugin-id'); + if (!$pluginId) { + $pluginId = $io->ask( + $this->trans('commands.generate.plugin.migrate.source.questions.plugin-id'), + $this->stringConverter->camelCaseToUnderscore($class) + ); + $input->setOption('plugin-id', $pluginId); + } + } +} diff --git a/src/Command/Generate/PluginMigrateSourceCommand.php b/src/Command/Generate/PluginMigrateSourceCommand.php new file mode 100644 index 000000000..5de03cccf --- /dev/null +++ b/src/Command/Generate/PluginMigrateSourceCommand.php @@ -0,0 +1,267 @@ +configFactory = $configFactory; + $this->chainQueue = $chainQueue; + $this->generator = $generator; + $this->entityTypeManager = $entityTypeManager; + $this->extensionManager = $extensionManager; + $this->validator = $validator; + $this->stringConverter = $stringConverter; + $this->elementInfoManager = $elementInfoManager; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:plugin:migrate:source') + ->setDescription($this->trans('commands.generate.plugin.migrate.source.description')) + ->setHelp($this->trans('commands.generate.plugin.migrate.source.help')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'class', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.migrate.source.options.class') + ) + ->addOption( + 'plugin-id', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.migrate.source.options.plugin-id') + ) + ->addOption( + 'table', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.migrate.source.options.table') + ) + ->addOption( + 'alias', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.migrate.source.options.alias') + ) + ->addOption( + 'group-by', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.migrate.source.options.group-by') + ) + ->addOption( + 'fields', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.generate.plugin.migrate.source.options.fields') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $class_name = $input->getOption('class'); + $plugin_id = $input->getOption('plugin-id'); + $table = $input->getOption('table'); + $alias = $input->getOption('alias'); + $group_by = $input->getOption('group-by'); + $fields = $input->getOption('fields'); + + $this->generator + ->generate( + $module, + $class_name, + $plugin_id, + $table, + $alias, + $group_by, + $fields + ); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + $class = $input->getOption('class'); + if (!$class) { + $class = $io->ask( + $this->trans('commands.generate.plugin.migrate.source.questions.class'), + ucfirst($this->stringConverter->underscoreToCamelCase($module)), + function ($class) { + return $this->validator->validateClassName($class); + } + ); + $input->setOption('class', $class); + } + + $pluginId = $input->getOption('plugin-id'); + if (!$pluginId) { + $pluginId = $io->ask( + $this->trans('commands.generate.plugin.migrate.source.questions.plugin-id'), + $this->stringConverter->camelCaseToUnderscore($class) + ); + $input->setOption('plugin-id', $pluginId); + } + + $table = $input->getOption('table'); + if (!$table) { + $table = $io->ask( + $this->trans('commands.generate.plugin.migrate.source.questions.table'), + '' + ); + $input->setOption('table', $table); + } + + $alias = $input->getOption('alias'); + if (!$alias) { + $alias = $io->ask( + $this->trans('commands.generate.plugin.migrate.source.questions.alias'), + substr($table, 0, 1) + ); + $input->setOption('alias', $alias); + } + + $groupBy = $input->getOption('group-by'); + if ($groupBy == '') { + $groupBy = $io->ask( + $this->trans('commands.generate.plugin.migrate.source.questions.group-by'), + false + ); + $input->setOption('group-by', $groupBy); + } + + $fields = $input->getOption('fields'); + if (!$fields) { + $fields = []; + while (true) { + $id = $io->ask( + $this->trans('commands.generate.plugin.migrate.source.questions.fields.id'), + false + ); + if (!$id) { + break; + } + $description = $io->ask( + $this->trans('commands.generate.plugin.migrate.source.questions.fields.description'), + $id + ); + $fields[] = [ + 'id' => $id, + 'description' => $description, + ]; + } + $input->setOption('fields', $fields); + } + } +} diff --git a/src/Command/Generate/PluginRestResourceCommand.php b/src/Command/Generate/PluginRestResourceCommand.php new file mode 100644 index 000000000..c11e9685d --- /dev/null +++ b/src/Command/Generate/PluginRestResourceCommand.php @@ -0,0 +1,225 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->stringConverter = $stringConverter; + $this->chainQueue = $chainQueue; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:plugin:rest:resource') + ->setDescription($this->trans('commands.generate.plugin.rest.resource.description')) + ->setHelp($this->trans('commands.generate.plugin.rest.resource.help')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'class', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.rest.resource.options.class') + ) + ->addOption( + 'name', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.service.options.name') + ) + ->addOption( + 'plugin-id', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.rest.resource.options.plugin-id') + ) + ->addOption( + 'plugin-label', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.rest.resource.options.plugin-label') + ) + ->addOption( + 'plugin-url', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.generate.plugin.rest.resource.options.plugin-url') + ) + ->addOption( + 'plugin-states', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.generate.plugin.rest.resource.options.plugin-states') + ) + ->setAliases(['gprr']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $class_name = $input->getOption('class'); + $plugin_id = $input->getOption('plugin-id'); + $plugin_label = $input->getOption('plugin-label'); + $plugin_url = $input->getOption('plugin-url'); + $plugin_states = $input->getOption('plugin-states'); + + $this->generator->generate($module, $class_name, $plugin_label, $plugin_id, $plugin_url, $plugin_states); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + return 0; + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --class option + $class_name = $input->getOption('class'); + if (!$class_name) { + $stringUtils = $this->stringConverter; + $class_name = $io->ask( + $this->trans('commands.generate.plugin.rest.resource.questions.class'), + 'DefaultRestResource', + function ($class_name) use ($stringUtils) { + if (!strlen(trim($class_name))) { + throw new \Exception('The Class name can not be empty'); + } + + return $stringUtils->humanToCamelCase($class_name); + } + ); + $input->setOption('class', $class_name); + } + + // --plugin-id option + $plugin_id = $input->getOption('plugin-id'); + if (!$plugin_id) { + $plugin_id = $io->ask( + $this->trans('commands.generate.plugin.rest.resource.questions.plugin-id'), + $this->stringConverter->camelCaseToUnderscore($class_name) + ); + $input->setOption('plugin-id', $plugin_id); + } + + // --plugin-label option + $plugin_label = $input->getOption('plugin-label'); + if (!$plugin_label) { + $plugin_label = $io->ask( + $this->trans('commands.generate.plugin.rest.resource.questions.plugin-label'), + $this->stringConverter->camelCaseToHuman($class_name) + ); + $input->setOption('plugin-label', $plugin_label); + } + + // --plugin-url option + $plugin_url = $input->getOption('plugin-url'); + if (!$plugin_url) { + $plugin_url = $io->ask( + $this->trans('commands.generate.plugin.rest.resource.questions.plugin-url') + ); + $input->setOption('plugin-url', $plugin_url); + } + + // --plugin-states option + $plugin_states = $input->getOption('plugin-states'); + if (!$plugin_states) { + $states = ['GET', 'PUT', 'POST', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS']; + $plugin_states = $io->choice( + $this->trans('commands.generate.plugin.rest.resource.questions.plugin-states'), + $states, + null, + true + ); + + $input->setOption('plugin-states', $plugin_states); + } + } +} diff --git a/src/Command/Generate/PluginRulesActionCommand.php b/src/Command/Generate/PluginRulesActionCommand.php new file mode 100644 index 000000000..6a063f2b7 --- /dev/null +++ b/src/Command/Generate/PluginRulesActionCommand.php @@ -0,0 +1,220 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->stringConverter = $stringConverter; + $this->chainQueue = $chainQueue; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:plugin:rulesaction') + ->setDescription($this->trans('commands.generate.plugin.rulesaction.description')) + ->setHelp($this->trans('commands.generate.plugin.rulesaction.help')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'class', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.rulesaction.options.class') + ) + ->addOption( + 'label', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.rulesaction.options.label') + ) + ->addOption( + 'plugin-id', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.rulesaction.options.plugin-id') + ) + ->addOption('type', null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.rulesaction.options.type')) + ->addOption( + 'category', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.generate.plugin.rulesaction.options.category') + ) + ->addOption( + 'context', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.rulesaction.options.context') + ) + ->setAliases(['gpra']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $class_name = $input->getOption('class'); + $label = $input->getOption('label'); + $plugin_id = $input->getOption('plugin-id'); + $type = $input->getOption('type'); + $category = $input->getOption('category'); + $context = $input->getOption('context'); + + $this->generator->generate($module, $class_name, $label, $plugin_id, $category, $context, $type); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + return 0; + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --class option + $class_name = $input->getOption('class'); + if (!$class_name) { + $class_name = $io->ask( + $this->trans('commands.generate.plugin.rulesaction.options.class'), + 'DefaultAction' + ); + $input->setOption('class', $class_name); + } + + // --label option + $label = $input->getOption('label'); + if (!$label) { + $label = $io->ask( + $this->trans('commands.generate.plugin.rulesaction.options.label'), + $this->stringConverter->camelCaseToHuman($class_name) + ); + $input->setOption('label', $label); + } + + // --plugin-id option + $plugin_id = $input->getOption('plugin-id'); + if (!$plugin_id) { + $plugin_id = $io->ask( + $this->trans('commands.generate.plugin.rulesaction.options.plugin-id'), + $this->stringConverter->camelCaseToUnderscore($class_name) + ); + $input->setOption('plugin-id', $plugin_id); + } + + // --type option + $type = $input->getOption('type'); + if (!$type) { + $type = $io->ask( + $this->trans('commands.generate.plugin.rulesaction.options.type'), + 'user' + ); + $input->setOption('type', $type); + } + + // --category option + $category = $input->getOption('category'); + if (!$category) { + $category = $io->ask( + $this->trans('commands.generate.plugin.rulesaction.options.category'), + $this->stringConverter->camelCaseToUnderscore($class_name) + ); + $input->setOption('category', $category); + } + + // --context option + $context = $input->getOption('context'); + if (!$context) { + $context = $io->ask( + $this->trans('commands.generate.plugin.rulesaction.options.context'), + $this->stringConverter->camelCaseToUnderscore($class_name) + ); + $input->setOption('context', $context); + } + } +} diff --git a/src/Command/Generate/PluginSkeletonCommand.php b/src/Command/Generate/PluginSkeletonCommand.php new file mode 100644 index 000000000..f1fb5ee18 --- /dev/null +++ b/src/Command/Generate/PluginSkeletonCommand.php @@ -0,0 +1,384 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->stringConverter = $stringConverter; + $this->validator = $validator; + $this->chainQueue = $chainQueue; + parent::__construct(); + } + + protected $pluginGeneratorsImplemented = [ + 'block' => 'generate:plugin:block', + 'ckeditor.plugin' => 'generate:plugin:ckeditorbutton', + 'condition' => 'generate:plugin:condition', + 'field.formatter' => 'generate:plugin:fieldformatter', + 'field.field_type' => 'generate:plugin:fieldtype', + 'field.widget' =>'generate:plugin:fieldwidget', + 'image.effect' => 'generate:plugin:imageeffect', + 'mail' => 'generate:plugin:mail' + ]; + + protected function configure() + { + $this + ->setName('generate:plugin:skeleton') + ->setDescription($this->trans('commands.generate.plugin.skeleton.description')) + ->setHelp($this->trans('commands.generate.plugin.skeleton.help')) + ->addOption( + 'module', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.common.options.module') + ) + ->addOption( + 'plugin-id', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.plugin.options.plugin-id') + ) + ->addOption( + 'class', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.block.options.class') + ) + ->addOption( + 'services', + null, + InputOption::VALUE_OPTIONAL| InputOption::VALUE_IS_ARRAY, + $this->trans('commands.common.options.services') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + $plugins = $this->getPlugins(); + + // @see use Drupal\Console\Command\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + + $pluginId = $input->getOption('plugin-id'); + $plugin = ucfirst($this->stringConverter->underscoreToCamelCase($pluginId)); + + // Confirm that plugin.manager is available + if (!$this->validator->validatePluginManagerServiceExist($pluginId, $plugins)) { + throw new \Exception( + sprintf( + $this->trans('commands.generate.plugin.skeleton.messages.plugin-dont-exist'), + $pluginId + ) + ); + } + + if (array_key_exists($pluginId, $this->pluginGeneratorsImplemented)) { + $io->warning( + sprintf( + $this->trans('commands.generate.plugin.skeleton.messages.plugin-generator-implemented'), + $pluginId, + $this->pluginGeneratorsImplemented[$pluginId] + ) + ); + } + + $className = $input->getOption('class'); + $services = $input->getOption('services'); + + // @see use Drupal\Console\Command\Shared\ServicesTrait::buildServices + $buildServices = $this->buildServices($services); + $pluginMetaData = $this->getPluginMetadata($pluginId); + + $this->generator->generate($module, $pluginId, $plugin, $className, $pluginMetaData, $buildServices); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + return 0; + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + $pluginId = $input->getOption('plugin-id'); + if (!$pluginId) { + $plugins = $this->getPlugins(); + $pluginId = $io->choiceNoList( + $this->trans('commands.generate.plugin.skeleton.questions.plugin'), + $plugins + ); + $input->setOption('plugin-id', $pluginId); + } + + if (array_key_exists($pluginId, $this->pluginGeneratorsImplemented)) { + $io->warning( + sprintf( + $this->trans('commands.generate.plugin.skeleton.messages.plugin-dont-exist'), + $pluginId, + $this->pluginGeneratorsImplemented[$pluginId] + ) + ); + } + + // --class option + $class = $input->getOption('class'); + if (!$class) { + $class = $io->ask( + $this->trans('commands.generate.plugin.skeleton.options.class'), + sprintf('%s%s', 'Default', ucfirst($this->stringConverter->underscoreToCamelCase($pluginId))), + function ($class) { + return $this->validator->validateClassName($class); + } + ); + $input->setOption('class', $class); + } + + // --services option + // @see Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion + $services = $input->getOption('services'); + if (!$services) { + $services = $this->servicesQuestion($io); + $input->setOption('services', $services); + } + } + + protected function getPluginMetadata($pluginId) + { + $pluginMetaData = [ + 'serviceId' => 'plugin.manager.' . $pluginId, + ]; + + // Load service and create reflection + $service = \Drupal::service($pluginMetaData['serviceId']); + + $reflectionClass = new \ReflectionClass($service); + + // Get list of properties with $reflectionClass->getProperties(); + $pluginManagerProperties = [ + 'subdir' => 'subdir', + 'pluginInterface' => 'pluginInterface', + 'pluginDefinitionAnnotationName' => 'pluginAnnotation', + ]; + + foreach ($pluginManagerProperties as $propertyName => $key) { + if (!$reflectionClass->hasProperty($propertyName)) { + $pluginMetaData[$key] = ''; + continue; + } + + $property = $reflectionClass->getProperty($propertyName); + $property->setAccessible(true); + $pluginMetaData[$key] = $property->getValue($service); + } + + if (empty($pluginMetaData['pluginInterface'])) { + $pluginMetaData['pluginInterfaceMethods'] = []; + } else { + $pluginMetaData['pluginInterfaceMethods'] = $this->getClassMethods($pluginMetaData['pluginInterface']); + } + + if (isset($pluginMetaData['pluginAnnotation']) && class_exists($pluginMetaData['pluginAnnotation'])) { + $pluginMetaData['pluginAnnotationProperties'] = $this->getPluginAnnotationProperties($pluginMetaData['pluginAnnotation']); + } else { + $pluginMetaData['pluginAnnotationProperties'] = []; + } + + return $pluginMetaData; + } + + /** + * Get data for the methods of a class. + * + * @param $class + * The fully-qualified name of class. + * + * @return + * An array keyed by method name, where each value is an array containing: + * - 'name: The name of the method. + * - 'declaration': The function declaration line. + * - 'description': The description from the method's docblock first line. + */ + protected function getClassMethods($class) + { + // Get a reflection class. + $classReflection = new \ReflectionClass($class); + $methods = $classReflection->getMethods(); + + $metaData = []; + $methodData = []; + + foreach ($methods as $method) { + $methodData['name'] = $method->getName(); + + $filename = $method->getFileName(); + $source = file($filename); + $startLine = $method->getStartLine(); + + $methodData['declaration'] = substr(trim($source[$startLine - 1]), 0, -1); + + $methodDocComment = explode("\n", $method->getDocComment()); + foreach ($methodDocComment as $line) { + if (substr($line, 0, 5) == ' * ') { + $methodData['description'] = substr($line, 5); + break; + } + } + + $metaData[$method->getName()] = $methodData; + } + + return $metaData; + } + + /** + * Get the list of properties from an annotation class. + * + * @param $pluginAnnotationClass + * The fully-qualified name of the plugin annotation class. + * + * @return + * An array keyed by property name, where each value is an array containing: + * - 'name: The name of the property. + * - 'description': The description from the property's docblock first line. + */ + protected function getPluginAnnotationProperties($pluginAnnotationClass) + { + // Get a reflection class for the annotation class. + // Each property of the annotation class describes a property for the + // plugin annotation. + $annotationReflection = new \ReflectionClass($pluginAnnotationClass); + $propertiesReflection = $annotationReflection->getProperties(\ReflectionProperty::IS_PUBLIC); + + $pluginProperties = []; + $annotationPropertyMetadata = []; + + foreach ($propertiesReflection as $propertyReflection) { + $annotationPropertyMetadata['name'] = $propertyReflection->name; + + $propertyDocblock = $propertyReflection->getDocComment(); + $propertyDocblockLines = explode("\n", $propertyDocblock); + foreach ($propertyDocblockLines as $line) { + if (substr($line, 0, 3) == '/**') { + continue; + } + + // Take the first actual docblock line to be the description. + if (!isset($annotationPropertyMetadata['description']) && substr($line, 0, 5) == ' * ') { + $annotationPropertyMetadata['description'] = substr($line, 5); + } + + // Look for a @var token, to tell us the type of the property. + if (substr($line, 0, 10) == ' * @var ') { + $annotationPropertyMetadata['type'] = substr($line, 10); + } + } + + $pluginProperties[$propertyReflection->name] = $annotationPropertyMetadata; + } + + return $pluginProperties; + } + + protected function getPlugins() + { + $plugins = []; + + foreach ($this->container->getServiceIds() as $serviceId) { + if (strpos($serviceId, 'plugin.manager.') === 0) { + $plugins[] = substr($serviceId, 15); + } + } + + return $plugins; + } +} diff --git a/src/Command/Generate/PluginTypeAnnotationCommand.php b/src/Command/Generate/PluginTypeAnnotationCommand.php new file mode 100644 index 000000000..93bd76d82 --- /dev/null +++ b/src/Command/Generate/PluginTypeAnnotationCommand.php @@ -0,0 +1,153 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->stringConverter = $stringConverter; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:plugin:type:annotation') + ->setDescription($this->trans('commands.generate.plugin.type.annotation.description')) + ->setHelp($this->trans('commands.generate.plugin.type.annotation.help')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'class', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.type.annotation.options.class') + ) + ->addOption( + 'machine-name', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.type.annotation.options.plugin-id') + ) + ->addOption( + 'label', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.type.annotation.options.label') + ) + ->setAliases(['gpta']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $module = $input->getOption('module'); + $class_name = $input->getOption('class'); + $machine_name = $input->getOption('machine-name'); + $label = $input->getOption('label'); + + $this->generator->generate($module, $class_name, $machine_name, $label); + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --class option + $class_name = $input->getOption('class'); + if (!$class_name) { + $class_name = $io->ask( + $this->trans('commands.generate.plugin.type.annotation.options.class'), + 'ExamplePlugin' + ); + $input->setOption('class', $class_name); + } + + // --machine-name option + $machine_name = $input->getOption('machine-name'); + if (!$machine_name) { + $machine_name = $io->ask( + $this->trans('commands.generate.plugin.type.annotation.options.machine-name'), + $this->stringConverter->camelCaseToUnderscore($class_name) + ); + $input->setOption('machine-name', $machine_name); + } + + // --label option + $label = $input->getOption('label'); + if (!$label) { + $label = $io->ask( + $this->trans('commands.generate.plugin.type.annotation.options.label'), + $this->stringConverter->camelCaseToHuman($class_name) + ); + $input->setOption('label', $label); + } + } +} diff --git a/src/Command/Generate/PluginTypeYamlCommand.php b/src/Command/Generate/PluginTypeYamlCommand.php new file mode 100644 index 000000000..3674b6ec4 --- /dev/null +++ b/src/Command/Generate/PluginTypeYamlCommand.php @@ -0,0 +1,154 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->stringConverter = $stringConverter; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:plugin:type:yaml') + ->setDescription($this->trans('commands.generate.plugin.type.yaml.description')) + ->setHelp($this->trans('commands.generate.plugin.type.yaml.help')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'class', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.type.yaml.options.class') + ) + ->addOption( + 'plugin-name', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.type.yaml.options.plugin-name') + ) + ->addOption( + 'plugin-file-name', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.type.yaml.options.plugin-file-name') + ) + ->setAliases(['gpty']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $module = $input->getOption('module'); + $class_name = $input->getOption('class'); + $plugin_name = $input->getOption('plugin-name'); + $plugin_file_name = $input->getOption('plugin-file-name'); + + $this->generator->generate($module, $class_name, $plugin_name, $plugin_file_name); + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --class option + $class_name = $input->getOption('class'); + if (!$class_name) { + $class_name = $io->ask( + $this->trans('commands.generate.plugin.type.yaml.options.class'), + 'ExamplePlugin' + ); + $input->setOption('class', $class_name); + } + + // --plugin-name option + $plugin_name = $input->getOption('plugin-name'); + if (!$plugin_name) { + $plugin_name = $io->ask( + $this->trans('commands.generate.plugin.type.yaml.options.plugin-name'), + $this->stringConverter->camelCaseToUnderscore($class_name) + ); + $input->setOption('plugin-name', $plugin_name); + } + + // --plugin-file-name option + $plugin_file_name = $input->getOption('plugin-file-name'); + if (!$plugin_file_name) { + $plugin_file_name = $io->ask( + $this->trans('commands.generate.plugin.type.yaml.options.plugin-file-name'), + strtr($plugin_name, '_-', '..') + ); + $input->setOption('plugin-file-name', $plugin_file_name); + } + } +} diff --git a/src/Command/Generate/PluginViewsFieldCommand.php b/src/Command/Generate/PluginViewsFieldCommand.php new file mode 100644 index 000000000..b91b08ad8 --- /dev/null +++ b/src/Command/Generate/PluginViewsFieldCommand.php @@ -0,0 +1,185 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->site = $site; + $this->stringConverter = $stringConverter; + $this->chainQueue = $chainQueue; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:plugin:views:field') + ->setDescription($this->trans('commands.generate.plugin.views.field.description')) + ->setHelp($this->trans('commands.generate.plugin.views.field.help')) + ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')) + ->addOption( + 'class', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.plugin.views.field.options.class') + ) + ->addOption( + 'title', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.views.field.options.title') + ) + ->addOption( + 'description', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.plugin.views.field.options.description') + ) + ->setAliases(['gpvf']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $class_name = $input->getOption('class'); + $class_machine_name = $this->stringConverter->camelCaseToUnderscore($class_name); + $title = $input->getOption('title'); + $description = $input->getOption('description'); + + $this->generator->generate($module, $class_machine_name, $class_name, $title, $description); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + return 0; + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --class option + $class_name = $input->getOption('class'); + if (!$class_name) { + $class_name = $io->ask( + $this->trans('commands.generate.plugin.views.field.questions.class'), + 'CustomViewsField' + ); + } + $input->setOption('class', $class_name); + + // --title option + $title = $input->getOption('title'); + if (!$title) { + $title = $io->ask( + $this->trans('commands.generate.plugin.views.field.questions.title'), + $this->stringConverter->camelCaseToHuman($class_name) + ); + $input->setOption('title', $title); + } + + // --description option + $description = $input->getOption('description'); + if (!$description) { + $description = $io->ask( + $this->trans('commands.generate.plugin.views.field.questions.description'), + $this->trans('commands.generate.plugin.views.field.questions.description_default') + ); + $input->setOption('description', $description); + } + } + + protected function createGenerator() + { + return new PluginViewsFieldGenerator(); + } +} diff --git a/src/Command/Generate/PostUpdateCommand.php b/src/Command/Generate/PostUpdateCommand.php new file mode 100644 index 000000000..180a70c0d --- /dev/null +++ b/src/Command/Generate/PostUpdateCommand.php @@ -0,0 +1,198 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->site = $site; + $this->validator = $validator; + $this->chainQueue = $chainQueue; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:post:update') + ->setDescription($this->trans('commands.generate.post:update.description')) + ->setHelp($this->trans('commands.generate.post.update.help')) + ->addOption( + 'module', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.common.options.module') + ) + ->addOption( + 'post-update-name', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.post.update.options.post-update-name') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $postUpdateName = $input->getOption('post-update-name'); + + $this->validatePostUpdateName($module, $postUpdateName); + + $this->generator->generate($module, $postUpdateName); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + return 0; + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $this->site->loadLegacyFile('/core/includes/update.inc'); + $this->site->loadLegacyFile('/core/includes/schema.inc'); + + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + $postUpdateName = $input->getOption('post-update-name'); + if (!$postUpdateName) { + $postUpdateName = $io->ask( + $this->trans('commands.generate.post.update.questions.post-update-name'), + '', + function ($postUpdateName) { + return $this->validator->validateSpaces($postUpdateName); + } + ); + + $input->setOption('post-update-name', $postUpdateName); + } + } + + + protected function createGenerator() + { + return new PostUpdateGenerator(); + } + + protected function getLastUpdate($module) + { + $this->site->loadLegacyFile('/core/includes/update.inc'); + $this->site->loadLegacyFile('/core/includes/schema.inc'); + + $updates = update_get_update_list(); + + if (empty($updates[$module]['pending'])) { + $lastUpdateSchema = drupal_get_schema_versions($module); + } else { + $lastUpdateSchema = reset(array_keys($updates[$module]['pending'], max($updates[$module]['pending']))); + } + + return $lastUpdateSchema; + } + + protected function validatePostUpdateName($module, $postUpdateName) + { + if (!$this->validator->validateSpaces($postUpdateName)) { + throw new \InvalidArgumentException( + sprintf( + $this->trans('commands.generate.post.update.messages.wrong-post-update-name'), + $postUpdateName + ) + ); + } + + if ($this->extensionManager->validateModuleFunctionExist($module, $module . '_post_update_' . $postUpdateName, $module . '.post_update.php')) { + throw new \InvalidArgumentException( + sprintf( + $this->trans('commands.generate.post.update.messages.post-update-name-already-implemented'), + $postUpdateName + ) + ); + } + } +} diff --git a/src/Command/Generate/ProfileCommand.php b/src/Command/Generate/ProfileCommand.php new file mode 100644 index 000000000..5dfbe1509 --- /dev/null +++ b/src/Command/Generate/ProfileCommand.php @@ -0,0 +1,270 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->stringConverter = $stringConverter; + $this->validator = $validator; + $this->appRoot = $appRoot; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('generate:profile') + ->setDescription($this->trans('commands.generate.profile.description')) + ->setHelp($this->trans('commands.generate.profile.help')) + ->addOption( + 'profile', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.profile.options.profile') + ) + ->addOption( + 'machine-name', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.profile.options.machine-name') + ) + ->addOption( + 'description', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.profile.options.description') + ) + ->addOption( + 'core', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.profile.options.core') + ) + ->addOption( + 'dependencies', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.profile.options.dependencies'), + '' + ) + ->addOption( + 'themes', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.profile.options.themes'), + '' + ) + ->addOption( + 'distribution', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.profile.options.distribution') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + if (!$this->confirmGeneration($io)) { + return 1; + } + + $profile = $this->validator->validateModuleName($input->getOption('profile')); + $machine_name = $this->validator->validateMachineName($input->getOption('machine-name')); + $description = $input->getOption('description'); + $core = $input->getOption('core'); + $dependencies = $this->validator->validateExtensions($input->getOption('dependencies'), 'module', $io); + $themes = $this->validator->validateExtensions($input->getOption('themes'), 'theme', $io); + $distribution = $input->getOption('distribution'); + $profile_path = $this->appRoot . '/profiles'; + + $this->generator->generate( + $profile, + $machine_name, + $profile_path, + $description, + $core, + $dependencies, + $themes, + $distribution + ); + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + //$stringUtils = $this->getStringHelper(); + $validators = $this->validator; + + try { + // A profile is technically also a module, so we can use the same + // validator to check the name. + $profile = $input->getOption('profile') ? $validators->validateModuleName($input->getOption('profile')) : null; + } catch (\Exception $error) { + $io->error($error->getMessage()); + + return 1; + } + + if (!$profile) { + $profile = $io->ask( + $this->trans('commands.generate.profile.questions.profile'), + '', + function ($profile) use ($validators) { + return $validators->validateModuleName($profile); + } + ); + $input->setOption('profile', $profile); + } + + try { + $machine_name = $input->getOption('machine-name') ? $validators->validateModuleName($input->getOption('machine-name')) : null; + } catch (\Exception $error) { + $io->error($error->getMessage()); + + return 1; + } + + if (!$machine_name) { + $machine_name = $io->ask( + $this->trans('commands.generate.profile.questions.machine-name'), + $this->stringConverter->createMachineName($profile), + function ($machine_name) use ($validators) { + return $validators->validateMachineName($machine_name); + } + ); + $input->setOption('machine-name', $machine_name); + } + + $description = $input->getOption('description'); + if (!$description) { + $description = $io->ask( + $this->trans('commands.generate.profile.questions.description'), + 'My Useful Profile' + ); + $input->setOption('description', $description); + } + + $core = $input->getOption('core'); + if (!$core) { + $core = $io->ask( + $this->trans('commands.generate.profile.questions.core'), + '8.x' + ); + $input->setOption('core', $core); + } + + $dependencies = $input->getOption('dependencies'); + if (!$dependencies) { + if ($io->confirm( + $this->trans('commands.generate.profile.questions.dependencies'), + true + ) + ) { + $dependencies = $io->ask( + $this->trans('commands.generate.profile.options.dependencies'), + '' + ); + } + $input->setOption('dependencies', $dependencies); + } + + $distribution = $input->getOption('distribution'); + if (!$distribution) { + if ($io->confirm( + $this->trans('commands.generate.profile.questions.distribution'), + false + ) + ) { + $distribution = $io->ask( + $this->trans('commands.generate.profile.options.distribution'), + 'My Kick-ass Distribution' + ); + $input->setOption('distribution', $distribution); + } + } + } + + /** + * @return ProfileGenerator + */ + protected function createGenerator() + { + return new ProfileGenerator(); + } +} diff --git a/src/Command/Generate/RouteSubscriberCommand.php b/src/Command/Generate/RouteSubscriberCommand.php new file mode 100644 index 000000000..1085ea469 --- /dev/null +++ b/src/Command/Generate/RouteSubscriberCommand.php @@ -0,0 +1,158 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->chainQueue = $chainQueue; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('generate:routesubscriber') + ->setDescription($this->trans('commands.generate.routesubscriber.description')) + ->setHelp($this->trans('commands.generate.routesubscriber.description')) + ->addOption( + 'module', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.common.options.module') + ) + ->addOption( + 'name', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.routesubscriber.options.name') + ) + ->addOption( + 'class', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.routesubscriber.options.class') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $output = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($output)) { + return 1; + } + + $module = $input->getOption('module'); + $name = $input->getOption('name'); + $class = $input->getOption('class'); + + $this->generator->generate($module, $name, $class); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); + + return 0; + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --name option + $name = $input->getOption('name'); + if (!$name) { + $name = $io->ask( + $this->trans('commands.generate.routesubscriber.questions.name'), + $module.'.route_subscriber' + ); + $input->setOption('name', $name); + } + + // --class option + $class = $input->getOption('class'); + if (!$class) { + $class = $io->ask( + $this->trans('commands.generate.routesubscriber.questions.class'), + 'RouteSubscriber' + ); + $input->setOption('class', $class); + } + } + + protected function createGenerator() + { + return new RouteSubscriberGenerator(); + } +} diff --git a/src/Command/Generate/ServiceCommand.php b/src/Command/Generate/ServiceCommand.php new file mode 100644 index 000000000..859bcfe1b --- /dev/null +++ b/src/Command/Generate/ServiceCommand.php @@ -0,0 +1,244 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->stringConverter = $stringConverter; + $this->chainQueue = $chainQueue; + parent::__construct(); + } + + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('generate:service') + ->setDescription($this->trans('commands.generate.service.description')) + ->setHelp($this->trans('commands.generate.service.description')) + ->addOption( + 'module', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.common.options.module') + ) + ->addOption( + 'name', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.service.options.name') + ) + ->addOption( + 'class', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.service.options.class') + ) + ->addOption( + 'interface', + null, + InputOption::VALUE_NONE, + $this->trans('commands.common.service.options.interface') + ) + ->addOption( + 'interface-name', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.common.service.options.interface-name') + ) + ->addOption( + 'services', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.common.options.services') + ) + ->addOption( + 'path-service', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.service.options.path') + ) + ->setAliases(['gs']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $name = $input->getOption('name'); + $class = $input->getOption('class'); + $interface = $input->getOption('interface'); + $interface_name = $input->getOption('interface-name'); + $services = $input->getOption('services'); + $path_service = $input->getOption('path-service'); + + $available_services = $this->container->getServiceIds(); + + if (in_array($name, array_values($available_services))) { + throw new \Exception( + sprintf( + $this->trans('commands.generate.service.messages.service-already-taken'), + $module + ) + ); + } + + // @see Drupal\Console\Command\Shared\ServicesTrait::buildServices + $build_services = $this->buildServices($services); + $this->generator->generate($module, $name, $class, $interface, $interface_name, $build_services, $path_service); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); + + return 0; + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + //--name option + $name = $input->getOption('name'); + if (!$name) { + $name = $io->ask( + $this->trans('commands.generate.service.questions.service-name'), + $module.'.default' + ); + $input->setOption('name', $name); + } + + // --class option + $class = $input->getOption('class'); + if (!$class) { + $class = $io->ask( + $this->trans('commands.generate.service.questions.class'), + 'DefaultService' + ); + $input->setOption('class', $class); + } + + // --interface option + $interface = $input->getOption('interface'); + if (!$interface) { + $interface = $io->confirm( + $this->trans('commands.generate.service.questions.interface'), + true + ); + $input->setOption('interface', $interface); + } + + // --interface_name option + $interface_name = $input->getOption('interface-name'); + if ($interface && !$interface_name) { + $interface_name = $io->askEmpty( + $this->trans('commands.generate.service.questions.interface-name') + ); + $input->setOption('interface-name', $interface_name); + } + + // --services option + $services = $input->getOption('services'); + if (!$services) { + // @see Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion + $services = $this->servicesQuestion($io); + $input->setOption('services', $services); + } + + // --path_service option + $path_service = $input->getOption('path-service'); + if (!$path_service) { + $path_service = $io->ask( + $this->trans('commands.generate.service.questions.path'), + '/modules/custom/' . $module . '/src/' + ); + $input->setOption('path-service', $path_service); + } + } +} diff --git a/src/Command/Generate/ThemeCommand.php b/src/Command/Generate/ThemeCommand.php new file mode 100644 index 000000000..8c598baf2 --- /dev/null +++ b/src/Command/Generate/ThemeCommand.php @@ -0,0 +1,383 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->validator = $validator; + $this->appRoot = $appRoot; + $this->themeHandler = $themeHandler; + $this->site = $site; + $this->stringConverter = $stringConverter; + parent::__construct(); + } + + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('generate:theme') + ->setDescription($this->trans('commands.generate.theme.description')) + ->setHelp($this->trans('commands.generate.theme.help')) + ->addOption( + 'theme', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.theme.options.module') + ) + ->addOption( + 'machine-name', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.theme.options.machine-name') + ) + ->addOption( + 'theme-path', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.theme.options.module-path') + ) + ->addOption( + 'description', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.theme.options.description') + ) + ->addOption('core', null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.theme.options.core')) + ->addOption( + 'package', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.theme.options.package') + ) + ->addOption( + 'global-library', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.theme.options.global-library') + ) + ->addOption( + 'libraries', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.theme.options.libraries') + ) + ->addOption( + 'base-theme', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.theme.options.base-theme') + ) + ->addOption( + 'regions', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.theme.options.regions') + ) + ->addOption( + 'breakpoints', + null, + InputOption::VALUE_OPTIONAL, + $this->trans('commands.generate.theme.options.breakpoints') + ) + ->setAliases(['gt']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $theme = $this->validator->validateModuleName($input->getOption('theme')); + $theme_path = $this->appRoot . $input->getOption('theme-path'); + $theme_path = $this->validator->validateModulePath($theme_path, true); + + $machine_name = $this->validator->validateMachineName($input->getOption('machine-name')); + $description = $input->getOption('description'); + $core = $input->getOption('core'); + $package = $input->getOption('package'); + $base_theme = $input->getOption('base-theme'); + $global_library = $input->getOption('global-library'); + $libraries = $input->getOption('libraries'); + $regions = $input->getOption('regions'); + $breakpoints = $input->getOption('breakpoints'); + + $this->generator->generate( + $theme, + $machine_name, + $theme_path, + $description, + $core, + $package, + $base_theme, + $global_library, + $libraries, + $regions, + $breakpoints + ); + + return 0; + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + try { + $theme = $input->getOption('theme') ? $this->validator->validateModuleName($input->getOption('theme')) : null; + } catch (\Exception $error) { + $io->error($error->getMessage()); + + return 1; + } + + if (!$theme) { + $validators = $this->validator; + $theme = $io->ask( + $this->trans('commands.generate.theme.questions.theme'), + '', + function ($theme) use ($validators) { + return $validators->validateModuleName($theme); + } + ); + $input->setOption('theme', $theme); + } + + try { + $machine_name = $input->getOption('machine-name') ? $this->validator->validateModule($input->getOption('machine-name')) : null; + } catch (\Exception $error) { + $io->error($error->getMessage()); + + return 1; + } + + if (!$machine_name) { + $machine_name = $io->ask( + $this->trans('commands.generate.theme.questions.machine-name'), + $this->stringConverter->createMachineName($theme), + function ($machine_name) use ($validators) { + return $validators->validateMachineName($machine_name); + } + ); + $input->setOption('machine-name', $machine_name); + } + + $theme_path = $input->getOption('theme-path'); + if (!$theme_path) { + $drupalRoot = $this->appRoot; + $theme_path = $io->ask( + $this->trans('commands.generate.theme.questions.theme-path'), + '/themes/custom', + function ($theme_path) use ($drupalRoot, $machine_name) { + $theme_path = ($theme_path[0] != '/' ? '/' : '') . $theme_path; + $full_path = $drupalRoot . $theme_path . '/' . $machine_name; + if (file_exists($full_path)) { + throw new \InvalidArgumentException( + sprintf( + $this->trans('commands.generate.theme.errors.directory-exists'), + $full_path + ) + ); + } else { + return $theme_path; + } + } + ); + $input->setOption('theme-path', $theme_path); + } + + $description = $input->getOption('description'); + if (!$description) { + $description = $io->ask( + $this->trans('commands.generate.theme.questions.description'), + 'My Awesome theme' + ); + $input->setOption('description', $description); + } + + $package = $input->getOption('package'); + if (!$package) { + $package = $io->ask( + $this->trans('commands.generate.theme.questions.package'), + 'Other' + ); + $input->setOption('package', $package); + } + + $core = $input->getOption('core'); + if (!$core) { + $core = $io->ask( + $this->trans('commands.generate.theme.questions.core'), + '8.x' + ); + $input->setOption('core', $core); + } + + $base_theme = $input->getOption('base-theme'); + if (!$base_theme) { + $themes = $this->themeHandler->rebuildThemeData(); + $themes['false'] =''; + + uasort($themes, 'system_sort_modules_by_info_name'); + + $base_theme = $io->choiceNoList( + $this->trans('commands.generate.theme.options.base-theme'), + array_keys($themes) + ); + $input->setOption('base-theme', $base_theme); + } + + $global_library = $input->getOption('global-library'); + if (!$global_library) { + $global_library = $io->ask( + $this->trans('commands.generate.theme.questions.global-library'), + 'global-styling' + ); + $input->setOption('global-library', $global_library); + } + + + // --libraries option. + $libraries = $input->getOption('libraries'); + if (!$libraries) { + if ($io->confirm( + $this->trans('commands.generate.theme.questions.library-add'), + true + ) + ) { + // @see \Drupal\Console\Command\Shared\ThemeRegionTrait::libraryQuestion + $libraries = $this->libraryQuestion($io); + $input->setOption('libraries', $libraries); + } + } + + // --regions option. + $regions = $input->getOption('regions'); + if (!$regions) { + if ($io->confirm( + $this->trans('commands.generate.theme.questions.regions'), + true + ) + ) { + // @see \Drupal\Console\Command\Shared\ThemeRegionTrait::regionQuestion + $regions = $this->regionQuestion($io); + $input->setOption('regions', $regions); + } + } + + // --breakpoints option. + $breakpoints = $input->getOption('breakpoints'); + if (!$breakpoints) { + if ($io->confirm( + $this->trans('commands.generate.theme.questions.breakpoints'), + true + ) + ) { + // @see \Drupal\Console\Command\Shared\ThemeRegionTrait::regionQuestion + $breakpoints = $this->breakpointQuestion($io); + $input->setOption('breakpoints', $breakpoints); + } + } + } +} diff --git a/src/Command/Generate/TwigExtensionCommand.php b/src/Command/Generate/TwigExtensionCommand.php new file mode 100644 index 000000000..182f408b8 --- /dev/null +++ b/src/Command/Generate/TwigExtensionCommand.php @@ -0,0 +1,192 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->site = $site; + $this->stringConverter = $stringConverter; + $this->chainQueue = $chainQueue; + parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('generate:twig:extension') + ->setDescription($this->trans('commands.generate.twig.extension.description')) + ->setHelp($this->trans('commands.generate.twig.extension.help')) + ->addOption( + 'module', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.common.options.module') + ) + ->addOption( + 'name', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.twig.extension.options.name') + ) + ->addOption( + 'class', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.common.options.class') + ) + ->addOption( + 'services', + null, + InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + $this->trans('commands.common.options.services') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $name = $input->getOption('name'); + $class = $input->getOption('class'); + $services = $input->getOption('services'); + // Add renderer service as first parameter. + array_unshift($services, 'renderer'); + + // @see Drupal\Console\Command\Shared\ServicesTrait::buildServices + $build_services = $this->buildServices($services); + + $this->generator->generate($module, $name, $class, $build_services); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']); + + return 0; + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // --module option + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + // --name option + $name = $input->getOption('name'); + if (!$name) { + $name = $io->ask( + $this->trans('commands.generate.twig.extension.questions.twig-extension'), + $module.'.twig.extension' + ); + $input->setOption('name', $name); + } + + // --class option + $class = $input->getOption('class'); + if (!$class) { + $class = $io->ask( + $this->trans('commands.common.options.class'), + 'DefaultTwigExtension' + ); + $input->setOption('class', $class); + } + + // --services option + $services = $input->getOption('services'); + if (!$services) { + // @see Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion + $services = $this->servicesQuestion($io); + $input->setOption('services', $services); + } + } +} diff --git a/src/Command/Generate/UpdateCommand.php b/src/Command/Generate/UpdateCommand.php new file mode 100644 index 000000000..923970a7e --- /dev/null +++ b/src/Command/Generate/UpdateCommand.php @@ -0,0 +1,199 @@ +extensionManager = $extensionManager; + $this->generator = $generator; + $this->site = $site; + $this->chainQueue = $chainQueue; + parent::__construct(); + } + + protected function configure() + { + $this + ->setName('generate:update') + ->setDescription($this->trans('commands.generate.update.description')) + ->setHelp($this->trans('commands.generate.update.help')) + ->addOption( + 'module', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.common.options.module') + ) + ->addOption( + 'update-n', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.generate.update.options.update-n') + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration + if (!$this->confirmGeneration($io)) { + return 1; + } + + $module = $input->getOption('module'); + $updateNumber = $input->getOption('update-n'); + + $lastUpdateSchema = $this->getLastUpdate($module); + + if ($updateNumber <= $lastUpdateSchema) { + throw new \InvalidArgumentException( + sprintf( + $this->trans('commands.generate.update.messages.wrong-update-n'), + $updateNumber + ) + ); + } + + $this->generator->generate($module, $updateNumber); + + $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']); + + return 0; + } + + protected function interact(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + + $this->site->loadLegacyFile('/core/includes/update.inc'); + $this->site->loadLegacyFile('/core/includes/schema.inc'); + + $module = $input->getOption('module'); + if (!$module) { + // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion + $module = $this->moduleQuestion($io); + $input->setOption('module', $module); + } + + $lastUpdateSchema = $this->getLastUpdate($module); + $nextUpdateSchema = $lastUpdateSchema ? ($lastUpdateSchema + 1): 8001; + + $updateNumber = $input->getOption('update-n'); + if (!$updateNumber) { + $updateNumber = $io->ask( + $this->trans('commands.generate.update.questions.update-n'), + $nextUpdateSchema, + function ($updateNumber) use ($lastUpdateSchema) { + if (!is_numeric($updateNumber)) { + throw new \InvalidArgumentException( + sprintf( + $this->trans('commands.generate.update.messages.wrong-update-n'), + $updateNumber + ) + ); + } else { + if ($updateNumber <= $lastUpdateSchema) { + throw new \InvalidArgumentException( + sprintf( + $this->trans('commands.generate.update.messages.wrong-update-n'), + $updateNumber + ) + ); + } + return $updateNumber; + } + } + ); + + $input->setOption('update-n', $updateNumber); + } + } + + + protected function createGenerator() + { + return new UpdateGenerator(); + } + + protected function getLastUpdate($module) + { + $this->site->loadLegacyFile('/core/includes/update.inc'); + $this->site->loadLegacyFile('/core/includes/schema.inc'); + + $updates = update_get_update_list(); + + if (empty($updates[$module]['pending'])) { + $lastUpdateSchema = drupal_get_schema_versions($module); + $lastUpdateSchema = $lastUpdateSchema[0]; + } else { + $lastUpdateSchema = reset(array_keys($updates[$module]['pending'], max($updates[$module]['pending']))); + } + + return $lastUpdateSchema; + } +} diff --git a/src/Generator/AuthenticationProviderGenerator.php b/src/Generator/AuthenticationProviderGenerator.php new file mode 100644 index 000000000..4fd53df28 --- /dev/null +++ b/src/Generator/AuthenticationProviderGenerator.php @@ -0,0 +1,75 @@ +extensionManager = $extensionManager; + } + + /** + * Generator Plugin Block. + * + * @param $module + * @param $class + * @param $provider_id + */ + public function generate($module, $class, $provider_id) + { + $parameters = [ + 'module' => $module, + 'class' => $class, + ]; + + $this->renderFile( + 'module/src/Authentication/Provider/authentication-provider.php.twig', + $this->extensionManager->getModule($module)->getAuthenticationPath('Provider'). '/' . $class . '.php', + $parameters + ); + + $parameters = [ + 'module' => $module, + 'class' => $class, + 'class_path' => sprintf('Drupal\%s\Authentication\Provider\%s', $module, $class), + 'name' => 'authentication.'.$module, + 'services' => [ + ['name' => 'config.factory'], + ['name' => 'entity_type.manager'], + ], + 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'), + 'tags' => [ + 'name' => 'authentication_provider', + 'provider_id' => $provider_id, + 'priority' => '100', + ], + ]; + + $this->renderFile( + 'module/services.yml.twig', + $this->extensionManager->getModule($module)->getPath() . '/' . $module . '.services.yml', + $parameters, + FILE_APPEND + ); + } +} diff --git a/src/Generator/BreakPointGenerator.php b/src/Generator/BreakPointGenerator.php new file mode 100644 index 000000000..7e91e0e35 --- /dev/null +++ b/src/Generator/BreakPointGenerator.php @@ -0,0 +1,61 @@ +extensionManager = $extensionManager; + } + + + /** + * Generator BreakPoint. + * + * @param $theme + * @param $breakpoints + * @param $machine_name + */ + public function generate($theme, $breakpoints, $machine_name) + { + $parameters = [ + 'theme' => $theme, + 'breakpoints' => $breakpoints, + 'machine_name' => $machine_name + ]; + + $theme_path = $this->extensionManager->getTheme($theme)->getPath(); + + $this->renderFile( + 'theme/breakpoints.yml.twig', + $theme_path .'/'.$machine_name.'.breakpoints.yml', + $parameters, + FILE_APPEND + ); + } +} diff --git a/src/Generator/CacheContextGenerator.php b/src/Generator/CacheContextGenerator.php new file mode 100644 index 000000000..da87ee974 --- /dev/null +++ b/src/Generator/CacheContextGenerator.php @@ -0,0 +1,64 @@ +extensionManager = $extensionManager; + } + + /** + * Generator Service. + * + * @param string $module Module name + * @param string $cache_context Cache context name + * @param string $class Class name + * @param array $services List of services + */ + public function generate($module, $cache_context, $class, $services) + { + $parameters = [ + 'module' => $module, + 'name' => 'cache_context.' . $cache_context, + 'class' => $class, + 'services' => $services, + 'class_path' => sprintf('Drupal\%s\CacheContext\%s', $module, $class), + 'tags' => ['name' => 'cache.context'], + 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'), + ]; + + $this->renderFile( + 'module/src/cache-context.php.twig', + $this->extensionManager->getModule($module)->getSourcePath().'/CacheContext/'.$class.'.php', + $parameters + ); + + $this->renderFile( + 'module/services.yml.twig', + $this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml', + $parameters, + FILE_APPEND + ); + } +} diff --git a/src/Generator/CommandGenerator.php b/src/Generator/CommandGenerator.php new file mode 100644 index 000000000..ff01bd572 --- /dev/null +++ b/src/Generator/CommandGenerator.php @@ -0,0 +1,94 @@ +extensionManager = $extensionManager; + $this->translatorManager = $translatorManager; + } + + /** + * Generate. + * + * @param string $extension Extension name + * @param string $extensionType Extension type + * @param string $name Command name + * @param string $class Class name + * @param boolean $containerAware Container Aware command + * @param array $services Services array + */ + public function generate($extension, $extensionType, $name, $class, $containerAware, $services) + { + $command_key = str_replace(':', '.', $name); + + $extensionObject = $this->extensionManager->getDrupalExtension($extensionType, $extension); + + $parameters = [ + 'extension' => $extension, + 'extensionType' => $extensionType, + 'name' => $name, + 'class_name' => $class, + 'container_aware' => $containerAware, + 'command_key' => $command_key, + 'services' => $services, + 'tags' => ['name' => 'drupal.command'], + 'class_path' => sprintf('Drupal\%s\Command\%s', $extension, $class), + 'file_exists' => file_exists($extensionObject->getPath().'/console.services.yml'), + ]; + + $this->renderFile( + 'module/src/Command/command.php.twig', + $extensionObject->getCommandDirectory().$class.'.php', + $parameters + ); + + $parameters['name'] = $extension.'.'.str_replace(':', '_', $name); + + $this->renderFile( + 'module/services.yml.twig', + $extensionObject->getPath() .'/console.services.yml', + $parameters, + FILE_APPEND + ); + + $this->renderFile( + 'module/src/Command/console/translations/en/command.yml.twig', + $extensionObject->getPath().'/console/translations/en/'.$command_key.'.yml' + ); + } +} diff --git a/src/Generator/ControllerGenerator.php b/src/Generator/ControllerGenerator.php new file mode 100644 index 000000000..bb95974d8 --- /dev/null +++ b/src/Generator/ControllerGenerator.php @@ -0,0 +1,62 @@ +extensionManager = $extensionManager; + } + + public function generate($module, $class, $routes, $test, $services) + { + $parameters = [ + 'class_name' => $class, + 'services' => $services, + 'module' => $module, + 'routes' => $routes, + //'learning' => $this->isLearning(), + ]; + + $this->renderFile( + 'module/src/Controller/controller.php.twig', + $this->extensionManager->getModule($module)->getControllerPath().'/'.$class.'.php', + $parameters + ); + + $this->renderFile( + 'module/routing-controller.yml.twig', + $this->extensionManager->getModule($module)->getPath().'/'.$module.'.routing.yml', + $parameters, + FILE_APPEND + ); + + if ($test) { + $this->renderFile( + 'module/Tests/Controller/controller.php.twig', + $this->extensionManager->getModule($module)->getTestPath('Controller').'/'.$class.'Test.php', + $parameters + ); + } + } +} diff --git a/src/Generator/EntityBundleGenerator.php b/src/Generator/EntityBundleGenerator.php new file mode 100644 index 000000000..18e6ac6c5 --- /dev/null +++ b/src/Generator/EntityBundleGenerator.php @@ -0,0 +1,86 @@ +extensionManager = $extensionManager; + } + + public function generate($module, $bundleName, $bundleTitle) + { + $parameters = [ + 'module' => $module, + 'bundle_name' => $bundleName, + 'bundle_title' => $bundleTitle, + //TODO: + //'learning' => $this->isLearning(), + ]; + + /** + * Generate core.entity_form_display.node.{ bundle_name }.default.yml + */ + $this->renderFile( + 'module/src/Entity/Bundle/core.entity_form_display.node.default.yml.twig', + $this->extensionManager->getModule($module)->getPath() . '/config/install/core.entity_form_display.node.' . $bundleName . '.default.yml', + $parameters + ); + + /** + * Generate core.entity_view_display.node.{ bundle_name }.default.yml + */ + $this->renderFile( + 'module/src/Entity/Bundle/core.entity_view_display.node.default.yml.twig', + $this->extensionManager->getModule($module)->getPath() . '/config/install/core.entity_view_display.node.' . $bundleName . '.default.yml', + $parameters + ); + + /** + * Generate core.entity_view_display.node.{ bundle_name }.teaser.yml + */ + $this->renderFile( + 'module/src/Entity/Bundle/core.entity_view_display.node.teaser.yml.twig', + $this->extensionManager->getModule($module)->getPath() . '/config/install/core.entity_view_display.node.' . $bundleName . '.teaser.yml', + $parameters + ); + + /** + * Generate field.field.node.{ bundle_name }.body.yml + */ + $this->renderFile( + 'module/src/Entity/Bundle/field.field.node.body.yml.twig', + $this->extensionManager->getModule($module)->getPath() . '/config/install/field.field.node.' . $bundleName . '.body.yml', + $parameters + ); + + /** + * Generate node.type.{ bundle_name }.yml + */ + $this->renderFile( + 'module/src/Entity/Bundle/node.type.yml.twig', + $this->extensionManager->getModule($module)->getPath() . '/config/install/node.type.' . $bundleName . '.yml', + $parameters + ); + } +} diff --git a/src/Generator/EntityConfigGenerator.php b/src/Generator/EntityConfigGenerator.php new file mode 100644 index 000000000..3a4f752b2 --- /dev/null +++ b/src/Generator/EntityConfigGenerator.php @@ -0,0 +1,109 @@ +extensionManager = $extensionManager; + } + + + /** + * Generator Entity. + * + * @param string $module Module name + * @param string $entity_name Entity machine name + * @param string $entity_class Entity class name + * @param string $label Entity label + * @param string $base_path Base path + * @param string $bundle_of Entity machine name of the content entity this config entity acts as a bundle for. + */ + public function generate($module, $entity_name, $entity_class, $label, $base_path, $bundle_of = null) + { + $parameters = [ + 'module' => $module, + 'entity_name' => $entity_name, + 'entity_class' => $entity_class, + 'label' => $label, + 'bundle_of' => $bundle_of, + 'base_path' => $base_path, + ]; + + $this->renderFile( + 'module/config/schema/entity.schema.yml.twig', + $this->extensionManager->getModule($module)->getPath().'/config/schema/'.$entity_name.'.schema.yml', + $parameters + ); + + $this->renderFile( + 'module/links.menu-entity-config.yml.twig', + $this->extensionManager->getModule($module)->getPath().'/'.$module.'.links.menu.yml', + $parameters, + FILE_APPEND + ); + + $this->renderFile( + 'module/links.action-entity.yml.twig', + $this->extensionManager->getModule($module)->getPath().'/'.$module.'.links.action.yml', + $parameters, + FILE_APPEND + ); + + $this->renderFile( + 'module/src/Entity/interface-entity.php.twig', + $this->extensionManager->getModule($module)->getEntityPath().'/'.$entity_class.'Interface.php', + $parameters + ); + + $this->renderFile( + 'module/src/Entity/entity.php.twig', + $this->extensionManager->getModule($module)->getEntityPath().'/'.$entity_class.'.php', + $parameters + ); + + $this->renderFile( + 'module/src/entity-route-provider.php.twig', + $this->extensionManager->getModule($module)->getSourcePath().'/'.$entity_class.'HtmlRouteProvider.php', + $parameters + ); + + $this->renderFile( + 'module/src/Form/entity.php.twig', + $this->extensionManager->getModule($module)->getFormPath().'/'.$entity_class.'Form.php', + $parameters + ); + + $this->renderFile( + 'module/src/Form/entity-delete.php.twig', + $this->extensionManager->getModule($module)->getFormPath().'/'.$entity_class.'DeleteForm.php', + $parameters + ); + + $this->renderFile( + 'module/src/entity-listbuilder.php.twig', + $this->extensionManager->getModule($module)->getSourcePath().'/'.$entity_class.'ListBuilder.php', + $parameters + ); + } +} diff --git a/src/Generator/EntityContentGenerator.php b/src/Generator/EntityContentGenerator.php new file mode 100644 index 000000000..3c9f98cce --- /dev/null +++ b/src/Generator/EntityContentGenerator.php @@ -0,0 +1,291 @@ +extensionManager = $extensionManager; + $this->site = $site; + $this->twigrenderer = $twigrenderer; + } + + public function setIo($io) + { + $this->io = $io; + } + + + /** + * Generator Entity. + * + * @param string $module Module name + * @param string $entity_name Entity machine name + * @param string $entity_class Entity class name + * @param string $label Entity label + * @param string $base_path Base path + * @param string $is_translatable Translation configuration + * @param string $bundle_entity_type (Config) entity type acting as bundle + * @param bool $revisionable Revision configuration + */ + public function generate($module, $entity_name, $entity_class, $label, $base_path, $is_translatable, $bundle_entity_type = null, $revisionable = false) + { + $parameters = [ + 'module' => $module, + 'entity_name' => $entity_name, + 'entity_class' => $entity_class, + 'label' => $label, + 'bundle_entity_type' => $bundle_entity_type, + 'base_path' => $base_path, + 'is_translatable' => $is_translatable, + 'revisionable' => $revisionable, + ]; + + $this->renderFile( + 'module/permissions-entity-content.yml.twig', + $this->extensionManager->getModule($module)->getPath().'/'.$module.'.permissions.yml', + $parameters, + FILE_APPEND + ); + + $this->renderFile( + 'module/links.menu-entity-content.yml.twig', + $this->extensionManager->getModule($module)->getPath().'/'.$module.'.links.menu.yml', + $parameters, + FILE_APPEND + ); + + $this->renderFile( + 'module/links.task-entity-content.yml.twig', + $this->extensionManager->getModule($module)->getPath().'/'.$module.'.links.task.yml', + $parameters, + FILE_APPEND + ); + + $this->renderFile( + 'module/links.action-entity-content.yml.twig', + $this->extensionManager->getModule($module)->getPath().'/'.$module.'.links.action.yml', + $parameters, + FILE_APPEND + ); + + $this->renderFile( + 'module/src/accesscontrolhandler-entity-content.php.twig', + $this->extensionManager->getModule($module)->getSourcePath().'/'.$entity_class.'AccessControlHandler.php', + $parameters + ); + + if ($is_translatable) { + $this->renderFile( + 'module/src/entity-translation-handler.php.twig', + $this->extensionManager->getModule($module)->getSourcePath().'/'.$entity_class.'TranslationHandler.php', + $parameters + ); + } + + $this->renderFile( + 'module/src/Entity/interface-entity-content.php.twig', + $this->extensionManager->getModule($module)->getEntityPath().'/'.$entity_class.'Interface.php', + $parameters + ); + + $this->renderFile( + 'module/src/Entity/entity-content.php.twig', + $this->extensionManager->getModule($module)->getEntityPath().'/'.$entity_class.'.php', + $parameters + ); + + $this->renderFile( + 'module/src/entity-content-route-provider.php.twig', + $this->extensionManager->getModule($module)->getSourcePath().'/'.$entity_class.'HtmlRouteProvider.php', + $parameters + ); + + $this->renderFile( + 'module/src/Entity/entity-content-views-data.php.twig', + $this->extensionManager->getModule($module)->getEntityPath().'/'.$entity_class.'ViewsData.php', + $parameters + ); + + $this->renderFile( + 'module/src/listbuilder-entity-content.php.twig', + $this->extensionManager->getModule($module)->getSourcePath().'/'.$entity_class.'ListBuilder.php', + $parameters + ); + + $this->renderFile( + 'module/src/Entity/Form/entity-settings.php.twig', + $this->extensionManager->getModule($module)->getFormPath().'/'.$entity_class.'SettingsForm.php', + $parameters + ); + + $this->renderFile( + 'module/src/Entity/Form/entity-content.php.twig', + $this->extensionManager->getModule($module)->getFormPath().'/'.$entity_class.'Form.php', + $parameters + ); + + $this->renderFile( + 'module/src/Entity/Form/entity-content-delete.php.twig', + $this->extensionManager->getModule($module)->getFormPath().'/'.$entity_class.'DeleteForm.php', + $parameters + ); + + $this->renderFile( + 'module/entity-content-page.php.twig', + $this->extensionManager->getModule($module)->getPath().'/'.$entity_name.'.page.inc', + $parameters + ); + + $this->renderFile( + 'module/templates/entity-html.twig', + $this->extensionManager->getModule($module)->getTemplatePath().'/'.$entity_name.'.html.twig', + $parameters + ); + + if ($revisionable) { + $this->renderFile( + 'module/src/Entity/Form/entity-content-revision-delete.php.twig', + $this->extensionManager->getModule($module)->getFormPath() .'/'.$entity_class.'RevisionDeleteForm.php', + $parameters + ); + $this->renderFile( + 'module/src/Entity/Form/entity-content-revision-revert-translation.php.twig', + $this->extensionManager->getModule($module)->getFormPath() .'/'.$entity_class.'RevisionRevertTranslationForm.php', + $parameters + ); + $this->renderFile( + 'module/src/Entity/Form/entity-content-revision-revert.php.twig', + $this->extensionManager->getModule($module)->getFormPath().'/'.$entity_class.'RevisionRevertForm.php', + $parameters + ); + $this->renderFile( + 'module/src/entity-storage.php.twig', + $this->extensionManager->getModule($module)->getSourcePath() .'/'.$entity_class.'Storage.php', + $parameters + ); + $this->renderFile( + 'module/src/interface-entity-storage.php.twig', + $this->extensionManager->getModule($module)->getSourcePath() .'/'.$entity_class.'StorageInterface.php', + $parameters + ); + $this->renderFile( + 'module/src/Controller/entity-controller.php.twig', + $this->extensionManager->getModule($module)->getControllerPath() .'/'.$entity_class.'Controller.php', + $parameters + ); + } + + if ($bundle_entity_type) { + $this->renderFile( + 'module/templates/entity-with-bundle-content-add-list-html.twig', + $this->extensionManager->getModule($module)->getTemplatePath().'/'.str_replace('_', '-', $entity_name).'-content-add-list.html.twig', + $parameters + ); + + // Check for hook_theme() in module file and warn ... + $module_filename = $this->extensionManager->getModule($module)->getPath().'/'.$module.'.module'; + // Check if the module file exists. + if (!file_exists($module_filename)) { + $this->renderFile( + 'module/module.twig', + $this->extensionManager->getModule($module)->getPath().'/'.$module . '.module', + [ + 'machine_name' => $module, + 'description' => '', + ] + ); + } + $module_file_contents = file_get_contents($module_filename); + if (strpos($module_file_contents, 'function ' . $module . '_theme') !== false) { + $this->io->warning( + [ + "It looks like you have a hook_theme already declared", + "Please manually merge the two hook_theme() implementations in", + $module_filename + ] + ); + } + + $this->renderFile( + 'module/src/Entity/entity-content-with-bundle.theme.php.twig', + $this->extensionManager->getModule($module)->getPath().'/'.$module.'.module', + $parameters, + FILE_APPEND + ); + + if (strpos($module_file_contents, 'function ' . $module . '_theme_suggestions_' . $entity_name) !== false) { + $this->io->warning( + [ + "It looks like you have a hook_theme_suggestions_HOOK already declared", + "Please manually merge the two hook_theme_suggestions_HOOK() implementations in", + $module_filename + ] + ); + } + + $this->renderFile( + 'module/src/Entity/entity-content-with-bundle.theme_hook_suggestions.php.twig', + $this->extensionManager->getModule($module)->getPath().'/'.$module.'.module', + $parameters, + FILE_APPEND + ); + } + + $content = $this->twigrenderer->render( + 'module/src/Entity/entity-content.theme.php.twig', + $parameters + ); + + + //@TODO: + /** + if ($this->isLearning()) { + $this->io->commentBlock( + [ + 'Add this to your hook_theme:', + $content + ] + ); + } + */ + } +} diff --git a/src/Generator/EventSubscriberGenerator.php b/src/Generator/EventSubscriberGenerator.php new file mode 100644 index 000000000..f53178be2 --- /dev/null +++ b/src/Generator/EventSubscriberGenerator.php @@ -0,0 +1,66 @@ +extensionManager = $extensionManager; + } + + /** + * Generator Service. + * + * @param string $module Module name + * @param string $name Service name + * @param string $class Class name + * @param string $events + * @param array $services List of services + */ + public function generate($module, $name, $class, $events, $services) + { + $parameters = [ + 'module' => $module, + 'name' => $name, + 'class' => $class, + 'class_path' => sprintf('Drupal\%s\EventSubscriber\%s', $module, $class), + 'events' => $events, + 'services' => $services, + 'tags' => ['name' => 'event_subscriber'], + 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'), + ]; + + $this->renderFile( + 'module/src/event-subscriber.php.twig', + $this->extensionManager->getModule($module)->getSourcePath().'/EventSubscriber/'.$class.'.php', + $parameters + ); + + $this->renderFile( + 'module/services.yml.twig', + $this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml', + $parameters, + FILE_APPEND + ); + } +} diff --git a/src/Generator/FormAlterGenerator.php b/src/Generator/FormAlterGenerator.php new file mode 100644 index 000000000..19fba6d82 --- /dev/null +++ b/src/Generator/FormAlterGenerator.php @@ -0,0 +1,57 @@ +extensionManager = $extensionManager; + } + + /** + * Generator Plugin Block. + * + * @param $module + * @param $form_id + * @param $inputs + * @param $metadata + */ + public function generate($module, $form_id, $inputs, $metadata) + { + $parameters = [ + 'module' => $module, + 'form_id' => $form_id, + 'inputs' => $inputs, + 'metadata' => $metadata + ]; + + $module_path = $this->extensionManager->getModule($module)->getPath(); + + $this->renderFile( + 'module/src/Form/form-alter.php.twig', + $module_path .'/'.$module.'.module', + $parameters, + FILE_APPEND + ); + } +} diff --git a/src/Generator/FormGenerator.php b/src/Generator/FormGenerator.php new file mode 100644 index 000000000..d19897480 --- /dev/null +++ b/src/Generator/FormGenerator.php @@ -0,0 +1,114 @@ +extensionManager = $extensionManager; + $this->stringConverter = $stringConverter; + } + + /** + * @param $module + * @param $class_name + * @param $services + * @param $config_file + * @param $inputs + * @param $form_id + * @param $form_type + * @param $path + * @param $menu_link_gen + * @param $menu_link_title + * @param $menu_parent + * @param $menu_link_desc + */ + public function generate($module, $class_name, $form_id, $form_type, $services, $config_file, $inputs, $path, $menu_link_gen, $menu_link_title, $menu_parent, $menu_link_desc) + { + $class_name_short = strtolower( + $this->stringConverter->removeSuffix($class_name) + ); + + $parameters = [ + 'class_name' => $class_name, + 'services' => $services, + 'config_file' => $config_file, + 'inputs' => $inputs, + 'module_name' => $module, + 'form_id' => $form_id, + 'path' => $path, + 'route_name' => $class_name, + 'menu_link_title' => $menu_link_title, + 'menu_parent' => $menu_parent, + 'menu_link_desc' => $menu_link_desc, + 'class_name_short' => $class_name_short + ]; + + if ($form_type == 'ConfigFormBase') { + $template = 'module/src/Form/form-config.php.twig'; + $parameters['config_form'] = true; + } else { + $template = 'module/src/Form/form.php.twig'; + $parameters['config_form'] = false; + } + + $this->renderFile( + 'module/routing-form.yml.twig', + $this->extensionManager->getModule($module)->getPath() .'/'.$module.'.routing.yml', + $parameters, + FILE_APPEND + ); + + $this->renderFile( + $template, + $this->extensionManager->getModule($module)->getFormPath() .'/'.$class_name.'.php', + $parameters + ); + + // Render defaults YML file. + if ($config_file == true) { + $this->renderFile( + 'module/config/install/field.default.yml.twig', + $this->extensionManager->getModule($module)->getPath() .'/config/install/'.$module.'.'.$class_name_short.'.yml', + $parameters + ); + } + + if ($menu_link_gen == true) { + $this->renderFile( + 'module/links.menu.yml.twig', + $this->extensionManager->getModule($module)->getPath() . '/' . $module . '.links.menu.yml', + $parameters, + FILE_APPEND + ); + } + } +} diff --git a/src/Generator/HelpGenerator.php b/src/Generator/HelpGenerator.php new file mode 100644 index 000000000..420240c19 --- /dev/null +++ b/src/Generator/HelpGenerator.php @@ -0,0 +1,54 @@ +extensionManager = $extensionManager; + } + + /** + * Generator Post Update Name function. + * + * @param $module + * @param $description + */ + public function generate($module, $description) + { + $module_path = $this->extensionManager->getModule($module)->getPath(); + + $parameters = [ + 'machine_name' => $module, + 'description' => $description, + 'file_exists' => file_exists($module_path .'/'.$module.'.module'), + ]; + + $this->renderFile( + 'module/help.php.twig', + $module_path .'/'.$module.'.module', + $parameters, + FILE_APPEND + ); + } +} diff --git a/src/Generator/ModuleFileGenerator.php b/src/Generator/ModuleFileGenerator.php new file mode 100644 index 000000000..8f8e84e47 --- /dev/null +++ b/src/Generator/ModuleFileGenerator.php @@ -0,0 +1,53 @@ + $machine_name, + 'file_path' => $file_path , + ]; + + if ($machine_name) { + $this->renderFile( + 'module/module-file.twig', + $file_path . '/' . $machine_name . '.module', + $parameters + ); + } + } +} diff --git a/src/Generator/ModuleGenerator.php b/src/Generator/ModuleGenerator.php new file mode 100644 index 000000000..f7c2ed0a7 --- /dev/null +++ b/src/Generator/ModuleGenerator.php @@ -0,0 +1,188 @@ + $module, + 'machine_name' => $machineName, + 'type' => 'module', + 'core' => $core, + 'description' => $description, + 'package' => $package, + 'dependencies' => $dependencies, + 'test' => $test, + 'twigtemplate' => $twigtemplate, + ]; + + $this->renderFile( + 'module/info.yml.twig', + $dir.'/'.$machineName.'.info.yml', + $parameters + ); + + if (!empty($featuresBundle)) { + $this->renderFile( + 'module/features.yml.twig', + $dir.'/'.$machineName.'.features.yml', + [ + 'bundle' => $featuresBundle, + ] + ); + } + + if ($moduleFile) { + // Generate '.module' file. + $this->createModuleFile($dir, $parameters); + } + + if ($composer) { + $this->renderFile( + 'module/composer.json.twig', + $dir.'/'.'composer.json', + $parameters + ); + } + + if ($test) { + $this->renderFile( + 'module/src/Tests/load-test.php.twig', + $dir . '/tests/src/Functional/' . 'LoadTest.php', + $parameters + ); + } + if ($twigtemplate) { + // If module file is not created earlier, create now. + if (!$moduleFile) { + // Generate '.module' file. + $this->createModuleFile($dir, $parameters); + } + $this->renderFile( + 'module/module-twig-template-append.twig', + $dir .'/' . $machineName . '.module', + $parameters, + FILE_APPEND + ); + $dir .= '/templates/'; + if (file_exists($dir)) { + if (!is_dir($dir)) { + throw new \RuntimeException( + sprintf( + 'Unable to generate the templates directory as the target directory "%s" exists but is a file.', + realpath($dir) + ) + ); + } + $files = scandir($dir); + if ($files != ['.', '..']) { + throw new \RuntimeException( + sprintf( + 'Unable to generate the templates directory as the target directory "%s" is not empty.', + realpath($dir) + ) + ); + } + if (!is_writable($dir)) { + throw new \RuntimeException( + sprintf( + 'Unable to generate the templates directory as the target directory "%s" is not writable.', + realpath($dir) + ) + ); + } + } + $this->renderFile( + 'module/twig-template-file.twig', + $dir . str_replace("_", "-", $machineName) . '.html.twig', + $parameters + ); + } + } + + /** + * Generate the '.module' file. + * + * @param string $dir + * The directory name. + * @param array $parameters + * The parameter array. + */ + protected function createModuleFile($dir, $parameters) + { + $this->renderFile( + 'module/module.twig', + $dir . '/' . $parameters['machine_name'] . '.module', + $parameters + ); + } +} diff --git a/src/Generator/PermissionGenerator.php b/src/Generator/PermissionGenerator.php new file mode 100644 index 000000000..643b1f4ba --- /dev/null +++ b/src/Generator/PermissionGenerator.php @@ -0,0 +1,60 @@ +extensionManager = $extensionManager; + } + + /** + * @param $module + * @param $permissions + * @param $learning + */ + public function generate($module, $permissions, $learning) + { + $parameters = [ + 'module_name' => $module, + 'permissions' => $permissions, + ]; + + $this->renderFile( + 'module/permission.yml.twig', + $this->extensionManager->getModule($module)->getPath().'/'.$module.'.permissions.yml', + $parameters, + FILE_APPEND + ); + + $content = $this->renderer->render( + 'module/permission-routing.yml.twig', + $parameters + ); + + if ($learning) { + echo 'You can use this permission in the routing file like this:'.PHP_EOL; + echo $content; + } + } +} diff --git a/src/Generator/PluginBlockGenerator.php b/src/Generator/PluginBlockGenerator.php new file mode 100644 index 000000000..3755ae193 --- /dev/null +++ b/src/Generator/PluginBlockGenerator.php @@ -0,0 +1,89 @@ +extensionManager = $extensionManager; + } + + /** + * Generator Plugin Block. + * + * @param $module + * @param $class_name + * @param $label + * @param $plugin_id + * @param $services + */ + public function generate($module, $class_name, $label, $plugin_id, $services, $inputs) + { + // Consider the type when determining a default value. Figure out what + // the code looks like for the default value tht we need to generate. + foreach ($inputs as &$input) { + $default_code = '$this->t(\'\')'; + if ($input['default_value'] == '') { + switch ($input['type']) { + case 'checkbox': + case 'number': + case 'weight': + case 'radio': + $default_code = 0; + break; + + case 'radios': + case 'checkboxes': + $default_code = 'array()'; + break; + } + } elseif (substr($input['default_value'], 0, 1) == '$') { + // If they want to put in code, let them, they're programmers. + $default_code = $input['default_value']; + } elseif (is_numeric($input['default_value'])) { + $default_code = $input['default_value']; + } elseif (preg_match('/^(true|false)$/i', $input['default_value'])) { + // Coding Standards + $default_code = strtoupper($input['default_value']); + } else { + $default_code = '$this->t(\'' . $input['default_value'] . '\')'; + } + $input['default_code'] = $default_code; + } + + $parameters = [ + 'module' => $module, + 'class_name' => $class_name, + 'label' => $label, + 'plugin_id' => $plugin_id, + 'services' => $services, + 'inputs' => $inputs, + ]; + + $this->renderFile( + 'module/src/Plugin/Block/block.php.twig', + $this->extensionManager->getPluginPath($module, 'Block').'/'.$class_name.'.php', + $parameters + ); + } +} diff --git a/src/Generator/PluginCKEditorButtonGenerator.php b/src/Generator/PluginCKEditorButtonGenerator.php new file mode 100644 index 000000000..bcbef106b --- /dev/null +++ b/src/Generator/PluginCKEditorButtonGenerator.php @@ -0,0 +1,57 @@ +extensionManager = $extensionManager; + } + + /** + * Generator Plugin CKEditor Button. + * + * @param string $module Module name + * @param string $class_name Plugin Class name + * @param string $label Plugin label + * @param string $plugin_id Plugin id + * @param string $button_name Button name + */ + public function generate($module, $class_name, $label, $plugin_id, $button_name, $button_icon_path) + { + $parameters = [ + 'module' => $module, + 'class_name' => $class_name, + 'label' => $label, + 'plugin_id' => $plugin_id, + 'button_name' => $button_name, + 'button_icon_path' => $button_icon_path, + ]; + + $this->renderFile( + 'module/src/Plugin/CKEditorPlugin/ckeditorbutton.php.twig', + $this->extensionManager->getPluginPath($module, 'CKEditorPlugin') . '/' . $class_name . '.php', + $parameters + ); + } +} diff --git a/src/Generator/PluginConditionGenerator.php b/src/Generator/PluginConditionGenerator.php new file mode 100644 index 000000000..3b6fa9ad8 --- /dev/null +++ b/src/Generator/PluginConditionGenerator.php @@ -0,0 +1,66 @@ +extensionManager = $extensionManager; + } + + /** + * Generator Plugin Field Formatter. + * + * @param string $module Module name + * @param string $class_name Plugin condition Class name + * @param string $label Plugin condition label + * @param string $plugin_id Plugin condition id + * @param string $context_definition_id Plugin condition context definition id + * @param string $context_definition_label Plugin condition context definition label + * @param bool $context_definition_required Plugin condition context definition required + */ + public function generate($module, $class_name, $label, $plugin_id, $context_definition_id, $context_definition_label, $context_definition_required) + { + $parameters = [ + 'module' => $module, + 'class_name' => $class_name, + 'label' => $label, + 'plugin_id' => $plugin_id, + 'context_definition_id' => $context_definition_id, + 'context_definition_label' => $context_definition_label, + 'context_definition_required' => $context_definition_required, + 'context_id' => str_replace('entity:', '', $context_definition_id) + ]; + + $this->renderFile( + 'module/src/Plugin/Condition/condition.php.twig', + $this->extensionManager->getPluginPath($module, 'Condition') . '/' . $class_name . '.php', + $parameters + ); + } +} diff --git a/src/Generator/PluginFieldFormatterGenerator.php b/src/Generator/PluginFieldFormatterGenerator.php new file mode 100644 index 000000000..b97fee7e3 --- /dev/null +++ b/src/Generator/PluginFieldFormatterGenerator.php @@ -0,0 +1,51 @@ +extensionManager = $extensionManager; + } + + /** + * Generator Plugin Field Formatter. + * + * @param string $module Module name + * @param string $class_name Plugin Class name + * @param string $label Plugin label + * @param string $plugin_id Plugin id + * @param string $field_type Field type this formatter supports + */ + public function generate($module, $class_name, $label, $plugin_id, $field_type) + { + $parameters = [ + 'module' => $module, + 'class_name' => $class_name, + 'label' => $label, + 'plugin_id' => $plugin_id, + 'field_type' => $field_type, + ]; + + $this->renderFile( + 'module/src/Plugin/Field/FieldFormatter/fieldformatter.php.twig', + $this->extensionManager->getPluginPath($module, 'Field/FieldFormatter') . '/' . $class_name . '.php', + $parameters + ); + } +} diff --git a/src/Generator/PluginFieldTypeGenerator.php b/src/Generator/PluginFieldTypeGenerator.php new file mode 100644 index 000000000..75f832a9d --- /dev/null +++ b/src/Generator/PluginFieldTypeGenerator.php @@ -0,0 +1,55 @@ +extensionManager = $extensionManager; + } + + /** + * Generator Plugin Field Type. + * + * @param string $module Module name + * @param string $class_name Plugin Class name + * @param string $label Plugin label + * @param string $plugin_id Plugin id + * @param string $description Plugin description + * @param string $default_widget Default widget this field type used supports + * @param string $default_formatter Default formatter this field type used supports + */ + public function generate($module, $class_name, $label, $plugin_id, $description, $default_widget, $default_formatter) + { + $parameters = [ + 'module' => $module, + 'class_name' => $class_name, + 'label' => $label, + 'plugin_id' => $plugin_id, + 'description' => $description, + 'default_widget' => $default_widget, + 'default_formatter' => $default_formatter, + ]; + + $this->renderFile( + 'module/src/Plugin/Field/FieldType/fieldtype.php.twig', + $this->extensionManager->getPluginPath($module, 'Field/FieldType') . '/' . $class_name . '.php', + $parameters + ); + } +} diff --git a/src/Generator/PluginFieldWidgetGenerator.php b/src/Generator/PluginFieldWidgetGenerator.php new file mode 100644 index 000000000..3e252e296 --- /dev/null +++ b/src/Generator/PluginFieldWidgetGenerator.php @@ -0,0 +1,51 @@ +extensionManager = $extensionManager; + } + + /** + * Generator Plugin Field Formatter. + * + * @param string $module Module name + * @param string $class_name Plugin Class name + * @param string $label Plugin label + * @param string $plugin_id Plugin id + * @param string $field_type Field type this widget supports + */ + public function generate($module, $class_name, $label, $plugin_id, $field_type) + { + $parameters = [ + 'module' => $module, + 'class_name' => $class_name, + 'label' => $label, + 'plugin_id' => $plugin_id, + 'field_type' => $field_type, + ]; + + $this->renderFile( + 'module/src/Plugin/Field/FieldWidget/fieldwidget.php.twig', + $this->extensionManager->getPluginPath($module, 'Field/FieldWidget') . '/' . $class_name . '.php', + $parameters + ); + } +} diff --git a/src/Generator/PluginImageEffectGenerator.php b/src/Generator/PluginImageEffectGenerator.php new file mode 100644 index 000000000..fa56ef27b --- /dev/null +++ b/src/Generator/PluginImageEffectGenerator.php @@ -0,0 +1,51 @@ +extensionManager = $extensionManager; + } + + /** + * Generator Plugin Image Effect. + * + * @param string $module Module name + * @param string $class_name Plugin Class name + * @param string $plugin_label Plugin label + * @param string $plugin_id Plugin id + * @param string $description Plugin description + */ + public function generate($module, $class_name, $label, $plugin_id, $description) + { + $parameters = [ + 'module' => $module, + 'class_name' => $class_name, + 'label' => $label, + 'plugin_id' => $plugin_id, + 'description' => $description, + ]; + + $this->renderFile( + 'module/src/Plugin/ImageEffect/imageeffect.php.twig', + $this->extensionManager->getPluginPath($module, 'ImageEffect') .'/'.$class_name.'.php', + $parameters + ); + } +} diff --git a/src/Generator/PluginImageFormatterGenerator.php b/src/Generator/PluginImageFormatterGenerator.php new file mode 100644 index 000000000..e71e739eb --- /dev/null +++ b/src/Generator/PluginImageFormatterGenerator.php @@ -0,0 +1,50 @@ +extensionManager = $extensionManager; + } + + + /** + * Generator Plugin Image Formatter. + * + * @param string $module Module name + * @param string $class_name Plugin Class name + * @param string $label Plugin label + * @param string $plugin_id Plugin id + */ + public function generate($module, $class_name, $label, $plugin_id) + { + $parameters = [ + 'module' => $module, + 'class_name' => $class_name, + 'label' => $label, + 'plugin_id' => $plugin_id, + ]; + + $this->renderFile( + 'module/src/Plugin/Field/FieldFormatter/imageformatter.php.twig', + $this->extensionManager->getPluginPath($module, 'Field/FieldFormatter') . '/' . $class_name . '.php', + $parameters + ); + } +} diff --git a/src/Generator/PluginMailGenerator.php b/src/Generator/PluginMailGenerator.php new file mode 100644 index 000000000..0c053b5d8 --- /dev/null +++ b/src/Generator/PluginMailGenerator.php @@ -0,0 +1,51 @@ +extensionManager = $extensionManager; + } + + /** + * Generator Plugin Block. + * + * @param $module + * @param $class_name + * @param $label + * @param $plugin_id + * @param $services + */ + public function generate($module, $class_name, $label, $plugin_id, $services) + { + $parameters = [ + 'module' => $module, + 'class_name' => $class_name, + 'label' => $label, + 'plugin_id' => $plugin_id, + 'services' => $services, + ]; + + $this->renderFile( + 'module/src/Plugin/Mail/mail.php.twig', + $this->extensionManager->getPluginPath($module, 'Mail') .'/'.$class_name.'.php', + $parameters + ); + } +} diff --git a/src/Generator/PluginMigrateProcessGenerator.php b/src/Generator/PluginMigrateProcessGenerator.php new file mode 100644 index 000000000..227a5eda8 --- /dev/null +++ b/src/Generator/PluginMigrateProcessGenerator.php @@ -0,0 +1,52 @@ +extensionManager = $extensionManager; + } + + /** + * Generate Migrate Source plugin code. + * + * @param $module + * @param $class_name + * @param $plugin_id + */ + public function generate($module, $class_name, $plugin_id) + { + $parameters = [ + 'module' => $module, + 'class_name' => $class_name, + 'plugin_id' => $plugin_id, + ]; + + $this->renderFile( + 'module/src/Plugin/migrate/process/process.php.twig', + $this->extensionManager->getPluginPath($module, 'migrate').'/process/'.$class_name.'.php', + $parameters + ); + } +} diff --git a/src/Generator/PluginMigrateSourceGenerator.php b/src/Generator/PluginMigrateSourceGenerator.php new file mode 100644 index 000000000..123fab82c --- /dev/null +++ b/src/Generator/PluginMigrateSourceGenerator.php @@ -0,0 +1,60 @@ +extensionManager = $extensionManager; + } + + /** + * Generate Migrate Source plugin code. + * + * @param $module + * @param $class_name + * @param $plugin_id + * @param $table + * @param $alias + * @param $group_by + * @param fields + */ + public function generate($module, $class_name, $plugin_id, $table, $alias, $group_by, $fields) + { + $parameters = [ + 'module' => $module, + 'class_name' => $class_name, + 'plugin_id' => $plugin_id, + 'table' => $table, + 'alias' => $alias, + 'group_by' => $group_by, + 'fields' => $fields, + ]; + + $this->renderFile( + 'module/src/Plugin/migrate/source/source.php.twig', + $this->extensionManager->getPluginPath($module, 'migrate').'/source/'.$class_name.'.php', + $parameters + ); + } +} diff --git a/src/Generator/PluginRestResourceGenerator.php b/src/Generator/PluginRestResourceGenerator.php new file mode 100644 index 000000000..05518ce81 --- /dev/null +++ b/src/Generator/PluginRestResourceGenerator.php @@ -0,0 +1,59 @@ +extensionManager = $extensionManager; + } + + + /** + * Generator Plugin Block. + * + * @param $module + * @param $class_name + * @param $plugin_label + * @param $plugin_id + * @param $plugin_url + * @param $plugin_states + */ + public function generate($module, $class_name, $plugin_label, $plugin_id, $plugin_url, $plugin_states) + { + $parameters = [ + 'module_name' => $module, + 'class_name' => $class_name, + 'plugin_label' => $plugin_label, + 'plugin_id' => $plugin_id, + 'plugin_url' => $plugin_url, + 'plugin_states' => $plugin_states, + ]; + + $this->renderFile( + 'module/src/Plugin/Rest/Resource/rest.php.twig', + $this->extensionManager->getPluginPath($module, 'rest') .'/resource/'.$class_name.'.php', + $parameters + ); + } +} diff --git a/src/Generator/PluginRulesActionGenerator.php b/src/Generator/PluginRulesActionGenerator.php new file mode 100644 index 000000000..a60ee380c --- /dev/null +++ b/src/Generator/PluginRulesActionGenerator.php @@ -0,0 +1,65 @@ +extensionManager = $extensionManager; + } + + /** + * Generator Plugin RulesAction. + * + * @param $module + * @param $class_name + * @param $label + * @param $plugin_id + * @param $category + * @param $context + */ + public function generate($module, $class_name, $label, $plugin_id, $category, $context, $type) + { + $parameters = [ + 'module' => $module, + 'class_name' => $class_name, + 'label' => $label, + 'plugin_id' => $plugin_id, + 'category' => $category, + 'context' => $context, + 'type' => $type, + ]; + + $this->renderFile( + 'module/src/Plugin/Action/rulesaction.php.twig', + $this->extensionManager->getPluginPath($module, 'Action').'/'.$class_name.'.php', + $parameters + ); + + $this->renderFile( + 'module/system.action.action.yml.twig', + $this->extensionManager->getModule($module)->getPath() .'/config/install/system.action.'.$plugin_id.'.yml', + $parameters + ); + } +} diff --git a/src/Generator/PluginSkeletonGenerator.php b/src/Generator/PluginSkeletonGenerator.php new file mode 100644 index 000000000..1e80864f4 --- /dev/null +++ b/src/Generator/PluginSkeletonGenerator.php @@ -0,0 +1,61 @@ +extensionManager = $extensionManager; + } + + /** + * Generator Post Update Name function. + * + * @param $module + * @param $pluginId + * @param $plugin + * @param $className + * @param $pluginMetaData + * @param $services + */ + public function generate($module, $pluginId, $plugin, $className, $pluginMetaData, $services) + { + $module_path = $this->extensionManager->getModule($module)->getPath(); + + $parameters = [ + 'module' => $module, + 'plugin_id' => $pluginId, + 'plugin' => $plugin, + 'class_name' => $className, + 'services' => $services, + 'plugin_annotation' => array_pop(explode('\\', $pluginMetaData['pluginAnnotation'])), + 'plugin_interface' => array_pop(explode('\\', $pluginMetaData['pluginInterface'])) + ]; + + $this->renderFile( + 'module/src/Plugin/skeleton.php.twig', + $module_path .'/src/'. $pluginMetaData['subdir'] . '/' . $className .'.php', + array_merge($parameters, $pluginMetaData) + ); + } +} diff --git a/src/Generator/PluginTypeAnnotationGenerator.php b/src/Generator/PluginTypeAnnotationGenerator.php new file mode 100644 index 000000000..2a5181f17 --- /dev/null +++ b/src/Generator/PluginTypeAnnotationGenerator.php @@ -0,0 +1,85 @@ +extensionManager = $extensionManager; + } + + /** + * Generator for Plugin type with annotation discovery. + * + * @param $module + * @param $class_name + * @param $machine_name + * @param $label + */ + public function generate($module, $class_name, $machine_name, $label) + { + $parameters = [ + 'module' => $module, + 'class_name' => $class_name, + 'machine_name' => $machine_name, + 'label' => $label, + 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'), + ]; + + $directory = $this->extensionManager->getModule($module)->getSourcePath() . '/Plugin/' . $class_name; + + if (!is_dir($directory)) { + mkdir($directory, 0777, true); + } + + $this->renderFile( + 'module/src/Annotation/plugin-type.php.twig', + $this->extensionManager->getModule($module)->getSourcePath() . '/Annotation/' . $class_name . '.php', + $parameters + ); + + $this->renderFile( + 'module/src/plugin-type-annotation-base.php.twig', + $this->extensionManager->getModule($module)->getSourcePath() .'/Plugin/' . $class_name . 'Base.php', + $parameters + ); + + $this->renderFile( + 'module/src/plugin-type-annotation-interface.php.twig', + $this->extensionManager->getModule($module)->getSourcePath() .'/Plugin/' . $class_name . 'Interface.php', + $parameters + ); + + $this->renderFile( + 'module/src/plugin-type-annotation-manager.php.twig', + $this->extensionManager->getModule($module)->getSourcePath() .'/Plugin/' . $class_name . 'Manager.php', + $parameters + ); + $this->renderFile( + 'module/plugin-annotation-services.yml.twig', + $this->extensionManager->getModule($module)->getPath() . '/' . $module . '.services.yml', + $parameters, + FILE_APPEND + ); + } +} diff --git a/src/Generator/PluginTypeYamlGenerator.php b/src/Generator/PluginTypeYamlGenerator.php new file mode 100644 index 000000000..8dd2807fb --- /dev/null +++ b/src/Generator/PluginTypeYamlGenerator.php @@ -0,0 +1,74 @@ +extensionManager = $extensionManager; + } + + /** + * Generator for Plugin type with Yaml discovery. + * + * @param $module + * @param $plugin_class + * @param $plugin_name + * @param $plugin_file_name + */ + public function generate($module, $plugin_class, $plugin_name, $plugin_file_name) + { + $parameters = [ + 'module' => $module, + 'plugin_class' => $plugin_class, + 'plugin_name' => $plugin_name, + 'plugin_file_name' => $plugin_file_name, + 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() . '/' . $module . '.services.yml'), + ]; + + $this->renderFile( + 'module/src/yaml-plugin-manager.php.twig', + $this->extensionManager->getModule($module)->getSourcePath() . '/' . $plugin_class . 'Manager.php', + $parameters + ); + + $this->renderFile( + 'module/src/yaml-plugin-manager-interface.php.twig', + $this->extensionManager->getModule($module)->getSourcePath() . '/' . $plugin_class . 'ManagerInterface.php', + $parameters + ); + + $this->renderFile( + 'module/plugin-yaml-services.yml.twig', + $this->extensionManager->getModule($module)->getPath() . '/' . $module . '.services.yml', + $parameters, + FILE_APPEND + ); + + $this->renderFile( + 'module/plugin.yml.twig', + $this->extensionManager->getModule($module)->getPath() . '/' . $module . '.' . $plugin_file_name . '.yml', + $parameters + ); + } +} diff --git a/src/Generator/PluginViewsFieldGenerator.php b/src/Generator/PluginViewsFieldGenerator.php new file mode 100644 index 000000000..3d0d03681 --- /dev/null +++ b/src/Generator/PluginViewsFieldGenerator.php @@ -0,0 +1,62 @@ +extensionManager = $extensionManager; + } + + /** + * Generator Plugin Field Formatter. + * + * @param string $module Module name + * @param string $class_name Plugin Class name + * @param string $label Plugin label + * @param string $plugin_id Plugin id + * @param string $field_type Field type this formatter supports + */ + public function generate($module, $class_machine_name, $class_name, $title, $description) + { + $parameters = [ + 'module' => $module, + 'class_machine_name' => $class_machine_name, + 'class_name' => $class_name, + 'title' => $title, + 'description' => $description, + ]; + + $this->renderFile( + 'module/module.views.inc.twig', + $this->extensionManager->getModule($module)->getPath() . '/' . $module . '.views.inc', + $parameters + ); + + $this->renderFile( + 'module/src/Plugin/Views/field/field.php.twig', + $this->extensionManager->getPluginPath($module, 'views/field') . '/' . $class_name . '.php', + $parameters + ); + } +} diff --git a/src/Generator/PostUpdateGenerator.php b/src/Generator/PostUpdateGenerator.php new file mode 100644 index 000000000..c3c10db7b --- /dev/null +++ b/src/Generator/PostUpdateGenerator.php @@ -0,0 +1,54 @@ +extensionManager = $extensionManager; + } + + /** + * Generator Post Update Name function. + * + * @param $module + * @param $post_update_name + */ + public function generate($module, $post_update_name) + { + $module_path = $this->extensionManager->getModule($module)->getPath(); + + $parameters = [ + 'module' => $module, + 'post_update_name' => $post_update_name, + 'file_exists' => file_exists($module_path .'/'.$module.'.post_update.php'), + ]; + + $this->renderFile( + 'module/post-update.php.twig', + $module_path .'/'.$module.'.post_update.php', + $parameters, + FILE_APPEND + ); + } +} diff --git a/src/Generator/ProfileGenerator.php b/src/Generator/ProfileGenerator.php new file mode 100644 index 000000000..8d0857c1a --- /dev/null +++ b/src/Generator/ProfileGenerator.php @@ -0,0 +1,83 @@ + $profile, + 'machine_name' => $machine_name, + 'type' => 'profile', + 'core' => $core, + 'description' => $description, + 'dependencies' => $dependencies, + 'themes' => $themes, + 'distribution' => $distribution, + ]; + + $this->renderFile( + 'profile/info.yml.twig', + $dir . '/' . $machine_name . '.info.yml', + $parameters + ); + + $this->renderFile( + 'profile/profile.twig', + $dir . '/' . $machine_name . '.profile', + $parameters + ); + + $this->renderFile( + 'profile/install.twig', + $dir . '/' . $machine_name . '.install', + $parameters + ); + } +} diff --git a/src/Generator/RouteSubscriberGenerator.php b/src/Generator/RouteSubscriberGenerator.php new file mode 100644 index 000000000..388991f37 --- /dev/null +++ b/src/Generator/RouteSubscriberGenerator.php @@ -0,0 +1,62 @@ +extensionManager = $extensionManager; + } + + /** + * Generator Service. + * + * @param string $module Module name + * @param string $name Service name + * @param string $class Class name + */ + public function generate($module, $name, $class) + { + $parameters = [ + 'module' => $module, + 'name' => $name, + 'class' => $class, + 'class_path' => sprintf('Drupal\%s\Routing\%s', $module, $class), + 'tags' => ['name' => 'event_subscriber'], + 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'), + ]; + + $this->renderFile( + 'module/src/Routing/route-subscriber.php.twig', + $this->extensionManager->getModule($module)->getRoutingPath().'/'.$class.'.php', + $parameters + ); + + $this->renderFile( + 'module/services.yml.twig', + $this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml', + $parameters, + FILE_APPEND + ); + } +} diff --git a/src/Generator/ServiceGenerator.php b/src/Generator/ServiceGenerator.php new file mode 100644 index 000000000..855839f80 --- /dev/null +++ b/src/Generator/ServiceGenerator.php @@ -0,0 +1,102 @@ +extensionManager = $extensionManager; + } + + /** + * Generator Service. + * + * @param string $module Module name + * @param string $name Service name + * @param string $class Class name + * @param string $interface If TRUE an interface for this service is generated + * @param array $services List of services + * @param string $path_service Path of services + */ + public function generate($module, $name, $class, $interface, $interface_name, $services, $path_service) + { + $interface = $interface ? ($interface_name ?: $class . 'Interface') : false; + $parameters = [ + 'module' => $module, + 'name' => $name, + 'class' => $class, + 'class_path' => sprintf('Drupal\%s\%s', $module, $class), + 'interface' => $interface, + 'services' => $services, + 'path_service' => $path_service, + 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'), + ]; + + $this->renderFile( + 'module/services.yml.twig', + $this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml', + $parameters, + FILE_APPEND + ); + + $this->renderFile( + 'module/src/service.php.twig', + $this->setDirectory($path_service, 'service.php.twig', $module, $class), + $parameters + ); + + if ($interface) { + $this->renderFile( + 'module/src/service-interface.php.twig', + $this->setDirectory($path_service, 'interface.php.twig', $module, $interface), + $parameters + ); + } + } + + protected function setDirectory($target, $template, $module, $class) + { + $default_path = '/modules/custom/' . $module . '/src/'; + $directory = ''; + + switch ($template) { + case 'service.php.twig': + $default_target = $this->extensionManager->getModule($module)->getPath() .'/src/'.$class.'.php'; + $custom_target = $this->extensionManager->getModule($module)->getPath() .'/'.$target.'/'.$class.'.php'; + + $directory = (strcmp($target, $default_path) == 0) ? $default_target : $custom_target; + break; + case 'interface.php.twig': + $default_target = $this->extensionManager->getModule($module)->getPath() .'/src/'.$class.'.php'; + $custom_target = $this->extensionManager->getModule($module)->getPath() .'/'.$target.'/'.$class.'.php'; + + $directory = (strcmp($target, $default_path) == 0) ? $default_target : $custom_target; + break; + default: + // code... + break; + } + + return $directory; + } +} diff --git a/src/Generator/ThemeGenerator.php b/src/Generator/ThemeGenerator.php new file mode 100644 index 000000000..78342bf98 --- /dev/null +++ b/src/Generator/ThemeGenerator.php @@ -0,0 +1,118 @@ +extensionManager = $extensionManager; + } + + public function generate( + $theme, + $machine_name, + $dir, + $description, + $core, + $package, + $base_theme, + $global_library, + $libraries, + $regions, + $breakpoints + ) { + $dir .= '/' . $machine_name; + if (file_exists($dir)) { + if (!is_dir($dir)) { + throw new \RuntimeException( + sprintf( + 'Unable to generate the bundle as the target directory "%s" exists but is a file.', + realpath($dir) + ) + ); + } + $files = scandir($dir); + if ($files != ['.', '..']) { + throw new \RuntimeException( + sprintf( + 'Unable to generate the bundle as the target directory "%s" is not empty.', + realpath($dir) + ) + ); + } + if (!is_writable($dir)) { + throw new \RuntimeException( + sprintf( + 'Unable to generate the bundle as the target directory "%s" is not writable.', + realpath($dir) + ) + ); + } + } + + $parameters = [ + 'theme' => $theme, + 'machine_name' => $machine_name, + 'type' => 'theme', + 'core' => $core, + 'description' => $description, + 'package' => $package, + 'base_theme' => $base_theme, + 'global_library' => $global_library, + 'libraries' => $libraries, + 'regions' => $regions, + 'breakpoints' => $breakpoints, + ]; + + $this->renderFile( + 'theme/info.yml.twig', + $dir . '/' . $machine_name . '.info.yml', + $parameters + ); + + $this->renderFile( + 'theme/theme.twig', + $dir . '/' . $machine_name . '.theme', + $parameters + ); + + if ($libraries) { + $this->renderFile( + 'theme/libraries.yml.twig', + $dir . '/' . $machine_name . '.libraries.yml', + $parameters + ); + } + + if ($breakpoints) { + $this->renderFile( + 'theme/breakpoints.yml.twig', + $dir . '/' . $machine_name . '.breakpoints.yml', + $parameters + ); + } + } +} diff --git a/src/Generator/TwigExtensionGenerator.php b/src/Generator/TwigExtensionGenerator.php new file mode 100644 index 000000000..91c522023 --- /dev/null +++ b/src/Generator/TwigExtensionGenerator.php @@ -0,0 +1,69 @@ +extensionManager = $extensionManager; + } + + /** + * Generator Service. + * + * @param string $module Module name + * @param string $name Service name + * @param string $class Class name + * @param array $services List of services + */ + public function generate($module, $name, $class, $services) + { + $parameters = [ + 'module' => $module, + 'name' => $name, + 'class' => $class, + 'class_path' => sprintf('Drupal\%s\TwigExtension\%s', $module, $class), + 'services' => $services, + 'tags' => ['name' => 'twig.extension'], + 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'), + ]; + + $this->renderFile( + 'module/services.yml.twig', + $this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml', + $parameters, + FILE_APPEND + ); + + $this->renderFile( + 'module/src/TwigExtension/twig-extension.php.twig', + $this->extensionManager->getModule($module)->getPath() .'/src/TwigExtension/'.$class.'.php', + $parameters + ); + } +} diff --git a/src/Generator/UpdateGenerator.php b/src/Generator/UpdateGenerator.php new file mode 100644 index 000000000..55180668d --- /dev/null +++ b/src/Generator/UpdateGenerator.php @@ -0,0 +1,55 @@ +extensionManager = $extensionManager; + } + + /** + * Generator Update N function. + * + * @param $module + * @param $update_number + */ + public function generate($module, $update_number) + { + $modulePath = $this->extensionManager->getModule($module)->getPath(); + $updateFile = $modulePath .'/'.$module.'.install'; + + $parameters = [ + 'module' => $module, + 'update_number' => $update_number, + 'file_exists' => file_exists($updateFile) + ]; + + $this->renderFile( + 'module/update.php.twig', + $updateFile, + $parameters, + FILE_APPEND + ); + } +} From dc4e15096f2cb3de6ad372777cf23b7cac5b78b7 Mon Sep 17 00:00:00 2001 From: acidaniel Date: Thu, 13 Jul 2017 10:10:51 -0500 Subject: [PATCH 296/321] Adding Aliases for Generate Commands. (#3431) --- src/Command/Generate/BreakPointCommand.php | 2 +- src/Command/Generate/CacheContextCommand.php | 2 +- src/Command/Generate/CommandCommand.php | 2 +- src/Command/Generate/ControllerCommand.php | 2 +- src/Command/Generate/EntityConfigCommand.php | 2 +- src/Command/Generate/EntityContentCommand.php | 2 +- src/Command/Generate/FormCommand.php | 2 +- src/Command/Generate/HelpCommand.php | 2 +- src/Command/Generate/ModuleFileCommand.php | 2 +- src/Command/Generate/PluginCKEditorButtonCommand.php | 2 +- src/Command/Generate/PluginConditionCommand.php | 2 +- src/Command/Generate/PluginMailCommand.php | 2 +- src/Command/Generate/PluginMigrateProcessCommand.php | 2 +- src/Command/Generate/PluginMigrateSourceCommand.php | 2 +- src/Command/Generate/PluginSkeletonCommand.php | 2 +- src/Command/Generate/PostUpdateCommand.php | 2 +- src/Command/Generate/ProfileCommand.php | 2 +- src/Command/Generate/RouteSubscriberCommand.php | 2 +- src/Command/Generate/TwigExtensionCommand.php | 2 +- src/Command/Generate/UpdateCommand.php | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Command/Generate/BreakPointCommand.php b/src/Command/Generate/BreakPointCommand.php index bb53df8ef..dcce46b0f 100644 --- a/src/Command/Generate/BreakPointCommand.php +++ b/src/Command/Generate/BreakPointCommand.php @@ -106,7 +106,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.breakpoint.options.breakpoints') - ); + )->setAliases(['gb']); } /** diff --git a/src/Command/Generate/CacheContextCommand.php b/src/Command/Generate/CacheContextCommand.php index 5ca9c0137..868b77690 100644 --- a/src/Command/Generate/CacheContextCommand.php +++ b/src/Command/Generate/CacheContextCommand.php @@ -100,7 +100,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.common.options.services') - ); + )->setAliases(['gcc']); } /** diff --git a/src/Command/Generate/CommandCommand.php b/src/Command/Generate/CommandCommand.php index 3b1901329..9417653e5 100644 --- a/src/Command/Generate/CommandCommand.php +++ b/src/Command/Generate/CommandCommand.php @@ -125,7 +125,7 @@ protected function configure() InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.common.options.services') ) - ->setAliases(['gcm']); + ->setAliases(['gco']); } /** diff --git a/src/Command/Generate/ControllerCommand.php b/src/Command/Generate/ControllerCommand.php index 0a0a08f14..923f91519 100644 --- a/src/Command/Generate/ControllerCommand.php +++ b/src/Command/Generate/ControllerCommand.php @@ -125,7 +125,7 @@ protected function configure() InputOption::VALUE_NONE, $this->trans('commands.generate.controller.options.test') ) - ->setAliases(['gcn']); + ->setAliases(['gcon']); } /** diff --git a/src/Command/Generate/EntityConfigCommand.php b/src/Command/Generate/EntityConfigCommand.php index 0f77e100a..c6a2b2eed 100644 --- a/src/Command/Generate/EntityConfigCommand.php +++ b/src/Command/Generate/EntityConfigCommand.php @@ -71,7 +71,7 @@ protected function configure() InputOption::VALUE_NONE, $this->trans('commands.generate.entity.config.options.bundle-of') ) - ->setAliases(['gecg']); + ->setAliases(['gec']); } /** diff --git a/src/Command/Generate/EntityContentCommand.php b/src/Command/Generate/EntityContentCommand.php index b664450e2..9b5e65b79 100644 --- a/src/Command/Generate/EntityContentCommand.php +++ b/src/Command/Generate/EntityContentCommand.php @@ -98,7 +98,7 @@ protected function configure() InputOption::VALUE_NONE, $this->trans('commands.generate.entity.content.options.revisionable') ) - ->setAliases(['gect']); + ->setAliases(['geco']); } /** diff --git a/src/Command/Generate/FormCommand.php b/src/Command/Generate/FormCommand.php index 6b84175c8..1eec424d5 100644 --- a/src/Command/Generate/FormCommand.php +++ b/src/Command/Generate/FormCommand.php @@ -185,7 +185,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.form.options.menu-link-desc') - ); + )->setAliases(['gf']); } /** diff --git a/src/Command/Generate/HelpCommand.php b/src/Command/Generate/HelpCommand.php index 678ce7143..bff5a1206 100644 --- a/src/Command/Generate/HelpCommand.php +++ b/src/Command/Generate/HelpCommand.php @@ -85,7 +85,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.module.options.description') - ); + )->setAliases(['gh']); } /** diff --git a/src/Command/Generate/ModuleFileCommand.php b/src/Command/Generate/ModuleFileCommand.php index e28c8ac33..8d8eca01d 100644 --- a/src/Command/Generate/ModuleFileCommand.php +++ b/src/Command/Generate/ModuleFileCommand.php @@ -69,7 +69,7 @@ protected function configure() null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module') - ); + )->setAliases(['gmf']); } /** diff --git a/src/Command/Generate/PluginCKEditorButtonCommand.php b/src/Command/Generate/PluginCKEditorButtonCommand.php index 2152dbeac..f73f9bda8 100644 --- a/src/Command/Generate/PluginCKEditorButtonCommand.php +++ b/src/Command/Generate/PluginCKEditorButtonCommand.php @@ -111,7 +111,7 @@ protected function configure() null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.plugin.ckeditorbutton.options.button-icon-path') - ); + )->setAliases(['gpc']); } /** diff --git a/src/Command/Generate/PluginConditionCommand.php b/src/Command/Generate/PluginConditionCommand.php index 24bc6da17..20d44a924 100644 --- a/src/Command/Generate/PluginConditionCommand.php +++ b/src/Command/Generate/PluginConditionCommand.php @@ -120,7 +120,7 @@ protected function configure() InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.condition.options.context-definition-required') ) - ->setAliases(['gpc']); + ->setAliases(['gpco']); } /** diff --git a/src/Command/Generate/PluginMailCommand.php b/src/Command/Generate/PluginMailCommand.php index 48a47d0d6..e461ea85a 100644 --- a/src/Command/Generate/PluginMailCommand.php +++ b/src/Command/Generate/PluginMailCommand.php @@ -116,7 +116,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.common.options.services') - ); + )->setAliases(['gpm']); } /** diff --git a/src/Command/Generate/PluginMigrateProcessCommand.php b/src/Command/Generate/PluginMigrateProcessCommand.php index 20ba70a60..cf705508c 100644 --- a/src/Command/Generate/PluginMigrateProcessCommand.php +++ b/src/Command/Generate/PluginMigrateProcessCommand.php @@ -85,7 +85,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.plugin.migrate.process.options.plugin-id') - ); + )->setAliases(['gpmp']); } /** diff --git a/src/Command/Generate/PluginMigrateSourceCommand.php b/src/Command/Generate/PluginMigrateSourceCommand.php index 5de03cccf..603b0679c 100644 --- a/src/Command/Generate/PluginMigrateSourceCommand.php +++ b/src/Command/Generate/PluginMigrateSourceCommand.php @@ -145,7 +145,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.generate.plugin.migrate.source.options.fields') - ); + )->setAliases(['gpms']); } /** diff --git a/src/Command/Generate/PluginSkeletonCommand.php b/src/Command/Generate/PluginSkeletonCommand.php index f1fb5ee18..01a3dfa00 100644 --- a/src/Command/Generate/PluginSkeletonCommand.php +++ b/src/Command/Generate/PluginSkeletonCommand.php @@ -124,7 +124,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL| InputOption::VALUE_IS_ARRAY, $this->trans('commands.common.options.services') - ); + )->setAliases(['gps']); } /** diff --git a/src/Command/Generate/PostUpdateCommand.php b/src/Command/Generate/PostUpdateCommand.php index 180a70c0d..0cad7f377 100644 --- a/src/Command/Generate/PostUpdateCommand.php +++ b/src/Command/Generate/PostUpdateCommand.php @@ -98,7 +98,7 @@ protected function configure() null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.post.update.options.post-update-name') - ); + )->setAliases(['gpu']); } /** diff --git a/src/Command/Generate/ProfileCommand.php b/src/Command/Generate/ProfileCommand.php index 5dfbe1509..5225379e0 100644 --- a/src/Command/Generate/ProfileCommand.php +++ b/src/Command/Generate/ProfileCommand.php @@ -126,7 +126,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL, $this->trans('commands.generate.profile.options.distribution') - ); + )->setAliases(['gpr']); } /** diff --git a/src/Command/Generate/RouteSubscriberCommand.php b/src/Command/Generate/RouteSubscriberCommand.php index 1085ea469..acc64fdd9 100644 --- a/src/Command/Generate/RouteSubscriberCommand.php +++ b/src/Command/Generate/RouteSubscriberCommand.php @@ -89,7 +89,7 @@ protected function configure() null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.routesubscriber.options.class') - ); + )->setAliases(['gr']); } /** diff --git a/src/Command/Generate/TwigExtensionCommand.php b/src/Command/Generate/TwigExtensionCommand.php index 182f408b8..a4f6a72d4 100644 --- a/src/Command/Generate/TwigExtensionCommand.php +++ b/src/Command/Generate/TwigExtensionCommand.php @@ -114,7 +114,7 @@ protected function configure() null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $this->trans('commands.common.options.services') - ); + )->setAliases(['gte']); } /** diff --git a/src/Command/Generate/UpdateCommand.php b/src/Command/Generate/UpdateCommand.php index 923970a7e..257845522 100644 --- a/src/Command/Generate/UpdateCommand.php +++ b/src/Command/Generate/UpdateCommand.php @@ -90,7 +90,7 @@ protected function configure() null, InputOption::VALUE_REQUIRED, $this->trans('commands.generate.update.options.update-n') - ); + )->setAliases(['gu']); } /** From 073e928e7b1ce848923ae35ee558cdbd8afce694 Mon Sep 17 00:00:00 2001 From: Christoph Burschka Date: Thu, 13 Jul 2017 20:02:24 +0200 Subject: [PATCH 297/321] Allow removing modules installed by profile. (#3407) (#1916) --- src/Command/Module/UninstallCommand.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Command/Module/UninstallCommand.php b/src/Command/Module/UninstallCommand.php index f73500ebe..114c1ee3d 100755 --- a/src/Command/Module/UninstallCommand.php +++ b/src/Command/Module/UninstallCommand.php @@ -172,6 +172,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } if (!$force = $input->getOption('force')) { + $profile = drupal_get_profile(); $dependencies = []; while (list($module) = each($moduleList)) { foreach (array_keys($moduleData[$module]->required_by) as $dependency) { From a2cbcc09760efcd7d50127a40d49485dae6dc148 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 13 Jul 2017 11:16:41 -0700 Subject: [PATCH 298/321] [console] Add missing alias. (#3433) --- src/Command/Debug/StateCommand.php | 5 +++-- src/Command/Module/UpdateCommand.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Command/Debug/StateCommand.php b/src/Command/Debug/StateCommand.php index d4ccd2663..60c06b745 100644 --- a/src/Command/Debug/StateCommand.php +++ b/src/Command/Debug/StateCommand.php @@ -59,12 +59,13 @@ protected function configure() $this ->setName('debug:state') ->setDescription($this->trans('commands.debug.state.description')) - ->setHelp($this->trans('commands.debug.state.help')) ->addArgument( 'key', InputArgument::OPTIONAL, $this->trans('commands.debug.state.arguments.key') - ); + ) + ->setHelp($this->trans('commands.debug.state.help')) + ->setAliases(['dst']); } /** diff --git a/src/Command/Module/UpdateCommand.php b/src/Command/Module/UpdateCommand.php index 349c51417..db251277c 100644 --- a/src/Command/Module/UpdateCommand.php +++ b/src/Command/Module/UpdateCommand.php @@ -68,7 +68,7 @@ protected function configure() null, InputOption::VALUE_NONE, $this->trans('commands.module.update.options.simulate') - )->setAliases(['mou']); + )->setAliases(['moup']); } /** From a3ce128db3cd5f177bf9594c591e644b9801418b Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 13 Jul 2017 17:37:27 -0700 Subject: [PATCH 299/321] [console] Remove console-develop templates. (#3434) --- templates/dash/generate-doc.html.twig | 56 ------- templates/dash/index.html.twig | 153 ------------------ .../gitbook/available-commands-list.md.twig | 14 -- templates/gitbook/available-commands.md.twig | 32 ---- templates/gitbook/command.md.twig | 39 ----- 5 files changed, 294 deletions(-) delete mode 100644 templates/dash/generate-doc.html.twig delete mode 100644 templates/dash/index.html.twig delete mode 100644 templates/gitbook/available-commands-list.md.twig delete mode 100644 templates/gitbook/available-commands.md.twig delete mode 100644 templates/gitbook/command.md.twig diff --git a/templates/dash/generate-doc.html.twig b/templates/dash/generate-doc.html.twig deleted file mode 100644 index 196bbc715..000000000 --- a/templates/dash/generate-doc.html.twig +++ /dev/null @@ -1,56 +0,0 @@ - - - - - {% block title %}{{ command }}{% endblock %} - - - -

{{ command }}

-

The {{ command }} command: {{ description }}

-

Usage: -

-        $ drupal {{ command }} {% if arguments|length>0 %}[arguments] {% endif %}{% if options|length>0 %}[options] {% endif %}
-    
-

-{% if options|length>0 %} -

Available options

- - - - - - - - - {% for option in options %} - - - - - {% endfor %} - -
OptionDetails
{{ option.name }}{{ option.description }}
-{% endif %} - -{% if arguments|length>0 %} -

Available arguments

- - - - - - - - - {% for argument in arguments %} - - - - - {% endfor %} - -
ArgumentDetails
{{ argument.name }}{{ argument.description }}
-{% endif %} - - diff --git a/templates/dash/index.html.twig b/templates/dash/index.html.twig deleted file mode 100644 index 83428bd03..000000000 --- a/templates/dash/index.html.twig +++ /dev/null @@ -1,153 +0,0 @@ - - - - - Drupal Console - - - -

Drupal Console

- -

Getting the project

- -

There are different ways to get the project on your local machine. Our recommendation for getting the project on your - local machine is by using the installer.

- -

Using the Drupal Console Installer

- -

You can install the Drupal Console locally by running the installer in your project - directory, the installer will take care of downloading the necesary files to run drupal console on you computer. -

-

Using curl:

-
$ curl https://drupalconsole.com/installer -L -o drupal.phar
-    
-

Or if you don't have curl:

-
php -r "readfile('https://drupalconsole.com/installer');" > drupal.phar
-    
-

Example:

-
$ php console.phar generate:module
-    
-

You can place this file anywhere you wish. If you put it in your PATH, you can access it - globally. On unixy systems you can even make it executable and invoke it without php. -

-

Access console from anywhere on your system

-
$ mv console.phar /usr/local/bin/drupal
-    
-

Apply executable permissions on the downloaded file:

-
$ chmod +x /usr/local/bin/drupal
-    
-

You can now execute console using:

-
$ drupal
-    
-

NOTE: The name drupal is just an alias you can name it - anything you like. -

- -

Install Drupal Console Using Composer

- -

You can install this project using composer. - -

-
+
-
-

-

Install Drupal Console globally using composer:

-
$ composer global require drupal/console:@stable
-    
-

Add the binary directory to your class path:

-
$ echo "PATH=$PATH:~/.composer/vendor/bin" >> ~/.bash_profile
-    
-

You can now execute console using:

-
$ console generate:module
-    
-

Download phar file

- -

You can download the latest version of Console from the repository releases page at:

- -

https://github.com/hechoendrupal/DrupalConsole -

- -

Make sure you download the console.phar file from the most current release.

- -

Update project

- -

Drupal 8 is under heavy development, to keep in sync with the latest changes. The easiest and recommended way of - updating Drupal Console is using the self-update command. -

-

Depending on the installation method:

-
Installed globally (and renamed to "drupal"):
-
$ drupal self-update
-    
-
Installed globally (using composer):
-
$ composer global update drupal/console:@stable
-    
-
Installed locally (running - from directory where the console.phar has been downloaded):
-
$ php console.phar self-update
-    
-

Available Drupal Console Commands

-

Note: Drupal Console commands *must* be run from the root of a Drupal 8 installation.

- - - - - - - - - {% for namespace, commands in command_list %} - {% if namespace != 'none' %} - - - - - {% endif %} - {% for command in commands %} - - - - - {% endfor %} - {% endfor %} - -
Drupal Console CommandDetails
{{ namespace }}
{{ command.name }}{{ command.description }}
-{% if options|length>0 %} -

Available options

- - - - - - - - - {% for option in options %} - - - - - {% endfor %} - -
OptionDetails
{{ option.name }}{{ option.description }}
-{% endif %} -{% if arguments|length>0 %} -

Available arguments

- - - - - - - - - {% for argument in arguments %} - - - - - {% endfor %} - -
ArgumentDetails
{{ argument.name }}{{ argument.description }}
-{% endif %} - - diff --git a/templates/gitbook/available-commands-list.md.twig b/templates/gitbook/available-commands-list.md.twig deleted file mode 100644 index 3343a19aa..000000000 --- a/templates/gitbook/available-commands-list.md.twig +++ /dev/null @@ -1,14 +0,0 @@ -{% for namespace in application.namespaces %} -{% if not loop.first %} -{% set last_namespace = namespace %} -{% endif %} -{% if last_namespace is defined %} - - {# Empty new line hack #} -{% endif %} -{% spaceless %} -{% for command in commands[namespace] %} - * [{{ command.name }}](commands/{{ command.name|replace(':','-') }}.md) -{% endfor %} -{% endspaceless %} -{% endfor %} diff --git a/templates/gitbook/available-commands.md.twig b/templates/gitbook/available-commands.md.twig deleted file mode 100644 index a9791ba6b..000000000 --- a/templates/gitbook/available-commands.md.twig +++ /dev/null @@ -1,32 +0,0 @@ -# {{ application.messages.title }} - -**{{ application.messages.note }}:** {{ application.messages.note_description }}. - -{{ application.messages.command }} | {{ application.messages.details }} ------------- | ------------- -{% for namespace in application.namespaces %} -{% if namespace != 'none' %} -**{{ namespace }}** | -{% endif %} -{% for command in commands[namespace] %} -[{{ command.name }}]({{ command.name|replace(':','-') }}.md) | {{ command.description }} -{% endfor %} -{% endfor %} -{% if application.options|length>0 %} - -## {{ application.messages.options }} -{{ application.messages.option }} | {{ application.messages.details }} --------|------------- -{% for option in application.options %} ---{{ option.name }} | {{ option.description }} -{% endfor %} -{% endif %} -{% if application.arguments|length>0 %} - -## {{ application.messages.arguments }} -{{ application.messages.argument }} | {{ application.messages.details }} ----------|------------- -{% for argument in application.arguments %} -{{ argument.name }} | {{ argument.description }} -{% endfor %} -{% endif %} diff --git a/templates/gitbook/command.md.twig b/templates/gitbook/command.md.twig deleted file mode 100644 index df02d0900..000000000 --- a/templates/gitbook/command.md.twig +++ /dev/null @@ -1,39 +0,0 @@ -# {{ name }} -{{ description }} - -**{{ messages.usage }}:** -``` -$ drupal {{ name }}{% if arguments|length>0 %} [arguments]{% endif %}{% if options|length>0 %} [options]{% endif %} - -{% for alias in aliases %} -$ {{ alias }} -{% endfor %} -``` -{% if options|length>0 %} - -## {{ messages.options }} -{{ messages.option }} | {{ messages.details }} --------|------------- -{% for option in options %} ---{{ option.name }} | {{ option.description }} -{% endfor %} -{% endif %} -{% if arguments|length>0 %} - -## {{ messages.arguments }} -{{ messages.argument }} | {{ messages.details }} ----------|------------- -{% for argument in arguments %} -{{ argument.name }} | {{ argument.description }} -{% endfor %} -{% endif %} -{% if examples|length>0 %} - -## {{ messages.examples }} -{% for example in examples %} -* {{ example.description }} -``` -$ {{ example.execution }} -``` -{% endfor %} -{% endif %} From 528acbcf7d274acd2759f6e0729f77799bcc5c7a Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Thu, 13 Jul 2017 19:45:20 -0700 Subject: [PATCH 300/321] [console] Add gitbook translations. (#3435) --- src/Application.php | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Application.php b/src/Application.php index af5e13c7c..e51326b54 100644 --- a/src/Application.php +++ b/src/Application.php @@ -296,16 +296,16 @@ public function getData() 'arguments' => $arguments, 'languages' => $languages, 'messages' => [ - 'title' => $this->trans('commands.generate.doc.gitbook.messages.title'), - 'note' => $this->trans('commands.generate.doc.gitbook.messages.note'), - 'note_description' => $this->trans('commands.generate.doc.gitbook.messages.note-description'), - 'command' => $this->trans('commands.generate.doc.gitbook.messages.command'), - 'options' => $this->trans('commands.generate.doc.gitbook.messages.options'), - 'option' => $this->trans('commands.generate.doc.gitbook.messages.option'), - 'details' => $this->trans('commands.generate.doc.gitbook.messages.details'), - 'arguments' => $this->trans('commands.generate.doc.gitbook.messages.arguments'), - 'argument' => $this->trans('commands.generate.doc.gitbook.messages.argument'), - 'examples' => $this->trans('commands.generate.doc.gitbook.messages.examples') + 'title' => $this->trans('application.gitbook.messages.title'), + 'note' => $this->trans('application.gitbook.messages.note'), + 'note_description' => $this->trans('application.gitbook.messages.note-description'), + 'command' => $this->trans('application.gitbook.messages.command'), + 'options' => $this->trans('application.gitbook.messages.options'), + 'option' => $this->trans('application.gitbook.messages.option'), + 'details' => $this->trans('application.gitbook.messages.details'), + 'arguments' => $this->trans('application.gitbook.messages.arguments'), + 'argument' => $this->trans('application.gitbook.messages.argument'), + 'examples' => $this->trans('application.gitbook.messages.examples') ], 'examples' => [] ]; @@ -373,13 +373,13 @@ private function commandData($commandName) 'key' => $commandKey, 'dashed' => str_replace(':', '-', $command->getName()), 'messages' => [ - 'usage' => $this->trans('commands.generate.doc.gitbook.messages.usage'), - 'options' => $this->trans('commands.generate.doc.gitbook.messages.options'), - 'option' => $this->trans('commands.generate.doc.gitbook.messages.option'), - 'details' => $this->trans('commands.generate.doc.gitbook.messages.details'), - 'arguments' => $this->trans('commands.generate.doc.gitbook.messages.arguments'), - 'argument' => $this->trans('commands.generate.doc.gitbook.messages.argument'), - 'examples' => $this->trans('commands.generate.doc.gitbook.messages.examples') + 'usage' => $this->trans('application.gitbook.messages.usage'), + 'options' => $this->trans('application.gitbook.messages.options'), + 'option' => $this->trans('application.gitbook.messages.option'), + 'details' => $this->trans('application.gitbook.messages.details'), + 'arguments' => $this->trans('application.gitbook.messages.arguments'), + 'argument' => $this->trans('application.gitbook.messages.argument'), + 'examples' => $this->trans('application.gitbook.messages.examples') ], ]; From 72ed29dcfb14a13554f3c81cd88bae9bf1c5b6cb Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Fri, 14 Jul 2017 02:18:06 -0700 Subject: [PATCH 301/321] [console] Tag 1.0.0-rc24 release. (#3436) --- composer.json | 2 +- composer.lock | 36 ++++++++++++++++++------------------ src/Application.php | 2 +- src/Extension/Manager.php | 4 ++-- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/composer.json b/composer.json index c825cee0c..060df0e83 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,7 @@ "composer/installers": "~1.0", "doctrine/annotations": "1.2.*", "doctrine/collections": "1.3.*", - "drupal/console-core": "1.0.0-rc23", + "drupal/console-core": "1.0.0-rc24", "drupal/console-dotenv": "~0", "drupal/console-extend-plugin": "~0", "gabordemooij/redbean": "~4.3", diff --git a/composer.lock b/composer.lock index a43f3a4fc..2e920bcb1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "b5375a537301f3ae536a38eb17ace817", + "content-hash": "3910e9a712bccd196d2cf68eec646412", "packages": [ { "name": "alchemy/zippy", @@ -186,16 +186,16 @@ }, { "name": "dflydev/dot-access-configuration", - "version": "v1.0.1", + "version": "v1.0.2", "source": { "type": "git", "url": "https://github.com/dflydev/dflydev-dot-access-configuration.git", - "reference": "9b65c83159c9003e00284ea1144ad96b69d9c8b9" + "reference": "ae6e7138b1d9063d343322cca63994ee1ac5161d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-configuration/zipball/9b65c83159c9003e00284ea1144ad96b69d9c8b9", - "reference": "9b65c83159c9003e00284ea1144ad96b69d9c8b9", + "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-configuration/zipball/ae6e7138b1d9063d343322cca63994ee1ac5161d", + "reference": "ae6e7138b1d9063d343322cca63994ee1ac5161d", "shasum": "" }, "require": { @@ -242,7 +242,7 @@ "config", "configuration" ], - "time": "2014-11-14T03:26:12+00:00" + "time": "2016-12-12T17:43:40+00:00" }, { "name": "dflydev/dot-access-data", @@ -578,21 +578,21 @@ }, { "name": "drupal/console-core", - "version": "1.0.0-rc23", + "version": "1.0.0-rc24", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "b1f3680ae19a4d00f8b701b060521bab2cccd6b1" + "reference": "dcf0f04a97a72b23596398a4ed9daa22a8dd5bd0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/b1f3680ae19a4d00f8b701b060521bab2cccd6b1", - "reference": "b1f3680ae19a4d00f8b701b060521bab2cccd6b1", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/dcf0f04a97a72b23596398a4ed9daa22a8dd5bd0", + "reference": "dcf0f04a97a72b23596398a4ed9daa22a8dd5bd0", "shasum": "" }, "require": { - "dflydev/dot-access-configuration": "1.0.1", - "drupal/console-en": "1.0.0-rc23", + "dflydev/dot-access-configuration": "^1.0", + "drupal/console-en": "1.0.0-rc24", "php": "^5.5.9 || ^7.0", "stecman/symfony-console-completion": "~0.7", "symfony/config": "~2.8", @@ -655,7 +655,7 @@ "drupal", "symfony" ], - "time": "2017-06-27T09:16:56+00:00" + "time": "2017-07-14T08:51:18+00:00" }, { "name": "drupal/console-dotenv", @@ -698,16 +698,16 @@ }, { "name": "drupal/console-en", - "version": "1.0.0-rc23", + "version": "1.0.0-rc24", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", - "reference": "e2461a8cf8bb29aacae0cf0f8a0a2c8d36ed4220" + "reference": "3235d0e3fd30e73b55585d746e7ba8dc39ca9281" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/e2461a8cf8bb29aacae0cf0f8a0a2c8d36ed4220", - "reference": "e2461a8cf8bb29aacae0cf0f8a0a2c8d36ed4220", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/3235d0e3fd30e73b55585d746e7ba8dc39ca9281", + "reference": "3235d0e3fd30e73b55585d746e7ba8dc39ca9281", "shasum": "" }, "type": "drupal-console-language", @@ -748,7 +748,7 @@ "drupal", "symfony" ], - "time": "2017-06-22T19:05:23+00:00" + "time": "2017-07-14T02:44:41+00:00" }, { "name": "drupal/console-extend-plugin", diff --git a/src/Application.php b/src/Application.php index e51326b54..93659b1d6 100644 --- a/src/Application.php +++ b/src/Application.php @@ -25,7 +25,7 @@ class Application extends BaseApplication /** * @var string */ - const VERSION = '1.0.0-rc23'; + const VERSION = '1.0.0-rc24'; public function __construct(ContainerInterface $container) { diff --git a/src/Extension/Manager.php b/src/Extension/Manager.php index b0798f965..3c82b78c8 100644 --- a/src/Extension/Manager.php +++ b/src/Extension/Manager.php @@ -98,10 +98,10 @@ public function showNoCore() } /** - * @param string $nameOnly + * @param boolean $nameOnly * @return array */ - public function getList($nameOnly) + public function getList($nameOnly = false) { return $this->getExtensions($this->extension, $nameOnly); } From 65983cb1a8d116db14fb9eb2e81c65e3f4a1c2ca Mon Sep 17 00:00:00 2001 From: Blas Date: Fri, 14 Jul 2017 11:56:59 -0500 Subject: [PATCH 302/321] Adding translation messages for commands (#3437) * Replacing in translation key from _ to - * Adding translation messages for the commands: config module:install taxonomy:term:delete --- src/Command/Config/ImportCommand.php | 2 +- src/Command/Config/ImportSingleCommand.php | 4 ++-- src/Command/Module/InstallCommand.php | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Command/Config/ImportCommand.php b/src/Command/Config/ImportCommand.php index b0f690cff..08a76de87 100644 --- a/src/Command/Config/ImportCommand.php +++ b/src/Command/Config/ImportCommand.php @@ -131,7 +131,7 @@ private function configImport(DrupalStyle $io, StorageComparer $storage_comparer $config_importer->import(); return true; } catch (ConfigImporterException $e) { - $message = 'The import failed due to the following reasons:' . "\n"; + $message = $this->trans('commands.config.import.messages.import-fail') . "\n"; $message .= implode("\n", $config_importer->getErrors()); $io->error( sprintf( diff --git a/src/Command/Config/ImportSingleCommand.php b/src/Command/Config/ImportSingleCommand.php index 5d26583b9..013314ec5 100644 --- a/src/Command/Config/ImportSingleCommand.php +++ b/src/Command/Config/ImportSingleCommand.php @@ -83,7 +83,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $directory = $input->getOption('directory'); if (!$file) { - $io->error('File option is missing.'); + $io->error($this->trans('commands.config.import.single..message.missing-file')); return 1; } @@ -172,7 +172,7 @@ private function configImport($io, StorageComparer $storageComparer) return true; } } catch (ConfigImporterException $e) { - $message = 'The import failed due to the following reasons:' . "\n"; + $message = $this->trans('commands.config.import.messages.import-fail') . "\n"; $message .= implode("\n", $configImporter->getErrors()); $io->error( sprintf( diff --git a/src/Command/Module/InstallCommand.php b/src/Command/Module/InstallCommand.php index 8373d8c1b..3d08bf13a 100644 --- a/src/Command/Module/InstallCommand.php +++ b/src/Command/Module/InstallCommand.php @@ -175,14 +175,14 @@ protected function execute(InputInterface $input, OutputInterface $output) if ($process->isSuccessful()) { $io->info( sprintf( - 'Module %s was downloaded with Composer.', + $this->trans('commands.module.install.messages.download-with-composer'), $moduleItem ) ); } else { $io->error( sprintf( - 'Module %s seems not to be installed with Composer. Halting.', + $this->trans('commands.module.install.messages.not-installed-with-composer'), $moduleItem ) ); @@ -202,7 +202,7 @@ protected function execute(InputInterface $input, OutputInterface $output) unset($module[array_search($invalidModule, $module)]); $io->error( sprintf( - 'Invalid module name: %s', + $this->trans('commands.module.install.messages.invalid-name'), $invalidModule ) ); From 14da01ae20be45cbd8aa2ecd26f654f7a9e3ac1a Mon Sep 17 00:00:00 2001 From: Chris Rockwell Date: Sat, 15 Jul 2017 14:48:25 -0400 Subject: [PATCH 303/321] Fix space in `__con struct` (#3439) * EntityContentGenearator should store *.page.inc in module root directory, not /src * Remove extraneous space in 'con struct' causing errors with generated templates' --- templates/module/src/Plugin/skeleton.php.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/module/src/Plugin/skeleton.php.twig b/templates/module/src/Plugin/skeleton.php.twig index ccf2caf2f..5bce614ab 100644 --- a/templates/module/src/Plugin/skeleton.php.twig +++ b/templates/module/src/Plugin/skeleton.php.twig @@ -54,7 +54,7 @@ class {{class_name}} implements {% if plugin_interface is not empty %} {{ plugin $plugin_definition, {{ servicesAsParameters(services)|join(', \n\t') }} ) { - parent::__cons truct($configuration, $plugin_id, $plugin_definition); + parent::__construct($configuration, $plugin_id, $plugin_definition); {{ serviceClassInitialization(services) }} } {% endif %} From c491624f393501b8a55bdfa62c6deec263c796c5 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 16 Jul 2017 03:58:06 -0700 Subject: [PATCH 304/321] [console] Add contribute links. (#3441) --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b1acb6be2..f94f86818 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Using the DrupalConsole Launcher drupal ``` -We highly recommend you to install the global executable, but if is not installed, then you can run DrupalConsole by: +We highly recommend you to install the global executable, but if is not installed, you can run Drupal Console depending on your installation by executing: ``` vendor/bin/drupal @@ -65,9 +65,9 @@ bin/drupal ## Drupal Console Support You can ask for support at Drupal Console gitter chat room [http://bit.ly/console-support](http://bit.ly/console-support). -## Getting The Project To Contribute - -For information about how to run this project for development follow instructions at [setup instructions](https://gist.github.com/jmolivas/97bbd07f328217be3564a434c5bd2618). +## Contribute to Drupal Console +* [Getting the project](https://docs.drupalconsole.com/en/contributing/getting-the-project.html) +* [Running the project](https://docs.drupalconsole.com/en/contributing/running-the-project.html) ## Enabling Autocomplete ``` From 118b2ada717933d9de15b923953cc3ed1cd86532 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 16 Jul 2017 11:59:49 -0700 Subject: [PATCH 305/321] [console] Remove lazy service definition. (#3442) --- bin/drupal.php | 1 + config/services/cache.yml | 1 - config/services/config.yml | 11 --------- config/services/create.yml | 5 ----- config/services/cron.yml | 2 -- config/services/database.yml | 9 -------- config/services/debug.yml | 29 ------------------------ config/services/entity.yml | 1 - config/services/feature.yml | 1 - config/services/field.yml | 1 - config/services/generate.yml | 41 ---------------------------------- config/services/generator.yml | 41 ---------------------------------- config/services/image.yml | 1 - config/services/locale.yml | 3 --- config/services/migrate.yml | 3 --- config/services/misc.yml | 2 -- config/services/module.yml | 6 ----- config/services/node.yml | 1 - config/services/queue.yml | 1 - config/services/rest.yml | 2 -- config/services/router.yml | 1 - config/services/simpletest.yml | 1 - config/services/site.yml | 5 ----- config/services/state.yml | 2 -- config/services/taxonomy.yml | 1 - config/services/theme.yml | 4 ---- config/services/update.yml | 2 -- config/services/user.yml | 7 ------ config/services/views.yml | 2 -- services.yml | 11 --------- uninstall.services.yml | 6 ----- 31 files changed, 1 insertion(+), 203 deletions(-) diff --git a/bin/drupal.php b/bin/drupal.php index f513a62ed..1f00c2ad9 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -10,6 +10,7 @@ use Drupal\Console\Application; set_time_limit(0); +error_reporting(-1); $autoloaders = []; diff --git a/config/services/cache.yml b/config/services/cache.yml index 028c19a83..632fe211a 100644 --- a/config/services/cache.yml +++ b/config/services/cache.yml @@ -4,4 +4,3 @@ services: arguments: ['@console.drupal_api', '@console.site', '@class_loader', '@request_stack'] tags: - { name: drupal.command } - lazy: true diff --git a/config/services/config.yml b/config/services/config.yml index cbdb2ef14..422aa2715 100644 --- a/config/services/config.yml +++ b/config/services/config.yml @@ -4,63 +4,52 @@ services: arguments: ['@config.factory', '@config.storage', '@config.storage.sync'] tags: - { name: drupal.command } - lazy: true console.config_diff: class: Drupal\Console\Command\Config\DiffCommand arguments: ['@config.storage', '@config.manager'] tags: - { name: drupal.command } - lazy: true console.config_edit: class: Drupal\Console\Command\Config\EditCommand arguments: ['@config.factory', '@config.storage', '@console.configuration_manager'] tags: - { name: drupal.command } - lazy: true console.config_export: class: Drupal\Console\Command\Config\ExportCommand arguments: ['@config.manager', '@config.storage'] tags: - { name: drupal.command } - lazy: true console.config_export_content_type: class: Drupal\Console\Command\Config\ExportContentTypeCommand arguments: ['@entity_type.manager', '@config.storage', '@console.extension_manager'] tags: - { name: drupal.command } - lazy: true console.config_export_single: class: Drupal\Console\Command\Config\ExportSingleCommand arguments: ['@entity_type.manager', '@config.storage', '@console.extension_manager'] tags: - { name: drupal.command } - lazy: true console.config_export_view: class: Drupal\Console\Command\Config\ExportViewCommand arguments: ['@entity_type.manager', '@config.storage', '@console.extension_manager'] tags: - { name: drupal.command } - lazy: true console.config_import: class: Drupal\Console\Command\Config\ImportCommand arguments: ['@config.storage', '@config.manager'] tags: - { name: drupal.command } - lazy: true console.config_import_single: class: Drupal\Console\Command\Config\ImportSingleCommand arguments: ['@config.storage', '@config.manager'] tags: - { name: drupal.command } - lazy: true console.config_override: class: Drupal\Console\Command\Config\OverrideCommand arguments: ['@config.storage', '@config.factory'] tags: - { name: drupal.command } - lazy: true console.config_validate: class: Drupal\Console\Command\Config\ValidateCommand tags: - { name: drupal.command } - lazy: true diff --git a/config/services/create.yml b/config/services/create.yml index b2ba06009..650fb4d59 100644 --- a/config/services/create.yml +++ b/config/services/create.yml @@ -4,28 +4,23 @@ services: arguments: ['@console.drupal_api', '@console.create_node_data'] tags: - { name: drupal.command } - lazy: true console.create_comments: class: Drupal\Console\Command\Create\CommentsCommand arguments: ['@console.create_comment_data'] tags: - { name: drupal.command } - lazy: true console.create_terms: class: Drupal\Console\Command\Create\TermsCommand arguments: ['@console.drupal_api', '@console.create_term_data'] tags: - { name: drupal.command } - lazy: true console.create_users: class: Drupal\Console\Command\Create\UsersCommand arguments: ['@console.drupal_api', '@console.create_user_data'] tags: - { name: drupal.command } - lazy: true console.create_vocabularies: class: Drupal\Console\Command\Create\VocabulariesCommand arguments: ['@console.create_vocabulary_data'] tags: - { name: drupal.command } - lazy: true diff --git a/config/services/cron.yml b/config/services/cron.yml index 865c2cd61..bbd8536d9 100644 --- a/config/services/cron.yml +++ b/config/services/cron.yml @@ -4,10 +4,8 @@ services: arguments: ['@module_handler', '@lock', '@state', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.cron_release: class: Drupal\Console\Command\Cron\ReleaseCommand arguments: ['@lock','@console.chain_queue'] tags: - { name: drupal.command } - lazy: true diff --git a/config/services/database.yml b/config/services/database.yml index 573eda99c..902995f57 100644 --- a/config/services/database.yml +++ b/config/services/database.yml @@ -4,49 +4,40 @@ services: arguments: ['@console.database_settings_generator'] tags: - { name: drupal.command } - lazy: true console.database_client: class: Drupal\Console\Command\Database\ClientCommand tags: - { name: drupal.command } - lazy: true console.database_query: class: Drupal\Console\Command\Database\QueryCommand tags: - { name: drupal.command } - lazy: true console.database_connect: class: Drupal\Console\Command\Database\ConnectCommand tags: - { name: drupal.command } - lazy: true console.database_drop: class: Drupal\Console\Command\Database\DropCommand arguments: ['@database'] tags: - { name: drupal.command } - lazy: true console.database_dump: class: Drupal\Console\Command\Database\DumpCommand arguments: ['@app.root', '@console.shell_process'] tags: - { name: drupal.command } - lazy: true console.database_log_clear: class: Drupal\Console\Command\Database\LogClearCommand arguments: ['@database'] tags: - { name: drupal.command } - lazy: true console.database_log_poll: class: Drupal\Console\Command\Database\LogPollCommand arguments: ['@database', '@date.formatter', '@entity_type.manager', '@string_translation'] tags: - { name: drupal.command } - lazy: true console.database_restore: class: Drupal\Console\Command\Database\RestoreCommand arguments: ['@app.root'] tags: - { name: drupal.command } - lazy: true diff --git a/config/services/debug.yml b/config/services/debug.yml index e63e3da6e..559d4cede 100644 --- a/config/services/debug.yml +++ b/config/services/debug.yml @@ -3,166 +3,137 @@ services: class: Drupal\Console\Command\Debug\ContainerCommand tags: - { name: drupal.command } - lazy: true console.event_debug: class: Drupal\Console\Command\Debug\EventCommand arguments: ['@event_dispatcher'] tags: - { name: drupal.command } - lazy: true console.permission_debug: class: Drupal\Console\Command\Debug\PermissionCommand tags: - { name: drupal.command } - lazy: true console.plugin_debug: class: Drupal\Console\Command\Debug\PluginCommand tags: - { name: drupal.command } - lazy: true console.update_debug: class: Drupal\Console\Command\Debug\UpdateCommand arguments: ['@console.site', '@update.post_update_registry'] tags: - { name: drupal.command } - lazy: true console.user_debug: class: Drupal\Console\Command\Debug\UserCommand arguments: ['@entity_type.manager','@entity.query', '@console.drupal_api'] tags: - { name: drupal.command } - lazy: true console.views_debug: class: Drupal\Console\Command\Debug\ViewsCommand arguments: ['@entity_type.manager'] tags: - { name: drupal.command } - lazy: true console.views_plugins_debug: class: Drupal\Console\Command\Debug\ViewsPluginsCommand tags: - { name: drupal.command } - lazy: true console.state_debug: class: Drupal\Console\Command\Debug\StateCommand arguments: ['@state', '@keyvalue'] tags: - { name: drupal.command } - lazy: true console.theme_debug: class: Drupal\Console\Command\Debug\ThemeCommand arguments: ['@config.factory', '@theme_handler'] tags: - { name: drupal.command } - lazy: true console.router_debug: class: Drupal\Console\Command\Debug\RouterCommand arguments: ['@router.route_provider'] tags: - { name: drupal.command } - lazy: true console.queue_debug: class: Drupal\Console\Command\Debug\QueueCommand arguments: ['@plugin.manager.queue_worker'] tags: - { name: drupal.command } - lazy: true console.libraries_debug: class: Drupal\Console\Command\Debug\LibrariesCommand arguments: ['@module_handler', '@theme_handler', '@library.discovery', '@app.root'] tags: - { name: drupal.command } - lazy: true console.module_debug: class: Drupal\Console\Command\Debug\ModuleCommand arguments: ['@console.configuration_manager', '@console.site', '@http_client'] tags: - { name: drupal.command } - lazy: true console.image_styles_debug: class: Drupal\Console\Command\Debug\ImageStylesCommand arguments: ['@entity_type.manager'] tags: - { name: drupal.command } - lazy: true console.entity_debug: class: Drupal\Console\Command\Debug\EntityCommand arguments: ['@entity_type.repository', '@entity_type.manager'] tags: - { name: drupal.command } - lazy: true console.database_log_debug: class: Drupal\Console\Command\Debug\DatabaseLogCommand arguments: ['@database', '@date.formatter', '@entity_type.manager', '@string_translation'] tags: - { name: drupal.command } - lazy: true console.database_table_debug: class: Drupal\Console\Command\Debug\DatabaseTableCommand arguments: ['@console.redbean', '@database'] tags: - { name: drupal.command } - lazy: true console.cron_debug: class: Drupal\Console\Command\Debug\CronCommand arguments: ['@module_handler'] tags: - { name: drupal.command } - lazy: true console.breakpoints_debug: class: Drupal\Console\Command\Debug\BreakpointsCommand arguments: ['@breakpoint.manager', '@app.root'] tags: - { name: drupal.command } - lazy: true console.cache_context_debug: class: Drupal\Console\Command\Debug\CacheContextCommand tags: - { name: drupal.command } - lazy: true console.config_debug: class: Drupal\Console\Command\Debug\ConfigCommand arguments: ['@config.factory', '@config.storage'] tags: - { name: drupal.command } - lazy: true console.config_settings_debug: class: Drupal\Console\Command\Debug\ConfigSettingsCommand arguments: ['@settings'] tags: - { name: drupal.command } - lazy: true console.config_validate_debug: class: Drupal\Console\Command\Debug\ConfigValidateCommand tags: - { name: drupal.command } - lazy: true console.multisite_debug: class: Drupal\Console\Command\Debug\MultisiteCommand arguments: ['@app.root'] tags: - { name: drupal.command } - lazy: true console.migrate_debug: class: Drupal\Console\Command\Debug\MigrateCommand arguments: ['@?plugin.manager.migration'] tags: - { name: drupal.command } - lazy: true console.rest_debug: class: Drupal\Console\Command\Debug\RestCommand arguments: ['@?plugin.manager.rest'] tags: - { name: drupal.command } - lazy: true console.test_debug: class: Drupal\Console\Command\Debug\TestCommand arguments: ['@?test_discovery'] tags: - { name: drupal.command } - lazy: true console.feature_debug: class: Drupal\Console\Command\Debug\FeaturesCommand tags: - { name: drupal.command } - lazy: true diff --git a/config/services/entity.yml b/config/services/entity.yml index 592389d55..58b018879 100644 --- a/config/services/entity.yml +++ b/config/services/entity.yml @@ -4,4 +4,3 @@ services: arguments: ['@entity_type.repository', '@entity_type.manager'] tags: - { name: drupal.command } - lazy: true diff --git a/config/services/feature.yml b/config/services/feature.yml index 1c4041b7c..3a3574131 100644 --- a/config/services/feature.yml +++ b/config/services/feature.yml @@ -3,4 +3,3 @@ services: class: Drupal\Console\Command\Features\ImportCommand tags: - { name: drupal.command } - lazy: true diff --git a/config/services/field.yml b/config/services/field.yml index caaebd3ca..0a181035d 100644 --- a/config/services/field.yml +++ b/config/services/field.yml @@ -4,4 +4,3 @@ services: arguments: ['@entity_type.manager', '@entity_field.manager'] tags: - { name: drupal.command } - lazy: true diff --git a/config/services/generate.yml b/config/services/generate.yml index 35b47fa17..1c0452a67 100644 --- a/config/services/generate.yml +++ b/config/services/generate.yml @@ -4,244 +4,203 @@ services: arguments: ['@console.module_generator', '@console.validator', '@app.root', '@console.string_converter', '@console.drupal_api'] tags: - { name: drupal.command } - lazy: true console.generate_modulefile: class: Drupal\Console\Command\Generate\ModuleFileCommand arguments: ['@console.extension_manager', '@console.modulefile_generator'] tags: - { name: drupal.command } - lazy: true console.generate_authentication_provider: class: Drupal\Console\Command\Generate\AuthenticationProviderCommand arguments: ['@console.extension_manager', '@console.authentication_provider_generator', '@console.string_converter'] tags: - { name: drupal.command } - lazy: true console.generate_controller: class: Drupal\Console\Command\Generate\ControllerCommand arguments: ['@console.extension_manager', '@console.controller_generator', '@console.string_converter', '@console.validator', '@router.route_provider', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.generate_breakpoint: class: Drupal\Console\Command\Generate\BreakPointCommand arguments: ['@console.breakpoint_generator', '@app.root', '@theme_handler', '@console.validator', '@console.string_converter'] tags: - { name: drupal.command } - lazy: true console.generate_help: class: Drupal\Console\Command\Generate\HelpCommand arguments: ['@console.help_generator', '@console.site', '@console.extension_manager', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.generate_form: class: Drupal\Console\Command\Generate\FormBaseCommand arguments: ['@console.extension_manager', '@console.form_generator', '@console.chain_queue', '@console.string_converter', '@plugin.manager.element_info', '@router.route_provider'] tags: - { name: drupal.command } - lazy: true console.generate_form_alter: class: Drupal\Console\Command\Generate\FormAlterCommand arguments: ['@console.extension_manager', '@console.form_alter_generator', '@console.string_converter', '@module_handler', '@plugin.manager.element_info', '@?profiler', '@app.root', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.generate_permissions: class: Drupal\Console\Command\Generate\PermissionCommand arguments: ['@console.extension_manager', '@console.string_converter', '@console.permission_generator'] tags: - { name: drupal.command } - lazy: true console.generate_event_subscriber: class: Drupal\Console\Command\Generate\EventSubscriberCommand arguments: ['@console.extension_manager', '@console.event_subscriber_generator', '@console.string_converter', '@event_dispatcher', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.generate_form_config: class: Drupal\Console\Command\Generate\ConfigFormBaseCommand arguments: ['@console.extension_manager', '@console.form_generator', '@console.string_converter', '@router.route_provider', '@plugin.manager.element_info', '@app.root', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.generate_plugin_type_annotation: class: Drupal\Console\Command\Generate\PluginTypeAnnotationCommand arguments: ['@console.extension_manager', '@console.plugin_type_annotation_generator', '@console.string_converter'] tags: - { name: drupal.command } - lazy: true console.generate_plugin_condition: class: Drupal\Console\Command\Generate\PluginConditionCommand arguments: ['@console.extension_manager', '@console.plugin_condition_generator', '@console.chain_queue', '@entity_type.repository', '@console.string_converter'] tags: - { name: drupal.command } - lazy: true console.generate_plugin_field: class: Drupal\Console\Command\Generate\PluginFieldCommand arguments: ['@console.extension_manager','@console.string_converter', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.generate_plugin_field_formatter: class: Drupal\Console\Command\Generate\PluginFieldFormatterCommand arguments: ['@console.extension_manager', '@console.plugin_field_formatter_generator','@console.string_converter', '@plugin.manager.field.field_type', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.generate_plugin_field_type: class: Drupal\Console\Command\Generate\PluginFieldTypeCommand arguments: ['@console.extension_manager', '@console.plugin_field_type_generator','@console.string_converter', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.generate_plugin_field_widget: class: Drupal\Console\Command\Generate\PluginFieldWidgetCommand arguments: ['@console.extension_manager', '@console.plugin_field_widget_generator','@console.string_converter', '@plugin.manager.field.field_type', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.generate_plugin_image_effect: class: Drupal\Console\Command\Generate\PluginImageEffectCommand arguments: ['@console.extension_manager', '@console.plugin_image_effect_generator','@console.string_converter', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.generate_plugin_image_formatter: class: Drupal\Console\Command\Generate\PluginImageFormatterCommand arguments: ['@console.extension_manager', '@console.plugin_image_formatter_generator','@console.string_converter', '@console.validator', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.generate_plugin_mail: class: Drupal\Console\Command\Generate\PluginMailCommand arguments: ['@console.extension_manager', '@console.plugin_mail_generator','@console.string_converter', '@console.validator', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.generate_plugin_migrate_source: class: Drupal\Console\Command\Generate\PluginMigrateSourceCommand arguments: ['@config.factory', '@console.chain_queue', '@console.plugin_migrate_source_generator', '@entity_type.manager', '@console.extension_manager', '@console.validator', '@console.string_converter', '@plugin.manager.element_info'] tags: - { name: drupal.command } - lazy: true console.generate_plugin_migrate_process: class: Drupal\Console\Command\Generate\PluginMigrateProcessCommand arguments: [ '@console.plugin_migrate_process_generator', '@console.chain_queue', '@console.extension_manager', '@console.string_converter'] tags: - { name: drupal.command } - lazy: true console.generate_plugin_rest_resource: class: Drupal\Console\Command\Generate\PluginRestResourceCommand arguments: ['@console.extension_manager', '@console.plugin_rest_resource_generator','@console.string_converter', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.generate_plugin_rules_action: class: Drupal\Console\Command\Generate\PluginRulesActionCommand arguments: ['@console.extension_manager', '@console.plugin_rules_action_generator','@console.string_converter', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.generate_plugin_skeleton: class: Drupal\Console\Command\Generate\PluginSkeletonCommand arguments: ['@console.extension_manager', '@console.plugin_skeleton_generator','@console.string_converter', '@console.validator', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.generate_plugin_type_yaml: class: Drupal\Console\Command\Generate\PluginTypeYamlCommand arguments: ['@console.extension_manager', '@console.plugin_type_yaml_generator','@console.string_converter'] tags: - { name: drupal.command } - lazy: true console.generate_plugin_views_field: class: Drupal\Console\Command\Generate\PluginViewsFieldCommand arguments: ['@console.extension_manager', '@console.plugin_views_field_generator', '@console.site','@console.string_converter','@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.generate_post_update: class: Drupal\Console\Command\Generate\PostUpdateCommand arguments: ['@console.extension_manager', '@console.post_update_generator', '@console.site', '@console.validator','@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.generate_profile: class: Drupal\Console\Command\Generate\ProfileCommand arguments: ['@console.extension_manager', '@console.profile_generator', '@console.string_converter', '@console.validator', '@app.root'] tags: - { name: drupal.command } - lazy: true console.generate_route_subscriber: class: Drupal\Console\Command\Generate\RouteSubscriberCommand arguments: ['@console.extension_manager', '@console.route_subscriber_generator', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.generate_service: class: Drupal\Console\Command\Generate\ServiceCommand arguments: ['@console.extension_manager', '@console.service_generator', '@console.string_converter', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.generate_theme: class: Drupal\Console\Command\Generate\ThemeCommand arguments: ['@console.extension_manager', '@console.theme_generator', '@console.validator', '@app.root', '@theme_handler', '@console.site', '@console.string_converter'] tags: - { name: drupal.command } - lazy: true console.generate_twig_extension: class: Drupal\Console\Command\Generate\TwigExtensionCommand arguments: ['@console.extension_manager', '@console.twig_extension_generator', '@console.site', '@console.string_converter', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.generate_update: class: Drupal\Console\Command\Generate\UpdateCommand arguments: ['@console.extension_manager', '@console.update_generator', '@console.site', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.generate_pluginblock: class: Drupal\Console\Command\Generate\PluginBlockCommand arguments: ['@config.factory', '@console.chain_queue', '@console.pluginblock_generator', '@entity_type.manager', '@console.extension_manager', '@console.validator', '@console.string_converter', '@plugin.manager.element_info'] tags: - { name: drupal.command } - lazy: true console.generate_command: class: Drupal\Console\Command\Generate\CommandCommand arguments: ['@console.command_generator', '@console.extension_manager', '@console.validator', '@console.string_converter', '@console.site'] tags: - { name: drupal.command } - lazy: true console.generate_ckeditorbutton: class: Drupal\Console\Command\Generate\PluginCKEditorButtonCommand arguments: ['@console.chain_queue', '@console.command_ckeditorbutton', '@console.extension_manager', '@console.string_converter'] tags: - { name: drupal.command } - lazy: true console.generate_entitycontent: class: Drupal\Console\Command\Generate\EntityContentCommand arguments: ['@console.chain_queue', '@console.entitycontent_generator', '@console.string_converter', '@console.extension_manager', '@console.validator'] tags: - { name: drupal.command } - lazy: true console.generate_entitybundle: class: Drupal\Console\Command\Generate\EntityBundleCommand arguments: ['@console.validator', '@console.entitybundle_generator', '@console.extension_manager'] tags: - { name: drupal.command } - lazy: true console.generate_entityconfig: class: Drupal\Console\Command\Generate\EntityConfigCommand arguments: ['@console.extension_manager', '@console.entityconfig_generator', '@console.validator', '@console.string_converter'] tags: - { name: drupal.command } - lazy: true console.generate_cache_context: class: Drupal\Console\Command\Generate\CacheContextCommand arguments: [ '@console.cache_context_generator', '@console.chain_queue', '@console.extension_manager', '@console.string_converter'] tags: - { name: drupal.command } - lazy: true diff --git a/config/services/generator.yml b/config/services/generator.yml index aa2b56c7d..d5eb5f4a5 100644 --- a/config/services/generator.yml +++ b/config/services/generator.yml @@ -3,242 +3,201 @@ services: class: Drupal\Console\Generator\ModuleGenerator tags: - { name: drupal.generator } - lazy: true console.modulefile_generator: class: Drupal\Console\Generator\ModuleFileGenerator tags: - { name: drupal.generator } - lazy: true console.authentication_provider_generator: class: Drupal\Console\Generator\AuthenticationProviderGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.help_generator: class: Drupal\Console\Generator\HelpGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.controller_generator: class: Drupal\Console\Generator\ControllerGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.breakpoint_generator: class: Drupal\Console\Generator\BreakPointGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.form_alter_generator: class: Drupal\Console\Generator\FormAlterGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.permission_generator: class: Drupal\Console\Generator\PermissionGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.event_subscriber_generator: class: Drupal\Console\Generator\EventSubscriberGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.form_generator: class: Drupal\Console\Generator\FormGenerator arguments: ['@console.extension_manager', '@console.string_converter'] tags: - { name: drupal.generator } - lazy: true console.profile_generator: class: Drupal\Console\Generator\ProfileGenerator tags: - { name: drupal.generator } - lazy: true console.post_update_generator: class: Drupal\Console\Generator\PostUpdateGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.plugin_condition_generator: class: Drupal\Console\Generator\PluginConditionGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.plugin_field_generator: class: Drupal\Console\Generator\PluginFieldFormatterGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.plugin_field_formatter_generator: class: Drupal\Console\Generator\PluginFieldFormatterGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.plugin_field_type_generator: class: Drupal\Console\Generator\PluginFieldTypeGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.plugin_field_widget_generator: class: Drupal\Console\Generator\PluginFieldWidgetGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.plugin_image_effect_generator: class: Drupal\Console\Generator\PluginImageEffectGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.plugin_image_formatter_generator: class: Drupal\Console\Generator\PluginImageFormatterGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.plugin_mail_generator: class: Drupal\Console\Generator\PluginMailGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.plugin_migrate_source_generator: class: Drupal\Console\Generator\PluginMigrateSourceGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.plugin_migrate_process_generator: class: Drupal\Console\Generator\PluginMigrateProcessGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.plugin_rest_resource_generator: class: Drupal\Console\Generator\PluginRestResourceGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.plugin_rules_action_generator: class: Drupal\Console\Generator\PluginRulesActionGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.plugin_skeleton_generator: class: Drupal\Console\Generator\PluginSkeletonGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.plugin_views_field_generator: class: Drupal\Console\Generator\PluginViewsFieldGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.plugin_type_annotation_generator: class: Drupal\Console\Generator\PluginTypeAnnotationGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.plugin_type_yaml_generator: class: Drupal\Console\Generator\PluginTypeYamlGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.route_subscriber_generator: class: Drupal\Console\Generator\RouteSubscriberGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.service_generator: class: Drupal\Console\Generator\ServiceGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.theme_generator: class: Drupal\Console\Generator\ThemeGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.twig_extension_generator: class: Drupal\Console\Generator\TwigExtensionGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.update_generator: class: Drupal\Console\Generator\UpdateGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.pluginblock_generator: class: Drupal\Console\Generator\PluginBlockGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.command_generator: class: Drupal\Console\Generator\CommandGenerator arguments: ['@console.extension_manager', '@console.translator_manager'] tags: - { name: drupal.generator } - lazy: true console.command_ckeditorbutton: class: Drupal\Console\Generator\PluginCKEditorButtonGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.database_settings_generator: class: Drupal\Console\Generator\DatabaseSettingsGenerator arguments: ['@kernel'] tags: - { name: drupal.generator } - lazy: true console.entitycontent_generator: class: Drupal\Console\Generator\EntityContentGenerator arguments: ['@console.extension_manager', '@console.site', '@console.renderer'] tags: - { name: drupal.generator } - lazy: true console.entitybundle_generator: class: Drupal\Console\Generator\EntityBundleGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.entityconfig_generator: class: Drupal\Console\Generator\EntityConfigGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true console.cache_context_generator: class: Drupal\Console\Generator\CacheContextGenerator arguments: ['@console.extension_manager'] tags: - { name: drupal.generator } - lazy: true diff --git a/config/services/image.yml b/config/services/image.yml index b9157c28f..73b5c566a 100644 --- a/config/services/image.yml +++ b/config/services/image.yml @@ -4,4 +4,3 @@ services: arguments: ['@entity_type.manager'] tags: - { name: drupal.command } - lazy: true diff --git a/config/services/locale.yml b/config/services/locale.yml index f17b9df97..a498b84e9 100644 --- a/config/services/locale.yml +++ b/config/services/locale.yml @@ -4,16 +4,13 @@ services: arguments: ['@console.site', '@console.extension_manager'] tags: - { name: drupal.command } - lazy: true console.language_delete: class: Drupal\Console\Command\Locale\LanguageDeleteCommand arguments: ['@console.site', '@entity_type.manager', '@module_handler'] tags: - { name: drupal.command } - lazy: true console.language_add: class: Drupal\Console\Command\Locale\LanguageAddCommand arguments: ['@console.site', '@module_handler'] tags: - { name: drupal.command } - lazy: true diff --git a/config/services/migrate.yml b/config/services/migrate.yml index ba69672b6..71ebc4f20 100644 --- a/config/services/migrate.yml +++ b/config/services/migrate.yml @@ -4,16 +4,13 @@ services: arguments: ['@?plugin.manager.migration'] tags: - { name: drupal.command } - lazy: true console.migrate_execute: class: Drupal\Console\Command\Migrate\ExecuteCommand arguments: ['@?plugin.manager.migration'] tags: - { name: drupal.command } - lazy: true console.migrate_setup: class: Drupal\Console\Command\Migrate\SetupCommand arguments: ['@state', '@?plugin.manager.migration'] tags: - { name: drupal.command } - lazy: true diff --git a/config/services/misc.yml b/config/services/misc.yml index 59986a81a..9fad17087 100644 --- a/config/services/misc.yml +++ b/config/services/misc.yml @@ -4,9 +4,7 @@ services: arguments: ['@?plugin.manager.devel_dumper'] tags: - { name: drupal.command } - lazy: true console.shell: class: Drupal\Console\Command\ShellCommand tags: - { name: drupal.command } - lazy: true diff --git a/config/services/module.yml b/config/services/module.yml index 16be0836e..e970203dc 100644 --- a/config/services/module.yml +++ b/config/services/module.yml @@ -4,34 +4,28 @@ services: arguments: ['@console.site', '@console.validator', '@module_installer', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.module_download: class: Drupal\Console\Command\Module\DownloadCommand arguments: ['@console.drupal_api', '@http_client', '@app.root', '@console.extension_manager', '@console.validator', '@console.site', '@console.configuration_manager', '@console.shell_process', '@console.root'] tags: - { name: drupal.command } - lazy: true console.module_install: class: Drupal\Console\Command\Module\InstallCommand arguments: ['@console.site', '@console.validator', '@module_installer', '@console.drupal_api', '@console.extension_manager', '@app.root', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.module_path: class: Drupal\Console\Command\Module\PathCommand arguments: ['@console.extension_manager'] tags: - { name: drupal.command } - lazy: true console.module_uninstall: class: Drupal\Console\Command\Module\UninstallCommand arguments: ['@console.site','@module_installer', '@console.chain_queue', '@config.factory', '@console.extension_manager'] tags: - { name: drupal.command } - lazy: true console.module_update: class: Drupal\Console\Command\Module\UpdateCommand arguments: ['@console.shell_process', '@console.root'] tags: - { name: drupal.command } - lazy: true diff --git a/config/services/node.yml b/config/services/node.yml index 5d79618a7..4dc94e2aa 100644 --- a/config/services/node.yml +++ b/config/services/node.yml @@ -4,4 +4,3 @@ services: arguments: ['@state'] tags: - { name: drupal.command } - lazy: true diff --git a/config/services/queue.yml b/config/services/queue.yml index 91926b0ee..fc41033fc 100644 --- a/config/services/queue.yml +++ b/config/services/queue.yml @@ -4,4 +4,3 @@ services: arguments: ['@plugin.manager.queue_worker', '@queue'] tags: - { name: drupal.command } - lazy: true diff --git a/config/services/rest.yml b/config/services/rest.yml index be4a30613..3b08edefe 100644 --- a/config/services/rest.yml +++ b/config/services/rest.yml @@ -4,7 +4,6 @@ services: arguments: ['@config.factory', '@?plugin.manager.rest'] tags: - { name: drupal.command } - lazy: true console.rest_enable: class: Drupal\Console\Command\Rest\EnableCommand arguments: @@ -15,4 +14,3 @@ services: - '@entity.manager' tags: - { name: drupal.command } - lazy: true diff --git a/config/services/router.yml b/config/services/router.yml index 1d78f21a2..4076dc6fd 100644 --- a/config/services/router.yml +++ b/config/services/router.yml @@ -4,4 +4,3 @@ services: arguments: ['@router.builder'] tags: - { name: drupal.command } - lazy: true diff --git a/config/services/simpletest.yml b/config/services/simpletest.yml index 327f8ae40..152e315f5 100644 --- a/config/services/simpletest.yml +++ b/config/services/simpletest.yml @@ -4,4 +4,3 @@ services: arguments: ['@app.root', '@?test_discovery', '@module_handler', '@date.formatter'] tags: - { name: drupal.command } - lazy: true diff --git a/config/services/site.yml b/config/services/site.yml index 2d3e3c650..17ad4e7a6 100644 --- a/config/services/site.yml +++ b/config/services/site.yml @@ -4,28 +4,23 @@ services: arguments: ['@app.root','@console.configuration_manager'] tags: - { name: drupal.command } - lazy: true console.site_maintenance: class: Drupal\Console\Command\Site\MaintenanceCommand arguments: ['@state', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.site_mode: class: Drupal\Console\Command\Site\ModeCommand arguments: ['@config.factory', '@console.configuration_manager', '@app.root', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.site_statistics: class: Drupal\Console\Command\Site\StatisticsCommand arguments: ['@console.drupal_api', '@entity.query', '@console.extension_manager', '@module_handler'] tags: - { name: drupal.command } - lazy: true console.site_status: class: Drupal\Console\Command\Site\StatusCommand arguments: ['@system.manager', '@settings', '@config.factory', '@theme_handler', '@app.root'] tags: - { name: drupal.command } - lazy: true diff --git a/config/services/state.yml b/config/services/state.yml index 03d8c97ba..be8572157 100644 --- a/config/services/state.yml +++ b/config/services/state.yml @@ -4,10 +4,8 @@ services: arguments: ['@state', '@keyvalue'] tags: - { name: drupal.command } - lazy: true console.state_override: class: Drupal\Console\Command\State\OverrideCommand arguments: ['@state', '@keyvalue'] tags: - { name: drupal.command } - lazy: true diff --git a/config/services/taxonomy.yml b/config/services/taxonomy.yml index 86344ea69..4fc0cce59 100644 --- a/config/services/taxonomy.yml +++ b/config/services/taxonomy.yml @@ -4,4 +4,3 @@ services: arguments: ['@entity_type.manager'] tags: - { name: drupal.command } - lazy: true diff --git a/config/services/theme.yml b/config/services/theme.yml index c4df2771c..74a2ff152 100644 --- a/config/services/theme.yml +++ b/config/services/theme.yml @@ -4,22 +4,18 @@ services: arguments: ['@console.drupal_api', '@http_client', '@app.root'] tags: - { name: drupal.command } - lazy: true console.theme_install: class: Drupal\Console\Command\Theme\InstallCommand arguments: ['@config.factory', '@theme_handler', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.theme_path: class: Drupal\Console\Command\Theme\PathCommand arguments: ['@console.extension_manager','@theme_handler'] tags: - { name: drupal.command } - lazy: true console.theme_uninstall: class: Drupal\Console\Command\Theme\UninstallCommand arguments: ['@config.factory', '@theme_handler', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true diff --git a/config/services/update.yml b/config/services/update.yml index c2417c88f..eed0fa5a8 100644 --- a/config/services/update.yml +++ b/config/services/update.yml @@ -4,10 +4,8 @@ services: arguments: ['@state', '@entity.definition_update_manager', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.update_execute: class: Drupal\Console\Command\Update\ExecuteCommand arguments: ['@console.site', '@state', '@module_handler', '@update.post_update_registry', '@console.extension_manager', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true diff --git a/config/services/user.yml b/config/services/user.yml index 8cf29da20..60e9da724 100644 --- a/config/services/user.yml +++ b/config/services/user.yml @@ -4,40 +4,33 @@ services: arguments: ['@entity_type.manager','@entity.query', '@console.drupal_api'] tags: - { name: drupal.command } - lazy: true console.user_login_clear_attempts: class: Drupal\Console\Command\User\LoginCleanAttemptsCommand arguments: ['@database'] tags: - { name: drupal.command } - lazy: true console.user_login_url: class: Drupal\Console\Command\User\LoginUrlCommand arguments: ['@entity_type.manager'] tags: - { name: drupal.command } - lazy: true console.user_password_hash: class: Drupal\Console\Command\User\PasswordHashCommand arguments: ['@password'] tags: - { name: drupal.command } - lazy: true console.user_password_reset: class: Drupal\Console\Command\User\PasswordResetCommand arguments: ['@database', '@console.chain_queue'] tags: - { name: drupal.command } - lazy: true console.user_role: class: Drupal\Console\Command\User\RoleCommand arguments: ['@console.drupal_api'] tags: - { name: drupal.command } - lazy: true console.user_create: class: Drupal\Console\Command\User\CreateCommand arguments: ['@database', '@entity_type.manager', '@date.formatter', '@console.drupal_api'] tags: - { name: drupal.command } - lazy: true diff --git a/config/services/views.yml b/config/services/views.yml index 95fda2f89..9fdc6a1cd 100644 --- a/config/services/views.yml +++ b/config/services/views.yml @@ -4,10 +4,8 @@ services: arguments: ['@entity_type.manager', '@entity.query'] tags: - { name: drupal.command } - lazy: true console.views_enable: class: Drupal\Console\Command\Views\EnableCommand arguments: ['@entity_type.manager', '@entity.query'] tags: - { name: drupal.command } - lazy: true diff --git a/services.yml b/services.yml index 5ca6761c8..e71584db1 100644 --- a/services.yml +++ b/services.yml @@ -1,42 +1,31 @@ services: console.root: class: SplString - lazy: true console.redbean: class: RedBeanPHP\R - lazy: true console.validator: class: Drupal\Console\Utils\Validator arguments: ['@console.extension_manager', '@console.translator_manager'] - lazy: true console.drupal_api: class: Drupal\Console\Utils\DrupalApi arguments: ['@app.root', '@entity_type.manager', '@http_client'] - lazy: true console.create_node_data: class: Drupal\Console\Utils\Create\NodeData arguments: ['@entity_type.manager', '@entity_field.manager', '@date.formatter', '@=service("console.drupal_api").getBundles()'] - lazy: true console.create_comment_data: class: Drupal\Console\Utils\Create\CommentData arguments: ['@entity_type.manager', '@entity_field.manager', '@date.formatter'] - lazy: true console.create_term_data: class: Drupal\Console\Utils\Create\TermData arguments: ['@entity_type.manager', '@entity_field.manager', '@date.formatter', '@=service("console.drupal_api").getVocabularies()'] - lazy: true console.create_user_data: class: Drupal\Console\Utils\Create\UserData arguments: ['@entity_type.manager', '@entity_field.manager', '@date.formatter', '@=service("console.drupal_api").getRoles()'] - lazy: true console.create_vocabulary_data: class: Drupal\Console\Utils\Create\VocabularyData arguments: ['@entity_type.manager', '@entity_field.manager', '@date.formatter'] - lazy: true console.annotation_command_reader: class: Drupal\Console\Annotations\DrupalCommandAnnotationReader - lazy: true console.annotation_validator: class: Drupal\Console\Utils\AnnotationValidator arguments: ['@console.annotation_command_reader', '@console.extension_manager'] - lazy: true diff --git a/uninstall.services.yml b/uninstall.services.yml index f18085141..c1835417a 100644 --- a/uninstall.services.yml +++ b/uninstall.services.yml @@ -2,29 +2,23 @@ services: console.site: class: Drupal\Console\Utils\Site arguments: ['@app.root', '@console.configuration_manager'] - lazy: true console.extension_manager: class: Drupal\Console\Extension\Manager arguments: ['@console.site', '@http_client', '@app.root'] - lazy: true console.server: class: Drupal\Console\Command\ServerCommand arguments: ['@app.root', '@console.configuration_manager'] tags: - { name: drupal.command } - lazy: true console.site_install: class: Drupal\Console\Command\Site\InstallCommand arguments: ['@console.extension_manager', '@console.site', '@console.configuration_manager', '@app.root'] tags: - { name: drupal.command } - lazy: true console.multisite_new: class: Drupal\Console\Command\Multisite\NewCommand arguments: ['@app.root'] tags: - { name: drupal.command } - lazy: true http_client: class: GuzzleHttp\Client - lazy: true From c5f60ae1507b7d8d80008db1ac867bdb359b3fcc Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 16 Jul 2017 12:53:15 -0700 Subject: [PATCH 306/321] Fix array_unique() expects parameter 1 to be array. (#3443) --- src/Application.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Application.php b/src/Application.php index 93659b1d6..2f07a71ad 100644 --- a/src/Application.php +++ b/src/Application.php @@ -207,8 +207,8 @@ private function registerCommands() if (array_key_exists($command->getName(), $aliases)) { $commandAliases = array_unique(array_merge( - $command->getAliases(), - $aliases[$command->getName()] + $command->getAliases()?$command->getAliases():[], + array_key_exists($command->getName(), $aliases)?$aliases[$command->getName()]:[] )); if (!is_array($commandAliases)) { $commandAliases = [$commandAliases]; From a7b32fe16640d8fcba2f3e6c0802bd8fa264e70b Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 17 Jul 2017 02:27:57 -0700 Subject: [PATCH 307/321] [console] Tag 1.0.0-rc25 release. (#3444) --- bin/drupal.php | 4 +++- composer.json | 2 +- composer.lock | 24 ++++++++++++------------ src/Application.php | 2 +- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/bin/drupal.php b/bin/drupal.php index 1f00c2ad9..250f3cec2 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -10,7 +10,9 @@ use Drupal\Console\Application; set_time_limit(0); -error_reporting(-1); +ini_set('display_errors', 1); +ini_set('display_startup_errors', 1); +error_reporting(E_ALL); $autoloaders = []; diff --git a/composer.json b/composer.json index 060df0e83..b4c83f539 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,7 @@ "composer/installers": "~1.0", "doctrine/annotations": "1.2.*", "doctrine/collections": "1.3.*", - "drupal/console-core": "1.0.0-rc24", + "drupal/console-core": "1.0.0-rc25", "drupal/console-dotenv": "~0", "drupal/console-extend-plugin": "~0", "gabordemooij/redbean": "~4.3", diff --git a/composer.lock b/composer.lock index 2e920bcb1..7a6dddb2e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "3910e9a712bccd196d2cf68eec646412", + "content-hash": "c031b2620e80d965d726b62d18e67a79", "packages": [ { "name": "alchemy/zippy", @@ -578,21 +578,21 @@ }, { "name": "drupal/console-core", - "version": "1.0.0-rc24", + "version": "1.0.0-rc25", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "dcf0f04a97a72b23596398a4ed9daa22a8dd5bd0" + "reference": "af7181073cd3cbd2efabe0343f0d5d24fdf02413" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/dcf0f04a97a72b23596398a4ed9daa22a8dd5bd0", - "reference": "dcf0f04a97a72b23596398a4ed9daa22a8dd5bd0", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/af7181073cd3cbd2efabe0343f0d5d24fdf02413", + "reference": "af7181073cd3cbd2efabe0343f0d5d24fdf02413", "shasum": "" }, "require": { "dflydev/dot-access-configuration": "^1.0", - "drupal/console-en": "1.0.0-rc24", + "drupal/console-en": "1.0.0-rc25", "php": "^5.5.9 || ^7.0", "stecman/symfony-console-completion": "~0.7", "symfony/config": "~2.8", @@ -655,7 +655,7 @@ "drupal", "symfony" ], - "time": "2017-07-14T08:51:18+00:00" + "time": "2017-07-17T09:10:19+00:00" }, { "name": "drupal/console-dotenv", @@ -698,16 +698,16 @@ }, { "name": "drupal/console-en", - "version": "1.0.0-rc24", + "version": "1.0.0-rc25", "source": { "type": "git", "url": "https://github.com/hechoendrupal/drupal-console-en.git", - "reference": "3235d0e3fd30e73b55585d746e7ba8dc39ca9281" + "reference": "63919e6f348ae2c1821952d067bc7e8f5edf6fe8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/3235d0e3fd30e73b55585d746e7ba8dc39ca9281", - "reference": "3235d0e3fd30e73b55585d746e7ba8dc39ca9281", + "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/63919e6f348ae2c1821952d067bc7e8f5edf6fe8", + "reference": "63919e6f348ae2c1821952d067bc7e8f5edf6fe8", "shasum": "" }, "type": "drupal-console-language", @@ -748,7 +748,7 @@ "drupal", "symfony" ], - "time": "2017-07-14T02:44:41+00:00" + "time": "2017-07-14T16:41:37+00:00" }, { "name": "drupal/console-extend-plugin", diff --git a/src/Application.php b/src/Application.php index 2f07a71ad..d3a3489b5 100644 --- a/src/Application.php +++ b/src/Application.php @@ -25,7 +25,7 @@ class Application extends BaseApplication /** * @var string */ - const VERSION = '1.0.0-rc24'; + const VERSION = '1.0.0-rc25'; public function __construct(ContainerInterface $container) { From a4a8efb31c5721b9ff07c20030bd249fe906f5ff Mon Sep 17 00:00:00 2001 From: Blas Date: Mon, 17 Jul 2017 17:11:33 -0500 Subject: [PATCH 308/321] Adding translations for some commands (#3446) * Replacing in translation key from _ to - * Adding translation messages for the commands: config module:install taxonomy:term:delete * Adding translation to config, edit and theme commands * Adding devel translations * Adding translations for generate command * Adding forgotten translation * Adding another forgotten translation --- src/Command/Config/EditCommand.php | 2 +- src/Command/DevelDumperCommand.php | 12 ++++++------ src/Command/Generate/HelpCommand.php | 2 +- src/Command/Generate/ModuleCommand.php | 2 +- src/Command/Generate/PluginFieldCommand.php | 2 +- src/Command/Generate/PluginFieldTypeCommand.php | 2 +- src/Command/Generate/PluginImageEffectCommand.php | 2 +- src/Command/Generate/ProfileCommand.php | 4 ++-- src/Command/Generate/ThemeCommand.php | 4 ++-- src/Command/Shared/FormTrait.php | 8 ++++---- src/Command/Shared/MenuTrait.php | 2 +- src/Command/Shared/PermissionTrait.php | 6 +++--- src/Command/Site/InstallCommand.php | 2 +- src/Command/Theme/PathCommand.php | 2 +- 14 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/Command/Config/EditCommand.php b/src/Command/Config/EditCommand.php index bd5ad9576..fe1ddc46d 100644 --- a/src/Command/Config/EditCommand.php +++ b/src/Command/Config/EditCommand.php @@ -140,7 +140,7 @@ protected function interact(InputInterface $input, OutputInterface $output) if (!$configName) { $configNames = $this->configFactory->listAll(); $configName = $io->choice( - 'Choose a configuration', + $this->trans('commands.config.edit.messages.choose-configuration'), $configNames ); diff --git a/src/Command/DevelDumperCommand.php b/src/Command/DevelDumperCommand.php index 97a246b9d..612b52e73 100644 --- a/src/Command/DevelDumperCommand.php +++ b/src/Command/DevelDumperCommand.php @@ -50,11 +50,11 @@ protected function configure() { $this ->setName('devel:dumper') - ->setDescription($this->trans('Change the devel dumper plugin')) + ->setDescription($this->trans('commands.devel.dumper.messages.change-devel-dumper-plugin')) ->addArgument( 'dumper', InputArgument::OPTIONAL, - $this->trans('Name of the devel dumper plugin') + $this->trans('commands.devel.dumper.messages.name-devel-dumper-plugin') )->setAliases(['dd']); } @@ -65,7 +65,7 @@ protected function interact(InputInterface $input, OutputInterface $output) { $io = new DrupalStyle($input, $output); if (!\Drupal::moduleHandler()->moduleExists('devel')) { - $io->error($this->trans('Devel must be installed')); + $io->error($this->trans('commands.devel.dumper.messages.devel-must-be-installed')); return 1; } @@ -76,7 +76,7 @@ protected function interact(InputInterface $input, OutputInterface $output) $dumpKeys = $this->getDumperKeys(); $dumper = $io->choice( - $this->trans('Select a Debug Dumper'), + $this->trans('commands.devel.dumper.messages.select-debug-dumper'), $dumpKeys, 'kint', //Make kint the default for quick 'switchback' false @@ -97,7 +97,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $dumper = $input->getArgument('dumper'); $dumpKeys = $this->getDumperKeys(); if (!in_array($dumper, $dumpKeys)) { - $io->error($this->trans('Dumper does not exist')); + $io->error($this->trans('commands.devel.dumper.messages.dumper-not-exist')); return 1; } @@ -108,7 +108,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $develSettings->set('devel_dumper', $dumper)->save(); $io->info( sprintf( - $this->trans('Devel Dumper set to: %s'), + $this->trans('commands.devel.dumper.messages.devel-dumper-set'), $configFactory->get('devel.settings')->get('devel_dumper') ) ); diff --git a/src/Command/Generate/HelpCommand.php b/src/Command/Generate/HelpCommand.php index bff5a1206..282aee5f6 100644 --- a/src/Command/Generate/HelpCommand.php +++ b/src/Command/Generate/HelpCommand.php @@ -140,7 +140,7 @@ protected function interact(InputInterface $input, OutputInterface $output) if (!$description) { $description = $io->ask( $this->trans('commands.generate.module.questions.description'), - 'My Awesome Module' + $this->trans('commands.generate.module.suggestions.my-awesome-module') ); } $input->setOption('description', $description); diff --git a/src/Command/Generate/ModuleCommand.php b/src/Command/Generate/ModuleCommand.php index 1382b08b3..215909eea 100644 --- a/src/Command/Generate/ModuleCommand.php +++ b/src/Command/Generate/ModuleCommand.php @@ -298,7 +298,7 @@ function ($modulePath) use ($drupalRoot, $machineName) { if (!$description) { $description = $io->ask( $this->trans('commands.generate.module.questions.description'), - 'My Awesome Module' + $this->trans('commands.generate.module.suggestions.my-awesome-module') ); } $input->setOption('description', $description); diff --git a/src/Command/Generate/PluginFieldCommand.php b/src/Command/Generate/PluginFieldCommand.php index 35577216a..965b54841 100644 --- a/src/Command/Generate/PluginFieldCommand.php +++ b/src/Command/Generate/PluginFieldCommand.php @@ -248,7 +248,7 @@ protected function interact(InputInterface $input, OutputInterface $output) if (!$description) { $description = $io->ask( $this->trans('commands.generate.plugin.field.questions.type-description'), - 'My Field Type' + $this->trans('commands.generate.plugin.field.suggestions.my-field-type') ); $input->setOption('type-description', $description); } diff --git a/src/Command/Generate/PluginFieldTypeCommand.php b/src/Command/Generate/PluginFieldTypeCommand.php index 49f6b6eef..cd7b9c64b 100644 --- a/src/Command/Generate/PluginFieldTypeCommand.php +++ b/src/Command/Generate/PluginFieldTypeCommand.php @@ -195,7 +195,7 @@ protected function interact(InputInterface $input, OutputInterface $output) if (!$description) { $description = $io->ask( $this->trans('commands.generate.plugin.fieldtype.questions.description'), - 'My Field Type' + $this->trans('commands.generate.plugin.fieldtype.suggestions.my-field-type') ); $input->setOption('description', $description); } diff --git a/src/Command/Generate/PluginImageEffectCommand.php b/src/Command/Generate/PluginImageEffectCommand.php index cf516e813..df33700e9 100644 --- a/src/Command/Generate/PluginImageEffectCommand.php +++ b/src/Command/Generate/PluginImageEffectCommand.php @@ -177,7 +177,7 @@ protected function interact(InputInterface $input, OutputInterface $output) if (!$description) { $description = $io->ask( $this->trans('commands.generate.plugin.imageeffect.questions.description'), - 'My Image Effect' + $this->trans('commands.generate.plugin.imageeffect.suggestions.my-image-effect') ); $input->setOption('description', $description); } diff --git a/src/Command/Generate/ProfileCommand.php b/src/Command/Generate/ProfileCommand.php index 5225379e0..f26791ae2 100644 --- a/src/Command/Generate/ProfileCommand.php +++ b/src/Command/Generate/ProfileCommand.php @@ -215,7 +215,7 @@ function ($machine_name) use ($validators) { if (!$description) { $description = $io->ask( $this->trans('commands.generate.profile.questions.description'), - 'My Useful Profile' + $this->trans('commands.generate.profile.suggestions.my-useful-profile') ); $input->setOption('description', $description); } @@ -253,7 +253,7 @@ function ($machine_name) use ($validators) { ) { $distribution = $io->ask( $this->trans('commands.generate.profile.options.distribution'), - 'My Kick-ass Distribution' + $this->trans('commands.generate.profile.suggestions.my-kick-ass-distribution') ); $input->setOption('distribution', $distribution); } diff --git a/src/Command/Generate/ThemeCommand.php b/src/Command/Generate/ThemeCommand.php index 8c598baf2..e92af8d1f 100644 --- a/src/Command/Generate/ThemeCommand.php +++ b/src/Command/Generate/ThemeCommand.php @@ -291,7 +291,7 @@ function ($theme_path) use ($drupalRoot, $machine_name) { if (!$description) { $description = $io->ask( $this->trans('commands.generate.theme.questions.description'), - 'My Awesome theme' + $this->trans('commands.generate.theme.suggestions.my-awesome-theme') ); $input->setOption('description', $description); } @@ -300,7 +300,7 @@ function ($theme_path) use ($drupalRoot, $machine_name) { if (!$package) { $package = $io->ask( $this->trans('commands.generate.theme.questions.package'), - 'Other' + $this->trans('commands.generate.theme.suggestions.other') ); $input->setOption('package', $package); } diff --git a/src/Command/Shared/FormTrait.php b/src/Command/Shared/FormTrait.php index f55da0134..8a72e0264 100644 --- a/src/Command/Shared/FormTrait.php +++ b/src/Command/Shared/FormTrait.php @@ -93,19 +93,19 @@ public function formQuestion(DrupalStyle $io) $size = null; if (in_array($input_type, ['textfield', 'password', 'password_confirm'])) { $maxlength = $io->ask( - 'Maximum amount of characters', + $this->trans('commands.generate.form.questions.max-amount-characters'), '64' ); $size = $io->ask( - 'Width of the textfield (in characters)', + $this->trans('commands.generate.form.questions.textfield-width-in-chars'), '64' ); } if ($input_type == 'select') { $size = $io->ask( - 'Size of multiselect box (in lines)', + $this->trans('commands.generate.form.questions.multiselect-size-in-lines'), '5' ); } @@ -113,7 +113,7 @@ public function formQuestion(DrupalStyle $io) $input_options = ''; if (in_array($input_type, ['checkboxes', 'radios', 'select'])) { $input_options = $io->ask( - 'Input options separated by comma' + $this->trans('commands.generate.form.questions.input-options') ); } diff --git a/src/Command/Shared/MenuTrait.php b/src/Command/Shared/MenuTrait.php index faa083c85..5d8bc55a4 100644 --- a/src/Command/Shared/MenuTrait.php +++ b/src/Command/Shared/MenuTrait.php @@ -56,7 +56,7 @@ public function menuQuestion(DrupalStyle $io, $className) $menu_link_desc = $io->ask( $menu_link_desc = $this->trans('commands.generate.form.options.menu-link-desc'), - 'A description for the menu entry' + $menu_link_desc = $this->trans('commands.generate.form.suggestions.description-for-menu') ); $menu_options['menu_link_title'] = $menu_link_title; $menu_options['menu_parent'] = $menu_parent; diff --git a/src/Command/Shared/PermissionTrait.php b/src/Command/Shared/PermissionTrait.php index a3e3f6796..1822ac06a 100644 --- a/src/Command/Shared/PermissionTrait.php +++ b/src/Command/Shared/PermissionTrait.php @@ -23,15 +23,15 @@ public function permissionQuestion(DrupalStyle $output) while (true) { $permission = $output->ask( $this->trans('commands.generate.permission.questions.permission'), - 'access content' + $this->trans('commands.generate.permission.suggestions.access-content') ); $title = $output->ask( $this->trans('commands.generate.permission.questions.title'), - 'Access content' + $this->trans('commands.generate.permission.suggestions.access-content') ); $description = $output->ask( $this->trans('commands.generate.permission.questions.description'), - 'Allow access to my content' + $this->trans('commands.generate.permission.suggestions.allow-access-content') ); $restrictAccess = $output->choiceNoList( $this->trans('commands.generate.permission.questions.restrict-access'), diff --git a/src/Command/Site/InstallCommand.php b/src/Command/Site/InstallCommand.php index 3781fa598..480219581 100644 --- a/src/Command/Site/InstallCommand.php +++ b/src/Command/Site/InstallCommand.php @@ -321,7 +321,7 @@ function ($profile) { if (!$siteName) { $siteName = $io->ask( $this->trans('commands.site.install.questions.site-name'), - 'Drupal 8' + $this->trans('commands.site.install.suggestions.site-name') ); $input->setOption('site-name', $siteName); } diff --git a/src/Command/Theme/PathCommand.php b/src/Command/Theme/PathCommand.php index 131c16525..fdfd85dce 100644 --- a/src/Command/Theme/PathCommand.php +++ b/src/Command/Theme/PathCommand.php @@ -73,7 +73,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if (!in_array($theme, $this->getThemeList())) { $io->error( sprintf( - 'Invalid theme name: %s', + $this->trans('commands.theme.path.messages.invalid-theme-name'), $theme ) ); From 256d563a5437ec476f6925fdac0c5328069a628c Mon Sep 17 00:00:00 2001 From: Geoff Date: Sat, 22 Jul 2017 11:56:14 -0700 Subject: [PATCH 309/321] Update composer package type; remove composer.lock (#3447) --- .gitignore | 1 + composer.json | 2 +- composer.lock | 2681 ------------------------------------------------- 3 files changed, 2 insertions(+), 2682 deletions(-) delete mode 100644 composer.lock diff --git a/.gitignore b/.gitignore index 6c785063f..4c2775433 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ /.rules # Composer +composer.lock /vendor /bin/phpunit /bin/jsonlint diff --git a/composer.json b/composer.json index b4c83f539..81078267b 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "The Drupal CLI. A tool to generate boilerplate code, interact with and debug Drupal.", "keywords": ["Drupal", "Console", "Development", "Symfony"], "homepage": "http://drupalconsole.com/", - "type": "project", + "type": "library", "license": "GPL-2.0+", "authors": [ { diff --git a/composer.lock b/composer.lock deleted file mode 100644 index 7a6dddb2e..000000000 --- a/composer.lock +++ /dev/null @@ -1,2681 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "content-hash": "c031b2620e80d965d726b62d18e67a79", - "packages": [ - { - "name": "alchemy/zippy", - "version": "0.4.3", - "source": { - "type": "git", - "url": "https://github.com/alchemy-fr/Zippy.git", - "reference": "5ffdc93de0af2770d396bf433d8b2667c77277ea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/alchemy-fr/Zippy/zipball/5ffdc93de0af2770d396bf433d8b2667c77277ea", - "reference": "5ffdc93de0af2770d396bf433d8b2667c77277ea", - "shasum": "" - }, - "require": { - "doctrine/collections": "~1.0", - "ext-mbstring": "*", - "php": ">=5.5", - "symfony/filesystem": "^2.0.5|^3.0", - "symfony/process": "^2.1|^3.0" - }, - "require-dev": { - "ext-zip": "*", - "guzzle/guzzle": "~3.0", - "guzzlehttp/guzzle": "^6.0", - "phpunit/phpunit": "^4.0|^5.0", - "symfony/finder": "^2.0.5|^3.0" - }, - "suggest": { - "ext-zip": "To use the ZipExtensionAdapter", - "guzzle/guzzle": "To use the GuzzleTeleporter with Guzzle 3", - "guzzlehttp/guzzle": "To use the GuzzleTeleporter with Guzzle 6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.4.x-dev" - } - }, - "autoload": { - "psr-4": { - "Alchemy\\Zippy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Alchemy", - "email": "dev.team@alchemy.fr", - "homepage": "http://www.alchemy.fr/" - } - ], - "description": "Zippy, the archive manager companion", - "keywords": [ - "bzip", - "compression", - "tar", - "zip" - ], - "time": "2016-11-03T16:10:31+00:00" - }, - { - "name": "composer/installers", - "version": "v1.3.0", - "source": { - "type": "git", - "url": "https://github.com/composer/installers.git", - "reference": "79ad876c7498c0bbfe7eed065b8651c93bfd6045" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/installers/zipball/79ad876c7498c0bbfe7eed065b8651c93bfd6045", - "reference": "79ad876c7498c0bbfe7eed065b8651c93bfd6045", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.0" - }, - "replace": { - "roundcube/plugin-installer": "*", - "shama/baton": "*" - }, - "require-dev": { - "composer/composer": "1.0.*@dev", - "phpunit/phpunit": "4.1.*" - }, - "type": "composer-plugin", - "extra": { - "class": "Composer\\Installers\\Plugin", - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Installers\\": "src/Composer/Installers" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Kyle Robinson Young", - "email": "kyle@dontkry.com", - "homepage": "https://github.com/shama" - } - ], - "description": "A multi-framework Composer library installer", - "homepage": "https://composer.github.io/installers/", - "keywords": [ - "Craft", - "Dolibarr", - "Eliasis", - "Hurad", - "ImageCMS", - "Kanboard", - "MODX Evo", - "Mautic", - "Maya", - "OXID", - "Plentymarkets", - "Porto", - "RadPHP", - "SMF", - "Thelia", - "WolfCMS", - "agl", - "aimeos", - "annotatecms", - "attogram", - "bitrix", - "cakephp", - "chef", - "cockpit", - "codeigniter", - "concrete5", - "croogo", - "dokuwiki", - "drupal", - "elgg", - "expressionengine", - "fuelphp", - "grav", - "installer", - "itop", - "joomla", - "kohana", - "laravel", - "lavalite", - "lithium", - "magento", - "mako", - "mediawiki", - "modulework", - "moodle", - "phpbb", - "piwik", - "ppi", - "puppet", - "reindex", - "roundcube", - "shopware", - "silverstripe", - "sydes", - "symfony", - "typo3", - "wordpress", - "yawik", - "zend", - "zikula" - ], - "time": "2017-04-24T06:37:16+00:00" - }, - { - "name": "dflydev/dot-access-configuration", - "version": "v1.0.2", - "source": { - "type": "git", - "url": "https://github.com/dflydev/dflydev-dot-access-configuration.git", - "reference": "ae6e7138b1d9063d343322cca63994ee1ac5161d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-configuration/zipball/ae6e7138b1d9063d343322cca63994ee1ac5161d", - "reference": "ae6e7138b1d9063d343322cca63994ee1ac5161d", - "shasum": "" - }, - "require": { - "dflydev/dot-access-data": "1.*", - "dflydev/placeholder-resolver": "1.*", - "php": ">=5.3.2" - }, - "require-dev": { - "symfony/yaml": "~2.1" - }, - "suggest": { - "symfony/yaml": "Required for using the YAML Configuration Builders" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-0": { - "Dflydev\\DotAccessConfiguration": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dragonfly Development Inc.", - "email": "info@dflydev.com", - "homepage": "http://dflydev.com" - }, - { - "name": "Beau Simensen", - "email": "beau@dflydev.com", - "homepage": "http://beausimensen.com" - } - ], - "description": "Given a deep data structure representing a configuration, access configuration by dot notation.", - "homepage": "https://github.com/dflydev/dflydev-dot-access-configuration", - "keywords": [ - "config", - "configuration" - ], - "time": "2016-12-12T17:43:40+00:00" - }, - { - "name": "dflydev/dot-access-data", - "version": "v1.1.0", - "source": { - "type": "git", - "url": "https://github.com/dflydev/dflydev-dot-access-data.git", - "reference": "3fbd874921ab2c041e899d044585a2ab9795df8a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-data/zipball/3fbd874921ab2c041e899d044585a2ab9795df8a", - "reference": "3fbd874921ab2c041e899d044585a2ab9795df8a", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-0": { - "Dflydev\\DotAccessData": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dragonfly Development Inc.", - "email": "info@dflydev.com", - "homepage": "http://dflydev.com" - }, - { - "name": "Beau Simensen", - "email": "beau@dflydev.com", - "homepage": "http://beausimensen.com" - }, - { - "name": "Carlos Frutos", - "email": "carlos@kiwing.it", - "homepage": "https://github.com/cfrutos" - } - ], - "description": "Given a deep data structure, access data by dot notation.", - "homepage": "https://github.com/dflydev/dflydev-dot-access-data", - "keywords": [ - "access", - "data", - "dot", - "notation" - ], - "time": "2017-01-20T21:14:22+00:00" - }, - { - "name": "dflydev/placeholder-resolver", - "version": "v1.0.2", - "source": { - "type": "git", - "url": "https://github.com/dflydev/dflydev-placeholder-resolver.git", - "reference": "c498d0cae91b1bb36cc7d60906dab8e62bb7c356" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dflydev/dflydev-placeholder-resolver/zipball/c498d0cae91b1bb36cc7d60906dab8e62bb7c356", - "reference": "c498d0cae91b1bb36cc7d60906dab8e62bb7c356", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-0": { - "Dflydev\\PlaceholderResolver": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dragonfly Development Inc.", - "email": "info@dflydev.com", - "homepage": "http://dflydev.com" - }, - { - "name": "Beau Simensen", - "email": "beau@dflydev.com", - "homepage": "http://beausimensen.com" - } - ], - "description": "Given a data source representing key => value pairs, resolve placeholders like ${foo.bar} to the value associated with the 'foo.bar' key in the data source.", - "homepage": "https://github.com/dflydev/dflydev-placeholder-resolver", - "keywords": [ - "placeholder", - "resolver" - ], - "time": "2012-10-28T21:08:28+00:00" - }, - { - "name": "dnoegel/php-xdg-base-dir", - "version": "0.1", - "source": { - "type": "git", - "url": "https://github.com/dnoegel/php-xdg-base-dir.git", - "reference": "265b8593498b997dc2d31e75b89f053b5cc9621a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dnoegel/php-xdg-base-dir/zipball/265b8593498b997dc2d31e75b89f053b5cc9621a", - "reference": "265b8593498b997dc2d31e75b89f053b5cc9621a", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "@stable" - }, - "type": "project", - "autoload": { - "psr-4": { - "XdgBaseDir\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "implementation of xdg base directory specification for php", - "time": "2014-10-24T07:27:01+00:00" - }, - { - "name": "doctrine/annotations", - "version": "v1.2.7", - "source": { - "type": "git", - "url": "https://github.com/doctrine/annotations.git", - "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/f25c8aab83e0c3e976fd7d19875f198ccf2f7535", - "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535", - "shasum": "" - }, - "require": { - "doctrine/lexer": "1.*", - "php": ">=5.3.2" - }, - "require-dev": { - "doctrine/cache": "1.*", - "phpunit/phpunit": "4.*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "psr-0": { - "Doctrine\\Common\\Annotations\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Docblock Annotations Parser", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "annotations", - "docblock", - "parser" - ], - "time": "2015-08-31T12:32:49+00:00" - }, - { - "name": "doctrine/collections", - "version": "v1.3.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/collections.git", - "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/collections/zipball/6c1e4eef75f310ea1b3e30945e9f06e652128b8a", - "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "psr-0": { - "Doctrine\\Common\\Collections\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Collections Abstraction library", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "array", - "collections", - "iterator" - ], - "time": "2015-04-14T22:21:58+00:00" - }, - { - "name": "doctrine/lexer", - "version": "v1.0.1", - "source": { - "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "Doctrine\\Common\\Lexer\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "lexer", - "parser" - ], - "time": "2014-09-09T13:34:57+00:00" - }, - { - "name": "drupal/console-core", - "version": "1.0.0-rc25", - "source": { - "type": "git", - "url": "https://github.com/hechoendrupal/drupal-console-core.git", - "reference": "af7181073cd3cbd2efabe0343f0d5d24fdf02413" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-core/zipball/af7181073cd3cbd2efabe0343f0d5d24fdf02413", - "reference": "af7181073cd3cbd2efabe0343f0d5d24fdf02413", - "shasum": "" - }, - "require": { - "dflydev/dot-access-configuration": "^1.0", - "drupal/console-en": "1.0.0-rc25", - "php": "^5.5.9 || ^7.0", - "stecman/symfony-console-completion": "~0.7", - "symfony/config": "~2.8", - "symfony/console": "~2.8", - "symfony/debug": "~2.8", - "symfony/dependency-injection": "~2.8", - "symfony/event-dispatcher": "~2.8", - "symfony/filesystem": "~2.8", - "symfony/finder": "~2.8", - "symfony/process": "~2.8", - "symfony/translation": "~2.8", - "symfony/yaml": "~2.8", - "twig/twig": "^1.23.1", - "webflo/drupal-finder": "^0.3.0", - "webmozart/path-util": "^2.3" - }, - "type": "project", - "autoload": { - "files": [ - "src/functions.php" - ], - "psr-4": { - "Drupal\\Console\\Core\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "David Flores", - "email": "dmousex@gmail.com", - "homepage": "http://dmouse.net" - }, - { - "name": "Jesus Manuel Olivas", - "email": "jesus.olivas@gmail.com", - "homepage": "http://jmolivas.com" - }, - { - "name": "Drupal Console Contributors", - "homepage": "https://github.com/hechoendrupal/DrupalConsole/graphs/contributors" - }, - { - "name": "Eduardo Garcia", - "email": "enzo@enzolutions.com", - "homepage": "http://enzolutions.com/" - }, - { - "name": "Omar Aguirre", - "email": "omersguchigu@gmail.com" - } - ], - "description": "Drupal Console Core", - "homepage": "http://drupalconsole.com/", - "keywords": [ - "console", - "development", - "drupal", - "symfony" - ], - "time": "2017-07-17T09:10:19+00:00" - }, - { - "name": "drupal/console-dotenv", - "version": "0.3.0", - "source": { - "type": "git", - "url": "https://github.com/weknowinc/drupal-console-dotenv.git", - "reference": "94e88646801c2f80ec2e5e66d3d8f21b0b467405" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/weknowinc/drupal-console-dotenv/zipball/94e88646801c2f80ec2e5e66d3d8f21b0b467405", - "reference": "94e88646801c2f80ec2e5e66d3d8f21b0b467405", - "shasum": "" - }, - "require": { - "vlucas/phpdotenv": "^2.3" - }, - "require-dev": { - "drupal/console-core": "~1.0" - }, - "type": "drupal-console-library", - "autoload": { - "psr-4": { - "Drupal\\Console\\Dotenv\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "Jesus Manuel Olivas", - "email": "jesus.olivas@gmail.com" - } - ], - "description": "Drupal Console Dotenv", - "time": "2017-07-04T01:14:02+00:00" - }, - { - "name": "drupal/console-en", - "version": "1.0.0-rc25", - "source": { - "type": "git", - "url": "https://github.com/hechoendrupal/drupal-console-en.git", - "reference": "63919e6f348ae2c1821952d067bc7e8f5edf6fe8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-en/zipball/63919e6f348ae2c1821952d067bc7e8f5edf6fe8", - "reference": "63919e6f348ae2c1821952d067bc7e8f5edf6fe8", - "shasum": "" - }, - "type": "drupal-console-language", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "David Flores", - "email": "dmousex@gmail.com", - "homepage": "http://dmouse.net" - }, - { - "name": "Jesus Manuel Olivas", - "email": "jesus.olivas@gmail.com", - "homepage": "http://jmolivas.com" - }, - { - "name": "Drupal Console Contributors", - "homepage": "https://github.com/hechoendrupal/DrupalConsole/graphs/contributors" - }, - { - "name": "Eduardo Garcia", - "email": "enzo@enzolutions.com", - "homepage": "http://enzolutions.com/" - }, - { - "name": "Omar Aguirre", - "email": "omersguchigu@gmail.com" - } - ], - "description": "Drupal Console English Language", - "homepage": "http://drupalconsole.com/", - "keywords": [ - "console", - "development", - "drupal", - "symfony" - ], - "time": "2017-07-14T16:41:37+00:00" - }, - { - "name": "drupal/console-extend-plugin", - "version": "0.9.1", - "source": { - "type": "git", - "url": "https://github.com/hechoendrupal/drupal-console-extend-plugin.git", - "reference": "ae2a76680f93c0fea31bbcafc6b0bcc234bb2fb4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hechoendrupal/drupal-console-extend-plugin/zipball/ae2a76680f93c0fea31bbcafc6b0bcc234bb2fb4", - "reference": "ae2a76680f93c0fea31bbcafc6b0bcc234bb2fb4", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.0", - "symfony/finder": ">=2.7 <3.0", - "symfony/yaml": ">=2.7 <3.0" - }, - "type": "composer-plugin", - "extra": { - "class": "Drupal\\Console\\Composer\\Plugin\\Extender" - }, - "autoload": { - "psr-4": { - "Drupal\\Console\\Composer\\Plugin\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "Jesus Manuel Olivas", - "email": "jesus.olivas@gmail.com" - } - ], - "description": "Drupal Console Extend Plugin", - "time": "2017-07-07T05:12:50+00:00" - }, - { - "name": "gabordemooij/redbean", - "version": "v4.3.4", - "source": { - "type": "git", - "url": "https://github.com/gabordemooij/redbean.git", - "reference": "d0944d7f966d7f45a0d973981fe3f64aff0050f0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/gabordemooij/redbean/zipball/d0944d7f966d7f45a0d973981fe3f64aff0050f0", - "reference": "d0944d7f966d7f45a0d973981fe3f64aff0050f0", - "shasum": "" - }, - "require": { - "php": ">=5.3.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "RedBeanPHP\\": "RedBeanPHP" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "New BSD and GPLv2" - ], - "authors": [ - { - "name": "Gabor de Mooij", - "email": "gabor@redbeanphp.com", - "homepage": "http://redbeanphp.com" - } - ], - "description": "RedBeanPHP ORM", - "homepage": "http://redbeanphp.com/", - "keywords": [ - "orm" - ], - "time": "2017-03-07T22:26:54+00:00" - }, - { - "name": "guzzlehttp/guzzle", - "version": "6.3.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699", - "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699", - "shasum": "" - }, - "require": { - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.4", - "php": ">=5.5" - }, - "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "^4.0 || ^5.0", - "psr/log": "^1.0" - }, - "suggest": { - "psr/log": "Required for using the Log middleware" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.2-dev" - } - }, - "autoload": { - "files": [ - "src/functions_include.php" - ], - "psr-4": { - "GuzzleHttp\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle is a PHP HTTP client library", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "rest", - "web service" - ], - "time": "2017-06-22T18:50:49+00:00" - }, - { - "name": "guzzlehttp/promises", - "version": "v1.3.1", - "source": { - "type": "git", - "url": "https://github.com/guzzle/promises.git", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "shasum": "" - }, - "require": { - "php": ">=5.5.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle promises library", - "keywords": [ - "promise" - ], - "time": "2016-12-20T10:07:11+00:00" - }, - { - "name": "guzzlehttp/psr7", - "version": "1.4.2", - "source": { - "type": "git", - "url": "https://github.com/guzzle/psr7.git", - "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", - "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", - "shasum": "" - }, - "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0" - }, - "provide": { - "psr/http-message-implementation": "1.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Tobias Schultze", - "homepage": "https://github.com/Tobion" - } - ], - "description": "PSR-7 message implementation that also provides common utility methods", - "keywords": [ - "http", - "message", - "request", - "response", - "stream", - "uri", - "url" - ], - "time": "2017-03-20T17:10:46+00:00" - }, - { - "name": "ircmaxell/password-compat", - "version": "v1.0.4", - "source": { - "type": "git", - "url": "https://github.com/ircmaxell/password_compat.git", - "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ircmaxell/password_compat/zipball/5c5cde8822a69545767f7c7f3058cb15ff84614c", - "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c", - "shasum": "" - }, - "require-dev": { - "phpunit/phpunit": "4.*" - }, - "type": "library", - "autoload": { - "files": [ - "lib/password.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Anthony Ferrara", - "email": "ircmaxell@php.net", - "homepage": "http://blog.ircmaxell.com" - } - ], - "description": "A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash", - "homepage": "https://github.com/ircmaxell/password_compat", - "keywords": [ - "hashing", - "password" - ], - "time": "2014-11-20T16:49:30+00:00" - }, - { - "name": "jakub-onderka/php-console-color", - "version": "0.1", - "source": { - "type": "git", - "url": "https://github.com/JakubOnderka/PHP-Console-Color.git", - "reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/e0b393dacf7703fc36a4efc3df1435485197e6c1", - "reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "jakub-onderka/php-code-style": "1.0", - "jakub-onderka/php-parallel-lint": "0.*", - "jakub-onderka/php-var-dump-check": "0.*", - "phpunit/phpunit": "3.7.*", - "squizlabs/php_codesniffer": "1.*" - }, - "type": "library", - "autoload": { - "psr-0": { - "JakubOnderka\\PhpConsoleColor": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-2-Clause" - ], - "authors": [ - { - "name": "Jakub Onderka", - "email": "jakub.onderka@gmail.com", - "homepage": "http://www.acci.cz" - } - ], - "time": "2014-04-08T15:00:19+00:00" - }, - { - "name": "jakub-onderka/php-console-highlighter", - "version": "v0.3.2", - "source": { - "type": "git", - "url": "https://github.com/JakubOnderka/PHP-Console-Highlighter.git", - "reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Highlighter/zipball/7daa75df45242c8d5b75a22c00a201e7954e4fb5", - "reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5", - "shasum": "" - }, - "require": { - "jakub-onderka/php-console-color": "~0.1", - "php": ">=5.3.0" - }, - "require-dev": { - "jakub-onderka/php-code-style": "~1.0", - "jakub-onderka/php-parallel-lint": "~0.5", - "jakub-onderka/php-var-dump-check": "~0.1", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~1.5" - }, - "type": "library", - "autoload": { - "psr-0": { - "JakubOnderka\\PhpConsoleHighlighter": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jakub Onderka", - "email": "acci@acci.cz", - "homepage": "http://www.acci.cz/" - } - ], - "time": "2015-04-20T18:58:01+00:00" - }, - { - "name": "nikic/php-parser", - "version": "v3.0.6", - "source": { - "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "0808939f81c1347a3c8a82a5925385a08074b0f1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0808939f81c1347a3c8a82a5925385a08074b0f1", - "reference": "0808939f81c1347a3c8a82a5925385a08074b0f1", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" - }, - "bin": [ - "bin/php-parse" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "PhpParser\\": "lib/PhpParser" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov" - } - ], - "description": "A PHP parser written in PHP", - "keywords": [ - "parser", - "php" - ], - "time": "2017-06-28T20:53:48+00:00" - }, - { - "name": "psr/http-message", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP messages", - "homepage": "https://github.com/php-fig/http-message", - "keywords": [ - "http", - "http-message", - "psr", - "psr-7", - "request", - "response" - ], - "time": "2016-08-06T14:39:51+00:00" - }, - { - "name": "psr/log", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2016-10-10T12:19:37+00:00" - }, - { - "name": "psy/psysh", - "version": "v0.8.9", - "source": { - "type": "git", - "url": "https://github.com/bobthecow/psysh.git", - "reference": "58a31cc4404c8f632d8c557bc72056af2d3a83db" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/58a31cc4404c8f632d8c557bc72056af2d3a83db", - "reference": "58a31cc4404c8f632d8c557bc72056af2d3a83db", - "shasum": "" - }, - "require": { - "dnoegel/php-xdg-base-dir": "0.1", - "jakub-onderka/php-console-highlighter": "0.3.*", - "nikic/php-parser": "~1.3|~2.0|~3.0", - "php": ">=5.3.9", - "symfony/console": "~2.3.10|^2.4.2|~3.0", - "symfony/var-dumper": "~2.7|~3.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "~1.11", - "hoa/console": "~3.16|~1.14", - "phpunit/phpunit": "~4.4|~5.0", - "symfony/finder": "~2.1|~3.0" - }, - "suggest": { - "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", - "ext-pdo-sqlite": "The doc command requires SQLite to work.", - "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.", - "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history.", - "hoa/console": "A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit." - }, - "bin": [ - "bin/psysh" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-develop": "0.8.x-dev" - } - }, - "autoload": { - "files": [ - "src/Psy/functions.php" - ], - "psr-4": { - "Psy\\": "src/Psy/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Justin Hileman", - "email": "justin@justinhileman.info", - "homepage": "http://justinhileman.com" - } - ], - "description": "An interactive shell for modern PHP.", - "homepage": "http://psysh.org", - "keywords": [ - "REPL", - "console", - "interactive", - "shell" - ], - "time": "2017-07-06T14:53:52+00:00" - }, - { - "name": "stecman/symfony-console-completion", - "version": "0.7.0", - "source": { - "type": "git", - "url": "https://github.com/stecman/symfony-console-completion.git", - "reference": "5461d43e53092b3d3b9dbd9d999f2054730f4bbb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/stecman/symfony-console-completion/zipball/5461d43e53092b3d3b9dbd9d999f2054730f4bbb", - "reference": "5461d43e53092b3d3b9dbd9d999f2054730f4bbb", - "shasum": "" - }, - "require": { - "php": ">=5.3.2", - "symfony/console": "~2.3 || ~3.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.6.x-dev" - } - }, - "autoload": { - "psr-4": { - "Stecman\\Component\\Symfony\\Console\\BashCompletion\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Stephen Holdaway", - "email": "stephen@stecman.co.nz" - } - ], - "description": "Automatic BASH completion for Symfony Console Component based applications.", - "time": "2016-02-24T05:08:54+00:00" - }, - { - "name": "symfony/config", - "version": "v2.8.24", - "source": { - "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "0b8541d18507d10204a08384640ff6df3c739ebe" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/0b8541d18507d10204a08384640ff6df3c739ebe", - "reference": "0b8541d18507d10204a08384640ff6df3c739ebe", - "shasum": "" - }, - "require": { - "php": ">=5.3.9", - "symfony/filesystem": "~2.3|~3.0.0" - }, - "require-dev": { - "symfony/yaml": "~2.7|~3.0.0" - }, - "suggest": { - "symfony/yaml": "To use the yaml reference dumper" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Config\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Config Component", - "homepage": "https://symfony.com", - "time": "2017-04-12T14:07:15+00:00" - }, - { - "name": "symfony/console", - "version": "v2.8.24", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "46e65f8d98c9ab629bbfcc16a4ff023f61c37fb2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/46e65f8d98c9ab629bbfcc16a4ff023f61c37fb2", - "reference": "46e65f8d98c9ab629bbfcc16a4ff023f61c37fb2", - "shasum": "" - }, - "require": { - "php": ">=5.3.9", - "symfony/debug": "^2.7.2|~3.0.0", - "symfony/polyfill-mbstring": "~1.0" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1|~3.0.0", - "symfony/process": "~2.1|~3.0.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2017-07-03T08:04:30+00:00" - }, - { - "name": "symfony/css-selector", - "version": "v3.3.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/css-selector.git", - "reference": "4d882dced7b995d5274293039370148e291808f2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/4d882dced7b995d5274293039370148e291808f2", - "reference": "4d882dced7b995d5274293039370148e291808f2", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\CssSelector\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jean-François Simon", - "email": "jeanfrancois.simon@sensiolabs.com" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony CssSelector Component", - "homepage": "https://symfony.com", - "time": "2017-05-01T15:01:29+00:00" - }, - { - "name": "symfony/debug", - "version": "v2.8.24", - "source": { - "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "8470d7701177a88edeb0cec59b44d50ef4477e9b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/8470d7701177a88edeb0cec59b44d50ef4477e9b", - "reference": "8470d7701177a88edeb0cec59b44d50ef4477e9b", - "shasum": "" - }, - "require": { - "php": ">=5.3.9", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" - }, - "require-dev": { - "symfony/class-loader": "~2.2|~3.0.0", - "symfony/http-kernel": "~2.3.24|~2.5.9|^2.6.2|~3.0.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Debug Component", - "homepage": "https://symfony.com", - "time": "2017-06-01T20:52:29+00:00" - }, - { - "name": "symfony/dependency-injection", - "version": "v2.8.24", - "source": { - "type": "git", - "url": "https://github.com/symfony/dependency-injection.git", - "reference": "66d2e252262749e0f3c735c183e4562c72ffb8c8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/66d2e252262749e0f3c735c183e4562c72ffb8c8", - "reference": "66d2e252262749e0f3c735c183e4562c72ffb8c8", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "conflict": { - "symfony/expression-language": "<2.6" - }, - "require-dev": { - "symfony/config": "~2.2|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", - "symfony/yaml": "~2.3.42|~2.7.14|~2.8.7|~3.0.7" - }, - "suggest": { - "symfony/config": "", - "symfony/expression-language": "For using expressions in service container configuration", - "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\DependencyInjection\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony DependencyInjection Component", - "homepage": "https://symfony.com", - "time": "2017-06-14T00:55:24+00:00" - }, - { - "name": "symfony/dom-crawler", - "version": "v3.3.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/dom-crawler.git", - "reference": "fc2c588ce376e9fe04a7b8c79e3ec62fe32d95b1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/fc2c588ce376e9fe04a7b8c79e3ec62fe32d95b1", - "reference": "fc2c588ce376e9fe04a7b8c79e3ec62fe32d95b1", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "symfony/polyfill-mbstring": "~1.0" - }, - "require-dev": { - "symfony/css-selector": "~2.8|~3.0" - }, - "suggest": { - "symfony/css-selector": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\DomCrawler\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony DomCrawler Component", - "homepage": "https://symfony.com", - "time": "2017-05-25T23:10:31+00:00" - }, - { - "name": "symfony/event-dispatcher", - "version": "v2.8.24", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "1377400fd641d7d1935981546aaef780ecd5bf6d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/1377400fd641d7d1935981546aaef780ecd5bf6d", - "reference": "1377400fd641d7d1935981546aaef780ecd5bf6d", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^2.0.5|~3.0.0", - "symfony/dependency-injection": "~2.6|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", - "symfony/stopwatch": "~2.3|~3.0.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com", - "time": "2017-06-02T07:47:27+00:00" - }, - { - "name": "symfony/expression-language", - "version": "v2.8.24", - "source": { - "type": "git", - "url": "https://github.com/symfony/expression-language.git", - "reference": "2b8394d92f012fe3410e55e28c24fd90c9864a01" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/expression-language/zipball/2b8394d92f012fe3410e55e28c24fd90c9864a01", - "reference": "2b8394d92f012fe3410e55e28c24fd90c9864a01", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\ExpressionLanguage\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony ExpressionLanguage Component", - "homepage": "https://symfony.com", - "time": "2017-06-01T20:52:29+00:00" - }, - { - "name": "symfony/filesystem", - "version": "v2.8.24", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "b8c9c18eacc525c980d27c7a2c8fd1e09e0ed4c7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/b8c9c18eacc525c980d27c7a2c8fd1e09e0ed4c7", - "reference": "b8c9c18eacc525c980d27c7a2c8fd1e09e0ed4c7", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "https://symfony.com", - "time": "2017-06-20T23:27:56+00:00" - }, - { - "name": "symfony/finder", - "version": "v2.8.24", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "4f4e84811004e065a3bb5ceeb1d9aa592630f9ad" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/4f4e84811004e065a3bb5ceeb1d9aa592630f9ad", - "reference": "4f4e84811004e065a3bb5ceeb1d9aa592630f9ad", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2017-06-01T20:52:29+00:00" - }, - { - "name": "symfony/http-foundation", - "version": "v2.8.24", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-foundation.git", - "reference": "2b592ca5fe2ad7ee8a92d409d2b830277ad58231" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/2b592ca5fe2ad7ee8a92d409d2b830277ad58231", - "reference": "2b592ca5fe2ad7ee8a92d409d2b830277ad58231", - "shasum": "" - }, - "require": { - "php": ">=5.3.9", - "symfony/polyfill-mbstring": "~1.1", - "symfony/polyfill-php54": "~1.0", - "symfony/polyfill-php55": "~1.0" - }, - "require-dev": { - "symfony/expression-language": "~2.4|~3.0.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpFoundation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony HttpFoundation Component", - "homepage": "https://symfony.com", - "time": "2017-06-20T23:27:56+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "f29dca382a6485c3cbe6379f0c61230167681937" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f29dca382a6485c3cbe6379f0c61230167681937", - "reference": "f29dca382a6485c3cbe6379f0c61230167681937", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2017-06-09T14:24:12+00:00" - }, - { - "name": "symfony/polyfill-php54", - "version": "v1.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php54.git", - "reference": "7dd1a8b9f0442273fdfeb1c4f5eaff6890a82789" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/7dd1a8b9f0442273fdfeb1c4f5eaff6890a82789", - "reference": "7dd1a8b9f0442273fdfeb1c4f5eaff6890a82789", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php54\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 5.4+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2017-06-09T08:25:21+00:00" - }, - { - "name": "symfony/polyfill-php55", - "version": "v1.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php55.git", - "reference": "94566239a7720cde0820f15f0cc348ddb51ba51d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/94566239a7720cde0820f15f0cc348ddb51ba51d", - "reference": "94566239a7720cde0820f15f0cc348ddb51ba51d", - "shasum": "" - }, - "require": { - "ircmaxell/password-compat": "~1.0", - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php55\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2017-06-09T08:25:21+00:00" - }, - { - "name": "symfony/process", - "version": "v2.8.24", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "57e52a0a6a80ea0aec4fc1b785a7920a95cb88a8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/57e52a0a6a80ea0aec4fc1b785a7920a95cb88a8", - "reference": "57e52a0a6a80ea0aec4fc1b785a7920a95cb88a8", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Process Component", - "homepage": "https://symfony.com", - "time": "2017-07-03T08:04:30+00:00" - }, - { - "name": "symfony/translation", - "version": "v2.8.24", - "source": { - "type": "git", - "url": "https://github.com/symfony/translation.git", - "reference": "a89af885b8c6d0142c79a02ca9cc059ed25d40d8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/a89af885b8c6d0142c79a02ca9cc059ed25d40d8", - "reference": "a89af885b8c6d0142c79a02ca9cc059ed25d40d8", - "shasum": "" - }, - "require": { - "php": ">=5.3.9", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/config": "<2.7" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8", - "symfony/intl": "~2.7.25|^2.8.18|~3.2.5", - "symfony/yaml": "~2.2|~3.0.0" - }, - "suggest": { - "psr/log": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Translation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Translation Component", - "homepage": "https://symfony.com", - "time": "2017-06-24T16:44:49+00:00" - }, - { - "name": "symfony/var-dumper", - "version": "v3.3.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/var-dumper.git", - "reference": "9ee920bba1d2ce877496dcafca7cbffff4dbe08a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/9ee920bba1d2ce877496dcafca7cbffff4dbe08a", - "reference": "9ee920bba1d2ce877496dcafca7cbffff4dbe08a", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" - }, - "require-dev": { - "ext-iconv": "*", - "twig/twig": "~1.34|~2.4" - }, - "suggest": { - "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", - "ext-symfony_debug": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "files": [ - "Resources/functions/dump.php" - ], - "psr-4": { - "Symfony\\Component\\VarDumper\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony mechanism for exploring and dumping PHP variables", - "homepage": "https://symfony.com", - "keywords": [ - "debug", - "dump" - ], - "time": "2017-07-05T13:02:37+00:00" - }, - { - "name": "symfony/yaml", - "version": "v2.8.24", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "4c29dec8d489c4e37cf87ccd7166cd0b0e6a45c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/4c29dec8d489c4e37cf87ccd7166cd0b0e6a45c5", - "reference": "4c29dec8d489c4e37cf87ccd7166cd0b0e6a45c5", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2017-06-01T20:52:29+00:00" - }, - { - "name": "twig/twig", - "version": "v1.34.4", - "source": { - "type": "git", - "url": "https://github.com/twigphp/Twig.git", - "reference": "f878bab48edb66ad9c6ed626bf817f60c6c096ee" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/f878bab48edb66ad9c6ed626bf817f60c6c096ee", - "reference": "f878bab48edb66ad9c6ed626bf817f60c6c096ee", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "psr/container": "^1.0", - "symfony/debug": "~2.7", - "symfony/phpunit-bridge": "~3.3@dev" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.34-dev" - } - }, - "autoload": { - "psr-0": { - "Twig_": "lib/" - }, - "psr-4": { - "Twig\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, - { - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com", - "role": "Project Founder" - }, - { - "name": "Twig Team", - "homepage": "http://twig.sensiolabs.org/contributors", - "role": "Contributors" - } - ], - "description": "Twig, the flexible, fast, and secure template language for PHP", - "homepage": "http://twig.sensiolabs.org", - "keywords": [ - "templating" - ], - "time": "2017-07-04T13:19:31+00:00" - }, - { - "name": "vlucas/phpdotenv", - "version": "v2.4.0", - "source": { - "type": "git", - "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c", - "reference": "3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "phpunit/phpunit": "^4.8 || ^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "psr-4": { - "Dotenv\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause-Attribution" - ], - "authors": [ - { - "name": "Vance Lucas", - "email": "vance@vancelucas.com", - "homepage": "http://www.vancelucas.com" - } - ], - "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", - "keywords": [ - "dotenv", - "env", - "environment" - ], - "time": "2016-09-01T10:05:43+00:00" - }, - { - "name": "webflo/drupal-finder", - "version": "0.3.0", - "source": { - "type": "git", - "url": "https://github.com/webflo/drupal-finder.git", - "reference": "6ef150707aad1755d91f9b0d2108bcc16661e76b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webflo/drupal-finder/zipball/6ef150707aad1755d91f9b0d2108bcc16661e76b", - "reference": "6ef150707aad1755d91f9b0d2108bcc16661e76b", - "shasum": "" - }, - "require-dev": { - "mikey179/vfsstream": "^1.6", - "phpunit/phpunit": "^4.8" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/DrupalFinder.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "Florian Weber", - "email": "florian@webflo.org" - } - ], - "description": "Helper class to locate a Drupal installation from a given path.", - "time": "2017-05-04T08:54:02+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2016-11-23T20:04:58+00:00" - }, - { - "name": "webmozart/path-util", - "version": "2.3.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/path-util.git", - "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/path-util/zipball/d939f7edc24c9a1bb9c0dee5cb05d8e859490725", - "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "webmozart/assert": "~1.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\PathUtil\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.", - "time": "2015-12-17T08:42:14+00:00" - } - ], - "packages-dev": [], - "aliases": [], - "minimum-stability": "dev", - "stability-flags": [], - "prefer-stable": true, - "prefer-lowest": false, - "platform": { - "php": "^5.5.9 || ^7.0" - }, - "platform-dev": [] -} From b0513d1d7bfc9f276d2ffa304d6c73cccd0d628d Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 23 Jul 2017 21:16:50 -0700 Subject: [PATCH 310/321] [console] Read root option to allow remote exection. (#3449) --- bin/drupal.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/drupal.php b/bin/drupal.php index 250f3cec2..973eb5d26 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -43,20 +43,21 @@ $input = new ArrayInput([]); $io = new DrupalStyle($input, $output); +$argvInputReader = new ArgvInputReader(); +$root = $argvInputReader->get('root', getcwd()); + $drupalFinder = new DrupalFinder(); -if (!$drupalFinder->locateRoot(getcwd())) { +if (!$drupalFinder->locateRoot($root)) { $io->error('DrupalConsole must be executed within a Drupal Site.'); exit(1); } chdir($drupalFinder->getDrupalRoot()); - $configurationManager = new ConfigurationManager(); $configuration = $configurationManager ->loadConfigurationFromDirectory($drupalFinder->getComposerRoot()); -$argvInputReader = new ArgvInputReader(); $debug = $argvInputReader->get('debug', false); if ($configuration && $options = $configuration->get('application.options') ?: []) { $argvInputReader->setOptionsFromConfiguration($options); From f6091a923a2927c2c359bbb8688aa53f5dee6fb3 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 23 Jul 2017 23:51:37 -0700 Subject: [PATCH 311/321] [debug:breakpoints] Make breakpoint.manager optional. (#3450) --- config/services/debug.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/services/debug.yml b/config/services/debug.yml index 559d4cede..c4dc39559 100644 --- a/config/services/debug.yml +++ b/config/services/debug.yml @@ -92,7 +92,7 @@ services: - { name: drupal.command } console.breakpoints_debug: class: Drupal\Console\Command\Debug\BreakpointsCommand - arguments: ['@breakpoint.manager', '@app.root'] + arguments: ['@?breakpoint.manager', '@app.root'] tags: - { name: drupal.command } console.cache_context_debug: From a10fcb204a5031bd21d4c09eccb0e59131df82c3 Mon Sep 17 00:00:00 2001 From: Christoph Burschka Date: Mon, 24 Jul 2017 09:08:18 +0200 Subject: [PATCH 312/321] Add cache:tag:invalidate command. (#3445) --- config/services/cache.yml | 5 ++ src/Command/Cache/TagInvalidateCommand.php | 72 ++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 src/Command/Cache/TagInvalidateCommand.php diff --git a/config/services/cache.yml b/config/services/cache.yml index 632fe211a..b45064079 100644 --- a/config/services/cache.yml +++ b/config/services/cache.yml @@ -4,3 +4,8 @@ services: arguments: ['@console.drupal_api', '@console.site', '@class_loader', '@request_stack'] tags: - { name: drupal.command } + console.cache_tag_invalidate: + class: Drupal\Console\Command\Cache\TagInvalidateCommand + arguments: ['@cache_tags.invalidator'] + tags: + - { name: drupal.command } diff --git a/src/Command/Cache/TagInvalidateCommand.php b/src/Command/Cache/TagInvalidateCommand.php new file mode 100644 index 000000000..27b522bef --- /dev/null +++ b/src/Command/Cache/TagInvalidateCommand.php @@ -0,0 +1,72 @@ +invalidator = $invalidator; + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('cache:tag:invalidate') + ->setDescription($this->trans('commands.cache.tag.invalidate.description')) + ->addArgument( + 'tag', + InputArgument::REQUIRED | InputArgument::IS_ARRAY, + $this->trans('commands.cache.tag.invalidate.options.tag') + ) + ->setAliases(['cti']); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new DrupalStyle($input, $output); + $tags = $input->getArgument('tag'); + + $io->comment( + sprintf( + $this->trans('commands.cache.tag.invalidate.messages.start'), + implode(', ', $tags) + ) + ); + + $this->invalidator->invalidateTags($tags); + $io->success($this->trans('commands.cache.tag.invalidate.messages.completed')); + } +} From eea21708f431e95ebf703437fc1239f628241bd5 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Mon, 24 Jul 2017 01:10:51 -0700 Subject: [PATCH 313/321] [console] Fix annotation does not exists. (#3451) --- src/Application.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Application.php b/src/Application.php index d3a3489b5..1030f7d7d 100644 --- a/src/Application.php +++ b/src/Application.php @@ -157,6 +157,14 @@ private function registerCommands() foreach ($consoleCommands as $name) { + AnnotationRegistry::reset(); + AnnotationRegistry::registerLoader( + [ + $this->container->get('class_loader'), + "loadClass" + ] + ); + if (!$this->container->has($name)) { continue; } From 90d166432772242eb3ca7dfc89906b74243bb9bb Mon Sep 17 00:00:00 2001 From: Geoff Date: Fri, 28 Jul 2017 01:07:57 -0700 Subject: [PATCH 314/321] Relax doctrine version constraints (#3452) Set constraint to minimum minor version, so that PHP 5.6+ environments can use newer minor versions. --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 81078267b..418774edc 100644 --- a/composer.json +++ b/composer.json @@ -39,8 +39,8 @@ "php": "^5.5.9 || ^7.0", "alchemy/zippy": "0.4.3", "composer/installers": "~1.0", - "doctrine/annotations": "1.2.*", - "doctrine/collections": "1.3.*", + "doctrine/annotations": "^1.2", + "doctrine/collections": "^1.3", "drupal/console-core": "1.0.0-rc25", "drupal/console-dotenv": "~0", "drupal/console-extend-plugin": "~0", From 22bb51dbe0949d1db3d1966aa28fb11502a1474a Mon Sep 17 00:00:00 2001 From: Geoff Date: Fri, 28 Jul 2017 01:09:29 -0700 Subject: [PATCH 315/321] Update Symfony component requirements to allow 3.0+ (#3453) Drupal 8.4 updates Symfony component requirements to ~3.2, so will conflict with a ~2.8 requirement. --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 418774edc..5a517fde8 100644 --- a/composer.json +++ b/composer.json @@ -49,8 +49,8 @@ "psy/psysh": "0.6.* || ~0.8", "symfony/css-selector": "~2.8|~3.0", "symfony/dom-crawler": "~2.8|~3.0", - "symfony/expression-language": "~2.8", - "symfony/http-foundation": "~2.8" + "symfony/expression-language": "~2.8|~3.0", + "symfony/http-foundation": "~2.8|~3.0" }, "bin": ["bin/drupal"], "config": { From 17892babb5589e17ca1af06f1c4e2c7333967fad Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Fri, 28 Jul 2017 02:06:18 -0700 Subject: [PATCH 316/321] [console] Tag 1.0.0-rc26 release. (#3456) --- composer.json | 2 +- src/Application.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 5a517fde8..9fb55366e 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,7 @@ "composer/installers": "~1.0", "doctrine/annotations": "^1.2", "doctrine/collections": "^1.3", - "drupal/console-core": "1.0.0-rc25", + "drupal/console-core": "1.0.0-rc26", "drupal/console-dotenv": "~0", "drupal/console-extend-plugin": "~0", "gabordemooij/redbean": "~4.3", diff --git a/src/Application.php b/src/Application.php index 1030f7d7d..125f82c4b 100644 --- a/src/Application.php +++ b/src/Application.php @@ -25,7 +25,7 @@ class Application extends BaseApplication /** * @var string */ - const VERSION = '1.0.0-rc25'; + const VERSION = '1.0.0-rc26'; public function __construct(ContainerInterface $container) { From fe6c8ea3641e55d00edcb1b61ccfe74083091ae9 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Fri, 28 Jul 2017 14:09:51 -0700 Subject: [PATCH 317/321] [console] Extend base commands. (#3457) --- src/Command/Cache/RebuildCommand.php | 5 +---- src/Command/Debug/ContainerCommand.php | 7 ++----- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Command/Cache/RebuildCommand.php b/src/Command/Cache/RebuildCommand.php index 01fedcd59..fb7fedfb1 100644 --- a/src/Command/Cache/RebuildCommand.php +++ b/src/Command/Cache/RebuildCommand.php @@ -11,8 +11,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Utils\DrupalApi; use Drupal\Console\Utils\Site; use Drupal\Console\Core\Style\DrupalStyle; @@ -24,8 +23,6 @@ */ class RebuildCommand extends Command { - use CommandTrait; - /** * @var DrupalApi */ diff --git a/src/Command/Debug/ContainerCommand.php b/src/Command/Debug/ContainerCommand.php index a8630cef2..03255a54f 100644 --- a/src/Command/Debug/ContainerCommand.php +++ b/src/Command/Debug/ContainerCommand.php @@ -11,9 +11,8 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Symfony\Component\Yaml\Yaml; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Core\Style\DrupalStyle; /** @@ -21,10 +20,8 @@ * * @package Drupal\Console\Command\Debug */ -class ContainerCommand extends Command +class ContainerCommand extends ContainerAwareCommand { - use ContainerAwareCommandTrait; - /** * {@inheritdoc} */ From c3b26846cd6e909fba50a6770db8d32c8d9def86 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sat, 29 Jul 2017 11:20:38 -0700 Subject: [PATCH 318/321] [generate:command] Extend base commands. (#3459) --- templates/module/src/Command/command.php.twig | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/templates/module/src/Command/command.php.twig b/templates/module/src/Command/command.php.twig index bbe779678..6e8b99fa8 100644 --- a/templates/module/src/Command/command.php.twig +++ b/templates/module/src/Command/command.php.twig @@ -13,9 +13,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; {% if container_aware %} -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Command\ContainerAwareCommand; {% else %} -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; {% endif %} use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Annotations\DrupalCommand; @@ -30,7 +30,7 @@ use Drupal\Console\Annotations\DrupalCommand; * extensionType="{{ extensionType }}" * ) */ -class {{ class_name }} extends Command {% endblock %} +class {{ class_name }} extends {% if container_aware %}ContainerAwareCommand{% else %}Command{% endif %} {% endblock %} {% block class_construct %} {% if services is not empty %} @@ -44,15 +44,6 @@ class {{ class_name }} extends Command {% endblock %} {% endif %} {% endblock %} -{% block use_trait %} -{% if container_aware %} - use ContainerAwareCommandTrait; -{% else %} - use CommandTrait; -{% endif %} - -{% endblock %} - {% block class_methods %} /** * {@inheritdoc} From 24233e7187b3e1cccf5f8f9a253003033bc12b03 Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 30 Jul 2017 20:21:39 -0700 Subject: [PATCH 319/321] [console] Extend command base (#3460) * [console] Extend base commands. * [console] Extend command base (#3458) * [console] Extend base commands. (#3457) * [console] Extend base commands --- src/Command/Cache/TagInvalidateCommand.php | 5 +---- src/Command/Config/DeleteCommand.php | 5 +---- src/Command/Config/DiffCommand.php | 5 +---- src/Command/Config/EditCommand.php | 5 +---- src/Command/Config/ExportCommand.php | 5 +---- src/Command/Config/ExportContentTypeCommand.php | 4 +--- src/Command/Config/ExportSingleCommand.php | 4 +--- src/Command/Config/ExportViewCommand.php | 4 +--- src/Command/Config/ImportCommand.php | 5 +---- src/Command/Config/ImportSingleCommand.php | 5 +---- src/Command/Config/OverrideCommand.php | 5 +---- src/Command/Config/ValidateCommand.php | 6 ++---- src/Command/Create/CommentsCommand.php | 4 +--- src/Command/Create/NodesCommand.php | 4 +--- src/Command/Create/TermsCommand.php | 5 +---- src/Command/Create/UsersCommand.php | 4 +--- src/Command/Create/VocabulariesCommand.php | 4 +--- src/Command/Cron/ExecuteCommand.php | 5 +---- src/Command/Cron/ReleaseCommand.php | 4 +--- src/Command/Database/AddCommand.php | 5 +---- src/Command/Database/ClientCommand.php | 4 +--- src/Command/Database/ConnectCommand.php | 4 +--- src/Command/Database/DatabaseLogBase.php | 5 +---- src/Command/Database/DropCommand.php | 4 +--- src/Command/Database/DumpCommand.php | 4 +--- src/Command/Database/LogClearCommand.php | 4 +--- src/Command/Database/QueryCommand.php | 4 +--- src/Command/Database/RestoreCommand.php | 4 +--- src/Command/Debug/BreakpointsCommand.php | 5 +---- src/Command/Debug/CacheContextCommand.php | 7 ++----- src/Command/Debug/ConfigCommand.php | 5 +---- src/Command/Debug/ConfigSettingsCommand.php | 5 +---- src/Command/Debug/ConfigValidateCommand.php | 6 ++---- src/Command/Debug/CronCommand.php | 5 +---- src/Command/Debug/DatabaseTableCommand.php | 4 +--- src/Command/Debug/EntityCommand.php | 5 +---- src/Command/Debug/EventCommand.php | 5 +---- src/Command/Debug/FeaturesCommand.php | 4 +--- src/Command/Debug/ImageStylesCommand.php | 5 +---- src/Command/Debug/LibrariesCommand.php | 5 +---- src/Command/Debug/MigrateCommand.php | 4 +--- src/Command/Debug/ModuleCommand.php | 5 +---- src/Command/Debug/MultisiteCommand.php | 5 +---- src/Command/Debug/PermissionCommand.php | 6 ++---- src/Command/Debug/PluginCommand.php | 6 ++---- src/Command/Debug/QueueCommand.php | 5 +---- src/Command/Debug/RestCommand.php | 4 +--- src/Command/Debug/RouterCommand.php | 5 +---- src/Command/Debug/StateCommand.php | 5 +---- src/Command/Debug/TestCommand.php | 5 +---- src/Command/Debug/ThemeCommand.php | 5 +---- src/Command/Debug/UpdateCommand.php | 5 +---- src/Command/Debug/UserCommand.php | 5 +---- src/Command/Debug/ViewsCommand.php | 5 +---- src/Command/Debug/ViewsPluginsCommand.php | 6 ++---- src/Command/DevelDumperCommand.php | 7 ++----- src/Command/Entity/DeleteCommand.php | 5 +---- src/Command/Features/ImportCommand.php | 4 +--- src/Command/Field/InfoCommand.php | 5 +---- src/Command/Generate/AuthenticationProviderCommand.php | 4 +--- src/Command/Generate/BreakPointCommand.php | 4 +--- src/Command/Generate/CacheContextCommand.php | 6 ++---- src/Command/Generate/CommandCommand.php | 7 +++---- src/Command/Generate/ControllerCommand.php | 6 ++---- src/Command/Generate/EntityBundleCommand.php | 4 +--- src/Command/Generate/EntityCommand.php | 4 +--- src/Command/Generate/EventSubscriberCommand.php | 6 ++---- src/Command/Generate/FormAlterCommand.php | 4 +--- src/Command/Generate/FormCommand.php | 6 ++---- src/Command/Generate/HelpCommand.php | 4 +--- src/Command/Generate/ModuleCommand.php | 4 +--- src/Command/Generate/ModuleFileCommand.php | 4 +--- src/Command/Generate/PermissionCommand.php | 4 +--- src/Command/Generate/PluginBlockCommand.php | 6 ++---- src/Command/Generate/PluginCKEditorButtonCommand.php | 4 +--- src/Command/Generate/PluginConditionCommand.php | 4 +--- src/Command/Generate/PluginFieldCommand.php | 4 +--- src/Command/Generate/PluginFieldFormatterCommand.php | 4 +--- src/Command/Generate/PluginFieldTypeCommand.php | 4 +--- src/Command/Generate/PluginFieldWidgetCommand.php | 4 +--- src/Command/Generate/PluginImageEffectCommand.php | 4 +--- src/Command/Generate/PluginImageFormatterCommand.php | 4 +--- src/Command/Generate/PluginMailCommand.php | 6 ++---- src/Command/Generate/PluginMigrateProcessCommand.php | 6 ++---- src/Command/Generate/PluginMigrateSourceCommand.php | 6 ++---- src/Command/Generate/PluginRestResourceCommand.php | 4 +--- src/Command/Generate/PluginRulesActionCommand.php | 4 +--- src/Command/Generate/PluginSkeletonCommand.php | 6 ++---- src/Command/Generate/PluginTypeAnnotationCommand.php | 4 +--- src/Command/Generate/PluginTypeYamlCommand.php | 4 +--- src/Command/Generate/PluginViewsFieldCommand.php | 5 +---- src/Command/Generate/PostUpdateCommand.php | 4 +--- src/Command/Generate/ProfileCommand.php | 4 +--- src/Command/Generate/RouteSubscriberCommand.php | 4 +--- src/Command/Generate/ServiceCommand.php | 6 ++---- src/Command/Generate/ThemeCommand.php | 4 +--- src/Command/Generate/TwigExtensionCommand.php | 6 ++---- src/Command/Generate/UpdateCommand.php | 4 +--- src/Command/Image/StylesFlushCommand.php | 5 +---- src/Command/Locale/LanguageAddCommand.php | 4 +--- src/Command/Locale/LanguageDeleteCommand.php | 4 +--- src/Command/Locale/TranslationStatusCommand.php | 4 +--- src/Command/Migrate/ExecuteCommand.php | 4 +--- src/Command/Migrate/RollBackCommand.php | 4 +--- src/Command/Migrate/SetupCommand.php | 6 ++---- src/Command/Module/DownloadCommand.php | 4 +--- src/Command/Module/InstallCommand.php | 4 +--- src/Command/Module/InstallDependencyCommand.php | 4 +--- src/Command/Module/PathCommand.php | 4 +--- src/Command/Module/UninstallCommand.php | 4 +--- src/Command/Module/UpdateCommand.php | 4 +--- src/Command/Multisite/NewCommand.php | 5 +---- src/Command/Node/AccessRebuildCommand.php | 5 +---- src/Command/Queue/RunCommand.php | 5 +---- src/Command/Rest/DisableCommand.php | 4 +--- src/Command/Rest/EnableCommand.php | 4 +--- src/Command/Router/RebuildCommand.php | 5 +---- src/Command/ServerCommand.php | 5 +---- src/Command/ShellCommand.php | 5 +---- src/Command/Site/ImportLocalCommand.php | 5 +---- src/Command/Site/InstallCommand.php | 6 ++---- src/Command/Site/MaintenanceCommand.php | 8 ++------ src/Command/Site/ModeCommand.php | 7 ++----- src/Command/Site/StatisticsCommand.php | 7 ++----- src/Command/Site/StatusCommand.php | 7 ++----- src/Command/State/DeleteCommand.php | 5 +---- src/Command/State/OverrideCommand.php | 5 +---- src/Command/Taxonomy/DeleteTermCommand.php | 5 +---- src/Command/Test/RunCommand.php | 5 +---- src/Command/Theme/DownloadCommand.php | 5 +---- src/Command/Theme/InstallCommand.php | 5 +---- src/Command/Theme/PathCommand.php | 6 +----- src/Command/Theme/UninstallCommand.php | 5 +---- src/Command/Update/EntitiesCommand.php | 5 +---- src/Command/Update/ExecuteCommand.php | 5 +---- src/Command/User/CreateCommand.php | 4 +--- src/Command/User/DeleteCommand.php | 5 +---- src/Command/User/LoginCleanAttemptsCommand.php | 4 +--- src/Command/User/LoginUrlCommand.php | 5 +---- src/Command/User/PasswordHashCommand.php | 4 +--- src/Command/User/PasswordResetCommand.php | 4 +--- src/Command/User/RoleCommand.php | 5 +---- src/Command/Views/DisableCommand.php | 5 +---- src/Command/Views/EnableCommand.php | 5 +---- 144 files changed, 170 insertions(+), 521 deletions(-) diff --git a/src/Command/Cache/TagInvalidateCommand.php b/src/Command/Cache/TagInvalidateCommand.php index 27b522bef..f7a978d4c 100644 --- a/src/Command/Cache/TagInvalidateCommand.php +++ b/src/Command/Cache/TagInvalidateCommand.php @@ -7,18 +7,15 @@ namespace Drupal\Console\Command\Cache; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Core\Cache\CacheTagsInvalidatorInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class TagInvalidateCommand extends Command { - use CommandTrait; - /** * @var CacheTagsInvalidatorInterface */ diff --git a/src/Command/Config/DeleteCommand.php b/src/Command/Config/DeleteCommand.php index 99ce41e8b..75a05096d 100644 --- a/src/Command/Config/DeleteCommand.php +++ b/src/Command/Config/DeleteCommand.php @@ -10,17 +10,14 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Yaml\Exception\RuntimeException; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Config\StorageInterface; use Drupal\Core\Config\CachedStorage; use Drupal\Core\Config\ConfigFactory; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; class DeleteCommand extends Command { - use CommandTrait; - protected $allConfig = []; /** diff --git a/src/Command/Config/DiffCommand.php b/src/Command/Config/DiffCommand.php index c97513940..708dd5f39 100644 --- a/src/Command/Config/DiffCommand.php +++ b/src/Command/Config/DiffCommand.php @@ -12,16 +12,13 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Config\CachedStorage; use Drupal\Core\Config\ConfigManager; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; class DiffCommand extends Command { - use CommandTrait; - /** * @var CachedStorage */ diff --git a/src/Command/Config/EditCommand.php b/src/Command/Config/EditCommand.php index fe1ddc46d..a3ef54d9f 100644 --- a/src/Command/Config/EditCommand.php +++ b/src/Command/Config/EditCommand.php @@ -17,15 +17,12 @@ use Drupal\Component\Serialization\Yaml; use Drupal\Core\Config\CachedStorage; use Drupal\Core\Config\ConfigFactory; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Core\Utils\ConfigurationManager; class EditCommand extends Command { - use CommandTrait; - /** * @var ConfigFactory */ diff --git a/src/Command/Config/ExportCommand.php b/src/Command/Config/ExportCommand.php index d0e24e73a..979aa2606 100644 --- a/src/Command/Config/ExportCommand.php +++ b/src/Command/Config/ExportCommand.php @@ -14,16 +14,13 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Symfony\Component\Filesystem\Filesystem; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Core\Config\ConfigManager; class ExportCommand extends Command { - use CommandTrait; - /** * @var ConfigManager */ diff --git a/src/Command/Config/ExportContentTypeCommand.php b/src/Command/Config/ExportContentTypeCommand.php index 684814b8f..f53c3e74c 100644 --- a/src/Command/Config/ExportContentTypeCommand.php +++ b/src/Command/Config/ExportContentTypeCommand.php @@ -12,17 +12,15 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Config\CachedStorage; use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Command\Shared\ExportTrait; use Drupal\Console\Extension\Manager; class ExportContentTypeCommand extends Command { - use CommandTrait; use ModuleTrait; use ExportTrait; diff --git a/src/Command/Config/ExportSingleCommand.php b/src/Command/Config/ExportSingleCommand.php index 28014a19c..b3086265a 100644 --- a/src/Command/Config/ExportSingleCommand.php +++ b/src/Command/Config/ExportSingleCommand.php @@ -12,18 +12,16 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Config\CachedStorage; use Drupal\Console\Core\Style\DrupalStyle; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Command\Shared\ExportTrait; use Drupal\Console\Extension\Manager; use Webmozart\PathUtil\Path; class ExportSingleCommand extends Command { - use CommandTrait; use ExportTrait; /** diff --git a/src/Command/Config/ExportViewCommand.php b/src/Command/Config/ExportViewCommand.php index 3d715472f..87df39718 100644 --- a/src/Command/Config/ExportViewCommand.php +++ b/src/Command/Config/ExportViewCommand.php @@ -11,8 +11,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Config\CachedStorage; @@ -22,7 +21,6 @@ class ExportViewCommand extends Command { - use CommandTrait; use ModuleTrait; use ExportTrait; diff --git a/src/Command/Config/ImportCommand.php b/src/Command/Config/ImportCommand.php index 08a76de87..90eeb26fa 100644 --- a/src/Command/Config/ImportCommand.php +++ b/src/Command/Config/ImportCommand.php @@ -9,10 +9,9 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Config\CachedStorage; use Drupal\Core\Config\ConfigManager; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Core\Config\ConfigImporterException; use Drupal\Core\Config\ConfigImporter; @@ -21,8 +20,6 @@ class ImportCommand extends Command { - use CommandTrait; - /** * @var CachedStorage */ diff --git a/src/Command/Config/ImportSingleCommand.php b/src/Command/Config/ImportSingleCommand.php index 013314ec5..5854fc80a 100644 --- a/src/Command/Config/ImportSingleCommand.php +++ b/src/Command/Config/ImportSingleCommand.php @@ -7,14 +7,13 @@ namespace Drupal\Console\Command\Config; use Drupal\config\StorageReplaceDataWrapper; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Core\Config\CachedStorage; use Drupal\Core\Config\ConfigImporter; use Drupal\Core\Config\ConfigImporterException; use Drupal\Core\Config\ConfigManager; use Drupal\Core\Config\StorageComparer; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -23,8 +22,6 @@ class ImportSingleCommand extends Command { - use CommandTrait; - /** * @var CachedStorage */ diff --git a/src/Command/Config/OverrideCommand.php b/src/Command/Config/OverrideCommand.php index 7d2ad9cc2..e1f1b2beb 100644 --- a/src/Command/Config/OverrideCommand.php +++ b/src/Command/Config/OverrideCommand.php @@ -10,16 +10,13 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Config\CachedStorage; use Drupal\Core\Config\ConfigFactory; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; class OverrideCommand extends Command { - use CommandTrait; - /** * @var CachedStorage */ diff --git a/src/Command/Config/ValidateCommand.php b/src/Command/Config/ValidateCommand.php index bf9f5faf3..a356d946c 100644 --- a/src/Command/Config/ValidateCommand.php +++ b/src/Command/Config/ValidateCommand.php @@ -9,8 +9,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Core\Config\TypedConfigManagerInterface; use Symfony\Component\Console\Input\InputArgument; @@ -21,9 +20,8 @@ * * @package Drupal\Console\Command\Config */ -class ValidateCommand extends Command +class ValidateCommand extends ContainerAwareCommand { - use ContainerAwareCommandTrait; use SchemaCheckTrait; use PrintConfigValidationTrait; diff --git a/src/Command/Create/CommentsCommand.php b/src/Command/Create/CommentsCommand.php index ec8e310a5..4358a8947 100644 --- a/src/Command/Create/CommentsCommand.php +++ b/src/Command/Create/CommentsCommand.php @@ -9,8 +9,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Command\Shared\CreateTrait; use Drupal\Console\Utils\Create\CommentData; use Drupal\Console\Core\Style\DrupalStyle; @@ -23,7 +22,6 @@ class CommentsCommand extends Command { use CreateTrait; - use CommandTrait; /** * @var CommentData diff --git a/src/Command/Create/NodesCommand.php b/src/Command/Create/NodesCommand.php index 0fd33f93f..93d9e6cdc 100644 --- a/src/Command/Create/NodesCommand.php +++ b/src/Command/Create/NodesCommand.php @@ -11,9 +11,8 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Annotations\DrupalCommand; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Command\Shared\CreateTrait; use Drupal\Console\Utils\Create\NodeData; use Drupal\Console\Utils\DrupalApi; @@ -33,7 +32,6 @@ class NodesCommand extends Command { use CreateTrait; - use CommandTrait; /** * @var DrupalApi diff --git a/src/Command/Create/TermsCommand.php b/src/Command/Create/TermsCommand.php index 96cc757f7..213f2e21c 100644 --- a/src/Command/Create/TermsCommand.php +++ b/src/Command/Create/TermsCommand.php @@ -11,8 +11,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Annotations\DrupalCommand; use Drupal\Console\Utils\Create\TermData; use Drupal\Console\Utils\DrupalApi; @@ -30,8 +29,6 @@ */ class TermsCommand extends Command { - use CommandTrait; - /** * @var DrupalApi */ diff --git a/src/Command/Create/UsersCommand.php b/src/Command/Create/UsersCommand.php index 89e91f299..281c886d5 100644 --- a/src/Command/Create/UsersCommand.php +++ b/src/Command/Create/UsersCommand.php @@ -11,8 +11,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Command\Shared\CreateTrait; use Drupal\Console\Utils\Create\UserData; use Drupal\Console\Utils\DrupalApi; @@ -26,7 +25,6 @@ class UsersCommand extends Command { use CreateTrait; - use CommandTrait; /** * @var DrupalApi diff --git a/src/Command/Create/VocabulariesCommand.php b/src/Command/Create/VocabulariesCommand.php index 65087d2f1..a8dca8b90 100644 --- a/src/Command/Create/VocabulariesCommand.php +++ b/src/Command/Create/VocabulariesCommand.php @@ -11,7 +11,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Utils\Create\VocabularyData; use Drupal\Console\Core\Style\DrupalStyle; @@ -22,8 +22,6 @@ */ class VocabulariesCommand extends Command { - use CommandTrait; - /** * @var VocabularyData */ diff --git a/src/Command/Cron/ExecuteCommand.php b/src/Command/Cron/ExecuteCommand.php index 6e6edb636..cb62af297 100644 --- a/src/Command/Cron/ExecuteCommand.php +++ b/src/Command/Cron/ExecuteCommand.php @@ -10,18 +10,15 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Lock\LockBackendInterface; use Drupal\Core\State\StateInterface; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Core\Utils\ChainQueue; class ExecuteCommand extends Command { - use CommandTrait; - /** * @var ModuleHandlerInterface */ diff --git a/src/Command/Cron/ReleaseCommand.php b/src/Command/Cron/ReleaseCommand.php index a4a0ff067..0554cde06 100644 --- a/src/Command/Cron/ReleaseCommand.php +++ b/src/Command/Cron/ReleaseCommand.php @@ -10,7 +10,7 @@ use Symfony\Component\Config\Definition\Exception\Exception; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Lock\LockBackendInterface; use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Console\Core\Command\Shared\CommandTrait; @@ -18,8 +18,6 @@ class ReleaseCommand extends Command { - use CommandTrait; - /** * @var LockBackendInterface */ diff --git a/src/Command/Database/AddCommand.php b/src/Command/Database/AddCommand.php index ee9f3591d..38b8593d1 100644 --- a/src/Command/Database/AddCommand.php +++ b/src/Command/Database/AddCommand.php @@ -11,18 +11,15 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Generator\DatabaseSettingsGenerator; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Command\Shared\ConnectTrait; use Drupal\Console\Core\Style\DrupalStyle; class AddCommand extends Command { - use CommandTrait; use ConnectTrait; - /** * @var DatabaseSettingsGenerator */ diff --git a/src/Command/Database/ClientCommand.php b/src/Command/Database/ClientCommand.php index a36af091b..4d679f472 100644 --- a/src/Command/Database/ClientCommand.php +++ b/src/Command/Database/ClientCommand.php @@ -11,15 +11,13 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Process\ProcessBuilder; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Command\Shared\ConnectTrait; use Drupal\Console\Core\Style\DrupalStyle; class ClientCommand extends Command { use ConnectTrait; - use CommandTrait; /** * {@inheritdoc} diff --git a/src/Command/Database/ConnectCommand.php b/src/Command/Database/ConnectCommand.php index caedf4fe6..229b6a1a6 100644 --- a/src/Command/Database/ConnectCommand.php +++ b/src/Command/Database/ConnectCommand.php @@ -10,14 +10,12 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Command\Shared\ConnectTrait; use Drupal\Console\Core\Style\DrupalStyle; class ConnectCommand extends Command { - use CommandTrait; use ConnectTrait; /** diff --git a/src/Command/Database/DatabaseLogBase.php b/src/Command/Database/DatabaseLogBase.php index f0d8e5056..7adff8a84 100644 --- a/src/Command/Database/DatabaseLogBase.php +++ b/src/Command/Database/DatabaseLogBase.php @@ -7,14 +7,13 @@ namespace Drupal\Console\Command\Database; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Database\Connection; use Drupal\Core\Datetime\DateFormatterInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Core\StringTranslation\TranslationInterface; use Drupal\user\UserStorageInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Logger\RfcLogLevel; use Drupal\user\Entity\User; use Drupal\Component\Utility\Unicode; @@ -30,8 +29,6 @@ */ abstract class DatabaseLogBase extends Command { - use CommandTrait; - /** * @var Connection */ diff --git a/src/Command/Database/DropCommand.php b/src/Command/Database/DropCommand.php index 09b67fd22..4e1e736c0 100644 --- a/src/Command/Database/DropCommand.php +++ b/src/Command/Database/DropCommand.php @@ -10,9 +10,8 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Database\Connection; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Command\Shared\ConnectTrait; use Drupal\Console\Core\Style\DrupalStyle; @@ -23,7 +22,6 @@ */ class DropCommand extends Command { - use CommandTrait; use ConnectTrait; /** diff --git a/src/Command/Database/DumpCommand.php b/src/Command/Database/DumpCommand.php index 403f195f2..8aeb7fbd4 100644 --- a/src/Command/Database/DumpCommand.php +++ b/src/Command/Database/DumpCommand.php @@ -11,15 +11,13 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Command\Shared\ConnectTrait; use Drupal\Console\Core\Utils\ShellProcess; use Drupal\Console\Core\Style\DrupalStyle; class DumpCommand extends Command { - use CommandTrait; use ConnectTrait; diff --git a/src/Command/Database/LogClearCommand.php b/src/Command/Database/LogClearCommand.php index 266a62bcb..87dcdb536 100644 --- a/src/Command/Database/LogClearCommand.php +++ b/src/Command/Database/LogClearCommand.php @@ -11,7 +11,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Database\Connection; use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Logger\RfcLogLevel; @@ -19,8 +19,6 @@ class LogClearCommand extends Command { - use CommandTrait; - /** * @var Connection */ diff --git a/src/Command/Database/QueryCommand.php b/src/Command/Database/QueryCommand.php index ea9479be9..281dc3aef 100644 --- a/src/Command/Database/QueryCommand.php +++ b/src/Command/Database/QueryCommand.php @@ -17,15 +17,13 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Process\ProcessBuilder; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Command\Shared\ConnectTrait; use Drupal\Console\Core\Style\DrupalStyle; class QueryCommand extends Command { use ConnectTrait; - use CommandTrait; /** * {@inheritdoc} diff --git a/src/Command/Database/RestoreCommand.php b/src/Command/Database/RestoreCommand.php index 4e6c8d6d7..673b8edb0 100644 --- a/src/Command/Database/RestoreCommand.php +++ b/src/Command/Database/RestoreCommand.php @@ -12,14 +12,12 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Process\ProcessBuilder; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Command\Shared\ConnectTrait; use Drupal\Console\Core\Style\DrupalStyle; class RestoreCommand extends Command { - use CommandTrait; use ConnectTrait; /** diff --git a/src/Command/Debug/BreakpointsCommand.php b/src/Command/Debug/BreakpointsCommand.php index 0c6f5603e..acf8d362b 100644 --- a/src/Command/Debug/BreakpointsCommand.php +++ b/src/Command/Debug/BreakpointsCommand.php @@ -10,10 +10,9 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\breakpoint\BreakpointManagerInterface; use Symfony\Component\Yaml\Yaml; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Annotations\DrupalCommand; use Drupal\Console\Core\Style\DrupalStyle; @@ -25,8 +24,6 @@ */ class BreakpointsCommand extends Command { - use CommandTrait; - /** * @var BreakpointManagerInterface */ diff --git a/src/Command/Debug/CacheContextCommand.php b/src/Command/Debug/CacheContextCommand.php index 5ffa1cd08..dbbc5be94 100644 --- a/src/Command/Debug/CacheContextCommand.php +++ b/src/Command/Debug/CacheContextCommand.php @@ -9,8 +9,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Console\Core\Style\DrupalStyle; /** @@ -18,10 +17,8 @@ * * @package Drupal\Console\Command\Debug */ -class CacheContextCommand extends Command +class CacheContextCommand extends ContainerAwareCommand { - use ContainerAwareCommandTrait; - /** * {@inheritdoc} */ diff --git a/src/Command/Debug/ConfigCommand.php b/src/Command/Debug/ConfigCommand.php index d7d4527fb..e73d5f286 100644 --- a/src/Command/Debug/ConfigCommand.php +++ b/src/Command/Debug/ConfigCommand.php @@ -13,14 +13,11 @@ use Drupal\Component\Serialization\Yaml; use Drupal\Core\Config\CachedStorage; use Drupal\Core\Config\ConfigFactory; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; class ConfigCommand extends Command { - use CommandTrait; - /** * @var ConfigFactory */ diff --git a/src/Command/Debug/ConfigSettingsCommand.php b/src/Command/Debug/ConfigSettingsCommand.php index 0ce42485e..503d41719 100644 --- a/src/Command/Debug/ConfigSettingsCommand.php +++ b/src/Command/Debug/ConfigSettingsCommand.php @@ -11,8 +11,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Drupal\Component\Serialization\Yaml; use Drupal\Console\Core\Style\DrupalStyle; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Site\Settings; /** @@ -22,8 +21,6 @@ */ class ConfigSettingsCommand extends Command { - use CommandTrait; - /** * @var Settings */ diff --git a/src/Command/Debug/ConfigValidateCommand.php b/src/Command/Debug/ConfigValidateCommand.php index 451679a74..9c23f669c 100644 --- a/src/Command/Debug/ConfigValidateCommand.php +++ b/src/Command/Debug/ConfigValidateCommand.php @@ -11,8 +11,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Console\Core\Style\DrupalStyle; use Symfony\Component\Console\Input\InputArgument; use Drupal\Core\Config\TypedConfigManagerInterface; @@ -24,9 +23,8 @@ * *@package Drupal\Console\Command\Debug */ -class ConfigValidateCommand extends Command +class ConfigValidateCommand extends ContainerAwareCommand { - use ContainerAwareCommandTrait; use SchemaCheckTrait; use PrintConfigValidationTrait; diff --git a/src/Command/Debug/CronCommand.php b/src/Command/Debug/CronCommand.php index 623d989b3..9b7f7d649 100644 --- a/src/Command/Debug/CronCommand.php +++ b/src/Command/Debug/CronCommand.php @@ -9,15 +9,12 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; class CronCommand extends Command { - use CommandTrait; - /** * @var ModuleHandlerInterface */ diff --git a/src/Command/Debug/DatabaseTableCommand.php b/src/Command/Debug/DatabaseTableCommand.php index 8746b4a69..88a77c2d2 100644 --- a/src/Command/Debug/DatabaseTableCommand.php +++ b/src/Command/Debug/DatabaseTableCommand.php @@ -11,10 +11,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use RedBeanPHP\R; use Drupal\Core\Database\Connection; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Command\Shared\ConnectTrait; @@ -25,7 +24,6 @@ */ class DatabaseTableCommand extends Command { - use CommandTrait; use ConnectTrait; /** diff --git a/src/Command/Debug/EntityCommand.php b/src/Command/Debug/EntityCommand.php index 803f9f275..ff1a74c07 100644 --- a/src/Command/Debug/EntityCommand.php +++ b/src/Command/Debug/EntityCommand.php @@ -9,16 +9,13 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Entity\EntityTypeRepository; use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; class EntityCommand extends Command { - use CommandTrait; - /** * @var EntityTypeRepository */ diff --git a/src/Command/Debug/EventCommand.php b/src/Command/Debug/EventCommand.php index 5d27e01a6..126e9bc57 100644 --- a/src/Command/Debug/EventCommand.php +++ b/src/Command/Debug/EventCommand.php @@ -10,9 +10,8 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Symfony\Component\Yaml\Yaml; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; /** @@ -22,8 +21,6 @@ */ class EventCommand extends Command { - use CommandTrait; - protected $eventDispatcher; /** diff --git a/src/Command/Debug/FeaturesCommand.php b/src/Command/Debug/FeaturesCommand.php index a94806058..bcb3bc3f9 100644 --- a/src/Command/Debug/FeaturesCommand.php +++ b/src/Command/Debug/FeaturesCommand.php @@ -11,10 +11,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Drupal\Console\Command\Shared\FeatureTrait; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Annotations\DrupalCommand; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; /** * @DrupalCommand( @@ -25,7 +24,6 @@ class FeaturesCommand extends Command { - use CommandTrait; use FeatureTrait; protected function configure() diff --git a/src/Command/Debug/ImageStylesCommand.php b/src/Command/Debug/ImageStylesCommand.php index 0bf1bb6a9..1a6ecbda7 100644 --- a/src/Command/Debug/ImageStylesCommand.php +++ b/src/Command/Debug/ImageStylesCommand.php @@ -9,9 +9,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; /** @@ -21,8 +20,6 @@ */ class ImageStylesCommand extends Command { - use CommandTrait; - /** * @var EntityTypeManagerInterface */ diff --git a/src/Command/Debug/LibrariesCommand.php b/src/Command/Debug/LibrariesCommand.php index 41875a71f..afd5b58a2 100644 --- a/src/Command/Debug/LibrariesCommand.php +++ b/src/Command/Debug/LibrariesCommand.php @@ -10,18 +10,15 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Extension\ThemeHandlerInterface; use Drupal\Core\Asset\LibraryDiscoveryInterface; use Drupal\Component\Serialization\Yaml; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; class LibrariesCommand extends Command { - use CommandTrait; - /** * @var ModuleHandlerInterface */ diff --git a/src/Command/Debug/MigrateCommand.php b/src/Command/Debug/MigrateCommand.php index 9b2f8b20d..ecaab1a85 100644 --- a/src/Command/Debug/MigrateCommand.php +++ b/src/Command/Debug/MigrateCommand.php @@ -13,8 +13,7 @@ use Drupal\Console\Command\Shared\MigrationTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Annotations\DrupalCommand; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\migrate\Plugin\MigrationPluginManagerInterface; /** @@ -26,7 +25,6 @@ class MigrateCommand extends Command { use MigrationTrait; - use CommandTrait; /** * @var MigrationPluginManagerInterface $pluginManagerMigration diff --git a/src/Command/Debug/ModuleCommand.php b/src/Command/Debug/ModuleCommand.php index 4a8767abc..21417aeb6 100644 --- a/src/Command/Debug/ModuleCommand.php +++ b/src/Command/Debug/ModuleCommand.php @@ -11,8 +11,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\Site; use GuzzleHttp\Client; @@ -20,8 +19,6 @@ class ModuleCommand extends Command { - use CommandTrait; - /** * @var ConfigurationManager */ diff --git a/src/Command/Debug/MultisiteCommand.php b/src/Command/Debug/MultisiteCommand.php index 333af16b0..6dcf18064 100644 --- a/src/Command/Debug/MultisiteCommand.php +++ b/src/Command/Debug/MultisiteCommand.php @@ -9,8 +9,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; /** @@ -20,8 +19,6 @@ */ class MultisiteCommand extends Command { - use CommandTrait; - protected $appRoot; /** diff --git a/src/Command/Debug/PermissionCommand.php b/src/Command/Debug/PermissionCommand.php index 8481ab8b2..759bd069c 100644 --- a/src/Command/Debug/PermissionCommand.php +++ b/src/Command/Debug/PermissionCommand.php @@ -10,8 +10,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Console\Core\Style\DrupalStyle; /** @@ -19,9 +18,8 @@ * * @package Drupal\Console\Command\Debug */ -class PermissionCommand extends Command +class PermissionCommand extends ContainerAwareCommand { - use ContainerAwareCommandTrait; /** * {@inheritdoc} */ diff --git a/src/Command/Debug/PluginCommand.php b/src/Command/Debug/PluginCommand.php index 408c94d4e..bc6e9096b 100644 --- a/src/Command/Debug/PluginCommand.php +++ b/src/Command/Debug/PluginCommand.php @@ -10,9 +10,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Symfony\Component\Yaml\Yaml; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Core\Style\DrupalStyle; /** @@ -20,9 +19,8 @@ * * @package Drupal\Console\Command\Debug */ -class PluginCommand extends Command +class PluginCommand extends ContainerAwareCommand { - use ContainerAwareCommandTrait; /** * {@inheritdoc} */ diff --git a/src/Command/Debug/QueueCommand.php b/src/Command/Debug/QueueCommand.php index 69af8bdff..e4907a260 100644 --- a/src/Command/Debug/QueueCommand.php +++ b/src/Command/Debug/QueueCommand.php @@ -7,11 +7,10 @@ namespace Drupal\Console\Command\Debug; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Drupal\Core\Queue\QueueWorkerManagerInterface; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; /** @@ -21,8 +20,6 @@ */ class QueueCommand extends Command { - use CommandTrait; - /** * @var QueueWorkerManagerInterface */ diff --git a/src/Command/Debug/RestCommand.php b/src/Command/Debug/RestCommand.php index ad1205800..1497365da 100644 --- a/src/Command/Debug/RestCommand.php +++ b/src/Command/Debug/RestCommand.php @@ -11,8 +11,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Annotations\DrupalCommand; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Command\Shared\RestTrait; @@ -26,7 +25,6 @@ */ class RestCommand extends Command { - use CommandTrait; use RestTrait; /** diff --git a/src/Command/Debug/RouterCommand.php b/src/Command/Debug/RouterCommand.php index a5e28fda8..726f0bdc7 100644 --- a/src/Command/Debug/RouterCommand.php +++ b/src/Command/Debug/RouterCommand.php @@ -10,16 +10,13 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Routing\RouteProviderInterface; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Component\Serialization\Yaml; class RouterCommand extends Command { - use CommandTrait; - /** * @var RouteProviderInterface */ diff --git a/src/Command/Debug/StateCommand.php b/src/Command/Debug/StateCommand.php index 60c06b745..88fc5dacd 100644 --- a/src/Command/Debug/StateCommand.php +++ b/src/Command/Debug/StateCommand.php @@ -10,10 +10,9 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\KeyValueStore\KeyValueFactoryInterface; use Drupal\Core\State\StateInterface; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Component\Serialization\Yaml; @@ -24,8 +23,6 @@ */ class StateCommand extends Command { - use CommandTrait; - /** * @var StateInterface */ diff --git a/src/Command/Debug/TestCommand.php b/src/Command/Debug/TestCommand.php index e18c784a5..1985b50e4 100644 --- a/src/Command/Debug/TestCommand.php +++ b/src/Command/Debug/TestCommand.php @@ -12,8 +12,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Drupal\Component\Serialization\Yaml; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Annotations\DrupalCommand; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\simpletest\TestDiscovery; @@ -26,8 +25,6 @@ */ class TestCommand extends Command { - use CommandTrait; - /** * @var TestDiscovery */ diff --git a/src/Command/Debug/ThemeCommand.php b/src/Command/Debug/ThemeCommand.php index 601228947..84a68ce23 100644 --- a/src/Command/Debug/ThemeCommand.php +++ b/src/Command/Debug/ThemeCommand.php @@ -10,16 +10,13 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Extension\ThemeHandler; use Drupal\Console\Core\Style\DrupalStyle; class ThemeCommand extends Command { - use CommandTrait; - /** * @var ConfigFactory */ diff --git a/src/Command/Debug/UpdateCommand.php b/src/Command/Debug/UpdateCommand.php index f61a3684e..6aebfccaa 100644 --- a/src/Command/Debug/UpdateCommand.php +++ b/src/Command/Debug/UpdateCommand.php @@ -9,16 +9,13 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Update\UpdateRegistry; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Utils\Site; use Drupal\Console\Core\Style\DrupalStyle; class UpdateCommand extends Command { - use CommandTrait; - /** * @var Site */ diff --git a/src/Command/Debug/UserCommand.php b/src/Command/Debug/UserCommand.php index a453c578e..48a73c59a 100644 --- a/src/Command/Debug/UserCommand.php +++ b/src/Command/Debug/UserCommand.php @@ -10,8 +10,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\Query\QueryFactory; use Drupal\Console\Core\Style\DrupalStyle; @@ -24,8 +23,6 @@ */ class UserCommand extends Command { - use CommandTrait; - /** * @var EntityTypeManagerInterface */ diff --git a/src/Command/Debug/ViewsCommand.php b/src/Command/Debug/ViewsCommand.php index b11e98c83..4f0a0016d 100644 --- a/src/Command/Debug/ViewsCommand.php +++ b/src/Command/Debug/ViewsCommand.php @@ -11,9 +11,8 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\views\Entity\View; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Console\Core\Style\DrupalStyle; @@ -24,8 +23,6 @@ */ class ViewsCommand extends Command { - use CommandTrait; - /** * @var EntityTypeManagerInterface */ diff --git a/src/Command/Debug/ViewsPluginsCommand.php b/src/Command/Debug/ViewsPluginsCommand.php index 728e465b8..8a86774e5 100644 --- a/src/Command/Debug/ViewsPluginsCommand.php +++ b/src/Command/Debug/ViewsPluginsCommand.php @@ -10,8 +10,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\views\Views; @@ -20,9 +19,8 @@ * * @package Drupal\Console\Command\Debug */ -class ViewsPluginsCommand extends Command +class ViewsPluginsCommand extends ContainerAwareCommand { - use ContainerAwareCommandTrait; /** * {@inheritdoc} */ diff --git a/src/Command/DevelDumperCommand.php b/src/Command/DevelDumperCommand.php index 612b52e73..f19d0412e 100644 --- a/src/Command/DevelDumperCommand.php +++ b/src/Command/DevelDumperCommand.php @@ -7,8 +7,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\devel\DevelDumperPluginManager; use Drupal\devel\DevelDumperManager; @@ -23,10 +22,8 @@ * @todo Move to namespace Devel * @todo Load devel.module legacy file */ -class DevelDumperCommand extends Command +class DevelDumperCommand extends ContainerAwareCommand { - use ContainerAwareCommandTrait; - /** * @var DevelDumperPluginManager */ diff --git a/src/Command/Entity/DeleteCommand.php b/src/Command/Entity/DeleteCommand.php index 561e5a5b6..f9b1ecbb4 100644 --- a/src/Command/Entity/DeleteCommand.php +++ b/src/Command/Entity/DeleteCommand.php @@ -9,16 +9,13 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Entity\EntityTypeRepository; use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; class DeleteCommand extends Command { - use CommandTrait; - /** * @var EntityTypeRepository */ diff --git a/src/Command/Features/ImportCommand.php b/src/Command/Features/ImportCommand.php index e315b9d90..01ef819a7 100644 --- a/src/Command/Features/ImportCommand.php +++ b/src/Command/Features/ImportCommand.php @@ -12,10 +12,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Drupal\Console\Command\Shared\FeatureTrait; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Annotations\DrupalCommand; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; /** * @DrupalCommand( @@ -26,7 +25,6 @@ class ImportCommand extends Command { - use CommandTrait; use FeatureTrait; public function __construct() diff --git a/src/Command/Field/InfoCommand.php b/src/Command/Field/InfoCommand.php index 002359d48..6c57302b0 100644 --- a/src/Command/Field/InfoCommand.php +++ b/src/Command/Field/InfoCommand.php @@ -10,11 +10,10 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Entity\EntityFieldManagerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\field\FieldConfigInterface; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; /** @@ -22,8 +21,6 @@ */ class InfoCommand extends Command { - use CommandTrait; - /** * @var EntityTypeManagerInterface */ diff --git a/src/Command/Generate/AuthenticationProviderCommand.php b/src/Command/Generate/AuthenticationProviderCommand.php index 8e6e2a027..3e608fd05 100644 --- a/src/Command/Generate/AuthenticationProviderCommand.php +++ b/src/Command/Generate/AuthenticationProviderCommand.php @@ -13,11 +13,10 @@ use Drupal\Console\Command\Shared\ServicesTrait; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\FormTrait; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Generator\AuthenticationProviderGenerator; use Drupal\Console\Command\Shared\ConfirmationTrait; use Drupal\Console\Core\Style\DrupalStyle; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Extension\Manager; @@ -27,7 +26,6 @@ class AuthenticationProviderCommand extends Command use ModuleTrait; use FormTrait; use ConfirmationTrait; - use CommandTrait; /** * @var Manager diff --git a/src/Command/Generate/BreakPointCommand.php b/src/Command/Generate/BreakPointCommand.php index dcce46b0f..d4582c55f 100644 --- a/src/Command/Generate/BreakPointCommand.php +++ b/src/Command/Generate/BreakPointCommand.php @@ -10,12 +10,11 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Extension\ThemeHandler; use Drupal\Console\Command\Shared\ThemeRegionTrait; use Drupal\Console\Command\Shared\ThemeBreakpointTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\Validator; use Drupal\Console\Core\Utils\StringConverter; @@ -26,7 +25,6 @@ */ class BreakPointCommand extends Command { - use CommandTrait; use ConfirmationTrait; use ThemeRegionTrait; use ThemeBreakpointTrait; diff --git a/src/Command/Generate/CacheContextCommand.php b/src/Command/Generate/CacheContextCommand.php index 868b77690..f9445c5e7 100644 --- a/src/Command/Generate/CacheContextCommand.php +++ b/src/Command/Generate/CacheContextCommand.php @@ -13,19 +13,17 @@ use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Generator\CacheContextGenerator; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Console\Core\Style\DrupalStyle; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Console\Extension\Manager; use Drupal\Console\Command\Shared\ServicesTrait; use Drupal\Console\Core\Utils\StringConverter; -class CacheContextCommand extends Command +class CacheContextCommand extends ContainerAwareCommand { use ModuleTrait; use ConfirmationTrait; - use ContainerAwareCommandTrait; use ServicesTrait; /** diff --git a/src/Command/Generate/CommandCommand.php b/src/Command/Generate/CommandCommand.php index 9417653e5..e0e15b128 100644 --- a/src/Command/Generate/CommandCommand.php +++ b/src/Command/Generate/CommandCommand.php @@ -12,8 +12,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Console\Command\Shared\ConfirmationTrait; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Generator\CommandGenerator; @@ -23,9 +22,9 @@ use Drupal\Console\Utils\Validator; use Drupal\Console\Utils\Site; -class CommandCommand extends Command +class CommandCommand extends ContainerAwareCommand + { - use ContainerAwareCommandTrait; use ConfirmationTrait; use ServicesTrait; use ModuleTrait; diff --git a/src/Command/Generate/ControllerCommand.php b/src/Command/Generate/ControllerCommand.php index 923f91519..730fd5ee6 100644 --- a/src/Command/Generate/ControllerCommand.php +++ b/src/Command/Generate/ControllerCommand.php @@ -14,23 +14,21 @@ use Drupal\Console\Command\Shared\ConfirmationTrait; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Generator\ControllerGenerator; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Core\Routing\RouteProviderInterface; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Core\Utils\StringConverter; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Console\Core\Command\Shared\InputTrait; use Drupal\Console\Extension\Manager; use Drupal\Console\Utils\Validator; -class ControllerCommand extends Command +class ControllerCommand extends ContainerAwareCommand { use ModuleTrait; use ServicesTrait; use ConfirmationTrait; use InputTrait; - use ContainerAwareCommandTrait; /** * @var Manager diff --git a/src/Command/Generate/EntityBundleCommand.php b/src/Command/Generate/EntityBundleCommand.php index 2a9ef6897..544f9441b 100644 --- a/src/Command/Generate/EntityBundleCommand.php +++ b/src/Command/Generate/EntityBundleCommand.php @@ -7,14 +7,13 @@ namespace Drupal\Console\Command\Generate; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Drupal\Console\Command\Shared\ConfirmationTrait; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ServicesTrait; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Generator\EntityBundleGenerator; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; @@ -22,7 +21,6 @@ class EntityBundleCommand extends Command { - use CommandTrait; use ModuleTrait; use ServicesTrait; use ConfirmationTrait; diff --git a/src/Command/Generate/EntityCommand.php b/src/Command/Generate/EntityCommand.php index d5869edc7..265872f00 100644 --- a/src/Command/Generate/EntityCommand.php +++ b/src/Command/Generate/EntityCommand.php @@ -10,14 +10,12 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Command\Shared\ModuleTrait; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; abstract class EntityCommand extends Command { - use CommandTrait; use ModuleTrait; private $entityType; private $commandName; diff --git a/src/Command/Generate/EventSubscriberCommand.php b/src/Command/Generate/EventSubscriberCommand.php index b4f8b29fb..5554a84fd 100644 --- a/src/Command/Generate/EventSubscriberCommand.php +++ b/src/Command/Generate/EventSubscriberCommand.php @@ -15,21 +15,19 @@ use Drupal\Console\Generator\EventSubscriberGenerator; use Drupal\Console\Command\Shared\ConfirmationTrait; use Drupal\Console\Command\Shared\EventsTrait; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Console\Core\Style\DrupalStyle; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Extension\Manager; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Drupal\Console\Core\Utils\ChainQueue; -class EventSubscriberCommand extends Command +class EventSubscriberCommand extends ContainerAwareCommand { use EventsTrait; use ServicesTrait; use ModuleTrait; use ConfirmationTrait; - use ContainerAwareCommandTrait; /** * @var Manager diff --git a/src/Command/Generate/FormAlterCommand.php b/src/Command/Generate/FormAlterCommand.php index 4c3d876f7..e614a139c 100644 --- a/src/Command/Generate/FormAlterCommand.php +++ b/src/Command/Generate/FormAlterCommand.php @@ -16,9 +16,8 @@ use Drupal\Console\Command\Shared\MenuTrait; use Drupal\Console\Command\Shared\FormTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Extension\Manager; use Drupal\Core\Extension\ModuleHandlerInterface; @@ -35,7 +34,6 @@ class FormAlterCommand extends Command use FormTrait; use MenuTrait; use ConfirmationTrait; - use CommandTrait; /** * @var Manager diff --git a/src/Command/Generate/FormCommand.php b/src/Command/Generate/FormCommand.php index 1eec424d5..7ddc23dd2 100644 --- a/src/Command/Generate/FormCommand.php +++ b/src/Command/Generate/FormCommand.php @@ -14,9 +14,8 @@ use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\MenuTrait; use Drupal\Console\Command\Shared\FormTrait; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Console\Core\Style\DrupalStyle; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Generator\FormGenerator; use Drupal\Console\Extension\Manager; use Drupal\Console\Core\Utils\ChainQueue; @@ -24,9 +23,8 @@ use Drupal\Core\Render\ElementInfoManager; use Drupal\Core\Routing\RouteProviderInterface; -abstract class FormCommand extends Command +abstract class FormCommand extends ContainerAwareCommand { - use ContainerAwareCommandTrait; use ModuleTrait; use ServicesTrait; use FormTrait; diff --git a/src/Command/Generate/HelpCommand.php b/src/Command/Generate/HelpCommand.php index 282aee5f6..8618ed620 100644 --- a/src/Command/Generate/HelpCommand.php +++ b/src/Command/Generate/HelpCommand.php @@ -10,11 +10,10 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Generator\HelpGenerator; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Extension\Manager; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\Site; @@ -22,7 +21,6 @@ class HelpCommand extends Command { - use CommandTrait; use ModuleTrait; use ConfirmationTrait; diff --git a/src/Command/Generate/ModuleCommand.php b/src/Command/Generate/ModuleCommand.php index 215909eea..2956270f8 100644 --- a/src/Command/Generate/ModuleCommand.php +++ b/src/Command/Generate/ModuleCommand.php @@ -13,17 +13,15 @@ use Symfony\Component\Console\Output\OutputInterface; use Drupal\Console\Generator\ModuleGenerator; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\Validator; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Utils\DrupalApi; class ModuleCommand extends Command { use ConfirmationTrait; - use CommandTrait; /** * @var ModuleGenerator diff --git a/src/Command/Generate/ModuleFileCommand.php b/src/Command/Generate/ModuleFileCommand.php index 8d8eca01d..e4d3ed480 100644 --- a/src/Command/Generate/ModuleFileCommand.php +++ b/src/Command/Generate/ModuleFileCommand.php @@ -10,8 +10,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Generator\ModuleFileGenerator; use Drupal\Console\Command\Shared\ConfirmationTrait; use Drupal\Console\Command\Shared\ModuleTrait; @@ -25,7 +24,6 @@ */ class ModuleFileCommand extends Command { - use CommandTrait; use ConfirmationTrait; use ModuleTrait; diff --git a/src/Command/Generate/PermissionCommand.php b/src/Command/Generate/PermissionCommand.php index a7aee3778..3dfa053e0 100644 --- a/src/Command/Generate/PermissionCommand.php +++ b/src/Command/Generate/PermissionCommand.php @@ -10,19 +10,17 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\PermissionTrait; use Drupal\Console\Generator\PermissionGenerator; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; use Drupal\Console\Core\Utils\StringConverter; class PermissionCommand extends Command { - use CommandTrait; use ModuleTrait; use PermissionTrait; use ConfirmationTrait; diff --git a/src/Command/Generate/PluginBlockCommand.php b/src/Command/Generate/PluginBlockCommand.php index 21679d997..eec339549 100644 --- a/src/Command/Generate/PluginBlockCommand.php +++ b/src/Command/Generate/PluginBlockCommand.php @@ -10,13 +10,12 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Console\Generator\PluginBlockGenerator; use Drupal\Console\Command\Shared\ServicesTrait; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\FormTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Extension\Manager; use Drupal\Console\Utils\Validator; use Drupal\Console\Core\Utils\StringConverter; @@ -26,13 +25,12 @@ use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Render\ElementInfoManagerInterface; -class PluginBlockCommand extends Command +class PluginBlockCommand extends ContainerAwareCommand { use ServicesTrait; use ModuleTrait; use FormTrait; use ConfirmationTrait; - use ContainerAwareCommandTrait; /** * @var ConfigFactory diff --git a/src/Command/Generate/PluginCKEditorButtonCommand.php b/src/Command/Generate/PluginCKEditorButtonCommand.php index f73f9bda8..d0bbd7aca 100644 --- a/src/Command/Generate/PluginCKEditorButtonCommand.php +++ b/src/Command/Generate/PluginCKEditorButtonCommand.php @@ -10,11 +10,10 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Generator\PluginCKEditorButtonGenerator; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Console\Extension\Manager; @@ -22,7 +21,6 @@ class PluginCKEditorButtonCommand extends Command { - use CommandTrait; use ModuleTrait; use ConfirmationTrait; diff --git a/src/Command/Generate/PluginConditionCommand.php b/src/Command/Generate/PluginConditionCommand.php index 20d44a924..7b1cbbcfe 100644 --- a/src/Command/Generate/PluginConditionCommand.php +++ b/src/Command/Generate/PluginConditionCommand.php @@ -10,9 +10,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Entity\EntityTypeRepository; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Generator\PluginConditionGenerator; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; @@ -28,7 +27,6 @@ */ class PluginConditionCommand extends Command { - use CommandTrait; use ModuleTrait; use ConfirmationTrait; diff --git a/src/Command/Generate/PluginFieldCommand.php b/src/Command/Generate/PluginFieldCommand.php index 965b54841..28925e10f 100644 --- a/src/Command/Generate/PluginFieldCommand.php +++ b/src/Command/Generate/PluginFieldCommand.php @@ -12,10 +12,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Core\Utils\ChainQueue; @@ -23,7 +22,6 @@ class PluginFieldCommand extends Command { use ModuleTrait; use ConfirmationTrait; - use CommandTrait; /** * @var Manager diff --git a/src/Command/Generate/PluginFieldFormatterCommand.php b/src/Command/Generate/PluginFieldFormatterCommand.php index 627ae163e..0befc9ffd 100644 --- a/src/Command/Generate/PluginFieldFormatterCommand.php +++ b/src/Command/Generate/PluginFieldFormatterCommand.php @@ -13,11 +13,10 @@ use Drupal\Console\Generator\PluginFieldFormatterGenerator; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Core\Field\FieldTypePluginManager; use Drupal\Console\Extension\Manager; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Core\Utils\ChainQueue; @@ -30,7 +29,6 @@ class PluginFieldFormatterCommand extends Command { use ModuleTrait; use ConfirmationTrait; - use CommandTrait; /** * @var Manager diff --git a/src/Command/Generate/PluginFieldTypeCommand.php b/src/Command/Generate/PluginFieldTypeCommand.php index cd7b9c64b..157a1e908 100644 --- a/src/Command/Generate/PluginFieldTypeCommand.php +++ b/src/Command/Generate/PluginFieldTypeCommand.php @@ -13,10 +13,9 @@ use Drupal\Console\Generator\PluginFieldTypeGenerator; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Core\Field\FieldTypePluginManager; @@ -30,7 +29,6 @@ class PluginFieldTypeCommand extends Command { use ModuleTrait; use ConfirmationTrait; - use CommandTrait; /** * @var Manager diff --git a/src/Command/Generate/PluginFieldWidgetCommand.php b/src/Command/Generate/PluginFieldWidgetCommand.php index a56213756..c61ea6cac 100644 --- a/src/Command/Generate/PluginFieldWidgetCommand.php +++ b/src/Command/Generate/PluginFieldWidgetCommand.php @@ -13,10 +13,9 @@ use Drupal\Console\Generator\PluginFieldWidgetGenerator; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Core\Field\FieldTypePluginManager; @@ -30,7 +29,6 @@ class PluginFieldWidgetCommand extends Command { use ModuleTrait; use ConfirmationTrait; - use CommandTrait; /** * @var Manager diff --git a/src/Command/Generate/PluginImageEffectCommand.php b/src/Command/Generate/PluginImageEffectCommand.php index df33700e9..68ca5463c 100644 --- a/src/Command/Generate/PluginImageEffectCommand.php +++ b/src/Command/Generate/PluginImageEffectCommand.php @@ -13,10 +13,9 @@ use Drupal\Console\Generator\PluginImageEffectGenerator; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Core\Utils\ChainQueue; @@ -29,7 +28,6 @@ class PluginImageEffectCommand extends Command { use ModuleTrait; use ConfirmationTrait; - use CommandTrait; /** * @var Manager diff --git a/src/Command/Generate/PluginImageFormatterCommand.php b/src/Command/Generate/PluginImageFormatterCommand.php index 5a3cb696f..07636c997 100644 --- a/src/Command/Generate/PluginImageFormatterCommand.php +++ b/src/Command/Generate/PluginImageFormatterCommand.php @@ -13,10 +13,9 @@ use Drupal\Console\Generator\PluginImageFormatterGenerator; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Utils\Validator; use Drupal\Console\Core\Utils\ChainQueue; @@ -25,7 +24,6 @@ class PluginImageFormatterCommand extends Command { use ModuleTrait; use ConfirmationTrait; - use CommandTrait; /** * @var Manager diff --git a/src/Command/Generate/PluginMailCommand.php b/src/Command/Generate/PluginMailCommand.php index e461ea85a..cf983fb74 100644 --- a/src/Command/Generate/PluginMailCommand.php +++ b/src/Command/Generate/PluginMailCommand.php @@ -15,10 +15,9 @@ use Drupal\Console\Command\Shared\FormTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; use Drupal\Console\Generator\PluginMailGenerator; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Utils\Validator; use Drupal\Console\Core\Utils\ChainQueue; @@ -28,13 +27,12 @@ * * @package Drupal\Console\Command\Generate */ -class PluginMailCommand extends Command +class PluginMailCommand extends ContainerAwareCommand { use ServicesTrait; use ModuleTrait; use FormTrait; use ConfirmationTrait; - use ContainerAwareCommandTrait; /** * @var Manager diff --git a/src/Command/Generate/PluginMigrateProcessCommand.php b/src/Command/Generate/PluginMigrateProcessCommand.php index cf705508c..14aaae194 100644 --- a/src/Command/Generate/PluginMigrateProcessCommand.php +++ b/src/Command/Generate/PluginMigrateProcessCommand.php @@ -10,21 +10,19 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Console\Generator\PluginMigrateProcessGenerator; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Extension\Manager; use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Core\Utils\ChainQueue; -class PluginMigrateProcessCommand extends Command +class PluginMigrateProcessCommand extends ContainerAwareCommand { use ModuleTrait; use ConfirmationTrait; - use ContainerAwareCommandTrait; /** * @var PluginMigrateProcessGenerator diff --git a/src/Command/Generate/PluginMigrateSourceCommand.php b/src/Command/Generate/PluginMigrateSourceCommand.php index 603b0679c..5fd86db3b 100644 --- a/src/Command/Generate/PluginMigrateSourceCommand.php +++ b/src/Command/Generate/PluginMigrateSourceCommand.php @@ -10,11 +10,10 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Console\Generator\PluginMigrateSourceGenerator; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Extension\Manager; use Drupal\Console\Utils\Validator; use Drupal\Console\Core\Utils\StringConverter; @@ -24,11 +23,10 @@ use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Render\ElementInfoManagerInterface; -class PluginMigrateSourceCommand extends Command +class PluginMigrateSourceCommand extends ContainerAwareCommand { use ModuleTrait; use ConfirmationTrait; - use ContainerAwareCommandTrait; /** * @var ConfigFactory diff --git a/src/Command/Generate/PluginRestResourceCommand.php b/src/Command/Generate/PluginRestResourceCommand.php index c11e9685d..e10a6a892 100644 --- a/src/Command/Generate/PluginRestResourceCommand.php +++ b/src/Command/Generate/PluginRestResourceCommand.php @@ -15,10 +15,9 @@ use Drupal\Console\Command\Shared\FormTrait; use Drupal\Console\Generator\PluginRestResourceGenerator; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Core\Utils\ChainQueue; @@ -33,7 +32,6 @@ class PluginRestResourceCommand extends Command use ModuleTrait; use FormTrait; use ConfirmationTrait; - use CommandTrait; /** * @var Manager diff --git a/src/Command/Generate/PluginRulesActionCommand.php b/src/Command/Generate/PluginRulesActionCommand.php index 6a063f2b7..fbdfe2575 100644 --- a/src/Command/Generate/PluginRulesActionCommand.php +++ b/src/Command/Generate/PluginRulesActionCommand.php @@ -15,10 +15,9 @@ use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\FormTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Core\Utils\ChainQueue; @@ -33,7 +32,6 @@ class PluginRulesActionCommand extends Command use ModuleTrait; use FormTrait; use ConfirmationTrait; - use CommandTrait; /** * @var Manager diff --git a/src/Command/Generate/PluginSkeletonCommand.php b/src/Command/Generate/PluginSkeletonCommand.php index 01a3dfa00..c86568b0e 100644 --- a/src/Command/Generate/PluginSkeletonCommand.php +++ b/src/Command/Generate/PluginSkeletonCommand.php @@ -11,13 +11,12 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; use Drupal\Console\Command\Shared\ServicesTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Console\Utils\Validator; @@ -27,12 +26,11 @@ * * @package Drupal\Console\Command\Generate */ -class PluginSkeletonCommand extends Command +class PluginSkeletonCommand extends ContainerAwareCommand { use ModuleTrait; use ConfirmationTrait; use ServicesTrait; - use ContainerAwareCommandTrait; /** * @var Manager diff --git a/src/Command/Generate/PluginTypeAnnotationCommand.php b/src/Command/Generate/PluginTypeAnnotationCommand.php index 93bd76d82..9454cb877 100644 --- a/src/Command/Generate/PluginTypeAnnotationCommand.php +++ b/src/Command/Generate/PluginTypeAnnotationCommand.php @@ -15,9 +15,8 @@ use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\FormTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Extension\Manager; use Drupal\Console\Core\Utils\StringConverter; @@ -32,7 +31,6 @@ class PluginTypeAnnotationCommand extends Command use ModuleTrait; use FormTrait; use ConfirmationTrait; - use CommandTrait; /** * @var Manager diff --git a/src/Command/Generate/PluginTypeYamlCommand.php b/src/Command/Generate/PluginTypeYamlCommand.php index 3674b6ec4..d1987bebb 100644 --- a/src/Command/Generate/PluginTypeYamlCommand.php +++ b/src/Command/Generate/PluginTypeYamlCommand.php @@ -15,10 +15,9 @@ use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\FormTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Core\Utils\ChainQueue; @@ -33,7 +32,6 @@ class PluginTypeYamlCommand extends Command use ModuleTrait; use FormTrait; use ConfirmationTrait; - use CommandTrait; /** * @var Manager diff --git a/src/Command/Generate/PluginViewsFieldCommand.php b/src/Command/Generate/PluginViewsFieldCommand.php index b91b08ad8..f0e0f971c 100644 --- a/src/Command/Generate/PluginViewsFieldCommand.php +++ b/src/Command/Generate/PluginViewsFieldCommand.php @@ -13,11 +13,10 @@ use Drupal\Console\Generator\PluginViewsFieldGenerator; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; use Drupal\Console\Core\Utils\ChainQueue; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Utils\Site; use Drupal\Console\Core\Utils\StringConverter; @@ -30,8 +29,6 @@ class PluginViewsFieldCommand extends Command { use ModuleTrait; use ConfirmationTrait; - use CommandTrait; - /** * @var Manager diff --git a/src/Command/Generate/PostUpdateCommand.php b/src/Command/Generate/PostUpdateCommand.php index 0cad7f377..24b40fbae 100644 --- a/src/Command/Generate/PostUpdateCommand.php +++ b/src/Command/Generate/PostUpdateCommand.php @@ -13,11 +13,10 @@ use Drupal\Console\Generator\PostUpdateGenerator; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; use Drupal\Console\Core\Utils\ChainQueue; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Utils\Site; use Drupal\Console\Utils\Validator; @@ -30,7 +29,6 @@ class PostUpdateCommand extends Command { use ModuleTrait; use ConfirmationTrait; - use CommandTrait; /** * @var Manager diff --git a/src/Command/Generate/ProfileCommand.php b/src/Command/Generate/ProfileCommand.php index f26791ae2..60e93dd96 100644 --- a/src/Command/Generate/ProfileCommand.php +++ b/src/Command/Generate/ProfileCommand.php @@ -8,13 +8,12 @@ namespace Drupal\Console\Command\Generate; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Generator\ProfileGenerator; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Drupal\Console\Core\Style\DrupalStyle; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Extension\Manager; use Drupal\Console\Core\Utils\StringConverter; use Drupal\Console\Utils\Validator; @@ -28,7 +27,6 @@ class ProfileCommand extends Command { use ConfirmationTrait; - use CommandTrait; /** * @var Manager diff --git a/src/Command/Generate/RouteSubscriberCommand.php b/src/Command/Generate/RouteSubscriberCommand.php index acc64fdd9..a6b11d5f1 100644 --- a/src/Command/Generate/RouteSubscriberCommand.php +++ b/src/Command/Generate/RouteSubscriberCommand.php @@ -13,11 +13,10 @@ use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Generator\RouteSubscriberGenerator; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; use Drupal\Console\Core\Utils\ChainQueue; -use Drupal\Console\Core\Command\Shared\CommandTrait; /** * Class RouteSubscriberCommand @@ -28,7 +27,6 @@ class RouteSubscriberCommand extends Command { use ModuleTrait; use ConfirmationTrait; - use CommandTrait; /** * @var Manager diff --git a/src/Command/Generate/ServiceCommand.php b/src/Command/Generate/ServiceCommand.php index 859bcfe1b..e6563dbe5 100644 --- a/src/Command/Generate/ServiceCommand.php +++ b/src/Command/Generate/ServiceCommand.php @@ -14,9 +14,8 @@ use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Generator\ServiceGenerator; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Console\Core\Style\DrupalStyle; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Extension\Manager; use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Console\Core\Utils\StringConverter; @@ -26,12 +25,11 @@ * * @package Drupal\Console\Command\Generate */ -class ServiceCommand extends Command +class ServiceCommand extends ContainerAwareCommand { use ServicesTrait; use ModuleTrait; use ConfirmationTrait; - use ContainerAwareCommandTrait; /** * @var Manager diff --git a/src/Command/Generate/ThemeCommand.php b/src/Command/Generate/ThemeCommand.php index e92af8d1f..2156e9381 100644 --- a/src/Command/Generate/ThemeCommand.php +++ b/src/Command/Generate/ThemeCommand.php @@ -14,12 +14,11 @@ use Drupal\Console\Command\Shared\ThemeBreakpointTrait; use Drupal\Console\Generator\ThemeGenerator; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; use Drupal\Console\Utils\Site; use Drupal\Console\Core\Utils\StringConverter; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Utils\Validator; use Drupal\Core\Extension\ThemeHandler; @@ -33,7 +32,6 @@ class ThemeCommand extends Command use ConfirmationTrait; use ThemeRegionTrait; use ThemeBreakpointTrait; - use CommandTrait; /** * @var Manager diff --git a/src/Command/Generate/TwigExtensionCommand.php b/src/Command/Generate/TwigExtensionCommand.php index a4f6a72d4..d91cfe6c4 100644 --- a/src/Command/Generate/TwigExtensionCommand.php +++ b/src/Command/Generate/TwigExtensionCommand.php @@ -6,7 +6,7 @@ namespace Drupal\Console\Command\Generate; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Console\Command\Shared\ConfirmationTrait; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ServicesTrait; @@ -19,19 +19,17 @@ use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Console\Utils\Site; use Drupal\Console\Core\Utils\StringConverter; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; /** * Class TwigExtensionCommand * * @package Drupal\Console\Command\Generate */ -class TwigExtensionCommand extends Command +class TwigExtensionCommand extends ContainerAwareCommand { use ModuleTrait; use ServicesTrait; use ConfirmationTrait; - use ContainerAwareCommandTrait; /** * @var Manager diff --git a/src/Command/Generate/UpdateCommand.php b/src/Command/Generate/UpdateCommand.php index 257845522..f3b41ad16 100644 --- a/src/Command/Generate/UpdateCommand.php +++ b/src/Command/Generate/UpdateCommand.php @@ -13,8 +13,7 @@ use Drupal\Console\Generator\UpdateGenerator; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; use Drupal\Console\Core\Utils\ChainQueue; @@ -29,7 +28,6 @@ class UpdateCommand extends Command { use ModuleTrait; use ConfirmationTrait; - use CommandTrait; /** * @var Manager diff --git a/src/Command/Image/StylesFlushCommand.php b/src/Command/Image/StylesFlushCommand.php index cd85dea71..c9b267a6a 100644 --- a/src/Command/Image/StylesFlushCommand.php +++ b/src/Command/Image/StylesFlushCommand.php @@ -9,15 +9,12 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; class StylesFlushCommand extends Command { - use CommandTrait; - /** * @var EntityTypeManagerInterface */ diff --git a/src/Command/Locale/LanguageAddCommand.php b/src/Command/Locale/LanguageAddCommand.php index 4baf8ef9e..9ea8eb5dd 100644 --- a/src/Command/Locale/LanguageAddCommand.php +++ b/src/Command/Locale/LanguageAddCommand.php @@ -11,10 +11,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Drupal\language\Entity\ConfigurableLanguage; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Command\Shared\LocaleTrait; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Console\Utils\Site; use Drupal\Console\Annotations\DrupalCommand; @@ -27,7 +26,6 @@ */ class LanguageAddCommand extends Command { - use CommandTrait; use LocaleTrait; /** diff --git a/src/Command/Locale/LanguageDeleteCommand.php b/src/Command/Locale/LanguageDeleteCommand.php index c6689bf12..2a27accbc 100644 --- a/src/Command/Locale/LanguageDeleteCommand.php +++ b/src/Command/Locale/LanguageDeleteCommand.php @@ -11,9 +11,8 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Command\Shared\LocaleTrait; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Console\Utils\Site; @@ -27,7 +26,6 @@ */ class LanguageDeleteCommand extends Command { - use CommandTrait; use LocaleTrait; /** diff --git a/src/Command/Locale/TranslationStatusCommand.php b/src/Command/Locale/TranslationStatusCommand.php index 95ed676fd..4c8f0304b 100644 --- a/src/Command/Locale/TranslationStatusCommand.php +++ b/src/Command/Locale/TranslationStatusCommand.php @@ -10,10 +10,9 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Command\Shared\LocaleTrait; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Utils\Site; use Drupal\Console\Extension\Manager; use Drupal\Console\Annotations\DrupalCommand; @@ -26,7 +25,6 @@ */ class TranslationStatusCommand extends Command { - use CommandTrait; use LocaleTrait; /** diff --git a/src/Command/Migrate/ExecuteCommand.php b/src/Command/Migrate/ExecuteCommand.php index ceb4083c3..06ad78724 100644 --- a/src/Command/Migrate/ExecuteCommand.php +++ b/src/Command/Migrate/ExecuteCommand.php @@ -16,11 +16,10 @@ use Drupal\Console\Utils\MigrateExecuteMessageCapture; use Drupal\Console\Command\Shared\MigrationTrait; use Drupal\Console\Command\Shared\DatabaseTrait; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\migrate\Plugin\MigrationInterface; use Drupal\State\StateInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\migrate\Plugin\MigrationPluginManagerInterface; use Drupal\Console\Annotations\DrupalCommand; @@ -34,7 +33,6 @@ class ExecuteCommand extends Command { use DatabaseTrait; use MigrationTrait; - use CommandTrait; protected $migrateConnection; diff --git a/src/Command/Migrate/RollBackCommand.php b/src/Command/Migrate/RollBackCommand.php index 84468e6d2..d8ae107ed 100644 --- a/src/Command/Migrate/RollBackCommand.php +++ b/src/Command/Migrate/RollBackCommand.php @@ -14,8 +14,7 @@ use Drupal\Console\Command\Shared\MigrationTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Annotations\DrupalCommand; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\migrate_plus\Entity\MigrationGroup; use Drupal\migrate\Plugin\MigrationInterface; use Drupal\migrate\MigrateExecutable; @@ -31,7 +30,6 @@ class RollBackCommand extends Command { use MigrationTrait; - use CommandTrait; /** * @var MigrationPluginManagerInterface $pluginManagerMigration diff --git a/src/Command/Migrate/SetupCommand.php b/src/Command/Migrate/SetupCommand.php index ae249249e..ecd16286d 100644 --- a/src/Command/Migrate/SetupCommand.php +++ b/src/Command/Migrate/SetupCommand.php @@ -12,8 +12,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Console\Command\Shared\DatabaseTrait; use Drupal\Console\Command\Shared\MigrationTrait; use Drupal\migrate\Plugin\MigrationPluginManagerInterface; @@ -28,9 +27,8 @@ * extensionType = "module" * ) */ -class SetupCommand extends Command +class SetupCommand extends ContainerAwareCommand { - use ContainerAwareCommandTrait; use DatabaseTrait; use MigrationTrait; diff --git a/src/Command/Module/DownloadCommand.php b/src/Command/Module/DownloadCommand.php index 8640f4027..56c8130c8 100644 --- a/src/Command/Module/DownloadCommand.php +++ b/src/Command/Module/DownloadCommand.php @@ -7,12 +7,11 @@ namespace Drupal\Console\Command\Module; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Command\Shared\ProjectDownloadTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\DrupalApi; @@ -25,7 +24,6 @@ class DownloadCommand extends Command { - use CommandTrait; use ProjectDownloadTrait; /** diff --git a/src/Command/Module/InstallCommand.php b/src/Command/Module/InstallCommand.php index 3d08bf13a..81a3c25b6 100644 --- a/src/Command/Module/InstallCommand.php +++ b/src/Command/Module/InstallCommand.php @@ -7,13 +7,12 @@ namespace Drupal\Console\Command\Module; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Process\ProcessBuilder; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Command\Shared\ProjectDownloadTrait; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Core\Style\DrupalStyle; @@ -31,7 +30,6 @@ */ class InstallCommand extends Command { - use CommandTrait; use ProjectDownloadTrait; use ModuleTrait; diff --git a/src/Command/Module/InstallDependencyCommand.php b/src/Command/Module/InstallDependencyCommand.php index 884a2be7b..311b98475 100644 --- a/src/Command/Module/InstallDependencyCommand.php +++ b/src/Command/Module/InstallDependencyCommand.php @@ -7,12 +7,11 @@ namespace Drupal\Console\Command\Module; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Command\Shared\ProjectDownloadTrait; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Core\Style\DrupalStyle; @@ -28,7 +27,6 @@ */ class InstallDependencyCommand extends Command { - use CommandTrait; use ProjectDownloadTrait; use ModuleTrait; diff --git a/src/Command/Module/PathCommand.php b/src/Command/Module/PathCommand.php index a32f6cf42..0d8cfa697 100644 --- a/src/Command/Module/PathCommand.php +++ b/src/Command/Module/PathCommand.php @@ -11,15 +11,13 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Extension\Manager; class PathCommand extends Command { - use CommandTrait; use ModuleTrait; /** diff --git a/src/Command/Module/UninstallCommand.php b/src/Command/Module/UninstallCommand.php index 114c1ee3d..603f00d76 100755 --- a/src/Command/Module/UninstallCommand.php +++ b/src/Command/Module/UninstallCommand.php @@ -7,13 +7,12 @@ namespace Drupal\Console\Command\Module; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Extension\Manager; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Command\Shared\ProjectDownloadTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\Site; @@ -23,7 +22,6 @@ class UninstallCommand extends Command { - use CommandTrait; use ProjectDownloadTrait; /** diff --git a/src/Command/Module/UpdateCommand.php b/src/Command/Module/UpdateCommand.php index db251277c..511c100fe 100644 --- a/src/Command/Module/UpdateCommand.php +++ b/src/Command/Module/UpdateCommand.php @@ -7,19 +7,17 @@ namespace Drupal\Console\Command\Module; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Command\Shared\ProjectDownloadTrait; use Drupal\Console\Core\Utils\ShellProcess; class UpdateCommand extends Command { - use CommandTrait; use ProjectDownloadTrait; diff --git a/src/Command/Multisite/NewCommand.php b/src/Command/Multisite/NewCommand.php index 008bb09c2..8e8e1c3fc 100644 --- a/src/Command/Multisite/NewCommand.php +++ b/src/Command/Multisite/NewCommand.php @@ -7,9 +7,8 @@ namespace Drupal\Console\Command\Multisite; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -25,8 +24,6 @@ */ class NewCommand extends Command { - use CommandTrait; - protected $appRoot; /** diff --git a/src/Command/Node/AccessRebuildCommand.php b/src/Command/Node/AccessRebuildCommand.php index e8abf86a6..dabbb73b1 100644 --- a/src/Command/Node/AccessRebuildCommand.php +++ b/src/Command/Node/AccessRebuildCommand.php @@ -10,9 +10,8 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\State\StateInterface; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; /** @@ -22,8 +21,6 @@ */ class AccessRebuildCommand extends Command { - use CommandTrait; - /** * @var StateInterface */ diff --git a/src/Command/Queue/RunCommand.php b/src/Command/Queue/RunCommand.php index 7fac3e05d..d45f4db75 100644 --- a/src/Command/Queue/RunCommand.php +++ b/src/Command/Queue/RunCommand.php @@ -7,13 +7,12 @@ namespace Drupal\Console\Command\Queue; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Drupal\Core\Queue\QueueWorkerManagerInterface; use Drupal\Core\Queue\QueueFactory; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; /** @@ -23,8 +22,6 @@ */ class RunCommand extends Command { - use CommandTrait; - /** * @var QueueWorkerManagerInterface */ diff --git a/src/Command/Rest/DisableCommand.php b/src/Command/Rest/DisableCommand.php index a2778574b..b42bdc8b6 100644 --- a/src/Command/Rest/DisableCommand.php +++ b/src/Command/Rest/DisableCommand.php @@ -10,8 +10,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Annotations\DrupalCommand; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Command\Shared\RestTrait; @@ -26,7 +25,6 @@ */ class DisableCommand extends Command { - use CommandTrait; use RestTrait; /** diff --git a/src/Command/Rest/EnableCommand.php b/src/Command/Rest/EnableCommand.php index 121c7903a..1a7c6c0ec 100644 --- a/src/Command/Rest/EnableCommand.php +++ b/src/Command/Rest/EnableCommand.php @@ -10,8 +10,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Annotations\DrupalCommand; use Drupal\rest\RestResourceConfigInterface; use Drupal\Console\Core\Style\DrupalStyle; @@ -29,7 +28,6 @@ */ class EnableCommand extends Command { - use CommandTrait; use RestTrait; /** diff --git a/src/Command/Router/RebuildCommand.php b/src/Command/Router/RebuildCommand.php index e1b06ef73..7c5bc5bb8 100644 --- a/src/Command/Router/RebuildCommand.php +++ b/src/Command/Router/RebuildCommand.php @@ -9,15 +9,12 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Routing\RouteBuilderInterface; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; class RebuildCommand extends Command { - use CommandTrait; - /** * @var RouteBuilderInterface */ diff --git a/src/Command/ServerCommand.php b/src/Command/ServerCommand.php index e306ceeca..16e1c7fcc 100644 --- a/src/Command/ServerCommand.php +++ b/src/Command/ServerCommand.php @@ -12,8 +12,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Process\ProcessBuilder; use Symfony\Component\Process\PhpExecutableFinder; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use \Drupal\Console\Core\Utils\ConfigurationManager; @@ -24,8 +23,6 @@ */ class ServerCommand extends Command { - use CommandTrait; - /** * @var string */ diff --git a/src/Command/ShellCommand.php b/src/Command/ShellCommand.php index 1c9b20c45..7db66821f 100644 --- a/src/Command/ShellCommand.php +++ b/src/Command/ShellCommand.php @@ -6,8 +6,7 @@ use Psy\Configuration; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; /** * Class ShellCommand @@ -16,8 +15,6 @@ */ class ShellCommand extends Command { - use CommandTrait; - /** * {@inheritdoc} */ diff --git a/src/Command/Site/ImportLocalCommand.php b/src/Command/Site/ImportLocalCommand.php index 9b030cbed..ef2750f2b 100644 --- a/src/Command/Site/ImportLocalCommand.php +++ b/src/Command/Site/ImportLocalCommand.php @@ -11,8 +11,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Core\Utils\ConfigurationManager; use Symfony\Component\Filesystem\Filesystem; @@ -25,8 +24,6 @@ */ class ImportLocalCommand extends Command { - use CommandTrait; - /** * @var string */ diff --git a/src/Command/Site/InstallCommand.php b/src/Command/Site/InstallCommand.php index 480219581..19f4dde6c 100644 --- a/src/Command/Site/InstallCommand.php +++ b/src/Command/Site/InstallCommand.php @@ -13,10 +13,9 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Core\Database\Database; use Drupal\Core\Installer\Exception\AlreadyInstalledException; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Command\Shared\DatabaseTrait; use Drupal\Console\Core\Utils\ConfigurationManager; use Drupal\Console\Extension\Manager; @@ -25,9 +24,8 @@ use Drupal\Console\Utils\Site; use Drupal\Console\Core\Utils\DrupalFinder; -class InstallCommand extends Command +class InstallCommand extends ContainerAwareCommand { - use ContainerAwareCommandTrait; use DatabaseTrait; /** diff --git a/src/Command/Site/MaintenanceCommand.php b/src/Command/Site/MaintenanceCommand.php index 8614abc28..f3af9ecd0 100644 --- a/src/Command/Site/MaintenanceCommand.php +++ b/src/Command/Site/MaintenanceCommand.php @@ -10,17 +10,13 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Core\State\StateInterface; use Drupal\Console\Core\Utils\ChainQueue; -class MaintenanceCommand extends Command +class MaintenanceCommand extends ContainerAwareCommand { - use ContainerAwareCommandTrait; - - /** * @var StateInterface */ diff --git a/src/Command/Site/ModeCommand.php b/src/Command/Site/ModeCommand.php index e9f2cbae3..3767e1727 100644 --- a/src/Command/Site/ModeCommand.php +++ b/src/Command/Site/ModeCommand.php @@ -11,17 +11,14 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Yaml\Yaml; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Core\Utils\ConfigurationManager; use Drupal\Core\Config\ConfigFactory; use Drupal\Console\Core\Utils\ChainQueue; -class ModeCommand extends Command +class ModeCommand extends ContainerAwareCommand { - use ContainerAwareCommandTrait; - /** * @var ConfigFactory */ diff --git a/src/Command/Site/StatisticsCommand.php b/src/Command/Site/StatisticsCommand.php index 4a4a6aede..4d4fcfc62 100644 --- a/src/Command/Site/StatisticsCommand.php +++ b/src/Command/Site/StatisticsCommand.php @@ -9,8 +9,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\DrupalApi; use Drupal\Core\Entity\Query\QueryFactory; @@ -22,10 +21,8 @@ * * @package Drupal\Console\Command\Site */ -class StatisticsCommand extends Command +class StatisticsCommand extends ContainerAwareCommand { - use ContainerAwareCommandTrait; - /** * @var DrupalApi */ diff --git a/src/Command/Site/StatusCommand.php b/src/Command/Site/StatusCommand.php index e0ee9502b..9773b0ee2 100644 --- a/src/Command/Site/StatusCommand.php +++ b/src/Command/Site/StatusCommand.php @@ -10,9 +10,8 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\ContainerAwareCommand; use Drupal\Core\Database\Database; -use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\system\SystemManager; use Drupal\Core\Site\Settings; @@ -24,10 +23,8 @@ * * @category site */ -class StatusCommand extends Command +class StatusCommand extends ContainerAwareCommand { - use ContainerAwareCommandTrait; - /* @var $connectionInfoKeys array */ protected $connectionInfoKeys = [ 'driver', diff --git a/src/Command/State/DeleteCommand.php b/src/Command/State/DeleteCommand.php index 5c3bf1596..0e30b5945 100644 --- a/src/Command/State/DeleteCommand.php +++ b/src/Command/State/DeleteCommand.php @@ -9,16 +9,13 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\KeyValueStore\KeyValueFactoryInterface; use Drupal\Core\State\StateInterface; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; class DeleteCommand extends Command { - use CommandTrait; - /** * @var StateInterface */ diff --git a/src/Command/State/OverrideCommand.php b/src/Command/State/OverrideCommand.php index dc1f88d99..6032d4bf8 100644 --- a/src/Command/State/OverrideCommand.php +++ b/src/Command/State/OverrideCommand.php @@ -10,10 +10,9 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\KeyValueStore\KeyValueFactoryInterface; use Drupal\Core\State\StateInterface; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Component\Serialization\Yaml; @@ -24,8 +23,6 @@ */ class OverrideCommand extends Command { - use CommandTrait; - /** * @var StateInterface */ diff --git a/src/Command/Taxonomy/DeleteTermCommand.php b/src/Command/Taxonomy/DeleteTermCommand.php index 98832b488..3200b092a 100644 --- a/src/Command/Taxonomy/DeleteTermCommand.php +++ b/src/Command/Taxonomy/DeleteTermCommand.php @@ -4,12 +4,11 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\taxonomy\Entity\Term; use Drupal\taxonomy\Entity\Vocabulary; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; /** @@ -19,8 +18,6 @@ */ class DeleteTermCommand extends Command { - use CommandTrait; - /** * The entity_type storage. * diff --git a/src/Command/Test/RunCommand.php b/src/Command/Test/RunCommand.php index 492bb1e30..74f3d06a7 100644 --- a/src/Command/Test/RunCommand.php +++ b/src/Command/Test/RunCommand.php @@ -12,8 +12,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Drupal\Component\Utility\Timer; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Annotations\DrupalCommand; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Core\Extension\ModuleHandlerInterface; @@ -28,8 +27,6 @@ */ class RunCommand extends Command { - use CommandTrait; - /** * @var string */ diff --git a/src/Command/Theme/DownloadCommand.php b/src/Command/Theme/DownloadCommand.php index 0f01f2c37..3db6105dd 100644 --- a/src/Command/Theme/DownloadCommand.php +++ b/src/Command/Theme/DownloadCommand.php @@ -11,8 +11,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Command\Shared\ProjectDownloadTrait; use Drupal\Console\Utils\DrupalApi; @@ -21,8 +20,6 @@ class DownloadCommand extends Command { use ProjectDownloadTrait; - use CommandTrait; - /** * @var DrupalApi diff --git a/src/Command/Theme/InstallCommand.php b/src/Command/Theme/InstallCommand.php index 77ce74796..ea5eb4aa9 100644 --- a/src/Command/Theme/InstallCommand.php +++ b/src/Command/Theme/InstallCommand.php @@ -11,8 +11,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Extension\ThemeHandler; use Drupal\Core\Config\UnmetDependenciesException; @@ -21,8 +20,6 @@ class InstallCommand extends Command { - use CommandTrait; - /** * @var ConfigFactory */ diff --git a/src/Command/Theme/PathCommand.php b/src/Command/Theme/PathCommand.php index fdfd85dce..77bd52693 100644 --- a/src/Command/Theme/PathCommand.php +++ b/src/Command/Theme/PathCommand.php @@ -11,17 +11,13 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Extension\Manager; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Core\Extension\ThemeHandler; class PathCommand extends Command { - use CommandTrait; - - /** * @var Manager */ diff --git a/src/Command/Theme/UninstallCommand.php b/src/Command/Theme/UninstallCommand.php index f553b6df2..7f0ae1005 100644 --- a/src/Command/Theme/UninstallCommand.php +++ b/src/Command/Theme/UninstallCommand.php @@ -10,8 +10,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Extension\ThemeHandler; use Drupal\Core\Config\UnmetDependenciesException; @@ -20,8 +19,6 @@ class UninstallCommand extends Command { - use CommandTrait; - /** * @var ConfigFactory */ diff --git a/src/Command/Update/EntitiesCommand.php b/src/Command/Update/EntitiesCommand.php index bf28b81f0..c1f98eaf5 100644 --- a/src/Command/Update/EntitiesCommand.php +++ b/src/Command/Update/EntitiesCommand.php @@ -9,8 +9,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Entity\EntityStorageException; use Drupal\Core\Utility\Error; use Drupal\Console\Core\Style\DrupalStyle; @@ -25,8 +24,6 @@ */ class EntitiesCommand extends Command { - use CommandTrait; - /** * @var StateInterface */ diff --git a/src/Command/Update/ExecuteCommand.php b/src/Command/Update/ExecuteCommand.php index 82d102f37..3eec5774a 100644 --- a/src/Command/Update/ExecuteCommand.php +++ b/src/Command/Update/ExecuteCommand.php @@ -10,11 +10,10 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\State\StateInterface; use Drupal\Core\Extension\ModuleHandler; use Drupal\Core\Update\UpdateRegistry; -use Drupal\Console\Core\Command\Shared\CommandTrait; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\Console\Utils\Site; use Drupal\Console\Extension\Manager; @@ -22,8 +21,6 @@ class ExecuteCommand extends Command { - use CommandTrait; - /** * @var Site */ diff --git a/src/Command/User/CreateCommand.php b/src/Command/User/CreateCommand.php index d1bd21d0d..dffd2d163 100644 --- a/src/Command/User/CreateCommand.php +++ b/src/Command/User/CreateCommand.php @@ -10,8 +10,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Database\Connection; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Datetime\DateFormatterInterface; @@ -23,7 +22,6 @@ class CreateCommand extends Command { - use CommandTrait; use ConfirmationTrait; /** diff --git a/src/Command/User/DeleteCommand.php b/src/Command/User/DeleteCommand.php index 0992e0d90..db20543d8 100644 --- a/src/Command/User/DeleteCommand.php +++ b/src/Command/User/DeleteCommand.php @@ -10,8 +10,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\Query\QueryFactory; use Drupal\Console\Core\Style\DrupalStyle; @@ -24,8 +23,6 @@ */ class DeleteCommand extends Command { - use CommandTrait; - /** * @var EntityTypeManagerInterface */ diff --git a/src/Command/User/LoginCleanAttemptsCommand.php b/src/Command/User/LoginCleanAttemptsCommand.php index 434282321..3bb1232b0 100644 --- a/src/Command/User/LoginCleanAttemptsCommand.php +++ b/src/Command/User/LoginCleanAttemptsCommand.php @@ -11,15 +11,13 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Output\OutputInterface; use Drupal\Console\Command\Shared\ConfirmationTrait; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Database\Connection; use Drupal\Console\Core\Style\DrupalStyle; use Drupal\user\Entity\User; class LoginCleanAttemptsCommand extends Command { - use CommandTrait; use ConfirmationTrait; /** diff --git a/src/Command/User/LoginUrlCommand.php b/src/Command/User/LoginUrlCommand.php index 97d4e08fb..6cd60cf86 100644 --- a/src/Command/User/LoginUrlCommand.php +++ b/src/Command/User/LoginUrlCommand.php @@ -10,8 +10,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Console\Core\Style\DrupalStyle; @@ -22,8 +21,6 @@ */ class LoginUrlCommand extends Command { - use CommandTrait; - /** * @var EntityTypeManagerInterface */ diff --git a/src/Command/User/PasswordHashCommand.php b/src/Command/User/PasswordHashCommand.php index bc9e62490..53f5843d5 100644 --- a/src/Command/User/PasswordHashCommand.php +++ b/src/Command/User/PasswordHashCommand.php @@ -10,15 +10,13 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Password\PasswordInterface; use Drupal\Console\Command\Shared\ConfirmationTrait; use Drupal\Console\Core\Style\DrupalStyle; class PasswordHashCommand extends Command { - use CommandTrait; use ConfirmationTrait; /** diff --git a/src/Command/User/PasswordResetCommand.php b/src/Command/User/PasswordResetCommand.php index 2eab398d5..67bc26457 100644 --- a/src/Command/User/PasswordResetCommand.php +++ b/src/Command/User/PasswordResetCommand.php @@ -9,8 +9,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Database\Connection; use Drupal\Console\Core\Utils\ChainQueue; use Drupal\Console\Command\Shared\ConfirmationTrait; @@ -19,7 +18,6 @@ class PasswordResetCommand extends Command { - use CommandTrait; use ConfirmationTrait; /** diff --git a/src/Command/User/RoleCommand.php b/src/Command/User/RoleCommand.php index dbce8e411..3dd34b09c 100644 --- a/src/Command/User/RoleCommand.php +++ b/src/Command/User/RoleCommand.php @@ -10,8 +10,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Utils\DrupalApi; use Drupal\Console\Core\Style\DrupalStyle; @@ -22,8 +21,6 @@ */ class RoleCommand extends Command { - use CommandTrait; - /** * @var DrupalApi */ diff --git a/src/Command/Views/DisableCommand.php b/src/Command/Views/DisableCommand.php index 4a0dddcb1..98cf7cf37 100644 --- a/src/Command/Views/DisableCommand.php +++ b/src/Command/Views/DisableCommand.php @@ -10,8 +10,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\Query\QueryFactory; use Drupal\Console\Core\Style\DrupalStyle; @@ -23,8 +22,6 @@ */ class DisableCommand extends Command { - use CommandTrait; - /** * @var EntityTypeManagerInterface */ diff --git a/src/Command/Views/EnableCommand.php b/src/Command/Views/EnableCommand.php index 7e3a56aa0..9ecd03c17 100644 --- a/src/Command/Views/EnableCommand.php +++ b/src/Command/Views/EnableCommand.php @@ -11,8 +11,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Config\Definition\Exception\Exception; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\Query\QueryFactory; use Drupal\Console\Core\Style\DrupalStyle; @@ -24,8 +23,6 @@ */ class EnableCommand extends Command { - use CommandTrait; - /** * @var EntityTypeManagerInterface */ From ae445f263cac11300f7d67220c3c67296396ee8f Mon Sep 17 00:00:00 2001 From: Jesus Manuel Olivas Date: Sun, 30 Jul 2017 21:04:18 -0700 Subject: [PATCH 320/321] [generate:command] Remove use statement. (#3461) --- templates/module/src/Command/command.php.twig | 1 - 1 file changed, 1 deletion(-) diff --git a/templates/module/src/Command/command.php.twig b/templates/module/src/Command/command.php.twig index 6e8b99fa8..9a69f454f 100644 --- a/templates/module/src/Command/command.php.twig +++ b/templates/module/src/Command/command.php.twig @@ -11,7 +11,6 @@ namespace Drupal\{{extension}}\Command; {% block use_class %} use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; {% if container_aware %} use Drupal\Console\Core\Command\ContainerAwareCommand; {% else %} From c70c13983e005774d9929a298ebb8f0015131d8b Mon Sep 17 00:00:00 2001 From: harold20 Date: Tue, 1 Aug 2017 06:19:10 -0600 Subject: [PATCH 321/321] Replace lost translation key in commands (#3462) --- .../Generate/EventSubscriberCommand.php | 2 +- src/Command/Generate/PermissionCommand.php | 4 ++-- src/Command/Generate/PluginFieldCommand.php | 4 ++-- .../Generate/PluginRestResourceCommand.php | 2 +- src/Command/Generate/PluginSkeletonCommand.php | 5 ++--- src/Command/Generate/PostUpdateCommand.php | 2 +- src/Command/Generate/ServiceCommand.php | 6 +++--- src/Command/Generate/ThemeCommand.php | 4 ++-- src/Command/Migrate/ExecuteCommand.php | 2 +- src/Command/Module/DownloadCommand.php | 2 +- .../Module/InstallDependencyCommand.php | 10 +++++----- src/Command/Shared/PermissionTrait.php | 16 ++++++++-------- src/Command/Site/InstallCommand.php | 18 +++++++++--------- src/Command/Site/MaintenanceCommand.php | 2 +- src/Command/Theme/InstallCommand.php | 2 +- src/Command/Theme/UninstallCommand.php | 2 +- src/Command/User/RoleCommand.php | 6 +++--- src/Command/Views/DisableCommand.php | 6 +++--- src/Command/Views/EnableCommand.php | 6 +++--- 19 files changed, 50 insertions(+), 51 deletions(-) diff --git a/src/Command/Generate/EventSubscriberCommand.php b/src/Command/Generate/EventSubscriberCommand.php index 5554a84fd..70d34617e 100644 --- a/src/Command/Generate/EventSubscriberCommand.php +++ b/src/Command/Generate/EventSubscriberCommand.php @@ -92,7 +92,7 @@ protected function configure() 'name', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.service.options.name') + $this->trans('commands.generate.service.options.service-name') ) ->addOption( 'class', diff --git a/src/Command/Generate/PermissionCommand.php b/src/Command/Generate/PermissionCommand.php index 3dfa053e0..064473770 100644 --- a/src/Command/Generate/PermissionCommand.php +++ b/src/Command/Generate/PermissionCommand.php @@ -64,8 +64,8 @@ protected function configure() { $this ->setName('generate:permissions') - ->setDescription($this->trans('commands.generate.permission.description')) - ->setHelp($this->trans('commands.generate.permission.help')) + ->setDescription($this->trans('commands.generate.permissions.description')) + ->setHelp($this->trans('commands.generate.permissions.help')) ->addOption( 'module', null, diff --git a/src/Command/Generate/PluginFieldCommand.php b/src/Command/Generate/PluginFieldCommand.php index 28925e10f..f32aaa586 100644 --- a/src/Command/Generate/PluginFieldCommand.php +++ b/src/Command/Generate/PluginFieldCommand.php @@ -86,13 +86,13 @@ protected function configure() 'type-description', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.field.options.type-type-description') + $this->trans('commands.generate.plugin.field.options.type-description') ) ->addOption( 'formatter-class', null, InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.plugin.field.options.class') + $this->trans('commands.generate.plugin.field.options.formatter-class') ) ->addOption( 'formatter-label', diff --git a/src/Command/Generate/PluginRestResourceCommand.php b/src/Command/Generate/PluginRestResourceCommand.php index e10a6a892..9e3f04c87 100644 --- a/src/Command/Generate/PluginRestResourceCommand.php +++ b/src/Command/Generate/PluginRestResourceCommand.php @@ -92,7 +92,7 @@ protected function configure() 'name', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.service.options.name') + $this->trans('commands.generate.service.options.service-name') ) ->addOption( 'plugin-id', diff --git a/src/Command/Generate/PluginSkeletonCommand.php b/src/Command/Generate/PluginSkeletonCommand.php index c86568b0e..6792c0992 100644 --- a/src/Command/Generate/PluginSkeletonCommand.php +++ b/src/Command/Generate/PluginSkeletonCommand.php @@ -109,13 +109,13 @@ protected function configure() 'plugin-id', null, InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.plugin.options.plugin-id') + $this->trans('commands.generate.plugin.skeleton.options.plugin') ) ->addOption( 'class', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.generate.plugin.block.options.class') + $this->trans('commands.generate.plugin.skeleton.options.class') ) ->addOption( 'services', @@ -124,7 +124,6 @@ protected function configure() $this->trans('commands.common.options.services') )->setAliases(['gps']); } - /** * {@inheritdoc} */ diff --git a/src/Command/Generate/PostUpdateCommand.php b/src/Command/Generate/PostUpdateCommand.php index 24b40fbae..648fc2e06 100644 --- a/src/Command/Generate/PostUpdateCommand.php +++ b/src/Command/Generate/PostUpdateCommand.php @@ -83,7 +83,7 @@ protected function configure() { $this ->setName('generate:post:update') - ->setDescription($this->trans('commands.generate.post:update.description')) + ->setDescription($this->trans('commands.generate.post.update.description')) ->setHelp($this->trans('commands.generate.post.update.help')) ->addOption( 'module', diff --git a/src/Command/Generate/ServiceCommand.php b/src/Command/Generate/ServiceCommand.php index e6563dbe5..8792b7e63 100644 --- a/src/Command/Generate/ServiceCommand.php +++ b/src/Command/Generate/ServiceCommand.php @@ -92,7 +92,7 @@ protected function configure() 'name', null, InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.service.options.name') + $this->trans('commands.generate.service.options.service-name') ) ->addOption( 'class', @@ -104,13 +104,13 @@ protected function configure() 'interface', null, InputOption::VALUE_NONE, - $this->trans('commands.common.service.options.interface') + $this->trans('commands.generate.service.options.interface') ) ->addOption( 'interface-name', null, InputOption::VALUE_OPTIONAL, - $this->trans('commands.common.service.options.interface-name') + $this->trans('commands.generate.service.options.interface-name') ) ->addOption( 'services', diff --git a/src/Command/Generate/ThemeCommand.php b/src/Command/Generate/ThemeCommand.php index 2156e9381..a9da69656 100644 --- a/src/Command/Generate/ThemeCommand.php +++ b/src/Command/Generate/ThemeCommand.php @@ -112,7 +112,7 @@ protected function configure() 'theme', null, InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.theme.options.module') + $this->trans('commands.generate.theme.options.theme') ) ->addOption( 'machine-name', @@ -124,7 +124,7 @@ protected function configure() 'theme-path', null, InputOption::VALUE_REQUIRED, - $this->trans('commands.generate.theme.options.module-path') + $this->trans('commands.generate.theme.options.theme-path') ) ->addOption( 'description', diff --git a/src/Command/Migrate/ExecuteCommand.php b/src/Command/Migrate/ExecuteCommand.php index 06ad78724..1e92b1144 100644 --- a/src/Command/Migrate/ExecuteCommand.php +++ b/src/Command/Migrate/ExecuteCommand.php @@ -69,7 +69,7 @@ protected function configure() 'db-type', null, InputOption::VALUE_REQUIRED, - $this->trans('commands.migrate.setup.migrations.options.db-type') + $this->trans('commands.migrate.execute.migrations.options.db-type') ) ->addOption( 'db-host', diff --git a/src/Command/Module/DownloadCommand.php b/src/Command/Module/DownloadCommand.php index 56c8130c8..c4155dc56 100644 --- a/src/Command/Module/DownloadCommand.php +++ b/src/Command/Module/DownloadCommand.php @@ -134,7 +134,7 @@ protected function configure() 'unstable', null, InputOption::VALUE_NONE, - $this->trans('commands.module.install.options.unstable') + $this->trans('commands.module.download.options.unstable') ) ->setAliases(['mod']); } diff --git a/src/Command/Module/InstallDependencyCommand.php b/src/Command/Module/InstallDependencyCommand.php index 311b98475..392e6f05f 100644 --- a/src/Command/Module/InstallDependencyCommand.php +++ b/src/Command/Module/InstallDependencyCommand.php @@ -78,11 +78,11 @@ protected function configure() { $this ->setName('module:dependency:install') - ->setDescription($this->trans('commands.module.install.dependencies.description')) + ->setDescription($this->trans('commands.module.dependency.install.description')) ->addArgument( 'module', InputArgument::IS_ARRAY, - $this->trans('commands.module.install.dependencies.arguments.module') + $this->trans('commands.module.dependency.install.arguments.module') )->setAliases(['modi']); } @@ -112,14 +112,14 @@ protected function execute(InputInterface $input, OutputInterface $output) $unInstalledDependencies = $this->calculateDependencies((array)$module); if (!$unInstalledDependencies) { - $io->warning($this->trans('commands.module.install.dependencies.messages.no-depencies')); + $io->warning($this->trans('commands.module.dependency.install.messages.no-depencies')); return 0; } try { $io->comment( sprintf( - $this->trans('commands.module.install.dependencies.messages.installing'), + $this->trans('commands.module.dependency.install.messages.installing'), implode(', ', $unInstalledDependencies) ) ); @@ -129,7 +129,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->moduleInstaller->install($unInstalledDependencies, true); $io->success( sprintf( - $this->trans('commands.module.install.dependencies.messages.success'), + $this->trans('commands.module.dependency.install.messages.success'), implode(', ', $unInstalledDependencies) ) ); diff --git a/src/Command/Shared/PermissionTrait.php b/src/Command/Shared/PermissionTrait.php index 1822ac06a..de2047730 100644 --- a/src/Command/Shared/PermissionTrait.php +++ b/src/Command/Shared/PermissionTrait.php @@ -22,19 +22,19 @@ public function permissionQuestion(DrupalStyle $output) $boolOrNone = ['true','false','none']; while (true) { $permission = $output->ask( - $this->trans('commands.generate.permission.questions.permission'), - $this->trans('commands.generate.permission.suggestions.access-content') + $this->trans('commands.generate.permissions.questions.permission'), + $this->trans('commands.generate.permissions.suggestions.access-content') ); $title = $output->ask( - $this->trans('commands.generate.permission.questions.title'), - $this->trans('commands.generate.permission.suggestions.access-content') + $this->trans('commands.generate.permissions.questions.title'), + $this->trans('commands.generate.permissions.suggestions.access-content') ); $description = $output->ask( - $this->trans('commands.generate.permission.questions.description'), - $this->trans('commands.generate.permission.suggestions.allow-access-content') + $this->trans('commands.generate.permissions.questions.description'), + $this->trans('commands.generate.permissions.suggestions.allow-access-content') ); $restrictAccess = $output->choiceNoList( - $this->trans('commands.generate.permission.questions.restrict-access'), + $this->trans('commands.generate.permissions.questions.restrict-access'), $boolOrNone, 'none' ); @@ -53,7 +53,7 @@ public function permissionQuestion(DrupalStyle $output) ); if (!$output->confirm( - $this->trans('commands.generate.permission.questions.add'), + $this->trans('commands.generate.permissions.questions.add'), true ) ) { diff --git a/src/Command/Site/InstallCommand.php b/src/Command/Site/InstallCommand.php index 19f4dde6c..1e8a888e6 100644 --- a/src/Command/Site/InstallCommand.php +++ b/src/Command/Site/InstallCommand.php @@ -83,19 +83,19 @@ protected function configure() 'langcode', null, InputOption::VALUE_REQUIRED, - $this->trans('commands.site.install.options.langcode') + $this->trans('commands.site.install.arguments.langcode') ) ->addOption( 'db-type', null, InputOption::VALUE_REQUIRED, - $this->trans('commands.site.install.options.db-type') + $this->trans('commands.site.install.arguments.db-type') ) ->addOption( 'db-file', null, InputOption::VALUE_REQUIRED, - $this->trans('commands.site.install.options.db-file') + $this->trans('commands.site.install.arguments.db-file') ) ->addOption( 'db-host', @@ -137,37 +137,37 @@ protected function configure() 'site-name', null, InputOption::VALUE_REQUIRED, - $this->trans('commands.site.install.options.site-name') + $this->trans('commands.site.install.arguments.site-name') ) ->addOption( 'site-mail', null, InputOption::VALUE_REQUIRED, - $this->trans('commands.site.install.options.site-mail') + $this->trans('commands.site.install.arguments.site-mail') ) ->addOption( 'account-name', null, InputOption::VALUE_REQUIRED, - $this->trans('commands.site.install.options.account-name') + $this->trans('commands.site.install.arguments.account-name') ) ->addOption( 'account-mail', null, InputOption::VALUE_REQUIRED, - $this->trans('commands.site.install.options.account-mail') + $this->trans('commands.site.install.arguments.account-mail') ) ->addOption( 'account-pass', null, InputOption::VALUE_REQUIRED, - $this->trans('commands.site.install.options.account-pass') + $this->trans('commands.site.install.arguments.account-pass') ) ->addOption( 'force', null, InputOption::VALUE_NONE, - $this->trans('commands.site.install.options.force') + $this->trans('commands.site.install.arguments.force') ) ->setAliases(['si']); } diff --git a/src/Command/Site/MaintenanceCommand.php b/src/Command/Site/MaintenanceCommand.php index f3af9ecd0..edfde2a53 100644 --- a/src/Command/Site/MaintenanceCommand.php +++ b/src/Command/Site/MaintenanceCommand.php @@ -51,7 +51,7 @@ protected function configure() ->addArgument( 'mode', InputArgument::REQUIRED, - $this->trans('commands.site.maintenance.arguments.mode').'[on/off]' + $this->trans('commands.site.maintenance.arguments.mode') ) ->setAliases(['sma']); } diff --git a/src/Command/Theme/InstallCommand.php b/src/Command/Theme/InstallCommand.php index ea5eb4aa9..7847598c7 100644 --- a/src/Command/Theme/InstallCommand.php +++ b/src/Command/Theme/InstallCommand.php @@ -61,7 +61,7 @@ protected function configure() ->addArgument( 'theme', InputArgument::IS_ARRAY, - $this->trans('commands.theme.install.options.module') + $this->trans('commands.theme.install.options.theme') ) ->addOption( 'set-default', diff --git a/src/Command/Theme/UninstallCommand.php b/src/Command/Theme/UninstallCommand.php index 7f0ae1005..41604ec9d 100644 --- a/src/Command/Theme/UninstallCommand.php +++ b/src/Command/Theme/UninstallCommand.php @@ -60,7 +60,7 @@ protected function configure() ->addArgument( 'theme', InputArgument::IS_ARRAY, - $this->trans('commands.theme.uninstall.options.module') + $this->trans('commands.theme.uninstall.options.theme') ) ->setAliases(['thu']); } diff --git a/src/Command/User/RoleCommand.php b/src/Command/User/RoleCommand.php index 3dd34b09c..71f5ff0df 100644 --- a/src/Command/User/RoleCommand.php +++ b/src/Command/User/RoleCommand.php @@ -48,17 +48,17 @@ protected function configure() ->addArgument( 'operation', InputOption::VALUE_REQUIRED, - $this->trans('commands.user.role.operation') + $this->trans('commands.user.role.arguments.operation') ) ->addArgument( 'user', InputOption::VALUE_REQUIRED, - $this->trans('commands.user.role.user') + $this->trans('commands.user.role.arguments.user') ) ->addArgument( 'role', InputOption::VALUE_REQUIRED, - $this->trans('commands.user.role.role') + $this->trans('commands.user.role.arguments.roles') )->setAliases(['ur']); } diff --git a/src/Command/Views/DisableCommand.php b/src/Command/Views/DisableCommand.php index 98cf7cf37..2a2e1101b 100644 --- a/src/Command/Views/DisableCommand.php +++ b/src/Command/Views/DisableCommand.php @@ -58,7 +58,7 @@ protected function configure() ->addArgument( 'view-id', InputArgument::OPTIONAL, - $this->trans('commands.views.debug.arguments.view-id') + $this->trans('commands.debug.views.arguments.view-id') ) ->setAliases(['vd']); } @@ -76,7 +76,7 @@ protected function interact(InputInterface $input, OutputInterface $output) ->condition('status', 1) ->execute(); $viewId = $io->choiceNoList( - $this->trans('commands.views.debug.arguments.view-id'), + $this->trans('commands.debug.views.arguments.view-id'), $views ); $input->setArgument('view-id', $viewId); @@ -95,7 +95,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $view = $this->entityTypeManager->getStorage('view')->load($viewId); if (empty($view)) { - $io->error(sprintf($this->trans('commands.views.debug.messages.not-found'), $viewId)); + $io->error(sprintf($this->trans('commands.debug.views.messages.not-found'), $viewId)); return 1; } diff --git a/src/Command/Views/EnableCommand.php b/src/Command/Views/EnableCommand.php index 9ecd03c17..7bd74d773 100644 --- a/src/Command/Views/EnableCommand.php +++ b/src/Command/Views/EnableCommand.php @@ -59,7 +59,7 @@ protected function configure() ->addArgument( 'view-id', InputArgument::OPTIONAL, - $this->trans('commands.views.debug.arguments.view-id') + $this->trans('commands.debug.views.arguments.view-id') ) ->setAliases(['ve']); } @@ -77,7 +77,7 @@ protected function interact(InputInterface $input, OutputInterface $output) ->condition('status', 0) ->execute(); $viewId = $io->choiceNoList( - $this->trans('commands.views.debug.arguments.view-id'), + $this->trans('commands.debug.views.arguments.view-id'), $views ); $input->setArgument('view-id', $viewId); @@ -97,7 +97,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if (empty($view)) { $io->error( sprintf( - $this->trans('commands.views.debug.messages.not-found'), + $this->trans('commands.debug.views.messages.not-found'), $viewId ) );