Drupaler
Cleaning Up After Migrating To Drupal
We have just finished a migration job for a client of ours from an old .Net system in to Drupal, the last task of which was to write some Apache mod_rewrite conditions and rules to deal with the URLs of their old website. This proved to be more trouble than I thought, mainly because I struggled to find examples of how this might work.
Firstly, the ground work. The URL pattern to be redirected looked like this:
MainArticle.aspx?m=33818&amid=30301119
Getting Stuff Done
Basically, an initial patch went in, we opened followup issues for cleanup, the followup issues never got followed up, so what's in HEAD is a bit of a mess. — catch, in a recent issue comment
This happens far too often. I'm not linking to the specific issue in the Drupal 7 queue because I don't want to point fingers; this suffices to exemplify my point.
Services, or How I Learned We're All Just Secretly hook_menu()
I am now batting nodes, complete with imagefield, between separate instances of Drupal with merriment and glee. For yes, I do have a working beta of Content distribution.
I'm about to quickly write a service to get CCK's content_fields() array from the remote, distributing site, so that the retrieving site can show a UI of possible values for a Views nodereference argument. Try it. It all makes sense once you do.
Multilingual Drupal: Some Dos And Don'ts
So we've done all French sites before. And we've done all English sites before. But a recent project was our first real forray in to multilingual sites and it's an e-commerce/Ubercart job! Talk about gluttons for punishment!
There are bags of tutorials, so I'll keep this short but sweet. A list of dos and don'ts from our painful, recent experience:
- Don't change the default language after initial set-up. Set your default language right at the start and don't mess with it. Ever.
Why Is Writing Drupal Documentation Harder Than Writing Wikipedia?
I used to write on Wikipedia, years ago when it was a wild frontier, we had barely 30 thousand articles, and not even my geek friends had heard of it from a source other than my blathering on about it.
How Drush Make Just Changed My Life
Note: Apparently it works fine with Windows too! See comments.
I'm pretty excited right now. I just tried drush make for the first time. Download it here:
http://drupal.org/project/drush_make
That's an order! You'll need drush too, if you don't have it yet (in which case, shame on you ... call yourself a Drupal developer?!)
http://drupal.org/project/drush
Importing Nodes Using The Batch API
For a recent custom module I was building I was faced with the challenge of having to create a bunch of nodes from data stored in an XML file.
I decided not to use Feeds or Node Import modules for a couple of reasons –
- The XML structure was fairly custom (it was coming out of one of our internal .net databases – euugh!)
Wrapping Up: A Linux Script For The End Of The Day
Here's another one of my little Linux admin scripts for all you Drupal developers out there. It's a Linux shell script requiring Drush, MySQL and Subversion, but could be easily modified to work with other databases and repositories and should work fine on a Mac, I think.
Getting French Characters On Your English Keyboard With Gnome
Those familiar with Windows (and I guess Mac OSX too) will probably be aware that you can get an é character from your keyboard by pressing AltGr + E. You may not be aware that in Linux you can't. This was a bit of a problem for me, as I live in France, a country who's native language relies rather heavily on the accents in the special character set. For example, the town I'm in is called Uzès and my daughter is called Moïra. It's also been driving my wife bananas, since she actually needs to write emails and letters in French but we have British keyboard layouts.
Drupal Help Haiti: Day 4
Ups and downs again today. Some strong support from Europe again, but the US has yielded no strong continuation. Don't get me wrong, we have people in the US interested in helping, and we're extremely gratefful for that, but we don't seem to have a US project "driver", so it seems to drop to pieces.
I managed to make some good progress this morning with Feeds, Views and Panels. And numerous people added to that progress throughout the day, so we actually got a reasonable amount done.
OpenID, I'm Starting To Understand
Important edit: Seems it doesn't work with Google Apps accounts - apologies to Zach in the comments, you were quite right. I'm revising this post. However, it does still work as described with all Google Mail domain accounts (e.g. personal Google accounts).
So, OpenID. Been about for a while. I kind of knew how it worked. I also knew I had dozens of OpenIDs, all in places of no use to me whatsoever that were generated automatically when I signed up for some service or other.
Drupal Help Haiti: Day 3
Having finally sorted out our goals (use the Project EPIC Twitter syntax to get targetted information to people who can help, using Drupal as a tool for managing and organising that data), day 3 started with an ambitious set of tickets:
- Identify and engage with an SMS gateway
- Configure the Feeds module to create nodes
- Create views for displaying aggregated tweet nodes
- Collate list of Haiti resources
- Install Backreference module
Drupal Help Haiti: Day 2
So we've started the second day of this project. Our mission is starting to become clearer.
Yesterday, within 7 hours of the effort really getting under way, we had a server, a team, an installation of Development Seed's excellent Managing News, but no real clue about what might be useful. There was a lot of chat about mapping, but Robert pointed out the UN are already doing a stunning job of mapping the crisis and also need volunteers. So dividing the Drupal geo community amongst us would be damaging and stupid.
Then we found this:
Helping Drupal Help Haiti
You may have noticed a degree of Haiti noise on the Internet today. Michael Caudy kicked things off and Robert Douglass quickly joined him on the campaign trail to get Drupal developers on board to create a Drupal website to help the aid workers hard at their tasks in the aftermath of the earthquake there.
Drupal And Linux, A Deployment Script
Quick post today, no politics *whatsoever*. ;-)
I just wrote another little batch script for deploying my Drupal sites from local to stage. Before I post the code, here's the workflow here in our office at CMS Professionals:
- Code is stored in Subversion away on the Internet (svn.cmspros.co.uk)
- Each developer has a working copy on their laptop
- Database during development is held on central (dedicated) CentOS/MySQL machine on our office LAN
Duplicate Issues, Are They Really A Problem?
We often see people getting berrated for posting dupes, sometimes deservedly. Let me say from the get go that I do not, in any way, support the needless creation of noise in issue queues by people who are so lazy as to have made *NO EFFORT WHATSOEVER* to find a solution. These people are a problem, and they waste everyone's time. But shouting at them does nothing. They won't change. Blanking them is the best approach. Close the issue with a link to Google or something.
Files Aren't Visible From All Domains Of A Site
I had a fun afternoon a few months back when all the imagecache images broke on a site I'd just taken live. I've just figured it out, so I'm telling you about it.
This was the situation:
- subsite.client.com was where I was developing the site, one of a family of multisites.
- subsite.com was a parked domain that went to just this site. It was this I'd just pointed to the IP of the box and that wasn't showing any images.
On the development domain, all worked fine. On the subsite domain, nothing.
Rewriting URLs For SEO
Quick non-Drupal, but very useful, post here. There are lots of people talking about things like this on the 'net, but I've never found my specific requirements in one place. So here they are, in one place. I'm sure other UK web developers will need them!
This is about avoiding duplicate content by making sure that any requests to no sub domain (e.g. http://drupaler.co.uk) get permanently redirected to the correct sub domain (e.g. http://www.drupaler.co.uk). This way Google doesn't see duplicate content and we're like three little Fonzies, Drupal, Google and me.
Drupal Services And The Dreaded Clock
Quick post this evening, because I'm stopping for the day. Just a troubleshooting tip for web services. We use the excellent Drupal Services module quite a lot for integration work. Take a look, if you don't know it:
http://drupal.org/project/services
Anyway, we always switch on the full security options, which are great for securing the API but stacked full of nasty gotchas. I had a new one today and I thought I'd share.
Part of building an authentication token for the Drupal Services module is adding in a timestamp. The code we normally use looks like this:
<?php
Multisite On localhost Without Virtual Hosts
I've been putting off setting up multisite on my localhost for ages, mostly because in the past I've found getting Apache virtual hosts to work can be a bit tricky: not impossible, but the sort of thing where I could easily lose an hour on a minor thing I've forgotten to do. And after all, with a shiny new iMac and a hard drive whose proportions I can't even remember, why not just 'drush dl' all over again?
But I'm actually working on a multisite project at the moment, and suddenly getting this to work becomes more interesting than having another SVN copy of my code kicking around.
Given multisite can respond to subfolders, I was wondering if this could work when Drupal itself is in a subfolder, like this:
