function do_cron() { global $config; ct_log("Cron-Job started.", 2, -1, 'cron'); $btns = churchcore_getModulesSorted(false, false); foreach ($btns as $key) { include_once constant(strtoupper($key)) . "/{$key}.php"; if (function_exists($key . "_cron")) { if (isset($config[$key . "_name"]) && $config[$key . "_name"] != "") { $arr = call_user_func($key . "_cron"); } } } ct_sendPendingNotifications(); ct_log("Cron-Job finished.", 2, -1, 'cron'); }
/** * execute cron job for all modules */ function do_cron() { global $files_dir; ct_log("Cron-Job started.", 2, -1, 'cron'); //delete temporary files (and sessions) older than one day $tempDir = $files_dir . '/tmp/'; foreach (array_slice(scandir($tempDir), 2) as $file) { $path = $tempDir . $file; if (is_file($path) && filemtime($path) < time() - 3600 * 24) { unlink($path); } } //launch the cronjobs of the individual CT modules $modulesSorted = churchcore_getModulesSorted(false, false); foreach ($modulesSorted as $key) { include_once constant(strtoupper($key)) . "/{$key}.php"; if (function_exists($key . "_cron") && getConf($key . "_name")) { call_user_func($key . "_cron"); } } ct_sendPendingNotifications(); ct_log("Cron-Job finished.", 2, -1, 'cron'); }
/** * log $txt into cdb_log and call ct_sendPendingNotifications * * @param string $domain_type * @param int $domain_id * @param string $txt * @param int $loglevel; default: 2 */ function ct_notify($domain_type, $domain_id, $txt, $loglevel = 2) { global $user; ct_log($txt, $loglevel, $domain_id, $domain_type); // TODO: please explain $notify = db_query('SELECT * FROM {cc_notification} n, {cc_notificationtype} nt WHERE n.notificationtype_id = nt.id AND n.person_id = :p_id AND n.domain_id = :domain_id AND n.domain_type = :domain_type AND nt.delay_hours = 0', array(':p_id' => $user->id, ":domain_id" => $domain_id, ":domain_type" => $domain_type))->fetch(); if ($notify) { ct_sendPendingNotifications(0); } }
function ct_notify($domain_type, $domain_id, $txt, $loglevel = 2) { global $user; ct_log($txt, $loglevel, $domain_id, $domain_type); $notify = db_query('select * from {cc_notification} n, {cc_notificationtype} nt where n.notificationtype_id=nt.id and n.person_id=:p_id and n.domain_id=:domain_id and n.domain_type=:domain_type and nt.delay_hours=0', array(':p_id' => $user->id, ":domain_id" => $domain_id, ":domain_type" => $domain_type))->fetch(); if ($notify !== false) { ct_sendPendingNotifications(0); } }