mysite_cron()
mysite.module, line 543
Cron hook for cleaning out bad data We use this routine to remove MySite references to deleted content containers.
function mysite_cron() {
// run this once per day, if cron is disabled, it runs from the settings page
$cron= variable_get('mysite_cron', '0');
$date = date("Ymd", time() - (3600 * 24)); // get yesterday's date
if ($date != $cron) {
variable_set('mysite_cron', $date);
$types = mysite_load_includes('types');
foreach ($types as $type) {
$data[$type] = module_invoke('mysite_type', $type .'_clear', $type);
}
// iterate through the returns and set user messages
if (!empty($data)) {
foreach ($data as $key => $value) {
if (is_array($value) && !empty($value)) {
foreach ($value as $item) {
$sql = "DELETE FROM {mysite_data} WHERE mid = %d";
db_query($sql, $item['mid']);
$sql = "SELECT message FROM {mysite} WHERE uid = %d";
$obj = db_fetch_object(db_query($sql, $uid));
$message = $obj->message;
$message .= t('<p>@title content is no longer available and has been removed from your personal page.</p>', array('@title' => $item['title']));
$sql = "UPDATE {mysite} SET message = '%s' WHERE uid = %d";
db_query($sql, $message, $item['uid']);
}
}
}
}
}
}