1
0
Fork 0

added spaces + some curly braces + some usage of dbm::is_result()

Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2017-04-04 19:46:56 +02:00
commit 03571f6e74
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78
11 changed files with 309 additions and 268 deletions

View file

@ -18,9 +18,10 @@ function cron_run(&$argv, &$argc){
if (! $poll_interval) {
$poll_interval = 10;
}
if ($last) {
$next = $last + ($poll_interval * 60);
if($next > time()) {
if ($next > time()) {
logger('cron intervall not reached');
return;
}
@ -65,7 +66,7 @@ function cron_run(&$argv, &$argc){
$d1 = get_config('system','last_expire_day');
$d2 = intval(datetime_convert('UTC','UTC','now','d'));
if($d2 != intval($d1)) {
if ($d2 != intval($d1)) {
proc_run(PRIORITY_LOW, "include/cronjobs.php", "update_contact_birthdays");
@ -170,7 +171,7 @@ function cron_poll_contacts($argc, $argv) {
continue;
}
foreach($res as $contact) {
foreach ($res as $contact) {
$xml = false;
@ -192,7 +193,7 @@ function cron_poll_contacts($argc, $argv) {
$contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3);
}
if($contact['priority'] AND !$force) {
if ($contact['priority'] AND !$force) {
$update = false;
@ -204,28 +205,28 @@ function cron_poll_contacts($argc, $argv) {
switch ($contact['priority']) {
case 5:
if (datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 month")) {
if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 month")) {
$update = true;
}
break;
case 4:
if (datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 week")) {
if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 week")) {
$update = true;
}
break;
case 3:
if (datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) {
if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 day")) {
$update = true;
}
break;
case 2:
if (datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 12 hour")) {
if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 12 hour")) {
$update = true;
}
break;
case 1:
default:
if (datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 hour")) {
if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 hour")) {
$update = true;
}
break;
@ -242,6 +243,10 @@ function cron_poll_contacts($argc, $argv) {
} else {
proc_run(PRIORITY_LOW, 'include/onepoll.php', intval($contact['id']));
}
if ($interval) {
time_sleep_until(microtime(true) + (float) $interval);
}
}
}
}