blob: 318fb67f023e5c9535a94d7a9a12bedec10972c1 (
plain) (
blame)
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
35
|
<?php
/*
* cronjob callback. This script does periodic checks, logging,
* housekeeping etc. Should be called every 5 mins by cron.
* Make a crontab entry that runs this as the same user the
* www-php is normally run as, eg. */
// */5 * * * * www-data php /path/to/api.php cron
if (!isLocalExecution())
exit(0);
switch (mt_rand(1, 10)) {
case 1:
Database::exec("DELETE FROM clientlog WHERE (UNIX_TIMESTAMP() - dateline) > 86400 * 90");
break;
case 2:
Database::exec("DELETE FROM eventlog WHERE (UNIX_TIMESTAMP() - dateline) > 86400 * 90");
break;
case 3:
Database::exec("DELETE FROM property WHERE dateline <> 0 AND dateline < UNIX_TIMESTAMP()");
break;
case 4:
Database::exec("DELETE FROM callback WHERE (UNIX_TIMESTAMP() - dateline) > 86400");
break;
case 5:
Database::exec("DELETE FROM statistic WHERE (UNIX_TIMESTAMP() - dateline) > 86400 * 90");
break;
case 6:
Database::exec("DELETE FROM machine WHERE (UNIX_TIMESTAMP() - lastseen) > 86400 * 365");
break;
}
Trigger::checkCallbacks();
Trigger::ldadp();
|