Created
February 8, 2014 14:31
-
-
Save olorton/8884591 to your computer and use it in GitHub Desktop.
Wordpress cron notification email
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('wp-load.php'); | |
require_once('wp-admin/includes/update.php'); | |
$details = get_preferred_from_update_core(); | |
$to = ''; // Put your email(s) here | |
$subject = 'Wordpress upgrade notification'; | |
if($details->response != "latest") | |
$message = 'time : ' . date('D, d M Y H:i:s e') . "\n"; | |
$message .= 'name : ' . get_bloginfo() . "\n"; | |
$message .= 'url : ' . get_bloginfo('url') . "\n"; | |
$subject .= ' for ' . get_bloginfo(); | |
foreach (get_object_vars($details) as $name => $value) { | |
if (is_object($value)) { | |
$message .= "$name :\n" . get_update_details($value, " "); | |
} else { | |
if (is_bool($value)) { | |
if ($value) { | |
$value = "true"; | |
} else { | |
$value = "false"; | |
} | |
} | |
if (strlen($value) == 0) { | |
$value = "[empty]"; | |
} | |
$message .= $indent . "$name : $value\n"; | |
} | |
} | |
mail($to, $subject, $message); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
wordpress? I thought you were all about
index.html
?