Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Are there any plans to add Drush support?
Are there any plans to add Drush support?
Comments
Comment #1
Sivaji_Ganesh_Jojodae CreditAttribution: Sivaji_Ganesh_Jojodae commentedI am currently working on this. I will submit a patch tomorrow.
Comment #2
Sivaji_Ganesh_Jojodae CreditAttribution: Sivaji_Ganesh_Jojodae commented@sun I got the initial version of drush demo integration code done, please review it when you get time.
If anyone want to make improvement in the above patch, you would use this link http://api.drupalecommerce.org/api/drupal/contrib-6--drush--includes--dr...
Comment #3
TravisCarden CreditAttribution: TravisCarden commentedThank you, @sivaji; this looks great! I've tested it with the latest dev release. Here are my findings/thoughts:
TOHAVE A BACKUP OF YOUR DATABASE". I've corrected them and attached a new patch.demo-create
.) I don't know if it should be that way or not.demo-snapshots
should sort the snapshots by date the way the web interface does?drush_confirm
when deleting a snapshot.Thanks again, @sivaji! :)
Comment #4
TravisCarden CreditAttribution: TravisCarden commentedOops. One more thing: It looks like if none of your snapshots have any description, it mucks up the table headings in the output of
demo-snapshots
:If I simply add a snapshot with a description, I get this:
Comment #5
TravisCarden CreditAttribution: TravisCarden commentedAlso, could we shorten
demo-snapshots
to, say,demo-list
? It's less to type, and I for one find it much easier to remember. (I have to stop and think every time to remember "snapshots".) If not, perhaps we could get a shorthand version of it.Speaking of which, perhaps we should add a command alias for
demo-delete
, such asdemo-del
, in keeping with the precedent set by Drush core (e.g.variable-delete (vdel)
andwatchdog-delete (wd-del)
).Finally, I wonder if there would be value in adding, say, a
demo-info
command to get more detail on a particular snapshot (namely, a list of the modules installed, as you would find on the web interface) similar topm-info
for modules. Hopefully that's the last thought I'll have on this tonight. :)Comment #6
Sivaji_Ganesh_Jojodae CreditAttribution: Sivaji_Ganesh_Jojodae commentedI guess MD5 checksum is the ideal way to cross check this.
This is true (for instance see below), could be a bug in drush.
Done, now it will list items sorted by modification date, recently modified file will appear first.
It makes sense. Added drush_confirm for delete command.
I can reproduce that only when the console width is small like 80x24 otherwise it looks fine. It is drush_print_table() API generating the table with dynamic width for columns. It turns too bad if i set width manually.
I like to go with following set of alias.
command alias
demo-create demo-mk
demo-delete demo-rm
demo-reset demo-rs
demo-snapshots demo-ss
demo-status demo-st
Let me know what you think about this.
Comment #7
TravisCarden CreditAttribution: TravisCarden commentedI compared the contents of a snapshot created through the web interface with those of one created with Drush, and they were identical except for a little session data, which is to be expected. So it looks like we're good on that front.
Your changes look great! I like how your first two command aliases (
demo-mk
anddemo-rm
) mirror corresponding Linux commands. That was smart. Unless the other three also mirror common commands I'm unfamiliar with (I'm a bit of a Linux n00b) I'd personally just omit them and suggestdemo-list
as an alias fordemo-snapshots
, but as you're the one doing all the work here, I happily defer to your judgment. :)I also proofread all the messages in the code and corrected a dozen or so typos and grammatical errors and made small changes to wording to maintain consistency with core Drush messages (mostly changing verb tenses). I also deleted a
TODO
that had been completed. Here's a new patch.Comment #8
TravisCarden CreditAttribution: TravisCarden commentedUh-oh. Suddenly
demo-delete
isn't working for me, but I'm getting a PHP error instead of a Drush message:Is it still working for you, @sivaji? I don't think I changed anything that should have broken it, but I don't have time to test further tonight.
Comment #9
Sivaji_Ganesh_Jojodae CreditAttribution: Sivaji_Ganesh_Jojodae commentedThanks for correcting typos and grammars.
Aha that's my change in patch #6 breaking delete command, attached patch will fix that. I like to use
demo-ls
(similar todemo-mk
anddemo-rm
) as an alias fordemo-snapshots
. Let's see what others think and will choose the best one.Hopefully everything is working fine now, i am curious to hear from tha_sun (I remember i have to update #754798: Default dump file name will do later today.)
Comment #10
TravisCarden CreditAttribution: TravisCarden commentedGood thinking with
demo-ls
; I like it.demo-delete
works again.Comment #11
TravisCarden CreditAttribution: TravisCarden commentedI've been looking at
drush_print_table
anddrush_table_column_autowidth
to see if I could identify the problem reported in comment #4 as belonging to Drush core, and I can't replicate the issue with any other commands. On the other hand, if I comment out line 197 of demo.drush.inc, I don't have the problem withdemo-snapshots
anymore, either.Does that suggest anything to you, @sivaji? I can't see what could be wrong with demo.drush.inc, but I can't seem to "break" anything else.
Comment #12
winston CreditAttribution: winston commentedDon't want to make this into a support request, but it might have relevance for this patch.
Does demo module have a concept of what is the "currently applied" demo snapshot?
If so, then a demo-update drush command to simply apply the current database state to the current applied snapshot would be helpful. Then again, perhaps this isn't such a good thing?
Here is my use case for reference. I'm using demo module to build a series of demo snapshots for a training course. The snapshots allow a student to "fast forward" to a specific point in the class (or catch up, etc.). What I'd like to be able to do is write a script using drush that will go through all the demo snapshots available, apply them, do a drush up to ensure they have the latest recommended versions of each module + update.php. That would be slightly simpler if a drush demo-update were possible so my script would use your drush demo-ls to get a list of the snapshots then looping through each one...
drush demo-reset "next one"
drush up
drush demo-update
loop
Anyway really glad drush integration is so close!
Comment #13
TravisCarden CreditAttribution: TravisCarden commentedI'm not entirely sure I understand the request, @winston. Your thought is that
demo-update
would detect which snapshot the current state of the site reflected? In other words, it would compare your site with your snapshots and say, "This is the snapshot that your current site is based on". My first thought is that that isn't really feasible because the live database will have changed from the snapshot, even if only with respect to the sessions and logs. There are perhaps a few ways it could be basically accomplished, but those that I can think of would be either extremely complicated and resource-intensive or hacky. In short, it would involve the addition, not merely of a Drush interface, but a whole new feature to Demo module itself; for which reason I would encourage you, if you wish to pursue it, to open a separate feature request issue. As to your plan to create a script to loop through snapshots applying them, you should only need to apply the latest one, because each snapshot is a complete export of the database and stands alone. Applying several serially will have the exact same effect as just applying the last one. Best wishes!Comment #14
auzigog CreditAttribution: auzigog commentedHey all. I'm interested in this support.
It seems to have stalled. How can I help move it forward from where it is currently at?
Comment #15
winston CreditAttribution: winston commented@TravisCarden
Yes, you're right my request doesn't make any sense :/
However, I do think this functionality as discussed will be helpful for me as I should be able to do what I want with a regular shell script with this functionality available to Drush. Basically I'd like to be able to loop through a set of snapshots (which I would be able to get from list), apply them, do a drush up after the snapshot is applied, then create the snapshot again.
Comment #16
TravisCarden CreditAttribution: TravisCarden commented@auzigog: Thanks for asking! You could test the patch in #9 and give your feedback. We've only had two eyes on it so far. Also, there's a bit of a rendering issue described in #4 and #11 that you could help us diagnose—or at least confirm it still exists. That would be a big help!
@winston: I still don't understand the need to loop through a set of snapshots, because snapshots aren't cumulative. Each one is a full database dump. If you apply one from yesterday,
drush up
, and then apply one from today, whatever changes were made to the database viadrush up
will be overwritten and lost when you apply the second snapshot. You'll have todrush up
. Just applying the very latest snapshot and doing adrush up
would have the same result (and, obviously, be much easier). If you still feel you need the functionality, please create a new support request. Thanks!Comment #17
Cyberwolf CreditAttribution: Cyberwolf commentedSubscribing.
Comment #18
frederickjhHi All!
Seems this lost momentum as it has been sitting since August 2010. any chance to get this review soon? Any chance of porting it to the D7 version of demo?
Comment #19
gaurav.kapoor CreditAttribution: gaurav.kapoor at OpenSense Labs commentedPatch looks good , it will be very useful addition , somebody should pick up these for D7 and D8 as well.
Comment #20
gaurav.kapoor CreditAttribution: gaurav.kapoor at OpenSense Labs commentedAdded to 6.x-1.x. Will open issues for D7 and D8 Drush integration as well. Removed the commented code part , in future it can be reproduced from patch submitted.