diff --git a/examples/example.aliases.yml b/examples/example.aliases.yml index c1efc4dc17..47ea65b8af 100644 --- a/examples/example.aliases.yml +++ b/examples/example.aliases.yml @@ -179,10 +179,6 @@ # - `drush sql-sync @live @stage` # NOTE: Setting boolean options broke with Symfony 3. This will be fixed # in a future release. See: https://github.com/drush-ops/drush/issues/2956 -# - 'alias-parameters': These options will only be set if the alias is -# used as the specified parameter. `sql:sync` and `core:rsync` are the two -# core commands that use this entry. These commands both have `source` -# and `target` parameters. # # Complex example: # @@ -202,12 +198,6 @@ # install: # options: # admin-password: 'secret-secret' -# alias-parameters: -# target: -# core: -# rsnyc: -# options: -# exclude-paths: sites/default/files/private # @endcode # # Altering aliases: diff --git a/src/Commands/core/RsyncCommands.php b/src/Commands/core/RsyncCommands.php index 249fd8ed75..2d38990a9b 100644 --- a/src/Commands/core/RsyncCommands.php +++ b/src/Commands/core/RsyncCommands.php @@ -142,9 +142,6 @@ protected function injectAliasPathParameterOptions($input, $parameterName) $aliasRecord = $evaluatedPath->getAliasRecord(); - // Inject the source and target alias records into the alias config context. - $aliasRecord->injectIntoConfig($aliasConfigContext, $parameterName); - // If the path is remote, then we will also inject the global // options into the alias config context so that we pick up // things like ssh-options. diff --git a/src/Commands/sql/SqlSyncCommands.php b/src/Commands/sql/SqlSyncCommands.php index a22ed6434a..40d7cc9b46 100644 --- a/src/Commands/sql/SqlSyncCommands.php +++ b/src/Commands/sql/SqlSyncCommands.php @@ -137,36 +137,6 @@ public function sqlsync($source, $target, $options = ['no-dump' => false, 'no-sy } } - /** - * Inject options from source and target alias parameters. - * - * @hook command-event sql:sync - * @param ConsoleCommandEvent $event - */ - public function preCommandEvent(ConsoleCommandEvent $event) - { - $input = $event->getInput(); - $this->injectAliasPathParameterOptions($input, 'source'); - $this->injectAliasPathParameterOptions($input, 'target'); - } - - protected function injectAliasPathParameterOptions($input, $parameterName) - { - // The Drush configuration object is a ConfigOverlay; fetch the alias - // context, that already has the options et. al. from the - // site-selection alias ('drush @site rsync ...'), @self. - $aliasConfigContext = $this->getConfig()->getContext(ConfigLocator::ALIAS_CONTEXT); - $manager = $this->siteAliasManager(); - - $aliasName = $input->getArgument($parameterName); - - // Inject the source and target alias records into the alias config context. - $aliasRecord = $manager->get($aliasName); - if (!empty($aliasRecord)) { - $manager->get($aliasName)->injectIntoConfig($aliasConfigContext, $parameterName); - } - } - /** * @hook validate sql-sync */ diff --git a/src/SiteAlias/AliasRecord.php b/src/SiteAlias/AliasRecord.php index cdb08a1220..8b17b1bc9f 100644 --- a/src/SiteAlias/AliasRecord.php +++ b/src/SiteAlias/AliasRecord.php @@ -253,28 +253,6 @@ protected function remap($data) return new Config($data); } - /** - * Copy options from the source and destination aliases into the - * alias context. - * - * This is essentially an `export` followed by `$config->combine()`. - * Parameter-specific options from the alias-parameters are also included. - * - * @param Config $config - * @param string $parameterName - * @return $this - */ - public function injectIntoConfig($config, $parameterName = '') - { - $aliasData = $this->export(); - $parameterSpecificData = $this->getParameterSpecificOptions($aliasData, $parameterName); - if (!empty($parameterSpecificData)) { - // Combine the data from the parameter-specific - $config->combine($parameterSpecificData); - } - return $this; - } - /** * Fetch the parameter-specific options from the 'alias-parameters' section of the alias. * @param string $parameterName diff --git a/tests/resources/alias-fixtures/example.alias.yml b/tests/resources/alias-fixtures/example.alias.yml index bf9c5d09b0..1eb9557947 100644 --- a/tests/resources/alias-fixtures/example.alias.yml +++ b/tests/resources/alias-fixtures/example.alias.yml @@ -1,35 +1,19 @@ dev: root: /path/to/dev uri: dev - alias-parameters: - source: - command: - core: - rsync: - options: - include-paths: dev-source - target: - command: - core: - rsync: - options: - exclude-paths: dev-target + command: + core: + rsync: + options: + include-paths: dev-path stage: root: /path/to/stage uri: stage - alias-parameters: - source: - command: - core: - rsync: - options: - include-paths: stage-source - target: - command: - core: - rsync: - options: - exclude-paths: stage-target + command: + core: + rsync: + options: + exclude-paths: stage-path live: user: www-admin host: service-provider.com diff --git a/tests/rsyncTest.php b/tests/rsyncTest.php index 13138b5529..d659cb2b77 100644 --- a/tests/rsyncTest.php +++ b/tests/rsyncTest.php @@ -25,17 +25,17 @@ public function testRsyncSimulated() { // Test simulated simple rsync with two local sites $this->drush('rsync', ['@example.stage', '@example.dev'], $options, NULL, NULL, self::EXIT_SUCCESS, '2>&1'); - $expected = "Calling system(rsync -e 'ssh ' -akz --include=\"stage-source\" --exclude=\"dev-target\" /path/to/stage /path/to/dev);"; + $expected = "Calling system(rsync -e 'ssh ' -akz /path/to/stage /path/to/dev);"; $this->assertOutputEquals($expected); // Test simulated rsync with relative paths $this->drush('rsync', ['@example.dev:files', '@example.stage:files'], $options, NULL, NULL, self::EXIT_SUCCESS, '2>&1'); - $expected = "Calling system(rsync -e 'ssh ' -akz --include=\"dev-source\" --exclude=\"stage-target\" /path/to/dev/files /path/to/stage/files);"; + $expected = "Calling system(rsync -e 'ssh ' -akz /path/to/dev/files /path/to/stage/files);"; $this->assertOutputEquals($expected); // Test simulated rsync on local machine with a remote target $this->drush('rsync', ['@example.dev:files', '@example.live:files'], $options, NULL, NULL, self::EXIT_SUCCESS, '2>&1'); - $expected = "Calling system(rsync -e 'ssh -o PasswordAuthentication=example' -akz --include=\"dev-source\" /path/to/dev/files www-admin@service-provider.com:/path/on/service-provider/files);"; + $expected = "Calling system(rsync -e 'ssh -o PasswordAuthentication=example' -akz /path/to/dev/files www-admin@service-provider.com:/path/on/service-provider/files);"; $this->assertOutputEquals($expected); // Test simulated backend invoke.