aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2016-03-20 20:26:55 +0100
committerMario Vavti <mario@mariovavti.com>2016-03-20 20:26:55 +0100
commit9fcd470acacf3dc283c91c52f591f5aaa3983ba4 (patch)
tree2e44a1dd615c54426b26fa1e73694e163cee4c2d
parent23419e4c26a3f971dd9ec50a37c78c009c12ffca (diff)
downloadvolse-hubzilla-9fcd470acacf3dc283c91c52f591f5aaa3983ba4.tar.gz
volse-hubzilla-9fcd470acacf3dc283c91c52f591f5aaa3983ba4.tar.bz2
volse-hubzilla-9fcd470acacf3dc283c91c52f591f5aaa3983ba4.zip
fix #328 by using a seperate query instead of group_concat
-rw-r--r--include/group.php16
-rw-r--r--mod/acl.php15
2 files changed, 22 insertions, 9 deletions
diff --git a/include/group.php b/include/group.php
index 22f221059..748ec0c13 100644
--- a/include/group.php
+++ b/include/group.php
@@ -211,6 +211,22 @@ function group_get_members($gid) {
return $ret;
}
+function group_get_members_xchan($gid) {
+ $ret = array();
+ if(intval($gid)) {
+ $r = q("SELECT xchan FROM group_member WHERE gid = %d AND uid = %d",
+ intval($gid),
+ intval(local_channel())
+ );
+ if(count($r)) {
+ foreach($r as $rr) {
+ $ret[] = $rr['xchan'];
+ }
+ }
+ }
+ return $ret;
+}
+
function mini_group_select($uid,$group = '') {
$grps = array();
diff --git a/mod/acl.php b/mod/acl.php
index d48a9b19c..6eeca8af0 100644
--- a/mod/acl.php
+++ b/mod/acl.php
@@ -2,6 +2,7 @@
/* ACL selector json backend */
require_once("include/acl_selectors.php");
+require_once("include/group.php");
function acl_init(&$a){
@@ -48,32 +49,28 @@ function acl_init(&$a){
if ($type=='' || $type=='g'){
- $r = q("SELECT `groups`.`id`, `groups`.`hash`, `groups`.`name`,
- %s as uids
+ $r = q("SELECT `groups`.`id`, `groups`.`hash`, `groups`.`name`
FROM `groups`,`group_member`
WHERE `groups`.`deleted` = 0 AND `groups`.`uid` = %d
- AND `group_member`.`gid`=`groups`.`id`
- $sql_extra
+ AND `group_member`.`gid`=`groups`.`id`
+ $sql_extra
GROUP BY `groups`.`id`
ORDER BY `groups`.`name`
LIMIT %d OFFSET %d",
- db_concat('group_member.xchan', ','),
intval(local_channel()),
intval($count),
intval($start)
);
foreach($r as $g){
-// logger('acl: group: ' . $g['name'] . ' members: ' . $g['uids']);
+// logger('acl: group: ' . $g['name'] . ' members: ' . group_get_members_xchan($g['id']));
$groups[] = array(
"type" => "g",
"photo" => "images/twopeople.png",
"name" => $g['name'],
"id" => $g['id'],
"xid" => $g['hash'],
- //FIXME: db_concat aka GROUP_CONCAT has a defoult setting of group_concat_max_len = 1024 in mysql.
- // This value is quickly exceeded here. As a result $g['uids'] only contains a part of the complete xchan set.
- "uids" => explode(",",$g['uids']),
+ "uids" => group_get_members_xchan($g['id']),
"link" => ''
);
}