WP Super Cache 0.8.9

WP Super Cache version 0.8.9 is now available. WP Super Cache is a page caching plugin for WordPress that will significantly speed up your website.

This version fixes a number of bugs and adds two new features, but in case you run into problems upgrading, make sure you delete wp-content/advanced-cache.php before copying plugins/wp-super-cache/advanced-cache.php over it. Go on, read that again. Delete that file. Jonathan Dingman didn’t and when he copied the file over the symlink he overwrote wp-super-cache/wp-cache-phase1.php. His site went belly up and he started screaming for my head!!! Err no, he appeared on asking why it didn’t work. Thanks Jonathan for working through the problem with me. My fault for not making the instructions clearer!

If this happens to you, take a deep breath and unzip the plugin again in the plugins folder and delete wp-content/advanced-cache.php

Anyway, the new features are:

  1. Cache rebuild. Serve a static cache file to anonymous users while that file is being generated.
  2. Disable the large global lock that makes every access to the cache atomic.

Besides those, I got rid of the symlinked file in wp-content/, and the plugin now copies a file called “advanced-cache.php” from the plugin directory to simplify things. Especially on operating systems where symlink isn’t available. Yes, that’s Windows.

If your site is horrendously busy and you get a ton of comments every day and you’re too broke to buy a new server, then the cache rebuild feature will help you a lot. You should see the load on your server go way down if you enable this. Anonymous users who visit a page where a comment has just been left will be served a static cache file from the supercache instead of all the requests trying to generate a brand new page. The page served to them might be a few seconds out of date but that trade off is worth it.
Here’s the original thread that inspired the idea. Thanks Tigertech for writing the patch and for sharing the performance graphs. Check out the load on his server, before and after the rebuild function was switch on:

wp super cache load graph

If you’ve had problems with deleting the cache on your blog it *might* be because of file locks. Some hosts just have problems with them. The file locking in the plugin is very coarse. When the plugin wants to do any sort of write operation it grabs a lock, does the writes (which could include clearing expired files, or creating wp-cache and supercache cache files), and then releases the lock.
Any other process running the plugin that tries that won’t get a lock: new cache files won’t be created, and cache files won’t be cleared.
It isn’t a huge problem that the lock is so coarse because the writes don’t take very long (the lock is enabled after the page is generated), but some very busy sites take quite a while to clear their cache files.
On the downside, disabling the file lock won’t stop multiple cached files being generated simultaneously (great), but it also won’t stop multiple “clear cache” attempts either (boo!)
From what I recall of looking at the other cache plugins for WordPress, most of them don’t have any file locking and seem to do just fine.

I almost forgot! There is also a new debug mode. Edit wp-content/wp-cache-config.php and look for “$wp_cache_debug” and follow the instructions. It will send you a few emails when things don’t go right and may help track down any problems.

As a final note, I would like to sincerely thank Robert Wolf who spruced up the admin page and gave it a nice lick of paint and Michael Torbert for helping me debug the plugin a while back.

WordPress MU 2.7 beta

A beta version of WordPress MU 2.7, the multi blog version of WordPress that runs on such sites as WordPress.com has just been uploaded and is available here.

This is quite a stable release and has been tested by many but it’s not the final 2.7 release so there are probably bugs we haven’t found yet. Don’t put it into production just yet, but if you’re working on a new site, you’re better off using this rather than 2.6.5 as the final WordPress MU 2.7 will be along soon.

Check the timeline for more info, there are still plenty of open tickets and keep an eye on the forums and please help out if you can.

I also want to extend a big thank you to everyone who has helped with this release, be it entering tickets, updating them, creating patches, or helping out on the forums and of course the WordPress community. This software wouldn’t be where it is today without you.

WP Super Cache 0.8.7

WP Super Cache version 0.8.7 is now available. WP Super Cache is a page caching plugin for WordPress that will significantly speed up your website.

This release addresses some issues large or busy sites had with deleting expired cache files. Some sites generated so many cache files that there were two many files generated, even when those files were cleared out every hour. To fix that I limited the recursive function that deletes the files to 100 deletions at a time. That function is called until all the cache files are deleted (or strictly speaking, no files are deleted. That’s how the expired file cleanup works).
It’s also possible to set the garbage collection interval to 10 minutes now which will also help.

WordPress 2.6 Easter Egg

This is new to me, even though others have known about it for months. There’s a Matrix Easter Egg in WordPress 2.6 and in the betas of WordPress 2.7. To activate it:

  1. Edit a post.
  2. Scroll down to the revisions section of the page and click the latest revision.
  3. On the next page, scroll down again and select the same revision for comparison.
  4. The Matrix has you..

Danger !
Self-comparison detected.
Initiating infinite loop eschewal protocol.
Self destruct in… 3
2
1
Wake up, Donncha…
The Matrix has you…
Don’t let this happen again. Go Back.

WordPress MU 2.6.5

The beauty of Burnham Beeches

WordPress MU, the multi blog version of WordPress that runs on such sites as WordPress.com has been updated to version 2.6.5 to address an XSS vulnerability in the feeds offered to users.

More details will be forthcoming but for the time being, there’s also the WordPress.org announcement post.

This release also has a number of bug fixes, including a fix and improvements to rss caching. This is a required upgrade, so please install it as soon as you can.

After you’ve upgraded, check out the nominations for the 2008 WPMU Awards and vote for your favourite!

In related news, a new version of WP Super Cache is also available. This version hopefully fixes:

  1. Issues with clients seeing compressed pages incorrectly
  2. Cache clean up
  3. Warnings if Apache modules are missing
  4. Better support for WordPress MU. The wp-content/cache/.htaccess rules are now displayed on the admin page
  5. Better documentation on file locking
  6. WP Cache files are written to a temporary file first
  7. Use WP_CONTENT_URL in mod_rewrite rules generator

It also adds a number of filters:

  1. “supercache_dir” filter so the supercache directory can be manipulated. “wp_cache_key” cache_action to modify the key the wp-cache file is named after. Using both of these should make it easier for plugin authors to manipulate the cache based on user agent or other criteria. ie. iPhone theme? Unfortunately .htaccess rewrite rules will have to be updated manually.
  2. Added “wpsupercache_buffer” filter so the current page can be manipulated before being stored in the cache.

Make your WordPress plugin talk AJAX

This morning at BarCamp Cork I gave a short talk on how to add AJAX functionality to WordPress plugins.

Here are the example scripts I used during the talk. Rename the files to .php and install as you would normal WordPress plugins.

  1. helloworld1.txt – very simple and basic “Hello World” plugin.
  2. helloworld2.txt – script that will display the text “Hello World” using an AJAX request to get the text from the server.
  3. helloworld3.txt – script that displays “Hello World” text, and an “update” link that increments a counter via an AJAX http request.
  4. helloworld4.txt – script that displays a simple form. The form has one text box, a “Random” button and a “Save” button. Clicking the “Random” button makes a request to the server to get a random number. “Save” sends the number to the server.
  5. helloworld5.txt and rate.txt – “Rating” script to rate a post (Originally from here). Makes an AJAX request to the server with the rating. Server returns randomly generated stats on rating. Place rate.php in wp-content/

All scripts that operate in the Settings page in the Dashboard use a nonce for security and access admin-ajax.php when making AJAX requests. The wp_ajax_$POST[ ‘action’ ] hook is used to execute the actual code that does something useful.

The rating script uses wp_enqueue_script() to load the jQuery class.

If you’re an Irish O2 user, and use Twitter you might like to install the new Tweet Tweet WordPress plugin. Thanks to Enda who let me use his O2 account briefly, I created a plugin that sends Twitter sms notifications using the free O2.ie web texts. That means Meteor, Vodafone and O2 are now covered. Anyone want to contribute a plugin for 3?

PS. I was very proud that Automattic was able to sponsor BarCamp Cork, and hopefully most of the WordPress badges found good homes! Conor says 116 signed up for the event, with just over 100 showing up. That’s a great number to pull in for a Saturday tech event!

IMG_4625

IMG_4724

More photos can be found on pix.ie and flickr. Looks like Phil hasn’t uploaded any of his shots yet! Can’t wait to see what came of his afternoon photo session. I had to leave early and missed it unfortunately.
Discovered photos of my presentation. Yes, I used Vi (or Vim if you want to be pedantic) to give my talk!

WordPress MU 2.6.3

WordPress MU, the multi blog version of WordPress that runs on WordPress.com has been updated.

Version 2.6.3 has just been released. This is a security release and a required update. More details about the vulnerability in the Snoopy library that WordPress uses can be found on the WordPress 2.6.3 announcement.

This release also includes a number of minor bug fixes but if you want to fix the Snoopy bug alone, it’s sufficient to update these files:

Those are not download links, click through and download the files using one of the links at the end of each page.

Otherwise, updating from 2.6.2 is as simple as overwriting your current install.

WP Super Cache 0.8.4, the garbage collector

WP Super Cache version 0.8.4 is now available. WP Super Cache is a page caching plugin for WordPress that will significantly speed up your website.

This is a minor release but was prompted by White Shadow. He released a plugin that cleans up expired cache files on a periodic basis instead of after X number of hits. Great minds think alike, (or fools seldom differ) because I had the same idea a few weeks ago and had the code running on this blog for that time without any problems.

WP Super Cache 0.8.4

The garbage collection system should have operated this way in the first place, but at least now it’s easier to configure.

PollDaddy join the Automattic Family

You’ve probably heard the news that Lenny and Eoin of PollDaddy have joined Automattic. PolDaddy has been acquired by Automattic, but on a personal level we’ve been joined by two great Irish guys from Sligo bringing the Irish contingent of Automattic up to three. Lenny did completely trash me at Wii Tennis but I won’t hold that against him!

We’ve even taken over a house here in Breckenridge, calling it the Irish House. The Irish Tricolour is flying outside an Irish pub downtown. They might lend it to us if we ask nicely ..
Raanan is staying there too so I guess we’ll make him an honourary Irishman for the week!

As well as the great PollDaddy news, expect a few more enhancements to WordPress.com soon, and if I have anything to do with it, a plugin or two that will make it into the WordPress MU community too!

WP Super Cache 0.8.3 "Speedy"

WP Super Cache version 0.8.3 is now available. WP Super Cache is a page caching plugin for WordPress that will significantly speed up your website.

Double Caching

This releases fixes a long standing compression bug. In older versions of the plugin, the cached page was compressed twice. Once to display to the current visitor, and once again for the cached files stored on the server. This has now been fixed and there’s a noticeable speed increase for anonymous visitors. Unfortunately as a side effect, it’s not possible to display the “super cache gz” html comment now. To verify that html pages are being served from the supercache directory you’ll have to add an error_log() somewhere and check that visits aren’t logged.
The plugin now uses fopen() instead of gzopen() which according to a comment on the gzopen() manual page is unreliable under high load.

IE7 Fixes

Apparently IE7 has problems when gzipped files are served as “x-gzip” files, under certain circumstances. This is an obscure bug but this has been fixed. If you’re upgrading, either remove wp-content/cache/.htaccess and visit the admin page and that file will be regenerated, or edit that file and change “x-gzip” to “gzip”.

A number of smaller bugs were also fixed. Check the changelog for further info.