forked from atutor/ATutor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcron.php
34 lines (27 loc) · 914 Bytes
/
cron.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
$_user_location = 'public';
define('AT_INCLUDE_PATH', '../include/');
require(AT_INCLUDE_PATH . 'vitals.inc.php');
// authenticate $_config['cron_key']
if (!isset($_config['cron_key']) || empty($_config['cron_key']) || ($_config['cron_key'] != $_GET['k'])) {
// not authenticated
exit;
}
$sql = "REPLACE INTO %sconfig VALUES ('last_cron', '".time()."')";
queryDB($sql, array(TABLE_PREFIX));
$module_list = $moduleFactory->getModules(AT_MODULE_STATUS_ENABLED, AT_MODULE_TYPE_CORE + AT_MODULE_TYPE_STANDARD + AT_MODULE_TYPE_EXTRA);
$keys = array_keys($module_list);
foreach($keys as $dir_name) {
$module =& $module_list[$dir_name];
if (!$module->getCronInterval()) {
continue;
}
$module->runCron();
}
// run the mail queue last
if ($_config['enable_mail_queue']) {
require_once(AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php');
$mail = new ATutorMailer;
$mail->SendQueue();
}
?>