Skip to main content
Joachim's blog

Main navigation

  • Home
  • About
  • Hire me

Breadcrumb

  1. Home

drupal planet

By joachim, Fri, 15/01/2010 - 14:37

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.

Tags

  • drupal
  • 5.x
  • 6.x
  • multisite
  • drupal planet
  • wtf
  • fix
  • is this a bug?
  • note to self
By joachim, Thu, 03/12/2009 - 14:15

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?

Tags

  • drupal
  • 6.x
  • development
  • multisite
  • localhost
  • drupal planet
By joachim, Tue, 17/11/2009 - 11:02

Counting Hooks

This (fairly long) one-liner counts the number of implementations of each hook in your Drupal installation:

ack "Implements? hook_" | perl -e 'while (<>) { m[(hook_\w+)] and $hooks{$1}++; } foreach (keys %hooks) { print "$_ - $hooks{$_}\n"; }'

To count only install file hooks, which was what I was doing, give ack the option "-G '.install'" thus:

ack "Implements? hook_" -G '.install' | perl -e 'while (<>) { m[(hook_\w+)] and $hooks{$1}++; } foreach (keys %hooks) { print "$_ - $hooks{$_}\n"; }'

Tags

  • drupal
  • perl
  • drupal planet
By joachim, Fri, 06/11/2009 - 08:56

Six Reasons To Get A Handbook Page For Your Module

Checkout view being currently disabled in ViewVC is a very good opportunity to remind everyone that linking to your README.txt file in CVS does not count as documentation on your project page!

Here are some things I, or anyone else, can do with a proper documentation page in what used to be called the handbooks section of drupal.org:

  • Correct it.
  • Expand on it.
  • Clarify things for newbies.

Tags

  • drupal
  • modules
  • drupal planet
By joachim, Wed, 04/11/2009 - 15:41

Nodes As NIDs

Is it just me who finds this poor style and potentially confusing:

<?phpfunction my_function($nodes) {  foreach ($nodes as $nid) {    // do stuff  }}?>

To me, a variable names $nodes will be an array of nodes -- that is, node objects. If it's an array of nids, I would call it $nids to avoid confusion about what we have there.

I'm curious if other people agree (in other words, is it worth my time writing a patch for core or will it just lead to bikeshedding?)

Tags

  • drupal
  • code style
  • drupal planet
By joachim, Wed, 04/11/2009 - 15:19

Creating A Set Of Fields In One Swell Foop

Situation: you need a heap of imagefields that more or less have the same setup. Let's not go into why.

You could spend half an hour bored witless clicking through the interface.

Or you could create just the one field, export the content type with content copy, and then doctor the code a little before importing it back in. Like this....

<?php
// The usual content type stuff here.
// Set of image fields
$image_fields = array(
'field_image_1' => 'Image 1',
'field_image_2' => 'Image 2',
// etc
);

foreach ($image_fields as $name => $label) {

Tags

  • drupal
  • 6.x
  • cck
  • drupal planet
By joachim, Sun, 18/10/2009 - 11:09

Small Core, Big Drupal, Tighter Contrib: Outer Core?

I've been mulling this idea since Paris, trying to figure out the best way to present it.

But basically:

We want a smaller, slimmer, efficient core.
But we also want Drupal to, like, be useful.
We want contrib, at least the high-use end of contrib, to be smoother, more organized, released on time with core.
It's been suggested we have a contrib maintainer, who would have the unenviable task of managing a huge kaboodle.

Tags

  • drupal
  • thinking aloud
  • core
  • roadmap
  • drupal planet
By joachim, Tue, 18/08/2009 - 09:21

Never Write A Line Of Code Again!

Okay, so I lied. But module builder can save you a lot of time when writing custom modules.

And it now works with drush, too. I added support for drush a few weeks ago, which let you do things like "$ drush mb mymodule cron init menu nodeapi --write" and hey presto, a new module folder is created, with an info file and a module file, with hook implementations ready to do your (evil) bidding. (Note: this blog does not sanction use of Drupal, module builder, or drush for evil.)

Tags

  • drupal
  • 6.x
  • module builder
  • development
  • Drush
  • drupal planet

Pagination

  • Previous page
  • 3
drupal planet

Frequent tags

  • Drupal Code Builder (9)
  • git (7)
  • module builder (7)
  • 6.x (5)
  • drupal commerce (4)
  • development (3)
  • Entity API (3)
  • tests (3)
  • Field API (3)
  • patching (3)
  • Rector (3)
  • Composer (3)
  • Drush (3)
  • contributing code (3)
  • drupal.org (2)
  • debugging (2)
  • multisite (2)
  • deprecation (2)
  • issue queue (2)
  • Drupal core (2)
  • core (2)
  • modules (2)
  • roadmap (2)
  • 7.x (2)
  • developer tools (2)
  • wtf (2)
  • maintaining projects (2)
  • code style (2)
  • contrib module (2)
Powered by Drupal