reduce the number of queries required to get a notice's groups
This commit is contained in:
parent
b9cabd45de
commit
200e18cd71
|
@ -1438,25 +1438,14 @@ class Notice extends Memcached_DataObject
|
||||||
|
|
||||||
$gi->notice_id = $this->id;
|
$gi->notice_id = $this->id;
|
||||||
|
|
||||||
if ($gi->find()) {
|
$ids = $gi->fetchAll('group_id');
|
||||||
while ($gi->fetch()) {
|
|
||||||
$ids[] = $gi->group_id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self::cacheSet($keypart, implode(',', $ids));
|
self::cacheSet($keypart, implode(',', $ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
$groups = array();
|
$groups = User_group::multiGet('id', $ids);
|
||||||
|
|
||||||
foreach ($ids as $id) {
|
return $groups->fetchAll();
|
||||||
$group = User_group::staticGet('id', $id);
|
|
||||||
if ($group) {
|
|
||||||
$groups[] = $group;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $groups;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user