aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-03-25 19:13:53 -0700
committerfriendica <info@friendica.com>2015-03-25 19:13:53 -0700
commitf1a16607095e0ebbd8ce2201a2f087557b39f282 (patch)
tree05dc203400ae1361b61892839e900b5d36ee3115
parenta6be0c9e72fc0fb34b6fe9005d337fa51d8e089d (diff)
downloadvolse-hubzilla-f1a16607095e0ebbd8ce2201a2f087557b39f282.tar.gz
volse-hubzilla-f1a16607095e0ebbd8ce2201a2f087557b39f282.tar.bz2
volse-hubzilla-f1a16607095e0ebbd8ce2201a2f087557b39f282.zip
item_check_service_class - the join is totally unnecessary
-rw-r--r--mod/item.php40
1 files changed, 20 insertions, 20 deletions
diff --git a/mod/item.php b/mod/item.php
index 6644be291..8aa3d8136 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -1071,37 +1071,37 @@ function fix_attached_file_permissions($channel,$observer_hash,$body,
function item_check_service_class($channel_id,$iswebpage) {
$ret = array('success' => false, $message => '');
+
if ($iswebpage) {
- $r = q("select count(i.id) as total from item i
- right join channel c on (i.author_xchan=c.channel_hash and i.uid=c.channel_id )
- and i.parent=i.id and (i.item_restrict & %d)>0 and not (i.item_restrict & %d)>0 and i.uid= %d ",
+ $r = q("select count(id) as total from item where parent = id
+ and ( item_restrict & %d ) > 0 and ( item_restrict & %d ) = 0 and uid = %d ",
intval(ITEM_WEBPAGE),
intval(ITEM_DELETED),
- intval($channel_id)
- );
+ intval($channel_id)
+ );
}
else {
- $r = q("select count(i.id) as total from item i
- right join channel c on (i.author_xchan=c.channel_hash and i.uid=c.channel_id )
- and i.parent=i.id and (i.item_restrict=0) and i.uid= %d ",
- intval($channel_id)
- );
+ $r = q("select count(id) as total from item where parent = id and item_restrict = 0 and uid = %d ",
+ intval($channel_id)
+ );
}
- if(! ($r && count($r))) {
- $ret['message'] = t('Unable to obtain identity information from database');
+
+ if(! $r) {
+ $ret['message'] = t('Unable to obtain post information from database.');
return $ret;
}
+
if (!$iswebpage) {
- if(! service_class_allows($channel_id,'total_items',$r[0]['total'])) {
- $result['message'] .= upgrade_message().sprintf(t("You have reached your limit of %1$.0f top level posts."),$r[0]['total']);
- return $result;
- }
+ if(! service_class_allows($channel_id,'total_items',$r[0]['total'])) {
+ $result['message'] .= upgrade_message() . sprintf( t('You have reached your limit of %1$.0f top level posts.'),$r[0]['total']);
+ return $result;
+ }
}
else {
- if(! service_class_allows($channel_id,'total_pages',$r[0]['total'])) {
- $result['message'] .= upgrade_message().sprintf(t("You have reached your limit of %1$.0f webpages."),$r[0]['total']);
- return $result;
- }
+ if(! service_class_allows($channel_id,'total_pages',$r[0]['total'])) {
+ $result['message'] .= upgrade_message() . sprintf( t('You have reached your limit of %1$.0f webpages.'),$r[0]['total']);
+ return $result;
+ }
}
$ret['success'] = true;