Certain commands (backup, for example) do not require that we rewrite the drushrc.php.
The way this is done right now is in the provision_drupal_drush_exit() hook, and that makes it impossible to cleanly (ie. through the hook_TASK_post()) to modify the drushrc ownership (for example). On top of that, it makes unnecessary writes.
We should explicitly write the drushrc in a post hook, and only when it's relevant.
Here are the tasks where it's irrelevant:
* backup
* login_reset
* delete backups
* clone (at least not in the original site context)
* delete
* disable
here are the tasks where it's relevant:
* verify
* install
* import?
* migrate
* restore
In the meantime, it's possible to add your own drush_exit() hook.
Comments
Comment #1
anarcat CreditAttribution: anarcat commented... i meant to finish this by saying:
"your own drush_exit() hook".
Comment #2
Steven Jones CreditAttribution: Steven Jones commentedSo we should just have some flag to mark it as 'dirty' and if it needs writing at the end it is, otherwise it isn't.
Comment #3
ergonlogicSo we're talking about provision_drupal_drush_exit() here? It looks like it's already a preg_match() against the command name to determine whether to write drushrc.php. Could we just extend this regex to include the other irrelevant commands?
Alternatively, this is where we would check against a 'dirty' flag (e.g., drush_get_context('PROVISION_SAVE_DATA')), or something similar? Presumably this would be set in a hook_drush_exit() in each of the relevant tasks?
Comment #4
anarcat CreditAttribution: anarcat commentedA dirty flag sounds like a better idea.
Comment #5
ergonlogicNew features need to be implemented in Aegir 3.x, then we can consider back-porting to Aegir 2.x.
Comment #6
helmo CreditAttribution: helmo commentedWe already filter on "preg_match("/^provision-(save|delete)/", ..."
Can't we extend the drush command definition with a property to indicate if re-saving the drush rc is required?
Comment #7
helmo CreditAttribution: helmo commentedReading this again I see that we already have an opt-out way. In drush_provision_drupal_post_provision_import we do
We could change the default for that and start to set it to true in the commands listed here in the summary.