From da2349bb6a85d13f0aa29046bef3021cf0c884ba Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 12 Feb 2015 17:45:25 -0800 Subject: provide relief to sites that are severely impacted by the slow ITEM_UNSEEN searches. This does not incorporate any other flag optimisations as that will require a major DB update and possibly involve significant downtime. This is just to bite off a little chunk now and provide some much needed relief. --- mod/manage.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'mod/manage.php') diff --git a/mod/manage.php b/mod/manage.php index 4a7b25068..cb46a1b76 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -57,9 +57,7 @@ function manage_content(&$a) { $c = q("SELECT id, item_restrict, item_flags FROM item - WHERE (item_restrict = %d) and ( item_flags & %d )>0 and uid = %d", - intval(ITEM_VISIBLE), - intval(ITEM_UNSEEN), + WHERE item_restrict = 0 and item_unseen = 1 and uid = %d", intval($channels[$x]['channel_id']) ); -- cgit v1.2.3 From 98dffd77efbad934a26fb4abee9b3e42eeb7b6d2 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 10 Mar 2015 02:23:14 -0700 Subject: channel delegation --- mod/manage.php | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'mod/manage.php') diff --git a/mod/manage.php b/mod/manage.php index cb46a1b76..54a65dbbf 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -2,7 +2,7 @@ function manage_content(&$a) { - if(! get_account_id()) { + if((! get_account_id()) || ($_SESSION['delegate'])) { notice( t('Permission denied.') . EOL); return; } @@ -144,6 +144,22 @@ function manage_content(&$a) { array( 'new_channel', t('Create a new channel'), t('Create a new channel')) ); + $delegates = q("select * from abook left join xchan on abook_xchan = xchan_hash where + abook_channel = %d and (abook_their_perms & %d) > 0", + intval(local_channel()), + intval(PERMS_A_DELEGATE) + ); + if(! $delegates) + $delegates = null; + + if($delegates) { + for($x = 0; $x < count($delegates); $x ++) { + $delegates[$x]['link'] = 'magic?f=&dest=' . urlencode($delegates[$x]['xchan_url']) . '&delegate=' . urlencode($delegates[$x]['xchan_addr']); + } + } + + + $o = replace_macros(get_markup_template('channels.tpl'), array( '$header' => t('Channel Manager'), '$msg_selected' => t('Current Channel'), @@ -153,9 +169,12 @@ function manage_content(&$a) { '$msg_make_default' => t('Make Default'), '$links' => $links, '$all_channels' => $channels, - '$mail_format' => t('%d new messages'), - '$intros_format' => t('%d new introductions'), + '$mail_format' => t('%d new messages'), + '$intros_format' => t('%d new introductions'), '$channel_usage_message' => $channel_usage_message, + '$delegate_header' => t('Delegated Channels'), + '$delegates' => $delegates, + )); -- cgit v1.2.3