[wp-hackers] wordpress auto update
Christopher Ross
cross at thisismyurl.com
Fri Jul 1 19:54:30 UTC 2011
On 2011-07-01, at 12:33 PM, Andrew Nacin wrote:
> One, my installation should email me when there is an update to core. It
> should, in the process, let me know if there's any plugins or themes out of
> date. This should target the admin email address.
Nacin, I think does the trick but would need to be cleaned up before it was released live. I run it on my own sites to check for updates every 12 hours and email me once a week if there is an update pending.
function thisismyurl_check_update() {
if (!get_transient('_site_transient_update_core_timer')) {
wp_version_check();
set_transient( '_site_transient_update_core_timer', true, (60*60*12));
$update_core = get_option('_site_transient_update_core');
if ($update_core) {
if($update_core->updates[0]->response == 'upgrade' && !get_transient('_site_transient_update_core_message')) {
wp_mail( get_bloginfo('admin_email'), get_bloginfo('name').__(' core upgrade available.'), __('There is a core upgrade availale for ').get_bloginfo('name').__(' at ').get_bloginfo('url').'/wp-admin/update-core.php').'.';
set_transient( '_site_transient_update_core_message', true, (60*60*24*7));
}
}
}
}
add_action('wp_head','thisismyurl_check_update');
__
Christopher Ross (cross at thisismyurl.com)
http://thisismyurl.com
WordPress Consulting, Design & Programming
Toronto - (416) 900-3731
More information about the wp-hackers
mailing list