1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 20:13:22 +01:00

Merge branch 'ticket/p/10141' into develop-olympus

* ticket/p/10141:
  [ticket/10141] Save a hash lookup when value is not in cache.
  [ticket/10141] Split double-assignment into conditional and unconditional part.
  [ticket/10141] Use a cache in $auth->_fill_acl() for better performance.
This commit is contained in:
Andreas Fischer 2011-04-22 11:16:32 +02:00
commit bc48fe1704

View File

@ -109,6 +109,7 @@ class auth
*/
function _fill_acl($user_permissions)
{
$seq_cache = array();
$this->acl = array();
$user_permissions = explode("\n", $user_permissions);
@ -125,8 +126,17 @@ class auth
while ($subseq = substr($seq, $i, 6))
{
if (isset($seq_cache[$subseq]))
{
$converted = $seq_cache[$subseq];
}
else
{
$converted = $seq_cache[$subseq] = str_pad(base_convert($subseq, 36, 2), 31, 0, STR_PAD_LEFT);
}
// We put the original bitstring into the acl array
$this->acl[$f] .= str_pad(base_convert($subseq, 36, 2), 31, 0, STR_PAD_LEFT);
$this->acl[$f] .= $converted;
$i += 6;
}
}