aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-06-03 01:16:17 -0700
committerFriendika <info@friendika.com>2011-06-03 01:16:17 -0700
commita27391c33a6b2d3828182ca5f8e8b65998cf47a7 (patch)
treec49d6ddd2e5689a3493cda27dadcc549748e12ee /include
parentf2bdcb19e7f2748d3c368ab11deeb98d63fedca7 (diff)
downloadvolse-hubzilla-a27391c33a6b2d3828182ca5f8e8b65998cf47a7.tar.gz
volse-hubzilla-a27391c33a6b2d3828182ca5f8e8b65998cf47a7.tar.bz2
volse-hubzilla-a27391c33a6b2d3828182ca5f8e8b65998cf47a7.zip
facebook queueing on failure, sync update.php with boot.php update version to avoid race condition
Diffstat (limited to 'include')
-rw-r--r--include/queue.php22
-rw-r--r--include/queue_fn.php16
2 files changed, 22 insertions, 16 deletions
diff --git a/include/queue.php b/include/queue.php
index ff280cb53..cc36b2f62 100644
--- a/include/queue.php
+++ b/include/queue.php
@@ -1,20 +1,6 @@
<?php
require_once("boot.php");
-
-function update_queue_time($id) {
- logger('queue: requeue item ' . $id);
- q("UPDATE `queue` SET `last` = '%s' WHERE `id` = %d LIMIT 1",
- dbesc(datetime_convert()),
- intval($id)
- );
-}
-
-function remove_queue_item($id) {
- logger('queue: remove queue item ' . $id);
- q("DELETE FROM `queue` WHERE `id` = %d LIMIT 1",
- intval($id)
- );
-}
+require_once('include/queue_fn.php');
function queue_run($argv, $argc){
global $a, $db;
@@ -58,6 +44,10 @@ function queue_run($argv, $argc){
if(! count($r)){
return;
}
+
+ call_hooks('queue_predeliver', $a, $r);
+
+
// delivery loop
require_once('include/salmon.php');
@@ -69,6 +59,7 @@ function queue_run($argv, $argc){
if(! count($qi))
continue;
+
$c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
intval($qi[0]['cid'])
);
@@ -121,7 +112,6 @@ function queue_run($argv, $argc){
}
break;
default:
- $a = get_app();
$params = array('owner' => $owner, 'contact' => $contact, 'queue' => $q_item, 'result' => false);
call_hooks('queue_deliver', $a, $params);
diff --git a/include/queue_fn.php b/include/queue_fn.php
new file mode 100644
index 000000000..bc47ceffd
--- /dev/null
+++ b/include/queue_fn.php
@@ -0,0 +1,16 @@
+<?php
+
+function update_queue_time($id) {
+ logger('queue: requeue item ' . $id);
+ q("UPDATE `queue` SET `last` = '%s' WHERE `id` = %d LIMIT 1",
+ dbesc(datetime_convert()),
+ intval($id)
+ );
+}
+
+function remove_queue_item($id) {
+ logger('queue: remove queue item ' . $id);
+ q("DELETE FROM `queue` WHERE `id` = %d LIMIT 1",
+ intval($id)
+ );
+}