Skip to content

Instantly share code, notes, and snippets.

@olorton
Created February 8, 2014 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olorton/8884591 to your computer and use it in GitHub Desktop.
Save olorton/8884591 to your computer and use it in GitHub Desktop.
Wordpress cron notification email
<?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);
}
@benfoxall
Copy link

wordpress? I thought you were all about index.html?

@olorton
Copy link
Author

olorton commented May 23, 2014

@benfoxall You hippy. (I just saw this comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment