It would be handy if we could use !files in the default sitealias. I found myself needing to specify the relative path to files when using default sitealias. Maybe I am not doing it right. In order to rsync from stage to dev, I had to:
drush rsync stage:\!files default:sites/all/files
As an aside, the ! character needs to be escaped for bash which is a touch annoying . Can we pick a different character? I don't think the consistency with dt() placeholders is important. Maybe this is consistent with a convention with which I am unfamiliar.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | files-path-alias-2.patch | 29.15 KB | greg.1.anderson |
| #6 | files-path-alias.patch | 28.09 KB | greg.1.anderson |
Comments
Comment #1
moshe weitzman commentedComment #2
greg.1.anderson commentedI'd be happy to change ! to something else; it annoys me too. "%"?
I did want to add !files in
_drush_sitealias_add_transient_defaults, but to do that you'd have to bootstrap to a database that might belong to a different site. I suppose the way to do that would be to use the same technique used to fetch the database credentials (via backend_invoke).Anyway, if you'd like me to do this (or the other one), go ahead and assign the issue to me.
Comment #3
moshe weitzman commentedLets definately change to %. That char works for me.
Doesn't 'default' always refer to the current, local site? If not, I can see how things get messy. Even that bootstrap issue could be messy. This is lower priority, I think.
Comment #4
greg.1.anderson commented'current' refers to the current local site that drush bootstrapped. 'default' refers to the site specified in sites/default/settings.php in whatever Drupal root drush bootstrapped to. I did consider adding %files to only the current site, since there's a convenient API call to make to get that, but I was worried that that would cause confusion when people tried to use %files in a context where it wasn't available. Error handling in rsync path substitution isn't very robust. :(
Comment #5
greg.1.anderson commentedComment #6
greg.1.anderson commentedHere is a patch that resolves references to %files even if said reference belongs to a different site or a remote site. A call to backend_invoke is used to resolve the reference via the status commad, which now includes a line with the File Directory Path. Care is taken to not call backend_invoke unless there is something that needs to be resolved.
This patch depends on #684090: use site alias 'root' in favor of path alias !root, and rename path aliases from !root to %root. This patch includes all of the changes from that issue so that it can be applied to drush-HEAD. (Sorry for the inconvenience.)
Comment #7
greg.1.anderson commentedComment #8
moshe weitzman commentedIt looks like there is an attempt for backward compat for the ! character. Lets remove that, since it was never released. Afterwards, looks ready for commit.
I also am ready to get rid of the backward compat for command names with spaces. spoke to adrian and he concurs on that.
Comment #9
greg.1.anderson commentedCommitted after removing backwards compatibility for !root and %root in path-aliases. 'root' is still copied -into- %root in path aliases so that it may be used in rsync (although doing so is unnecessary, since relative paths are relative to %root, but still, for consistency...)
Here's the patch that was committed.