Drush rundown

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
mortona2k's picture

Here's my slides:
https://docs.google.com/a/forumone.com/presentation/d/1QJlWEbtHSrWKUAwYq...

Collaborated notes are below, Thanks for participating!
http://piratepad.net/wBQnNBhpdh

Original post:
I'll put together a Drush tutorial for the next meetup. Please let me know in the comments what I should include or what you are interested in learning.

Comments

drush cc all

PapaGrande's picture

Clearing the caches from the cli is a great time saver when developing and fixing production server issues because you don't have to click through multiple pages to do it..

Installation profiles

sprocketman's picture

One of the great Drush commands is site-install, so I was thinking it might be good to go over how to set up and install different profiles when initializing a new Drupal site. Could be seperate presentation since it doesn't just apply to Drush. I'd be more than happy to go over that if anyone's interested.

install profiles

mortona2k's picture

I only have basic knowledge here, any pro tips would be cool!

Drush shell scripts

WarrenK's picture

I'd like to see some examples of scripting in drush.

I'm going to need help with

mortona2k's picture

I'm going to need help with that. I just know how to use the commands.

I'll pm you an example

jasonmce's picture

I'll throw together a little example drush script by Tuesday you can clean up and add to your presentation if you think it'd help

Please do, that would be rad.

mortona2k's picture

Please do, that would be rad.

So how does one debug a drush

mortona2k's picture

So how does one debug a drush script? Or do you just write perfect code and hope it works?

jasonmce's picture

because sometimes drupal apis surprise you :-)

What I tend to do is simply code the thing in steps, and heavily error-check at each step. Lots of internal error checking and posting of messages. And of course test it on your dev version of the site first if you can.

ex: in my "update all articles" sample code from the presentation

  • After my db_query("select nid from {node} where type='article' and status=1;") I output the $article_node_rows->countQuery()->execute()->fetchField(); to see if the # of rows looks right.
  • Then I add the while loop, with just the echo line (that should actually be) "goodnight article $node->author_id : $node->nid : $node->title: $node->field_publish_date\n"; and I'd let that run to spot check
  • Finally I'd put in my $node->save();, backing up the DB and hitting |enter| with crossed fingers
  • If there were no errors I'd "drush cc all" and do a bunch of after-check to see if I need to roll-back in a hurry.

Does that make me a bad person?

--Jason

Hehe no, you're not a bad

mortona2k's picture

Hehe no, you're not a bad person. So primarily echo and watchdog messages.. Is there a devel function that prints well in the terminal?

Thanks.

Top 25 drush commands...

hemant_saraf's picture

How about a demo of top 25 Drush commands and a talk about what one could do with it... also how to generate a make file from a current website? thanks...

make

mortona2k's picture

Can you tell me a little about how you want to use make? I figured out how to create a makefile and install from one, but an alternative that I use is rsyncing files and sql-syncing databases. Let me know what you want to do, and I'll add it to the demo.

Seattle

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week