From 859a2ac8ef1c3ce234b894598be846cbc89cf54a Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 15 Jun 2015 17:28:52 -0700 Subject: DB changes for some channel flags --- mod/admin.php | 14 ++++---------- mod/manage.php | 10 ++++------ mod/ping.php | 2 +- mod/post.php | 4 +--- mod/receive.php | 5 ++--- mod/zfinger.php | 10 +++------- mod/zotfeed.php | 5 ++--- 7 files changed, 17 insertions(+), 33 deletions(-) (limited to 'mod') diff --git a/mod/admin.php b/mod/admin.php index eaaf67c8d..3b8cd2a95 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -211,9 +211,7 @@ function admin_page_summary(&$a) { // available channels, primary and clones $channels = array(); - $r = q("SELECT COUNT(*) AS total, COUNT(CASE WHEN channel_primary = 1 THEN 1 ELSE NULL END) AS main, COUNT(CASE WHEN channel_primary = 0 THEN 1 ELSE NULL END) AS clones FROM channel WHERE NOT (channel_pageflags & %d)>0", - intval(PAGE_REMOVED) - ); + $r = q("SELECT COUNT(*) AS total, COUNT(CASE WHEN channel_primary = 1 THEN 1 ELSE NULL END) AS main, COUNT(CASE WHEN channel_primary = 0 THEN 1 ELSE NULL END) AS clones FROM channel WHERE channel_removed = 0"); if ($r) { $channels['total'] = array('label' => t('# Channels'), 'val' => $r[0]['total']); $channels['main'] = array('label' => t('# primary'), 'val' => $r[0]['main']); @@ -788,11 +786,10 @@ function admin_page_users(&$a){ $users = q("SELECT `account_id` , `account_email`, `account_lastlog`, `account_created`, `account_expires`, " . "`account_service_class`, ( account_flags & %d )>0 as `blocked`, " . "(SELECT %s FROM channel as ch " . - "WHERE ch.channel_account_id = ac.account_id and not (ch.channel_pageflags & %d )>0) as `channels` " . + "WHERE ch.channel_account_id = ac.account_id and ch.channel_removed = 0 ) as `channels` " . "FROM account as ac where true $serviceclass $order limit %d offset %d ", intval(ACCOUNT_BLOCKED), db_concat('ch.channel_address', ' '), - intval(PAGE_REMOVED), intval($a->pager['itemspage']), intval($a->pager['start']) ); @@ -950,9 +947,7 @@ function admin_page_channels(&$a){ /* get channels */ - $total = q("SELECT count(*) as total FROM channel where not (channel_pageflags & %d)>0", - intval(PAGE_REMOVED|PAGE_SYSTEM) - ); + $total = q("SELECT count(*) as total FROM channel where channel_removed = 0 and channel_system = 0"); if($total) { $a->set_pager_total($total[0]['total']); $a->set_pager_itemspage(100); @@ -960,8 +955,7 @@ function admin_page_channels(&$a){ $order = " order by channel_name asc "; - $channels = q("SELECT * from channel where not ( channel_pageflags & %d )>0 $order limit %d offset %d ", - intval(PAGE_REMOVED|PAGE_SYSTEM), + $channels = q("SELECT * from channel where channel_removed = 0 and channel_system = 0 $order limit %d offset %d ", intval($a->pager['itemspage']), intval($a->pager['start']) ); diff --git a/mod/manage.php b/mod/manage.php index c6b653ab6..c86db55e8 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -41,9 +41,8 @@ function manage_content(&$a) { $channels = null; if(local_channel()) { - $r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel.channel_account_id = %d and not ( channel_pageflags & %d )>0 order by channel_name ", - intval(get_account_id()), - intval(PAGE_REMOVED) + $r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel.channel_account_id = %d and channel_removed = 0 order by channel_name ", + intval(get_account_id()) ); $account = get_app()->get_account(); @@ -124,9 +123,8 @@ function manage_content(&$a) { } } - $r = q("select count(channel_id) as total from channel where channel_account_id = %d and not ( channel_pageflags & %d )>0", - intval(get_account_id()), - intval(PAGE_REMOVED) + $r = q("select count(channel_id) as total from channel where channel_account_id = %d and channel_removed = 0", + intval(get_account_id()) ); $limit = account_service_class_fetch(get_account_id(),'total_identities'); if($limit !== false) { diff --git a/mod/ping.php b/mod/ping.php index 16c72f5e6..b093c1cab 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -376,7 +376,7 @@ function ping_init(&$a) { $t1 = dba_timer(); if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) { - $r = q("SELECT id, item_flags FROM item + $r = q("SELECT id, item_wall FROM item WHERE item_unseen = 1 and uid = %d $item_normal and author_xchan != '%s'", diff --git a/mod/post.php b/mod/post.php index 66a354ead..dfda7db9d 100644 --- a/mod/post.php +++ b/mod/post.php @@ -103,9 +103,7 @@ function post_init(&$a) { // Any channel will do, providing it's currently active. We just need to have an // identity to attach to the packet we send back. So find one. - $c = q("select * from channel where not ( channel_pageflags & %d )>0 limit 1", - intval(PAGE_REMOVED) - ); + $c = q("select * from channel where channel_removed = 0 limit 1"); if (! $c) { // nobody here diff --git a/mod/receive.php b/mod/receive.php index deaf8cb37..571f736ed 100644 --- a/mod/receive.php +++ b/mod/receive.php @@ -31,9 +31,8 @@ function receive_post(&$a) { // Diaspora sites *may* provide a truncated guid. - $r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_guid like '%s' AND (channel_pageflags & %d ) = 0 LIMIT 1", - dbesc($guid . '%'), - intval(PAGE_REMOVED) + $r = q("SELECT * FROM channel left join xchan on channel_hash = xchan_hash WHERE channel_guid like '%s' AND channel_removed = 0 LIMIT 1", + dbesc($guid . '%') ); if(! $r) http_status_exit(500); diff --git a/mod/zfinger.php b/mod/zfinger.php index 39c9ae9aa..8ddd92f3d 100644 --- a/mod/zfinger.php +++ b/mod/zfinger.php @@ -74,14 +74,10 @@ function zfinger_init(&$a) { */ $r = q("select channel.*, xchan.* from channel left join xchan on channel_hash = xchan_hash - where ( channel_pageflags & %d )>0 order by channel_id limit 1", - intval(PAGE_SYSTEM) - ); + where channel_system = 1 order by channel_id limit 1"); if(! $r) { $r = q("select channel.*, xchan.* from channel left join xchan on channel_hash = xchan_hash - where not ( channel_pageflags & %d )>0 order by channel_id limit 1", - intval(PAGE_REMOVED) - ); + where channel_removed = 0 order by channel_id limit 1"); } } } @@ -99,7 +95,7 @@ function zfinger_init(&$a) { $id = $e['channel_id']; - $sys_channel = (($e['channel_pageflags'] & PAGE_SYSTEM) ? true : false); + $sys_channel = (intval($e['channel_system']) ? true : false); $special_channel = (($e['channel_pageflags'] & PAGE_PREMIUM) ? true : false); $adult_channel = (($e['channel_pageflags'] & PAGE_ADULT) ? true : false); $censored = (($e['channel_pageflags'] & PAGE_CENSORED) ? true : false); diff --git a/mod/zotfeed.php b/mod/zotfeed.php index 78a667330..b2f2e0465 100644 --- a/mod/zotfeed.php +++ b/mod/zotfeed.php @@ -21,9 +21,8 @@ function zotfeed_init(&$a) { $channel_address = ((argc() > 1) ? argv(1) : ''); if($channel_address) { - $r = q("select channel_id, channel_name from channel where channel_address = '%s' and not (channel_pageflags & %d) > 0 limit 1", - dbesc(argv(1)), - intval(PAGE_REMOVED) + $r = q("select channel_id, channel_name from channel where channel_address = '%s' and channel_removed = 0 limit 1", + dbesc(argv(1)) ); } else { -- cgit v1.2.3