We provide hosting for clients and friends, along with management of a few servers. Even though we don’t control what people install, we try to make sure that everyone remembers to keep software installations up-to-date. This is especially important for WordPress. Its not that WordPress is insecure, its wildly popular, and thats what makes it a prime target for exploitation.
To aid in this cause I use a non-intrusive method of locating the WordPress version file and extracting the version number from it so clients can be notified if they are running an out-of-date installation of WordPress. This is done by using the find command and searching for “version.php
” within the path of “wp-includes
” and then running grep to search for “$wp_version =
“. The complete command looks like this:
find / -name 'version.php' -path '*wp-includes/*' -print -exec grep '$wp_version =' {} \; -exec echo '' \;
It’s best to narrow down where to search if possible, instead of starting at root (e.g. /). In the case of cPanel, user directories are usually stored in “/home"
. Running the command will output something like this:
/home/user/public_html/wp-includes/version.php $wp_version = '3.0.1';
Now if I could just come up with a quick way to automate nagging them to update.