Skip to content
Snippets Groups Projects
Commit a424cd8e authored by chris's avatar chris
Browse files

add authname memory cache

actions which concern multiple pages (e.g. search, backlinks, recents)
end up repeatedly encoding the current user's name and groups. This
change caches the results of the encoding allowing them to be reused.

darcs-hash:20060923161206-9b6ab-a3ec8f1c2ec284d84b9ff85cba1e56165b2967a7.gz
parent 720307d9
No related branches found
No related tags found
No related merge requests found
......@@ -380,13 +380,20 @@ function auth_aclcheck($id,$user,$groups){
* @see rawurldecode()
*/
function auth_nameencode($name,$skip_group=false){
if($skip_group && $name{0} =='@'){
return '@'.preg_replace('/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f])/e',
"'%'.dechex(ord('\\1'))",substr($name,1));
}else{
return preg_replace('/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f])/e',
"'%'.dechex(ord('\\1'))",$name);
global $cache_authname;
$cache =& $cache_authname;
if (!isset($cache[$name][$skip_group])) {
if($skip_group && $name{0} =='@'){
$cache[$name][$skip_group] = '@'.preg_replace('/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f])/e',
"'%'.dechex(ord('\\1'))",substr($name,1));
}else{
$cache[$name][$skip_group] = preg_replace('/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f])/e',
"'%'.dechex(ord('\\1'))",$name);
}
}
return $cache[$name][$skip_group];
}
/**
......
......@@ -24,9 +24,10 @@
else { error_reporting(DOKU_E_LEVEL); }
// init memory caches
global $cache_revinfo; $cache_revinfo = array();
global $cache_wikifn; $cache_wikifn = array();
global $cache_wikifn; $cache_cleanid = array();
global $cache_revinfo; $cache_revinfo = array();
global $cache_wikifn; $cache_wikifn = array();
global $cache_cleanid; $cache_cleanid = array();
global $cache_authname; $cache_authname = array();
//prepare config array()
global $conf;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment