Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
enzolutions committed Jun 6, 2019
2 parents 9606bc4 + 9a895aa commit 1d8fe7e
Show file tree
Hide file tree
Showing 100 changed files with 1,492 additions and 831 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- hhvm

matrix:
fast_finish: true
allow_failures:
- php: hhvm
- php: 7.0
- php: 7.1

env:
global:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"require": {
"php": "^5.5.9 || ^7.0",
"alchemy/zippy": "^0.4.3",
"alchemy/zippy": "~0.4",
"composer/installers": "~1.0",
"doctrine/annotations": "^1.2",
"doctrine/collections": "^1.3",
Expand Down
4 changes: 2 additions & 2 deletions config/services/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
- { name: drupal.command }
console.config_export_content_type:
class: Drupal\Console\Command\Config\ExportContentTypeCommand
arguments: ['@console.extension_manager', '@entity_type.manager', '@console.validator', '@console.chain_queue']
arguments: ['@console.extension_manager', '@entity_type.manager', '@console.validator', '@console.chain_queue', '@config.storage']
tags:
- { name: drupal.command }
console.config_export_entity:
Expand All @@ -36,7 +36,7 @@ services:
- { name: drupal.command }
console.config_export_view:
class: Drupal\Console\Command\Config\ExportViewCommand
arguments: ['@entity_type.manager', '@config.storage', '@console.extension_manager', '@console.validator']
arguments: ['@entity_type.manager', '@config.storage', '@console.extension_manager', '@console.validator', '@console.chain_queue']
tags:
- { name: drupal.command }
console.config_import:
Expand Down
20 changes: 1 addition & 19 deletions config/services/database.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
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:
- { 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:
- { name: drupal.command }
console.database_drop:
class: Drupal\Console\Command\Database\DropCommand
tags:
- { name: drupal.command }
console.database_dump:
class: Drupal\Console\Command\Database\DumpCommand
arguments: ['@app.root', '@console.shell_process']
arguments: ['@app.root', '@console.shell_process', '@database']
tags:
- { name: drupal.command }
console.database_log_clear:
Expand All @@ -35,8 +22,3 @@ services:
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']
tags:
- { name: drupal.command }
2 changes: 1 addition & 1 deletion config/services/debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ services:
- { name: drupal.command }
console.rest_debug:
class: Drupal\Console\Command\Debug\RestCommand
arguments: ['@?plugin.manager.rest']
arguments: ['@entity_type.manager', '@?plugin.manager.rest']
tags:
- { name: drupal.command }
console.test_debug:
Expand Down
2 changes: 1 addition & 1 deletion config/services/generate.yml
Original file line number Diff line number Diff line change
@@ -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', '@console.chain_queue']
arguments: ['@console.module_generator', '@console.validator', '@app.root', '@console.string_converter', '@console.drupal_api', '@console.chain_queue', '@console.site']
tags:
- { name: drupal.command }
console.generate_modulefile:
Expand Down
5 changes: 0 additions & 5 deletions config/services/generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,6 @@ 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']
Expand Down
11 changes: 11 additions & 0 deletions config/services/multisite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
services:
console.multisite_new:
class: Drupal\Console\Command\Multisite\NewCommand
arguments: ['@app.root', '@console.validator']
tags:
- { name: drupal.command }
console.multisite_update:
class: Drupal\Console\Command\Multisite\UpdateCommand
arguments: ['@app.root']
tags:
- { name: drupal.command }
4 changes: 2 additions & 2 deletions config/services/rest.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
services:
console.rest_disable:
class: Drupal\Console\Command\Rest\DisableCommand
arguments: ['@config.factory', '@?plugin.manager.rest']
arguments: ['@entity_type.manager', '@?plugin.manager.rest']
tags:
- { name: drupal.command }
console.rest_enable:
class: Drupal\Console\Command\Rest\EnableCommand
arguments:
- '@entity_type.manager'
- '@?plugin.manager.rest'
- '@authentication_collector'
- '@config.factory'
- '@entity.manager'
tags:
- { name: drupal.command }
2 changes: 1 addition & 1 deletion config/services/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ services:
- { name: drupal.command }
console.site_status:
class: Drupal\Console\Command\Site\StatusCommand
arguments: ['@?system.manager', '@settings', '@config.factory', '@theme_handler', '@app.root']
arguments: ['@?system.manager', '@settings', '@config.factory', '@theme_handler', '@app.root', '@renderer']
tags:
- { name: drupal.command }
13 changes: 12 additions & 1 deletion src/Bootstrap/Drupal.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,20 @@ public function boot()
$io->writeln('➤ Creating request');
}

$parsed_url = parse_url($uri);

if($parsed_url['scheme'] == 'https') {
$_SERVER['HTTPS'] = 'on';
}

$path = '/';
if(isset($parsed_url['path'])) {
$path = $parsed_url['path'] . $path;
}

$_SERVER['HTTP_HOST'] = parse_url($uri, PHP_URL_HOST);
$_SERVER['SERVER_PORT'] = null;
$_SERVER['REQUEST_URI'] = '/';
$_SERVER['REQUEST_URI'] = $path;
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['SERVER_SOFTWARE'] = null;
Expand Down
87 changes: 65 additions & 22 deletions src/Command/Config/ExportContentTypeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,26 @@

namespace Drupal\Console\Command\Config;

use Drupal\Console\Command\Shared\ExportTrait;
use Drupal\Console\Command\Shared\ModuleTrait;
use Drupal\Console\Core\Command\Command;
use Drupal\Console\Core\Utils\ChainQueue;
use Drupal\Console\Extension\Manager;
use Drupal\Console\Utils\Validator;
use Drupal\Core\Entity\EntityTypeManagerInterface;
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 Drupal\Console\Core\Command\Command;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Console\Core\Utils\ChainQueue;
use Drupal\Console\Extension\Manager;

use Drupal\Core\Config\CachedStorage;

class ExportContentTypeCommand extends Command
{
use ModuleTrait;
use ExportTrait;

const ALL = '-all-';

/**
* @var Manager
Expand All @@ -42,23 +48,32 @@ class ExportContentTypeCommand extends Command
*/
protected $chainQueue;

/**
* @var CachedStorage
*/
protected $configStorage;

/**
* ExportContentTypeCommand constructor.
*
* @param EntityTypeManagerInterface $entityTypeManager
* @param Validator $validator
* @param ChainQueue $chainQueue
* @param CachedStorage $configStorage,
*/
public function __construct(
Manager $extensionManager,
EntityTypeManagerInterface $entityTypeManager,
Validator $validator,
ChainQueue $chainQueue
ChainQueue $chainQueue,
CachedStorage $configStorage

) {
$this->extensionManager = $extensionManager;
$this->entityTypeManager = $entityTypeManager;
$this->validator = $validator;
$this->chainQueue = $chainQueue;
$this->configStorage = $configStorage;
parent::__construct();
}

Expand All @@ -73,7 +88,7 @@ protected function configure()
->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module'))
->addArgument(
'content-type',
InputArgument::REQUIRED,
InputArgument::REQUIRED | InputArgument::IS_ARRAY,
$this->trans('commands.config.export.content.type.arguments.content-type')
)->addOption(
'optional-config',
Expand All @@ -91,6 +106,12 @@ protected function configure()
InputOption::VALUE_NONE,
$this->trans('commands.config.export.content.type.options.remove-config-hash')
)
->addOption(
'include-module-dependencies',
null,
InputOption::VALUE_OPTIONAL,
$this->trans('commands.config.export.content.type.options.include-module-dependencies')
)
->setAliases(['cect']);

$this->configExport = [];
Expand All @@ -108,25 +129,36 @@ protected function interact(InputInterface $input, OutputInterface $output)
$contentType = $input->getArgument('content-type');
if (!$contentType) {
$bundles_entities = $this->entityTypeManager->getStorage('node_type')->loadMultiple();
$bundles = [ExportContentTypeCommand::ALL => $this->trans('commands.config.export.content.type.questions.all')];
$bundles_ids = [];

foreach ($bundles_entities as $entity) {
$bundles[$entity->id()] = $entity->label();
$bundles_ids[] = $entity->id();
}

$contentType = $this->getIo()->choice(
$this->trans('commands.config.export.content.type.questions.content-type'),
$bundles
);
if (!$contentType) {
$contentType = $this->getIo()->choice(
$this->trans('commands.config.export.content.type.questions.content-type'),
$bundles
);
}

if ($contentType == ExportContentTypeCommand::ALL) {
$input->setArgument('content-type', $bundles_ids);
}else{
$input->setArgument('content-type', [$contentType]);
}
}
$input->setArgument('content-type', $contentType);

$optionalConfig = $input->getOption('optional-config');
if (!$optionalConfig) {
$optionalConfig = $this->getIo()->confirm(
$this->trans('commands.config.export.content.type.questions.optional-config'),
true
);
$input->setOption('optional-config', $optionalConfig);
}
$input->setOption('optional-config', $optionalConfig);

if (!$input->getOption('remove-uuid')) {
$removeUuid = $this->getIo()->confirm(
Expand All @@ -142,28 +174,39 @@ protected function interact(InputInterface $input, OutputInterface $output)
);
$input->setOption('remove-config-hash', $removeHash);
}

$includeModuleDependencies = $input->getOption('include-module-dependencies');
if (!$includeModuleDependencies) {
$includeModuleDependencies = $this->getIo()->confirm(
$this->trans('commands.config.export.content.type.questions.include-module-dependencies'),
true
);
$input->setOption('include-module-dependencies', $includeModuleDependencies);
}
}

/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$module = $this->validateModule($input->getOption('module'));
$contentType = $input->getArgument('content-type');
$module = $input->getOption('module');
$contentTypes = $input->getArgument('content-type');
$optionalConfig = $input->getOption('optional-config');
$removeUuid = $input->getOption('remove-uuid');
$removeHash = $input->getOption('remove-config-hash');
$includeModuleDependencies = $input->getOption('include-module-dependencies');

$this->chainQueue->addCommand(
'config:export:entity', [
'entity-type' => 'node_type',
'bundle' => $contentType,
'--module' => $module,
'--optional-config' => $optionalConfig,
'--remove-uuid' => $removeUuid,
'--remove-config-hash' => $removeHash
]
'config:export:entity', [
'entity-type' => 'node_type',
'bundle' => $contentTypes,
'--module' => $module,
'--optional-config' => $optionalConfig,
'--remove-uuid' => $removeUuid,
'--remove-config-hash' => $removeHash,
'--include-module-dependencies' => $includeModuleDependencies
]
);
}
}
Loading

0 comments on commit 1d8fe7e

Please sign in to comment.