Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there any software that I can run on either a Linux or a Windows server to check for domains that have out dated WordPress installations. I have seen a rise in hacked WordPress sites and in all the cases it was because the clients had not installed updates.

share|improve this question
1  
what about google webmaster tools? –  Bainternet Feb 13 '13 at 9:41

3 Answers 3

up vote 2 down vote accepted

If you can access the files from the server just include wp-includes/version.php from each installation. That file is completely stand-alone, it just defines five variables:

/**
 * The WordPress version string
 *
 * @global string $wp_version
 */
$wp_version = '3.5.1';

/**
 * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
 *
 * @global int $wp_db_version
 */
$wp_db_version = 22441;

/**
 * Holds the TinyMCE version
 *
 * @global string $tinymce_version
 */
$tinymce_version = '358-23224';

/**
 * Holds the required PHP version
 *
 * @global string $required_php_version
 */
$required_php_version = '5.2.4';

/**
 * Holds the required MySQL version
 *
 * @global string $required_mysql_version
 */
$required_mysql_version = '5.0';

A simple version_compare() will do the trick:

if ( '-1' == version_compare( $wp_version, '3.5.1' ) )
    return 'outdated';
share|improve this answer

Here are 3 ideas:

1) There are services out there that let you manage your clients Wordpress installs remotely via plugins.

For example:

2) You can also get the Wordpress version from the readme.html file. You could fetch the readme.html files with wp_remote_get() and parse them to get the corresponding version numbers. You can read about this function in the Codex:

http://codex.wordpress.org/Function_API/wp_remote_get

Here is one idea:

function wpse_85742_version_from_readme($url){    
    $version="?";

    // fetch the html page:
    //
    $response = wp_remote_get( $url );

    if( is_wp_error( $response ) ) {
       $error_message = $response->get_error_message();
       // echo "Something went wrong:". $error_message;
       // let's show "error" if we have problems fetching the page:
       //
       $version="error";

    } else {

        // get the body of the page:
        //
        $html=$response['body'];


        // let's strip out the newlines and tabs:
        //
        $html=str_replace("\n","",$html);
        $html=str_replace("\t","",$html);

        // let's find this type of html string:
        /*
        <h1 id="logo">
            <a href="http://wordpress.org/"><img alt="WordPress" src="wp-admin/images/wordpress-logo.png" /></a>
            <br /> Version 3.5.1
        </h1>
        */
        preg_match('/<h1 id=\"logo\">(.*?)<\/h1>/i', $html, $matches);

        // check if we got a match:
        //
        if(isset($matches[1])){
            $version=strip_tags($matches[1]);
        }
    }
    return $version;        
}

and you can use it like this:

$url="http://example.com/readme.html";
echo wpse_85742_version_from_readme($url);

and it will give you result like:

Version 3.5.1

3) In some cases the readme.html file is not accessible due to security settings in .htaccess.

Then you could try the feed instead and search for the generator tag:

<generator>http://wordpress.org/?v=3.5.1</generator>

This can be done with SimpleXmlElement():

function wpse_85742_version_from_feed($url){
    $xml = new SimpleXmlElement(file_get_contents($url));
    return str_replace("http://wordpress.org/?v=","",$xml->channel->generator);
}

and used like this:

$url="http://example.com/readme.html";
echo wpse_85742_version_from_feed($url);

and it will give you result like:

3.5.1

version number from readme.html

share|improve this answer

A simple solution would be to just use wget and grep the meta generator for example:

//need xml2 installed
wget -q -O - http://www.example.com | xml2 | grep meta | awk -F/ '{print $NF}' 

The problem is that a lot of people remove the meta generator tag, so then I suggest you have a look at this answer by Otto (the file he links ) on where else to check for version info, Remotely identify the version of a WordPress installation?

There are also WordPress scanners that do version fingerprinting, namely WPScan, you can Google it.

If you have access to server files then toscho's answer is the best.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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