diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2008-03-21 11:49:34 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2008-03-21 11:49:34 +0100 |
commit | 086ae52d12011746a75f5588e877347bc0457352 (patch) | |
tree | e73263c7a29d0f94fafb874562610e16eb292ba8 /includes/MagicWord.php | |
parent | 749e7fb2bae7bbda855de3c9e319435b9f698ff7 (diff) |
Update auf MediaWiki 1.12.0
Diffstat (limited to 'includes/MagicWord.php')
-rw-r--r-- | includes/MagicWord.php | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/includes/MagicWord.php b/includes/MagicWord.php index f7a9400d..18c931c5 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -101,6 +101,44 @@ class MagicWord { 'numberofadmins', 'defaultsort', ); + + /* Array of caching hints for ParserCache */ + static public $mCacheTTLs = array ( + 'currentmonth' => 86400, + 'currentmonthname' => 86400, + 'currentmonthnamegen' => 86400, + 'currentmonthabbrev' => 86400, + 'currentday' => 3600, + 'currentday2' => 3600, + 'currentdayname' => 3600, + 'currentyear' => 86400, + 'currenttime' => 3600, + 'currenthour' => 3600, + 'localmonth' => 86400, + 'localmonthname' => 86400, + 'localmonthnamegen' => 86400, + 'localmonthabbrev' => 86400, + 'localday' => 3600, + 'localday2' => 3600, + 'localdayname' => 3600, + 'localyear' => 86400, + 'localtime' => 3600, + 'localhour' => 3600, + 'numberofarticles' => 3600, + 'numberoffiles' => 3600, + 'numberofedits' => 3600, + 'currentweek' => 3600, + 'currentdow' => 3600, + 'localweek' => 3600, + 'localdow' => 3600, + 'numberofusers' => 3600, + 'numberofpages' => 3600, + 'currentversion' => 86400, + 'currenttimestamp' => 3600, + 'localtimestamp' => 3600, + 'pagesinnamespace' => 3600, + 'numberofadmins' => 3600, + ); static public $mObjects = array(); @@ -122,11 +160,13 @@ class MagicWord { * @static */ static function &get( $id ) { + wfProfileIn( __METHOD__ ); if (!array_key_exists( $id, self::$mObjects ) ) { $mw = new MagicWord(); $mw->load( $id ); self::$mObjects[$id] = $mw; } + wfProfileOut( __METHOD__ ); return self::$mObjects[$id]; } @@ -148,7 +188,17 @@ class MagicWord { } return self::$mVariableIDs; } - + + /* Allow external reads of TTL array */ + static function getCacheTTL($id) { + if (array_key_exists($id,self::$mCacheTTLs)) { + return self::$mCacheTTLs[$id]; + } else { + return -1; + } + } + + # Initialises this object with an ID function load( $id ) { global $wgContLang; |