aboutsummaryrefslogtreecommitdiffstats
path: root/include/queue.php
diff options
context:
space:
mode:
authormrjive <mrjive@mrjive.it>2015-10-02 09:45:03 +0200
committermrjive <mrjive@mrjive.it>2015-10-02 09:45:03 +0200
commit32522b61f235266384c81c0669fceaf58afeb4fe (patch)
tree48427e8f48421b3bb8f344d85f2ebfe1271ea34e /include/queue.php
parent11c1573b55f278a664a90a2872d06a40b3ac3026 (diff)
parent1da3828a09485a9b2bc6113cbab9ca9ca483ffc0 (diff)
downloadvolse-hubzilla-32522b61f235266384c81c0669fceaf58afeb4fe.tar.gz
volse-hubzilla-32522b61f235266384c81c0669fceaf58afeb4fe.tar.bz2
volse-hubzilla-32522b61f235266384c81c0669fceaf58afeb4fe.zip
Merge pull request #6 from redmatrix/master
updating from original codebase
Diffstat (limited to 'include/queue.php')
-rw-r--r--include/queue.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/include/queue.php b/include/queue.php
index 18c8c5fa2..71ac50c83 100644
--- a/include/queue.php
+++ b/include/queue.php
@@ -23,6 +23,9 @@ function queue_run($argv, $argc){
logger('queue: start');
+ // delete all queue items more than 3 days old
+ // but first mark these sites dead if we haven't heard from them in a month
+
$r = q("select outq_posturl from outq where outq_created < %s - INTERVAL %s",
db_utcnow(), db_quoteinterval('3 DAY')
);
@@ -85,15 +88,34 @@ function queue_run($argv, $argc){
return;
foreach($r as $rr) {
+
+ $dresult = null;
+
if(in_array($rr['outq_posturl'],$deadguys))
continue;
+ $base = '';
+ $h = parse_url($rr['outq_posturl']);
+ if($h)
+ $base = $h['scheme'] . '://' . $h['host'] . (($h['port']) ? ':' . $h['port'] : '');
+
if($rr['outq_driver'] === 'post') {
$result = z_post_url($rr['outq_posturl'],$rr['outq_msg']);
if($result['success'] && $result['return_code'] < 300) {
logger('queue: queue post success to ' . $rr['outq_posturl'], LOGGER_DEBUG);
+ if($base) {
+ q("update site set site_update = '%s', site_dead = 0 where site_url = '%s' ",
+ dbesc(datetime_convert()),
+ dbesc($base)
+ );
+ }
+ q("update dreport set dreport_result = '%s', dreport_time = '%s' where dreport_queue = '%s' limit 1",
+ dbesc('accepted for delivery'),
+ dbesc(datetime_convert()),
+ dbesc($rr['outq_hash'])
+ );
$y = q("delete from outq where outq_hash = '%s'",
- dbesc($rr['ouq_hash'])
+ dbesc($rr['outq_hash'])
);
}
else {
@@ -102,6 +124,7 @@ function queue_run($argv, $argc){
dbesc(datetime_convert()),
dbesc($rr['outq_hash'])
);
+ $deadguys[] = $rr['outq_posturl'];
}
continue;
}