Book progress
I'm extremely pleased to note that Matt Westgate of Lullabot has agreed to be a coauthor on the book. I'm pleased not only because Matt brings a wealth of Drupal experience to this endeavor, but because I'll be having lunch with him more often.
Pubcookie for Drupal 4.7
I've just committed a version of the pubcookie module that's compatible with Drupal 4.7. I also added a bit to the README to explain how the pubcookie module works:
When you click on the Log In link provided by the pubcookie block, it takes you to the directory you specified for "Login directory" under admin > settings > pubcookie (by default, 'login'). The pubcookie module takes this path, adds "pc" (an arbitrary string) to the end of it and -- and here's the key -- registers it as a menu item in the menu hook. So now http://yourdomain.com/login/pc is not a nonexistent file but a registered Drupal path that is "located" inside a directory that's protected by a .htaccess file restricting the contents to pubcookie-server-authenticated users. So when you reach that path, the pubcookie module receives a call to pubcookie_page() and goes from there.
Script for automating Drupal installation
I do a lot of testing with Drupal, so I need a quick and easy way to create a new Drupal site, create the associated database, and get started. There are probably better solutions out there, but this is what I use. It's a bash script that I developed with the help of killes sometime last year. I just updated it for Drupal 4.7.
Now when I want to create a new Drupal site I just type
newdrupal47 foo bar
where foo is the name I'm giving the new site and bar is the name of the MySQL user (the MySQL user is optional; it defaults to root). It gets the Drupal 4.7 branch from CVS, configures the settings file, creates the database, optionally runs some local SQL, and opens Safari. Here's the script (it lost the indentation, oh well):
#!/bin/bash
if [ $# = "0" ]; then
echo "newdrupal47: usage: newdrupal47 sitename db_user"
exit 1;
fi
# You may want to set HOST to be your box's domain name
HOST='localhost'
DB_USER='root'
# If second argument is nonzero we were given a db_user;
# use it instead of defaulting to root
if [ -n "$2" ]; then
DB_USER=$2
fi
# This is the location of an SQL file to run after the Drupal
# database has been given to MySQL. I use it to insert one
# line into the user roles table and one line into the user
# table, thus establishing the admin user.
LOCAL_SQL=~/newdrupal47.sql
# This is the location of your htdocs directory.
DIR="/Library/WebServer/Documents"
echo "Changing directory to $DIR"
cd $DIR
echo "Retrieving Drupal 4.7 branch..."
# Pull down drupal 4.7
cvs -z3 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal checkout -r DRUPAL-4-7 drupal
echo "Configuring..."
# Rename the drupal site from "drupal" to whatever the first parameter was,
# e.g. newdrupal47 drupaltest results in a directory named drupaltest
mv $DIR/drupal $DIR/$1
# Make a copy of the default settings folder and name it localhost
# You may want to substitute your machine's DNS name
cp -R $DIR/$1/sites/default $DIR/$1/sites/$HOST
MYSQL_LOC=`which mysql`
if [ -x $MYSQL_LOC ]; then
echo "Enter the database password for user '$DB_USER'"
echo -n "Password: "
read -s PASS
# set local database connection
# -i means edit file in-place
# we search only lines 85-90 in the settings file
sed -i '' 85,90s#username:password@localhost/databasename#$DB_USER:$PASS@localhost/$1# $DIR/$1/sites/$HOST/settings.php
# set the base url
sed -i '' 108,110s#www.example.com#$HOST/$1# $DIR/$1/sites/$HOST/settings.php
echo "Creating database..."
mysqladmin -u$DB_USER -p$PASS create $1
$MYSQL_LOC -u$DB_USER -p$PASS $1 < $DIR/$1/database/database.4.1.mysql
echo "Checking for local configuration..."
if [ -r $LOCAL_SQL ]; then
echo "Found local configuration; executing SQL"
$MYSQL_LOC -u$DB_USER -p$PASS $1 < $LOCAL_SQL
fi
fi
echo "Done"
#opens Safari to the new site on OS X
open http://$HOST/$1
Drupal 4.7 released
Two major projects have been released. The first is Drupal 4.7.
The second is code-named Nathaniel.
Would you believe that the first project actually took longer?!
Progress
I'm nearly ready to submit the first set of chapters to the publisher.
I'm also revisiting the publish and subscribe modules. Finished 4.6 and 4.7 versions coming soon.
I was able to hear Ray Kurzweil speak this past week at the Human Computer Interaction Forum I attended.
Baby coming soon, too!
Resource contention
I've spent the past two days migrating a very busy community site from a Windows server in Georgia to a FreeBSD server in Iowa. The new server is faster hardware, but even so the server is living on the edge of available CPU and memory. This is good, because it means I'll have to learn more about tuning a busy Drupal server.
I'm off to Washington, D.C. for a bit to work on a BEN project. I see the long shadows of CCK, actions, workflow, and views playing a big part.
OSCMS
It's now day 2 of the Open Source CMS Summit and the conference is going great guns. There's a general hum around the conference and great ideas are getting thrown around.
Strangely, the best session today for me was not Drupal-related -- it was the smalltalk session on Seaside. I'd read about smalltalk's continuations before but had never seen them demonstrated. Avi Bryant gave a demo that had jaws on the floor as he dynamically changed his (~8 lines of code) shopping cart demo while it was running. Unfortunately, Drupal is firmly anchored in the mediocre world of PHP, and that shows no signs of changing. But that doesn't mean we can't take some of the ideas, where the language allows us.
Adrian Rossouw, Earl Miles, Jeff Robbins and I had a great conversation over dinner about how actions, forms API, and web services can integrate. The theory is that actions take parameters as input, and one way to get those parameters is to fill out a form. So a browser can drive the action, but an XML-RPC call could, too. New tonight was the realization that automatically exposing subsets of actions as macros to end users who have the proper permissions solves much of the problem that we currently solve with a PHP filter, only more securely.
As I've said to several people today, what makes Drupal fun for me is a combination of working on problems and solving them in the best way possible and being surrounded by people who are smarter than I am. That stretches me, just like approaching a problem from a completely different paradigm (e.g., the smalltalk demo) stretches me.
Pre-OSCMS Summit
I've updated the session description for the actions/workflow session that Matt Westgate and I are putting together for the upcoming OSCMS Summit. So far 44 people are signed up for the session. Wow! That's enough that we've split the session into smaller working groups after a brief intro.
When I mentioned that I was going to Vancouver, a colleague mentioned The Salmon House.
Token-based authentication
Drupal embraces other technologies. It's a bit like universal glue. There's a proposal to add token-based web service authentication to Drupal.
I've been meaning to spend more time exploring service-oriented architecture since it seems to be all the rage lately. Getting a Little Closer to SOA was helpful and the chapter from Web Services and Contemporary SOA (Part II: Advanced Messaging, Metadata, and Security) was good.
I'm still not sure enough about how to express Drupal's architecture to map it into one of the traditional box-and-line figures to think about such things, though I'm thinking about it a lot as the Book takes shape.
I'd like to see Drupal have self-defining exportable content types (that's the elusive CCK), workflow for Drupal's main types (users, nodes, comments, and documents*), relationship-based data interchange (that's publish/subscribe), actions that are triggerable by multiple inputs (workflow state changes, cron, a poke with a sharp web service call), and views. I want Drupal to internally know the difference between doing things singly, e.g., a node_load() on each of the 4 nodes we're loading, and in batches (e.g. node_batch_load()). And I think everyone who installs a Drupal site should get a pony.
*Documents are files with a node to hold the metadata, e.g. images, MS Office documents.
Writing
I've completed two chapters so far of the Drupal book, Sessions and Writing a Module. Next up, I'm tackling the form API. For that, and in preparation for Vancouver, I need to delve deep into the form code. So far it's been a nice clean place.



