Skip to content

Commit

Permalink
Fix drush-ops#40. Added commented out shell alias as discussed. I als…
Browse files Browse the repository at this point in the history
…o fixed a nasty shell alias bug which this revealed. It had been previously reported at https://drupal.org/node/1967346. I used str_getcsv() to fix it and that function is not available in php 5.2 so backport to 5.x needs work.
  • Loading branch information
weitzman committed Aug 27, 2013
1 parent 4a3e6d6 commit 7603629
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples/example.drushrc.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
# $options['shell-aliases']['online'] = 'variable-delete -y --exact maintenance_mode';
# $options['shell-aliases']['dis-all'] = '!drush -y dis `drush pml --status=enabled --type=module --no-core --pipe`';
# $options['shell-aliases']['self-alias'] = 'site-alias @self --with-db --alias-name=new';
# $options['shell-aliases']['site-get'] = '@none php-eval "return drush_sitealias_site_get();"';

// Add a 'pm-clone' to simplify git cloning from drupal.org.
# $options['shell-aliases']['pm-clone'] = 'pm-download --gitusername=YOURUSERNAME --package-handler=git_drupalorg';
Expand Down
3 changes: 2 additions & 1 deletion includes/command.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1884,7 +1884,8 @@ function drush_shell_alias_replace() {
$unmatched_replacements = preg_replace('/[{}]/', '', $unmatched_replacements);
return drush_set_error('DRUSH_SHELL_ALIAS_UNMATCHED_REPLACEMENTS', dt('The shell alias @alias-name uses replacements "@unmatched". You must use this command with a site alias (e.g. `drush @myalias @alias-name ...`) that defines all of these variables.', array('@alias-name' => $first, '@unmatched' => $unmatched_replacements)));
}
$alias_value = explode(' ', $alias_value);
// Respect quoting. See http://stackoverflow.com/questions/2202435/php-explode-the-string-but-treat-words-in-quotes-as-a-single-word
$alias_value = str_getcsv($alias_value, ' ');
}
drush_log(dt('Shell alias found: !key => !value', array('!key' => $first, '!value' => implode(' ', $alias_value))), 'debug');
$replacement = $alias_value;
Expand Down

0 comments on commit 7603629

Please sign in to comment.