The drop is always movingYou know that saying about standing on the shoulders of giants? Drupal is standing on a huge pile of midgetsAll content management systems suck, Drupal just happens to suck less.Popular open source software is more secure than unpopular open source software, because insecure software becomes unpopular fast. [That doesn't happen for proprietary software.]Drupal makes sandwiches happen.There is a module for that

Quickly navigating the deep directory structure

Submitted by nk on Mon, 2010-02-15 07:44

This works only on Linux:

chx@veyron:/var/www/drupal$ tail -3 /home/chx/.bashrc
function go() {
  cd `find . -type d -name $1`
}
chx@veyron:/var/www/drupal$ go views
chx@veyron:/var/www/drupal/sites/all/modules/views$

Do not use github

Submitted by nk on Thu, 2010-02-04 11:24

If you use git then use gitorious or repo.or.cz or anything that's not github. Reasons:

  1. github source code is not available. This makes me very uncomfortable. Who knows what might happen to the source code hosted there. I am not saying they will sneak in a backdoor but they could.

Rapidshare premium account download script

Submitted by nk on Tue, 2010-01-26 08:57

Although the web is full of scripts to help downloading from rapidshare with a premium account, none of them seemed to work for me. First, create a cookie file: curl -k -c .rapidshare -d 'login=USERID&password=PASSWORD' 'https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi'. In the browser first you click the "premium user" button, second you click "download". We download these pages because the first contains the number of the rapidshare server actually containing the file, like rs123.rapidshare.com and then the mirror like rs123gc3 for Global Crossing.

<?php

Drupal 8: everything is pluggable

Submitted by nk on Sat, 2010-01-23 20:17

In previous Drupals we had a rough version of plugins -- you could load a cache plugin instead of cache.inc but that was all. The pluggability was on file level and it only existed for very few files. Drupal 7 introduced many more pluggable subsystems and now the pluggability happens on a class level (mostly). We can plug in sessions, cache, queue, field storage, password hashing... Crell is working on unifying these for quite some time now. And this is all good, however, for Drupal 8 I would like to see a lot more.

Some Drupal 7 porting tips

Submitted by nk on Fri, 2010-01-22 08:32
  • UPDATE/INSERT often can be updated to a single db_merge.
  • Don't forget to ->execute() your db_select/db_insert/etc
  • Themes can have many variables and you might want to do
    function theme_fivestar_preview($variables) {
      $theme_definition = fivestar_theme();
      foreach ($theme_definition['fivestar_preview']['arguments'] as $key => $default) {
        $$key = $variables[$key];
      }

    Edit: merlinofchaos suggests simply extract($variables, EXTR_SKIP); because that's what templates do.

Just how big we are?

Submitted by nk on Fri, 2010-01-15 13:55

Up until now, Drupal tried (and tried hard) to work with every nick-and-dime shared hosting companies. We have changed course with the launch (and the success) of the GoPHP5 movement allowing us to use PHP 5.2 in Drupal 7. But that required a movement and was a huge change. I would believe that by now Drupal is large enough that it can set up some smaller requirements instead of worrying about which host will and which won't support it. One such has long been a problem -- the memory requirements -- but this as a problem affecting everyone and is filed and worked on as a critical bug.

On global warming

Submitted by nk on Mon, 2010-01-11 06:01

Just this morning I saw some tweets about how Global Warming is a "A marketable but mostly inaccurate name for something very very important." I fully agree. I would communicate the problem like this: The climate changes. Which is not a surprise because the climate always changes. Alas, it seems the direction the climate moves have dire consequences on humanity -- some places (affecting hundreds of millions at least) will have severe droughts and other places, like huge cities on ocean coasts might get flooded.

Another growth problem: shrinking amount of core contributors

Submitted by nk on Tue, 2009-12-29 20:12

While Drupal 7 is awesome, it's quite clear we have a problem: we do not have enough core contributors. According to Greg's post there are less than 700 contributors to Drupal 7 core. Compare this to Angie's report on Drupal 5 and 6 where the number have doubled -- and now it shrinked. Shrinking amount of contributors combined with a growing code base is uh oh.

form identity theft

Submitted by nk on Sat, 2009-12-26 11:29

I have created a rather complicated form to be submitted to search/location. There are two ways to do this, grab the search location form and alter it or if you need to do lots of fancy AJAX stuff which require a vastly different form structure, just recreate it and the lie to Drupal about which form it is -- in other words, steal the identity of search_form. You only need two lines of code in a form_alter (you can't do this in form generation as form_id gets overwritten unconditionally).

  $form['form_id']['#value'] = 'search_form';
  $form['form_token']['#default_value'] = drupal_get_token('search_form');

Simpletest alter or why do you want to port your contrib now

Submitted by nk on Sat, 2009-12-19 10:19

As we are writing various MongoDB related handlers (cache, session, watchdog and field storage are all ready -- I will write a longer post about MongoDB) we found that there are little pieces missing from Drupal 7. Like we needed to extend a core session test and then disable the original. Turns out, we forgot adding a drupal_alter to simpletest to allow for this. So I filed a trivial issue (adds one line of code) and I hope it will get in.

User login