create site records for all queued sites and check for death

This commit is contained in:
redmatrix
2015-09-28 17:13:11 -07:00
parent dbeae16dc1
commit e5f47cd14b
9 changed files with 68 additions and 21 deletions

View File

@@ -22,6 +22,22 @@ function queue_run($argv, $argc){
logger('queue: start');
$r = q("select outq_posturl from outq where outq_created < %s - INTERVAL %s",
db_utcnow(), db_quoteinterval('3 DAY')
);
if($r) {
foreach($r as $rr) {
$site_url = '';
$h = parse_url($rr['outq_posturl']);
$desturl = $h['scheme'] . '://' . $h['host'] . (($h['port']) ? ':' . $h['port'] : '');
q("update site set site_dead = 1 where site_dead = 0 and site_url = '%s' and site_update < %s - INTERVAL %s",
dbesc($desturl),
db_utcnow(), db_quoteinterval('1 MONTH')
);
}
}
$r = q("DELETE FROM outq WHERE outq_created < %s - INTERVAL %s",
db_utcnow(), db_quoteinterval('3 DAY')
);