aboutsummaryrefslogtreecommitdiffstats
path: root/include/notifier.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-02-06 13:27:37 -0800
committerFriendika <info@friendika.com>2011-02-06 13:27:37 -0800
commit3f973445609d604154a687b50a29a753826b7a5e (patch)
treedbd386328eb4ced798f72fdc1c6c53572bcfbf14 /include/notifier.php
parent8a55168d4f470fb06b2e02896541688d3967bae5 (diff)
parent64be33a3ff9ddae16ba7a57c842441a2d0058a5b (diff)
downloadvolse-hubzilla-3f973445609d604154a687b50a29a753826b7a5e.tar.gz
volse-hubzilla-3f973445609d604154a687b50a29a753826b7a5e.tar.bz2
volse-hubzilla-3f973445609d604154a687b50a29a753826b7a5e.zip
Merge branch 'master' of https://github.com/fabrixxm/friendika into fabrixxm-master
Diffstat (limited to 'include/notifier.php')
-rw-r--r--include/notifier.php43
1 files changed, 28 insertions, 15 deletions
diff --git a/include/notifier.php b/include/notifier.php
index 8442349cf..07bde7c4d 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -2,18 +2,18 @@
require_once("boot.php");
function notifier_run($argv, $argc){
- global $a, $db;
+ global $a, $db;
- if(is_null($a)){
- $a = new App;
- }
+ if(is_null($a)){
+ $a = new App;
+ }
- if(is_null($db)){
- @include(".htconfig.php");
- require_once("dba.php");
- $db = new dba($db_host, $db_user, $db_pass, $db_data);
- unset($db_host, $db_user, $db_pass, $db_data);
- };
+ if(is_null($db)) {
+ @include(".htconfig.php");
+ require_once("dba.php");
+ $db = new dba($db_host, $db_user, $db_pass, $db_data);
+ unset($db_host, $db_user, $db_pass, $db_data);
+ }
require_once("session.php");
require_once("datetime.php");
@@ -62,11 +62,12 @@ function notifier_run($argv, $argc){
$r = q("SELECT `parent`, `uid`, `edited` FROM `item` WHERE `id` = %d LIMIT 1",
intval($item_id)
);
- if(! count($r)){
+
+ if((! count($r)) || (! intval($r[0]['parent']))) {
return;
}
-
- $parent_id = $r[0]['parent'];
+
+ $parent_id = intval($r[0]['parent']);
$uid = $r[0]['uid'];
$updated = $r[0]['edited'];
@@ -77,6 +78,13 @@ function notifier_run($argv, $argc){
if(! count($items)){
return;
}
+
+ // avoid race condition with deleting entries
+
+ if($items[0]['deleted']) {
+ foreach($items as $item)
+ $item['deleted'] = 1;
+ }
}
$r = q("SELECT `contact`.*, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`, `user`.`page-flags`
@@ -122,8 +130,8 @@ function notifier_run($argv, $argc){
$allow_people = expand_acl($parent['allow_cid']);
$allow_groups = expand_groups(expand_acl($parent['allow_gid']));
- $deny_people = expand_acl($parent['deny_cid']);
- $deny_groups = expand_groups(expand_acl($parent['deny_gid']));
+ $deny_people = expand_acl($parent['deny_cid']);
+ $deny_groups = expand_groups(expand_acl($parent['deny_gid']));
$conversants = array();
@@ -220,6 +228,8 @@ function notifier_run($argv, $argc){
else {
if($followup) {
foreach($items as $item) { // there is only one item
+ if(! $item['parent'])
+ continue;
if($item['id'] == $item_id) {
logger('notifier: followup: item: ' . print_r($item,true), LOGGER_DATA);
$slap = atom_entry($item,'html',$owner,$owner,false);
@@ -229,6 +239,9 @@ function notifier_run($argv, $argc){
}
else {
foreach($items as $item) {
+ if(! $item['parent'])
+ continue;
+
$contact = get_item_contact($item,$contacts);
if(! $contact)
continue;