I've written a small Drush command to facilitate giving user ownership of a node and it's revisions or comment to a specified user. I mostly use it to correct my own blog postings or comments that I make when I'm logged into my blog with the wrong user account.
With such a weird and niche use case, I didn't think it belonged in core, but I thought it might have a place in Extras. Checking here before publishing elsewhere.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | drush_extras.933030-6.patch | 5.24 KB | Grayside |
| #4 | drush_extras.933030.patch | 3.83 KB | Grayside |
| #2 | drush_give.drush_.inc_.txt | 5.01 KB | Grayside |
| drush_give.drush_.inc_.txt | 4.97 KB | Grayside |
Comments
Comment #1
greg.1.anderson commentedLooks useful; I'll gladly take it in extras, but first I need to (re) create the drush-extras project.
The patch looks good. My only comment is that you have a few drush_log 'notice' and 'warning' that inform the user that the operation could not be completed. These should all be drush_error. The places where you use drush_log 'success' are appropriate.
Comment #2
Grayside commentedUpdated to use drush_set_error().
Comment #3
greg.1.anderson commentedCommitted -- although I notice there are still a couple of missing dt()s, and a couple of drush_log()s that should be drush_set_error().
Comment #4
Grayside commentedAck, sorry about that. Attached patch hopefully corrects the rest. Also added some quotation marks around node titles and user names to make it easier to read them.
Comment #5
greg.1.anderson commentedCommitted.
I did notice some minor errors that could still be corrected. The code seems to charge ahead even when there is a bad account:
You should use
return drush_set_error(...);to bail out of the function. Also, -s is not respected.Comment #6
Grayside commentedAttached patch hopefully fixes the remaining drush_set_error() gaffs. While I was at it, I did some error message standardization and a few other tweaks.
Strange to keep enhancing it in the same issue. ;)
This patch should be applied to the command in the repo, it is not a new copy of the entirety of drush_give.