Drupal

OSCMS 2007

Back from Sunnyvale, where I had an enjoyable time at the 2007 OSCMS conference. I spent time hawking the book, geeking out, and hanging out with Adrian.

Unfortunately my return flight was badly timed (reminder: book flights earlier next time!) and I nearly missed it because I was talking to Dries about the actions module. Wish I could have been there for the whole hack session.

Judging by the buzz at the conference, Drupal has a bright future.

As for the conference itself, there was only one thing missing.

Topic: 

Zend Platform on an Intel Mac

Finally. After over a year, Zend has recompiled their debugging extension so it will run on Intel Macs. That's the good news. The bad news is that now it's part of their enterprise-class Zend Platform product.

I'm running the 30-day trial, and was able to install it by running the install shell script and choosing the manual option to enter my Apache settings. Apache wouldn't restart after the installation because of course the xdebug extension that I had enabled in my php.ini file needed to be disabled.

Oh so close!

We are less than a week away from going to print with Pro Drupal Development!

We didn't quite get the book into print before the 2007 OSCMS Summit. If you're attending, I'll be the tall guy in the trench coat going "Pssst! Wanna buy a Drupal book?"

I plan to lug a copy of the proofs along for anyone who wants to flip through the book. Hmm, maybe I'd better weigh them before I make that commitment.

Searching Drupal code

Often I find myself in the position of having to find something in the Drupal codebase. It's easy to do; from the command line:

cd drupal5
grep -rn contact .

This recursively searches the code for Drupal 5 and returns all occurrences of the word "contact", along with the filename and line number. Suppose I'm searching for the places where the contact database table is updated in Drupal. I can pipe the results into another grep:

grep -rn contact . | grep UPDATE
./modules/contact/contact.module:227:    db_query('UPDATE {contact} SET selected = 0');
./modules/contact/contact.module:242:    db_query("UPDATE {contact} SET category = '%s', recipients = '%s', reply = '%s', weight = %d, selected = %d WHERE cid = %d", $form_values['category'], $form_values['recipients'], $form_values['reply'], $form_values['weight'], $form_values['selected'], $form_values['cid']);

If you find yourself doing this frequently, it's helpful to make a shell script. I use OS X, and in my user directory I have created a directory called bin in which my scripts live. Of course, I've had to modify my /Users/john/.profile file to include that path when OS X is searching for executables by adding the following line:

PATH=$PATH:/Users/john/bin

I created a file at /Users/john/bin/f that contains the following line of code:

#!/bin/bash
grep -rn $1 .

Now instead of typing grep -rn contact . I can simply type

f contact

Quick 'n' easy. For more shortcuts, see Steven's handy tips.

Pages

Subscribe to RSS - Drupal