mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/10141] Use a cache in $auth->_fill_acl() for better performance.
Many sequences being converted are the same. Use a local cache to convert each sequence once, speeding up the function. PHPBB3-10141
This commit is contained in:
parent
32bc980ca0
commit
11dd4b54fa
1 changed files with 10 additions and 2 deletions
|
@ -109,6 +109,7 @@ class auth
|
|||
*/
|
||||
function _fill_acl($user_permissions)
|
||||
{
|
||||
$seq_cache = array();
|
||||
$this->acl = array();
|
||||
$user_permissions = explode("\n", $user_permissions);
|
||||
|
||||
|
@ -124,9 +125,16 @@ class auth
|
|||
}
|
||||
|
||||
while ($subseq = substr($seq, $i, 6))
|
||||
{
|
||||
if (isset($seq_cache[$subseq]))
|
||||
{
|
||||
$this->acl[$f] .= $seq_cache[$subseq];
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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] .= ($seq_cache[$subseq] = str_pad(base_convert($subseq, 36, 2), 31, 0, STR_PAD_LEFT));
|
||||
}
|
||||
$i += 6;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue