What would be the best way to remotely get the Wordpress version number of a website?
I manage a large number of websites under Wordpress and I'd like to create a sort of control panel on which I would be able to see a list of all sites and the WP version they are runn开发者_JAVA技巧ing on.
How would you do that?
I should mention that the websites are hosted on different servers.
You have to create a db with all databases and they passwords and servers (to connect to the other servers) and retrieve the version, or create a plugin to wordpress that prints the version only if you send some password from get or post (for security reasons), and install it into all wordpress systems, then you only have to read the plugin url. (this is usefull if you don't have direct access to the mysql, this happens on some hosting companys that have the mysql db on a closed network. )
If i were you, i would opt to choose my secound option (bolded)
EDIT: Please in the plugin use Hash protection, or something like that:
Your Platform Side:
<?php
$mypass="test123";
$version = file_get_contents("http://www.example.com/yourpluginurl?pass=".md5($mypass+date("d")));
if(isset($version) && $version !== false){
//your code here
}
Plugin Side:
<?php
$mypass="test123";
if(md5($mypass.date("d")) == $_GET['pass']){
//Get version here
}
?>
For each site, read the generator meta tag.
You could also FTP in and get the version from wp-includes/version.php. But CuSS' suggestion of a plugin is the best way to go, IMO.
Much more secure to use Curl or TFTP to query the file version.php at serverroot/wp-includes/version.php No need to call the database or install a plugin. You will need a local database of all logins/passwords.
精彩评论