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.

Comments

moshe weitzman’s picture

Title: !fils for the default sitealias » !files for the default sitealias
greg.1.anderson’s picture

Assigned: greg.1.anderson » Unassigned
Priority: Minor » Normal

I'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.

moshe weitzman’s picture

Lets 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.

greg.1.anderson’s picture

'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. :(

greg.1.anderson’s picture

Assigned: Unassigned » greg.1.anderson
Priority: Normal » Minor
greg.1.anderson’s picture

Assigned: Unassigned » greg.1.anderson
Priority: Normal » Minor
StatusFileSize
new28.09 KB

Here 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.)

greg.1.anderson’s picture

Status: Active » Needs review
moshe weitzman’s picture

Status: Needs review » Needs work

It 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.

greg.1.anderson’s picture

Status: Needs work » Fixed
StatusFileSize
new29.15 KB

Committed 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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.