Archive Page 2

Automatic Updates for Plugins and Themes Hosted Outside WordPress Extend

#

Here are two sample scripts along with an API to provide automatic updates for plugins and themes you host on your own server.

Inside /api you’ll find index.php which processes all the update requests. You should place this in something like http://updates.example.com and update $api_url in /plugin/test-plugin-update/test-plugin-update.php and /theme/portfolio-racer/inc/updates.php accordingly. If you activate these sample plugins without changing API URL, updates will be checked against my test server. If you decide to update, both plugin and theme will be replaced with exactly the same version of each.

AJAX Cache Purge Cookie Plugin

#

This plugin sets a “version” cookie of your site’s content, which can be used for time-based cache invalidation, as the cookie is checked and updated (if necessary) on each page request through a single AJAX request.

Download: ajax-cache-purge.zip (June 26, 2010)

Installation

Please note that this plugin is intended for people who run their own servers.

  1. Upload and enable the plugin.
  2. Add the value of wp_cache_key_cookie to the cache key.

Nginx Example

fastcgi_cache_path 	/var/www/cache  levels=1:2
			keys_zone=wp-cache:10m
			inactive=2m max_size=2000m;
fastcgi_temp_path 	/var/www/cache/tmp;
server {
	# other config options
	location ~ \.php$ {
		# wp_cache_key_cookie is supplied by the plugin
		set $wp_cache_key $scheme$host$request_uri|$cookie_wp_cache_key_cookie;
		#add key in header for debugging
		#add_header	WP_KEY $wp_cache_key;
		fastcgi_cache 		wp-cache;
		fastcgi_cache_key 	$wp_cache_key;
	}
}

Laptop from Aboard the Shuttle Spacecraft

#

There is only one brand of laptops used aboard the space shuttlesIBM ThinkPad. In my opinion, they are the best laptops one can ever buy, mainly because of their unspoken hardware and famous red trackpoint mouse.

Several weeks ago the screen inverter of my Dell Latitude D820 laptop (which also has a trackpoint) failed and turned it into a desktop that can only be used with an external monitor. So I found a used IBM ThinkPad A31p (released in 2002), which is now running Ubuntu that supports every piece of hardware inside it. Although I won’t be carrying it around very often because it weights 3.45 kg (7.6 lb), I might make a sticker that says “Used Aboard the Shuttle Spacecraft” and look cool even with a laptop that old.

IBM ThinkPad A31p

 Read more »

Standalone Script for Clearing APC Cache

#

After upgrading WordPress to a new version, you might need to clear the APC opcode cache. Here is a simple script that you can store in the root of your website, for example, clearapc.php:

if (function_exists('apc_clear_cache') && $_GET['pass'] == 'secret') {
        if (apc_clear_cache() && apc_clear_cache('user'))
                print 'All Clear!';
        else
                print 'Clearing Failed!';
        print '<pre>';
        print_r(apc_cache_info());
        print '</pre>';
} else {
        print 'Authenticate, please!';
}

Then call the script via http://example.com/clearapc.php?pass=secret

Instead of using ?pass=secret, you might well call the filename something that is hard to guess: clearapc93920.php

Chrome OS vs Android for Tablets

#

Android’s strength is cellular voice and data transfer and its low power consumption while Chrome OS has better support for various hardware architectures, and they are both based on the Linux kernel.

If you were to build a tablet that has a touch screen not bigger than 9 inches and a modern browser as its only application, GSM + data connection, instant startup and a batter life of 12 hours, which OS would you choose?

I can’t understand why Google needs Chrome OS. Is it only for devices that don’t have touchscreens?