1

I have set up many custom WordPress installations on different domains. Now and then, there are security updates available for Wordpress. Now I log in to all websites and update the installation. However, I am sometimes interrupted doing this work and I forget which installations I have updated and which not.

So I am looking for a freeware (gratis) tool that runs on Windows 7 (x64 if that should matter). I enter the URLs of the blogs and the tool lists the versions of Wordpress that are installed.

The tool must be able to save the list of URLs or provide an option to input URLs from command line or similar, so that I don't have to type the URLs every time. It must work without credentials and e.g. analyze the <meta name="generator" ...> tag, which I have not suppressed.

No online tools (web services), please. I want a good old standalone EXE application. Please do not suggest to turn on auto-updates in Wordpress, install Wordpress Update notification plugins etc. I receive too many Emails already.

1

Not a single exe but you could really easily script this in python.

Python is a free language with a really rich set of libraries included and a huge range of additional ones available including many web interfaces. The default libraries include access to web pages, regular expression parsing, etc., so it would be really easy to write a script which fetches the pages from the specified url or a default list of urls and parses the meta tags. With a little more work you could get it to actually do the updates for you.

  • Free
  • I don't think that there is a platform that it is not available for
  • Easy
  • Quick
  • Lots of online help available from the community.

Example code

#!/usr/bin/env python
#coding:utf-8
"""
Author:  Steve Barnes --<>
Purpose: Get the meta generator from one or more URLs.
Created: 31/01/15
"""
from __future__ import print_function
import sys
import os
import urllib2
import json
import re

def read_url_list(url_or_filename):
    """ Get a list of default urls from a filename."""
    urllist = []
    if not os.path.isfile(url_or_filename):  # See if it is a filename
        urllist.append(url_or_filename)  # No so treat as a URL
    else:
        with open(url_or_filename, 'r') as infile:  # This bit not tested
            for line in infile.readlines():
                if not line.startswith('#'):  # Allow for comments
                    urllist.append(line.strip())
    return urllist

def get_meta(url):
    """ Get the meta data from a URL."""
    regex = re.compile(r'<meta\W+name="generator"(.+?)>', re.IGNORECASE) 
    page = urllib2.urlopen(url).read()  # Get the page
    return regex.findall(page)  # Look for the pattern

if __name__ == '__main__':
    if len(sys.argv) == 1:  # No arguments
        print("To get the generator from some URLs supply on the command line")
        print("a list of the URLs or file names that contain such a list.")
        print("Files must have one URL per line - ignores lines starting with #")
    for arg in sys.argv[1:]:
        URLs = read_url_list(arg)
        for URL in URLs:
            print(URL, get_meta(URL))
    # Get and display the current version to compare against.
    rawjson = urllib2.urlopen("https://api.wordpress.org/core/version-check/1.7/").read()
    version = json.loads(rawjson)
    print("Latest version: "+version["offers"][0]["version"])
  • 1
    Thanks. Unfortunately I end up programming everything myself, like this or this. I wonder whether from millions of bloggers, one of them might have written that tool already. (Most of them might use hosted services, I know) – Thomas Weller Jan 31 '15 at 8:45
  • @ThomasW. forgot to mention that the base program - to collect the meta from a list of URLs would probably be less than 20 lines. – Steve Barnes Jan 31 '15 at 8:52
  • 1
    Thanks a lot. For other visitors: The script is for Python 2.x. It does not support international domains (IDN), so the URL list must contain the URL in escaped mode. Other than that, it basically works (no error handling etc., just rerun the script in case of errors). – Thomas Weller Feb 2 '15 at 22:57
  • 1
    Add 3 more lines to get the latest version of WordPress: rawjson = urllib2.urlopen("https://api.wordpress.org/core/version-check/1.7/").read() version = json.loads(rawjson) print("Latest version: "+version["offers"][0]["version"]) – Thomas Weller Feb 3 '15 at 22:43
  • @ThomasW. Thanks - I have added to the answer – Steve Barnes Feb 4 '15 at 6:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.