Some standards
This commit is contained in:
parent
9c16b47f55
commit
f7b0c2082b
|
@ -65,7 +65,7 @@ function cron_run(&$argv, &$argc){
|
||||||
$d1 = get_config('system','last_expire_day');
|
$d1 = get_config('system','last_expire_day');
|
||||||
$d2 = intval(datetime_convert('UTC','UTC','now','d'));
|
$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");
|
proc_run(PRIORITY_LOW, "include/cronjobs.php", "update_contact_birthdays");
|
||||||
|
|
||||||
|
@ -104,14 +104,15 @@ function cron_poll_contacts($argc, $argv) {
|
||||||
$force = false;
|
$force = false;
|
||||||
$restart = false;
|
$restart = false;
|
||||||
|
|
||||||
if (($argc > 1) && ($argv[1] == 'force'))
|
if (($argc > 1) && ($argv[1] == 'force')) {
|
||||||
$force = true;
|
$force = true;
|
||||||
|
}
|
||||||
if (($argc > 1) && ($argv[1] == 'restart')) {
|
if (($argc > 1) && ($argv[1] == 'restart')) {
|
||||||
$restart = true;
|
$restart = true;
|
||||||
$generation = intval($argv[2]);
|
$generation = intval($argv[2]);
|
||||||
if (!$generation)
|
if (!$generation) {
|
||||||
killme();
|
killme();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($argc > 1) && intval($argv[1])) {
|
if (($argc > 1) && intval($argv[1])) {
|
||||||
|
@ -130,9 +131,9 @@ function cron_poll_contacts($argc, $argv) {
|
||||||
// we are unable to match those posts with a Diaspora GUID and prevent duplicates.
|
// we are unable to match those posts with a Diaspora GUID and prevent duplicates.
|
||||||
|
|
||||||
$abandon_days = intval(get_config('system','account_abandon_days'));
|
$abandon_days = intval(get_config('system','account_abandon_days'));
|
||||||
if($abandon_days < 1)
|
if ($abandon_days < 1) {
|
||||||
$abandon_days = 0;
|
$abandon_days = 0;
|
||||||
|
}
|
||||||
$abandon_sql = (($abandon_days)
|
$abandon_sql = (($abandon_days)
|
||||||
? sprintf(" AND `user`.`login_date` > UTC_TIMESTAMP() - INTERVAL %d DAY ", intval($abandon_days))
|
? sprintf(" AND `user`.`login_date` > UTC_TIMESTAMP() - INTERVAL %d DAY ", intval($abandon_days))
|
||||||
: ''
|
: ''
|
||||||
|
@ -169,7 +170,7 @@ function cron_poll_contacts($argc, $argv) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($res as $contact) {
|
foreach ($res as $contact) {
|
||||||
|
|
||||||
$xml = false;
|
$xml = false;
|
||||||
|
|
||||||
|
@ -191,7 +192,7 @@ function cron_poll_contacts($argc, $argv) {
|
||||||
$contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3);
|
$contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($contact['priority'] AND !$force) {
|
if ($contact['priority'] AND !$force) {
|
||||||
|
|
||||||
$update = false;
|
$update = false;
|
||||||
|
|
||||||
|
@ -203,29 +204,35 @@ function cron_poll_contacts($argc, $argv) {
|
||||||
|
|
||||||
switch ($contact['priority']) {
|
switch ($contact['priority']) {
|
||||||
case 5:
|
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;
|
$update = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
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;
|
$update = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
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;
|
$update = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
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;
|
$update = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
default:
|
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;
|
$update = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!$update)
|
if (!$update) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger("Polling ".$contact["network"]." ".$contact["id"]." ".$contact["nick"]." ".$contact["name"]);
|
logger("Polling ".$contact["network"]." ".$contact["id"]." ".$contact["nick"]." ".$contact["name"]);
|
||||||
|
|
|
@ -111,7 +111,7 @@ function cron_expire_and_remove_users() {
|
||||||
// delete user and contact records for recently removed accounts
|
// delete user and contact records for recently removed accounts
|
||||||
$r = q("SELECT * FROM `user` WHERE `account_removed` AND `account_expires_on` < UTC_TIMESTAMP() - INTERVAL 3 DAY");
|
$r = q("SELECT * FROM `user` WHERE `account_removed` AND `account_expires_on` < UTC_TIMESTAMP() - INTERVAL 3 DAY");
|
||||||
if (dbm::is_result($r)) {
|
if (dbm::is_result($r)) {
|
||||||
foreach($r as $user) {
|
foreach ($r as $user) {
|
||||||
q("DELETE FROM `contact` WHERE `uid` = %d", intval($user['uid']));
|
q("DELETE FROM `contact` WHERE `uid` = %d", intval($user['uid']));
|
||||||
q("DELETE FROM `user` WHERE `uid` = %d", intval($user['uid']));
|
q("DELETE FROM `user` WHERE `uid` = %d", intval($user['uid']));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue