From 2cd6b2cb2ac285caa2c0051f96bbccb1a8df711e Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 5 Jul 2014 21:45:13 -0700 Subject: make the pending connections query consistent between mod/ping and mod/connections --- mod/ping.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mod/ping.php b/mod/ping.php index 8a498d543..49475de66 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -269,11 +269,11 @@ function ping_init(&$a) { if(argc() > 1 && (argv(1) === 'intros')) { $result = array(); - $r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook_xchan = xchan_hash - WHERE abook_channel = %d and (abook_flags & %d) and not (abook_flags & %d)", + $r = q("SELECT * FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d) and not ((abook_flags & %d) or (xchan_flags & %d))", intval(local_user()), intval(ABOOK_FLAG_PENDING), - intval(ABOOK_FLAG_SELF) + intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED), + intval(XCHAN_FLAGS_DELETED|XCHAN_FLAGS_ORPHAN) ); if($r) { @@ -370,9 +370,11 @@ function ping_init(&$a) { $t2 = dba_timer(); - $intr = q("select count(abook_id) as total from abook where (abook_flags & %d) and abook_channel = %d", + $intr = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and (abook_flags & %d) and not ((abook_flags & %d) or (xchan_flags & %d))", + intval(local_user()), intval(ABOOK_FLAG_PENDING), - intval(local_user()) + intval(ABOOK_FLAG_SELF|ABOOK_FLAG_IGNORED), + intval(XCHAN_FLAGS_DELETED|XCHAN_FLAGS_ORPHAN) ); $t3 = dba_timer(); -- cgit v1.2.3