aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2011-04-22 11:17:39 +0200
committerAndreas Fischer <bantu@phpbb.com>2011-04-22 11:17:39 +0200
commitca0a066854addfc557b7b6fb0c25deed2a3fe960 (patch)
tree4787a7343ef8f5bfedf36f7f38377eb69c15bf13
parentf08880e2c4fa5cac4b35716bb03f51a8b10c0c21 (diff)
parentbc48fe17048092d6b8d8bfc386dc3d446d5575ea (diff)
downloadforums-ca0a066854addfc557b7b6fb0c25deed2a3fe960.tar
forums-ca0a066854addfc557b7b6fb0c25deed2a3fe960.tar.gz
forums-ca0a066854addfc557b7b6fb0c25deed2a3fe960.tar.bz2
forums-ca0a066854addfc557b7b6fb0c25deed2a3fe960.tar.xz
forums-ca0a066854addfc557b7b6fb0c25deed2a3fe960.zip
Merge branch 'develop-olympus' into develop
* develop-olympus: [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.
-rw-r--r--phpBB/includes/auth.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/phpBB/includes/auth.php b/phpBB/includes/auth.php
index 5b197e93f3..22aca5faf9 100644
--- a/phpBB/includes/auth.php
+++ b/phpBB/includes/auth.php
@@ -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;
}
}