It’s important to keep WordPress up to date, but keeping track of all your sites can be a struggle. I recently had to list and check every site for updates, but I couldn’t use a service such as WP Remote. It had to be locally or private hosted. So I turned to Google Docs!
Here is a script that will check a list of sites and:
- Put their version number in the adjacent column
- Grab the latest version number from WordPress.org
- Colour code the results
View the code on Gist.
When everything is saved, reload the spreadsheet and after a few moments a “TomJN Scripts” menu will appear, with a check versions menu item. Click on this and wait while it grabs the versions and fills in the B column.
How Does it Grab The Version?
The script fires off a request to readme.html, then parses it to grab the version number. It’s looking at the h1 with the ID of #logo to be precise. For the latest version of WordPress, I’m calling the v1.5 update mechanism to grab the version number. The returned response also contains a download link and the required version of PHP.
This does expose a security problem however, as you can add any WordPress site to the list, not just your own. To protect yourself, delete readme.html and keep your WordPress install upto date.
This script should be useful if you deal with Google Apps, and could be used for many other purposes. For example you could start firing off emails from GMail if a site is out of date.