From 95415bff69a6dba17d9aa3ff02707c94872e75e4 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 28 Jan 2013 19:24:36 -0800 Subject: delete item should now mostly work --- include/notifier.php | 6 +++++- include/zot.php | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/notifier.php b/include/notifier.php index dddf0aade..b22f77d91 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -204,7 +204,11 @@ function notifier_run($argv, $argc){ $r = fetch_post_tags($r); $target_item = $r[0]; - + + if($target_item['item_restrict'] & ITEM_DELETED) + logger('notifier: target item ITEM_DELETED', LOGGER_DEBUG); + + $s = q("select * from channel where channel_id = %d limit 1", intval($target_item['uid']) ); diff --git a/include/zot.php b/include/zot.php index ac18dfd41..8e3f0303e 100644 --- a/include/zot.php +++ b/include/zot.php @@ -910,8 +910,15 @@ function process_delivery($sender,$arr,$deliveries,$relay) { } if($arr['item_restrict'] & ITEM_DELETED) { - delete_imported_item($sender,$arr,$channel['channel_id']); + $item_id = delete_imported_item($sender,$arr,$channel['channel_id']); $result[] = array($d['hash'],'deleted'); + + if($relay && $item_id) { + logger('process_delivery: invoking relay'); + proc_run('php','include/notifier.php','relay',intval($item_id)); + $result[] = array($d['hash'],'relayed'); + } + continue; } @@ -988,20 +995,24 @@ function update_imported_item($sender,$item,$uid) { function delete_imported_item($sender,$item,$uid) { - $r = q("select id from item where author_xchan = '%s' or owner_xchan = '%s' + logger('delete_imported_item invoked',LOGGER_DEBUG); + + $r = q("select id from item where ( author_xchan = '%s' or owner_xchan = '%s' ) and uri = '%s' and uid = %d limit 1", dbesc($sender['hash']), dbesc($sender['hash']), dbesc($item['uri']), intval($uid) ); + if(! $r) { logger('delete_imported_item: failed: ownership issue'); - return; + return false; } require_once('include/items.php'); drop_item($r[0]['id'],false); + return $r[0]['id']; } function process_mail_delivery($sender,$arr,$deliveries) { -- cgit v1.2.3