$registered++; } else { $user_id = 0; $unregistered++; } mlog("\nEMAIL: {$email}, uid {$user_id}; memory usage : " . memory_get_usage() . "\n"); } $lh = $member->left_house(); $lh = array_shift($lh); $text = '* ' . $member->full_name() . ', left ' . $lh['date_pretty']; if (!in_array($text, $email_text)) { $email_text[] = $text; } } if ($email_text) { write_and_send_email($current, $email_text, $template); } mlog("\n"); $sss = "Active alerts: {$active}\nEmail lookups: {$registered} registered, {$unregistered} unregistered\nQuery lookups: {$queries}\nSent emails: {$sentemails}\n"; if ($globalsuccess) { $sss .= 'Everything went swimmingly, in '; } else { $sss .= 'Something went wrong! Total time: '; } $sss .= getmicrotime() - $global_start . "\n\n"; mlog($sss); mlog(date('r') . "\n"); function write_and_send_email($current, $data, $template) { global $globalsuccess, $sentemails, $nomail, $start_time; $sentemails++;
foreach ($o as $major => $body) { if ($body) { $heading = $deschead . ' : ' . $count[$major] . ' ' . $sects[$major] . ($count[$major] != 1 ? 's' : ''); $email_text .= "{$heading}\n" . str_repeat('=', strlen($heading)) . "\n\n"; if ($count[$major] > 3) { $email_text .= "There are more results than we have shown here. See more:\nhttp://www.openaustralia.org/search/?s=" . urlencode($criteria_raw) . "+section:" . $sects_short[$major] . "&o=d\n\n"; } $email_text .= $body; } } $email_text .= "To cancel your alert for items " . $desc . ", please use:\nhttp://www.openaustralia.org/D/" . $alertitem['alert_id'] . '-' . $alertitem['registrationtoken'] . "\n\n"; } } } if ($email_text) { write_and_send_email($current_email, $user_id, $email_text); } mlog("\n"); $sss = "Active alerts: {$active}\nEmail lookups: {$registered} registered, {$unregistered} unregistered\nQuery lookups: {$queries}\nSent emails: {$sentemails}\n"; if ($globalsuccess) { $sss .= 'Everything went swimmingly, in '; } else { $sss .= 'Something went wrong! Total time: '; } $sss .= getmicrotime() - $global_start . "\n\n"; mlog($sss); if (!$nomail && !$onlyemail) { $fp = fopen('alerts-lastsent', 'w'); fwrite($fp, time() . "\n"); fwrite($fp, $max_batch_id); fclose($fp);
foreach ($o as $major => $body) { if ($body) { $heading = $desc . ' : ' . $count[$major] . ' ' . $sects[$major] . ($count[$major] != 1 ? 's' : ''); $email_text .= "{$heading}\n" . str_repeat('=', strlen($heading)) . "\n\n"; if ($count[$major] > 3) { $email_text .= "There are more results than we have shown here. See more:\nhttp://www.theyworkforyou.com/search/?s=" . urlencode($criteria_raw) . "+section:" . $sects_search[$major] . "&o=d\n\n"; } $email_text .= $body; } } $email_text .= "To cancel your alert for " . $desc . ", please use:\nhttp://www.theyworkforyou.com/D/" . $alertitem['alert_id'] . '-' . $alertitem['registrationtoken'] . "\n\n"; } } } if ($email_text) { write_and_send_email($current_email, $user_id, $email_text, $template); } mlog("\n"); $sss = "Active alerts: {$active}\nEmail lookups: {$registered} registered, {$unregistered} unregistered\nQuery lookups: {$queries}\nSent emails: {$sentemails}\n"; if ($globalsuccess) { $sss .= 'Everything went swimmingly, in '; } else { $sss .= 'Something went wrong! Total time: '; } $sss .= getmicrotime() - $global_start . "\n\n"; mlog($sss); if (!$nomail && !$onlyemail) { $fp = fopen('alerts-lastsent', 'w'); fwrite($fp, time() . "\n"); fwrite($fp, $max_batch_id); fclose($fp);