summaryrefslogtreecommitdiff
path: root/inc/pageutils.php
diff options
context:
space:
mode:
authorchris <chris@jalakai.co.uk>2006-08-27 20:33:27 +0200
committerchris <chris@jalakai.co.uk>2006-08-27 20:33:27 +0200
commitdc2c0e04646a8bbd31f08140918d61d1dda25c2e (patch)
treef419fd1140e9eec5d2bdb7399c82117a5838d116 /inc/pageutils.php
parent6e0cc83a924bf9b5f90ae80f11ccdcf58ee415a7 (diff)
downloadrpg-dc2c0e04646a8bbd31f08140918d61d1dda25c2e.tar.gz
rpg-dc2c0e04646a8bbd31f08140918d61d1dda25c2e.tar.bz2
update cleanID and wikiFN result caches to support unit testing
- move caches into global scope (they were static in function scope) - add teardown() method to clean_id unit test - to clear its cache darcs-hash:20060827183327-9b6ab-cf9beb2ca6c47142dfaad3117d7c86748a54312c.gz
Diffstat (limited to 'inc/pageutils.php')
-rw-r--r--inc/pageutils.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/inc/pageutils.php b/inc/pageutils.php
index 02330e2a4..882a6bf56 100644
--- a/inc/pageutils.php
+++ b/inc/pageutils.php
@@ -58,6 +58,10 @@ function getID($param='id',$clean=true){
return $id;
}
+// function result cache for cleanID
+global $cache_cleanid;
+$cache_cleanid = array();
+
/**
* Remove unwanted chars from ID
*
@@ -73,7 +77,8 @@ function cleanID($raw_id,$ascii=false){
global $lang;
static $sepcharpat = null;
- static $cache = array();
+ global $cache_cleanid;
+ $cache = & $cache_cleanid;
// check if it's already in the memory cache
if (isset($cache[$raw_id])) {
@@ -140,6 +145,10 @@ function noNS($id) {
}
}
+// function result cache for wikiFN
+global $cache_wikifn;
+$cache_wikifn = array();
+
/**
* returns the full path to the datafile specified by ID and
* optional revision
@@ -151,7 +160,9 @@ function noNS($id) {
function wikiFN($raw_id,$rev='',$clean=true){
global $conf;
- static $cache = array();
+ global $cache_wikifn;
+ $cache = & $cache_wikifn;
+
if (isset($cache[$raw_id]) && isset($cache[$raw_id][$rev])) {
return $cache[$raw_id][$rev];
}