6100 comments
2357 subscribers
6264 on Twitter
Subscribe! Feed reader E-mail

Drupal notes from helping a client improve her development environment

Keeping a to-do list helps you keep sane. If you don’t have a full-scale issue tracker, use a wiki page, text file, or something like that. It’s really useful to be able to get the list of things you’re working on or waiting for out of your head and into a form you can review.

*Drupal Features help you export configuration into code.* This is much better than creating an installation profile because you can update your features with new settings and apply them to existing sites. Invaluable when working with multi-sites that may need to be updated. You may need to clear your Drupal cache before you see changes applied.

Version control is really handy even when you’re working on your own. The ability to go back in time to a working setup (code + database) can help you experiment more freely and avoid late nights spent recovering from mistakes.

*Drush (Drupal shell) is awesome.* It’s a big timesaver. We use it to download and enable modules (dl and en), clear the cache (cc), run database updates (updatedb), launch a SQL console (sqlc), execute PHP (php-eval), run tests, and so on. I use it a lot because I hate clicking around.

Even more powerful with a little bit of xargs magic so that it’s easy to run a drush command against all the sites. Like this:

cat sites.txt | xargs -n 1 -I {} drush -l {} somecommand

Design decisions: Multisite without shared tables; services or syndication for sharing content between sites; central authentication for admin users…

Bash script to create or clone multisites makes tedious things a little bit simpler. Tasks:

  • Create a database and give access to a user.
  • Create the site and files directory.
  • Create the settings.php with the database settings.
  • Copy the base database into the new database.
  • Create a symbolic link.

2011-06-28 Tue 08:55

Short URL: http://sachachua.com/blog/p/22331
  • http://www.clausconrad.com/ Claus Conrad

    Hi Sacha, two things:

    1) I agree with everything above, especially what you say about version control – I started using it for my own projects after being forced to for multi-developer projects and can’t emphasize enough, how much that decision has helped me. I strongly believe every developer should learn how to use version control before or while learning how to code.

    2) Contradicting no. 1, I find it really hard to keep database schemas synced to version control, so I usually only use them for code. Do you have any “best practices” on how to make version controlling your database less frustrating, regardless of the CMS used?

  • izus

    instead of :
    cat sites.txt | xargs -n 1 -I {} drush -l {} somecommand

    if you installed drush4 you can just run drush @sites in a multisite installation !

    drush @sites cron runs cron in all sites installed in a multi-site :-)

  • http://sachachua.com Sacha Chua

    izus: Ooooooooh. I didn’t know about that. That’s awesome! =D

    Claus: Drupal 6 and Drupal 7 database schemas should be updated in .install files using the schema API, so that might help. We version-control database backups as an easy way to go back in time for content or configuration.

  • Roger

    I always like your posts, Sacha.

    What do you use for central authentication for admin users?

  • Arjan

    I second that question: what do you use for central authentication for admin users? (and separate databases, different domains)

  • http://sachachua.com Sacha Chua

    The client is looking at CAS as a potential way to handle central authentication for admin users across multisites. LDAP may be another alternative.

On This Day...

  • 2012: Business update: Four months in! — I started my own business four months ago, and I’ve been slowly poking and prodding the boundaries of my comfort [...]
  • 2010: Weekly review: Week ending June 27, 2010 — Happy summer! I finished building my Adirondack chair today. I think it’s the first time I’ve ever sat in a [...]
  • 2009: The joys of making things — Today was a day for making things. I made myself a simple lined tote with adjustable straps and exterior pockets–deep blue [...]
  • 2006: Hey! Toastmasters! =D — Keynote Speakers Advanced Club - Club #: 8600, Dist #: 60, Est: 04/29/2003 Meeting Time: 10:00 am, 2nd & 4th Saturday OPG [...]
  • 2006: What’s your story? — Thanks to Gabriel Mansour, I was part of a fun podcast with Joey de Villa (Accordion Guy, Tucows). Joey and [...]
  • 2006: Tiny laptop = conversation starter — I can’t count the conversations that have started because my laptop’s smaller than usual, but I’ve enjoyed each of them. Today [...]
  • 2004: Teaching reflections — CS21A Dr. Sarmenta finished the lecture on Java Basics and started on Conditionals. I’m worried that the students might find the discussion on [...]

Get the highlights as a PDF!

Stories from my Twenties: Highlights from a Decade of Blogging

Free sample!