aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/deliver.php8
-rw-r--r--include/deliver_hooks.php29
-rw-r--r--include/event.php5
-rw-r--r--include/notifier.php37
4 files changed, 65 insertions, 14 deletions
diff --git a/include/deliver.php b/include/deliver.php
index 7a43e3d47..82a1ac6df 100644
--- a/include/deliver.php
+++ b/include/deliver.php
@@ -62,9 +62,17 @@ function deliver_run($argv, $argc) {
$result = z_post_url($r[0]['outq_posturl'],$r[0]['outq_msg']);
if($result['success'] && $result['return_code'] < 300) {
logger('deliver: queue post success to ' . $r[0]['outq_posturl'], LOGGER_DEBUG);
+
+ q("update dreport set status = '%s', dreport_time = '%s' where dreport_queue = '%s' limit 1",
+ dbesc('accepted for delivery'),
+ dbesc(datetime_convert()),
+ dbesc($argv[$x])
+ );
+
$y = q("delete from outq where outq_hash = '%s'",
dbesc($argv[$x])
);
+
}
else {
logger('deliver: queue post returned ' . $result['return_code'] . ' from ' . $r[0]['outq_posturl'],LOGGER_DEBUG);
diff --git a/include/deliver_hooks.php b/include/deliver_hooks.php
new file mode 100644
index 000000000..f0d6ba1b1
--- /dev/null
+++ b/include/deliver_hooks.php
@@ -0,0 +1,29 @@
+<?php
+
+
+require_once('include/cli_startup.php');
+require_once('include/zot.php');
+
+
+function deliver_hooks_run($argv, $argc) {
+
+ cli_startup();
+
+ $a = get_app();
+
+ if($argc < 2)
+ return;
+
+
+ $r = q("select * from item where id = '%d'",
+ intval($argv[1])
+ );
+ if($r)
+ call_hooks('notifier_normal',$r[0]);
+
+}
+
+if (array_search(__file__,get_included_files())===0){
+ deliver_hooks_run($argv,$argc);
+ killme();
+}
diff --git a/include/event.php b/include/event.php
index f0a806dfa..e303ad232 100644
--- a/include/event.php
+++ b/include/event.php
@@ -755,12 +755,15 @@ function event_store_item($arr, $event) {
}
}
+
+
$item_arr = array();
$prefix = '';
// $birthday = false;
if($event['type'] === 'birthday') {
- $prefix = t('This event has been added to your calendar.');
+ if(! is_sys_channel($arr['uid']))
+ $prefix = t('This event has been added to your calendar.');
// $birthday = true;
// The event is created on your own site by the system, but appears to belong
diff --git a/include/notifier.php b/include/notifier.php
index fd95d53e2..3b29229cf 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -579,7 +579,7 @@ function notifier_run($argv, $argc){
if($deliveries_per_process <= 0)
$deliveries_per_process = 1;
- $deliver = array();
+ $deliveries = array();
foreach($dhubs as $hub) {
@@ -675,27 +675,38 @@ function notifier_run($argv, $argc){
);
}
}
- $deliver[] = $hash;
- if(count($deliver) >= $deliveries_per_process) {
- proc_run('php','include/deliver.php',$deliver);
- $deliver = array();
- if($interval)
- @time_sleep_until(microtime(true) + (float) $interval);
+ $deliveries[] = $hash;
+ }
+
+ if($normal_mode) {
+ $x = q("select * from hook where hook = 'notifier_normal'");
+ if($x)
+ proc_run('php','deliver_hooks.php', $target_item['id']);
+ }
+
+ if($deliveries) {
+ $deliver = array();
+
+ foreach($deliveries as $d) {
+
+ $deliver[] = $d;
+
+ if(count($deliver) >= $deliveries_per_process) {
+ proc_run('php','include/deliver.php',$deliver);
+ $deliver = array();
+ if($interval)
+ @time_sleep_until(microtime(true) + (float) $interval);
+ }
}
}
// catch any stragglers
- if(count($deliver)) {
+ if($deliver)
proc_run('php','include/deliver.php',$deliver);
- }
logger('notifier: basic loop complete.', LOGGER_DEBUG);
-
- if($normal_mode)
- call_hooks('notifier_normal',$target_item);
-
call_hooks('notifier_end',$target_item);