Commit 802f7aa0 authored by Dries's avatar Dries

- Patch #374568 by chx: remove useless JOIN from permission query.

parent ff9e8427
......@@ -572,10 +572,10 @@ function user_role_permissions($roles = array(), $reset = FALSE) {
if ($fetch) {
// Get from the database permissions that were not in the static variable.
// Only role IDs with at least one permission assigned will return rows.
$result = db_query("SELECT r.rid, p.permission FROM {role} r INNER JOIN {role_permission} p ON p.rid = r.rid WHERE r.rid IN (:fetch)", array(':fetch' => $fetch));
$result = db_query("SELECT rid, permission FROM {role_permission} WHERE rid IN (:fetch)", array(':fetch' => $fetch));
while ($row = db_fetch_array($result)) {
$stored_permissions[$row['rid']][$row['permission']] = TRUE;
foreach ($result as $row) {
$stored_permissions[$row->rid][$row->permission] = TRUE;
}
foreach ($fetch as $rid) {
// For every rid, we know we at least assigned an empty array.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment