Posts Tagged: wordpress

Updraft – A Cloud Backup and Restore Plugin For WordPress

Over the past several months I have been working hard on a new plugin for WordPress and now I am pleased to unveil the initial release.

Updraft is a backup and restore plugin for WordPress. It can do scheduled or one time backups of your plugins, themes, uploads, and DB itself. These backups can be kept locally, emailed, sent to an FTP server, uploaded to Rackspace Cloud Files, or transferred to Amazon S3.1

Additionally, you can pick the number of backups to retain and restore from a backup of your choice either by using a local backup, uploading copies yourself, or pulling them down from your cloud service.2

Visit the Updraft homepage to learn more, see a screencast, and give feedback on bugs or features you’d like to see. I look forward to hearing from you!

  1. Updraft requires WordPress 3.0 or greater!
  2. At this time restoration does not encompass DB. You will need to download and restore the DB via another tool. I am actively looking for ways to work around this issue for a future release.

New Year, New Theme

Having realized that I haven’t looked at WordPress theme development in nearly a year, I decided to search around and ended up switching over to Mystique. The theme offers a wealth of features and even obsoletes some plugins and widgets I was previously using. I’m not sure if I’ll stick with it long-term but it’s certainly a very polished product. Fidgetr may need a few upgrades to keep up with the times… Let me know in the comments if you spot anything broken!

I’ve put quite a few custom CSS tweaks in already, some of which I’ve listed below. Others who use the Mystique theme may find these changes helpful.

  1. To hide the websnapr feature add “.webshot{display:none !important;}” to the user CSS section.
  2. Fidgetr’s comment display depends on sidebar overflow so I added “#sidebar {overflow:visible;}” as well. Secondary sidebar overflow would need #sidebar2

One Year Blogiversary

Around a year ago I finally decided to start a blog. Since then I’ve changed the domain, name, written over 60 posts about various things, and released two WordPress plugins. I had no defined goals when I started…and I still don’t! So in the spirit of my random posting, here are some stats about traffic growth and download numbers for my plugins. Let the navel gazing commence.

Random Traffic Statistics

The site has grown from an average of under 100 visits a week to well over 1500 now. Much of that growth has been driven by the release of Fidgetr and CDN Tools, my WordPress plugins (more on them later). However, the single most popular post I’ve written so far was the fix for GrowlMail in 10.6.2. Google indexed it quickly and it became the #1 search result for people attempting to fix their Mail plugin incompatibilities. Other popular articles include items about VMware and OpenSSL UCC/SAN certificates.

Plugin Statistics

Fidgetr has seen almost 9000 downloads since its initial release at the end of January. In that time it has dramatically improved, but I still welcome feature suggestions and patches (and new themes!). Would Picasa support be a useful addition?

CDN Tools has had over 2000 downloads since the end of February. Due to how deeply it hooks into WP I had to make significant changes for WP 2.8 as well as utilize several new hooks for WP 2.9 support. There is still quite a ways to go before I’m happy with this plugin, but I’m pleased that so many people are using it on their blogs.

With these two plugins I am currently the 605th ranked WP plugin dev (by downloads) according to w-shadow. Top 500 here I come!

WordPress 2.9 Upgrade

WP 2.9 is out. The upgrade went quite smoothly here, but be sure you upgrade your plugins before running the core upgrade! Fidgetr and CDN Tools are both 2.9 compatible already, so if you have the latest versions you’re set.

Writing Compatible PHP For WordPress

One of the big problems I’ve run into as a WordPress plugin developer is the diversity of PHP installations. Simply stating you only support PHP5 and greater is insufficient to ensure compatibility. Things you may take for granted in your development environment may be missing or worse, partially functional. I’ve decided to document a few of the bigger “gotchas” I’ve run into so future WordPress hackers will have a starting point for investigating problems.

Minimum PHP Version

One easy way to reduce compatibility confusion is specifying a minimum version of PHP for your WordPress plugin or widget. To do so you can use PHP’s version_compare function:

if(version_compare(PHP_VERSION, '5.0.0','<')) {
	die(sprintf('You are currently running PHP version %s and you must have at least PHP 5.0.x', PHP_VERSION));
}

Take a look at the version_compare documentation for more information.

PHP Modules

The biggest single thing to remember is that any module for PHP is optional. If you want to require something like curl, that’s great, but be aware that some non-trivial percentage of your potential users may not have it. Still want to use that module? Test for its presence during the instantiation of your plugin and die if it’s not present. This will prevent users from being able to successfully install your “broken” product if they don’t have the proper requirements.

Sometimes you’ll find yourself using functions you think are core to PHP like “mime_content_type”. This is not the case. In fact, I have frequently run into PHP installations that have no MIME detection facilities at all. Consider writing a fallback for suffix detection1 in addition to coding for mime_content_type and the finfo_* methods.

Safe Mode and Related Problems

Another common issue is safe_mode and open_basedir. These flags enforce certain security restrictions (must have the same group as PHP when writing to a directory, can’t open files beneath the basedir, et cetera). However, they also impact some modules. For instance, using curl you can’t use CURLOPT_FOLLOWLOCATION. This will trigger the error “CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set”.

Network Communication

I’ve already talked a bit about the curl module, but you may also be tempted to use file_get_contents() assuming allow_url_fopen is enabled. This is very frequently untrue in shared hosting environments. Luckily, you don’t need to rely on curl or allow_url_fopen or write your own fsockopen() wrapper class. Instead, WordPress has integrated Snoopy into the core. Invoking it to fetch just the contents of a URL could not be easier!

require_once( ABSPATH . 'wp-includes/class-snoopy.php');
$snoopy = new Snoopy();
$result = $snoopy->fetch($url);
if($result) {
	$response = $snoopy->results;
}

Just hit up Google for the class docs to learn everything Snoopy can do for you.

There are many more where these came from, so drop your problems and solutions in the comments!

  1. This can be a security risk in certain circumstances, so be careful.

WordPress Plugin Updates

I’ve spent quite a bit of time on CDN Tools and Fidgetr in the past few weeks and this has cut back on the time I had planned to use to write blog entries. I’ll try to get a few new articles up soon, but in the mean time here is a status update on some projects you might be interested in…

CDN Tools (v0.9x and higher) is now compatible with WordPress 2.8+ and features a wide variety of reliability upgrades for various installation quirks. I will be testing it shortly with WP 2.9 and expect to have a compatible version out prior to that release. There are also some fun new features in the pipeline that will hopefully see the light of day in the next few weeks.

Regarding Fidgetr; I have decided to port the widget to the new WP 2.8 multi-widget API (which is adapted from the firetree multi-widget class). While doing so I discovered that my previous assumptions about a single Fidgetr widget per WordPress page made porting quite difficult. This necessitated an almost total rewrite of the core (and major modifications to the accompanying themes). At this time I have the new widget mostly working, but there are many cosmetic bugs to resolve with the themes. That said, I’m excited to offer this feature for those who desire it. I have no targeted release date, but Fidgetr 2.0 will require WP 2.8+. Fidgetr 1.3.5 is almost certainly the last 2.7 compatible release.