Index: trunk/extensions/MetavidWiki/includes/MV_ParserCache.php |
— | — | @@ -1,34 +0,0 @@ |
2 | | -<?php |
3 | | -/* |
4 | | - * MV_ParserCache.php Created on Feb 27, 2008 |
5 | | - * |
6 | | - * All Metavid Wiki code is Released under the GPL2 |
7 | | - * for more info visit http://metavid.org/wiki/Code |
8 | | - * |
9 | | - * @author Michael Dale |
10 | | - * @email dale@ucsc.edu |
11 | | - * @url http://metavid.org |
12 | | - */ |
13 | | -if ( !defined( 'MEDIAWIKI' ) ) die( 1 ); |
14 | | - // quick hack to shift namespace of inline metavid parse cache |
15 | | - // avoids conflicts of inline display with full article display |
16 | | - class MV_ParserCache extends ParserCache { |
17 | | - var $extraKeyOpt = 'mv'; |
18 | | - var $addToKey = ''; |
19 | | - public static function & singleton() { |
20 | | - static $instance; |
21 | | - if ( !isset( $instance ) ) { |
22 | | - global $parserMemc; |
23 | | - $instance = new MV_ParserCache( $parserMemc ); |
24 | | - } |
25 | | - // reset addToKey |
26 | | - $instance->addToKey = ''; |
27 | | - return $instance; |
28 | | - } |
29 | | - function addToKey( $opt ) { |
30 | | - $this->addToKey = $opt; |
31 | | - } |
32 | | - function getKey( &$article, &$user ) { |
33 | | - return parent::getKey( $article, $user ) . $this->extraKeyOpt . $this->addToKey; |
34 | | - } |
35 | | - } |
Index: trunk/extensions/MetavidWiki/includes/MV_GlobalFunctions.php |
— | — | @@ -139,7 +139,6 @@ |
140 | 140 | $wgAutoloadClasses['MV_StreamFile'] = dirname( __FILE__ ) . '/MV_StreamFile.php'; |
141 | 141 | |
142 | 142 | $wgAutoloadClasses['MV_StreamImage'] = dirname( __FILE__ ) . '/MV_StreamImage.php'; |
143 | | - $wgAutoloadClasses['MV_ParserCache'] = dirname( __FILE__ ) . '/MV_ParserCache.php'; |
144 | 143 | $wgAutoloadClasses['MV_MagicWords'] = dirname( __FILE__ ) . '/MV_MagicWords.php'; |
145 | 144 | |
146 | 145 | /**********************************************/ |
Index: trunk/extensions/MetavidWiki/includes/articlepages/MV_SequencePage.php |
— | — | @@ -34,13 +34,16 @@ |
35 | 35 | //temporally stop cache: |
36 | 36 | $wgEnableParserCache = $parserOutput =false; |
37 | 37 | |
38 | | - if($wgEnableParserCache){ |
39 | | - $mvParserCache = & MV_ParserCache::singleton(); |
40 | | - $mvParserCache->addToKey( 'seq-xml' ); //differentiate the articles xml from article |
41 | | - $parserOutput = $mvParserCache->get( $this, $wgUser ); |
| 38 | + if( $wgEnableParserCache ) { |
| 39 | + $parserOptions = ParserOptions::newFromUser( $wgUser ); |
| 40 | + $mvParserCache = ParserCache::singleton(); |
| 41 | + $parserOptions->addExtraKey( 'mv:seq-xml' ); //differentiate the articles xml from article |
| 42 | + $parserOutput = $mvParserCache->get( $this, $parserOptions ); |
| 43 | + |
| 44 | + if( $parserOutput != false ) |
| 45 | + return $parserOutput->getText(); |
42 | 46 | } |
43 | | - if(isset($parserOutput) && $parserOutput != false) |
44 | | - return $parserOutput->getText(); |
| 47 | + |
45 | 48 | //get the high level sequence description: |
46 | 49 | $this->getSequenceHLRD(); |
47 | 50 | $this->parseHLRD_DOM(); |
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Overlay.php |
— | — | @@ -290,13 +290,16 @@ |
291 | 291 | |
292 | 292 | /*try to pull from cache: separate out cache for internal links vs external links cache*/ |
293 | 293 | if( $wgEnableParserCache ) { |
294 | | - $MvParserCache = & MV_ParserCache::singleton(); |
295 | | - $add_opt = ( $absolute_links ) ? 'a':''; |
296 | | - // add the dbKey since I don't know how to easy purge the cache and we are getting cache missmatch |
297 | | - $add_opt .= $mvdTitle->getDBkey(); |
298 | | - $MvParserCache->addToKey( $add_opt ); |
| 294 | + $MvParserCache = ParserCache::singleton(); |
| 295 | + $popts = ParserOptions::newFromUser( $wgUser ); |
| 296 | + if ( $absolute_links ) { |
| 297 | + $popts->addExtraKey( 'Metavid-absolutelinks' ); |
| 298 | + } |
299 | 299 | |
300 | | - $parserOutput = $MvParserCache->get( $mvdArticle, $wgUser ); |
| 300 | + // FIXME: add the dbKey since I don't know how to easy purge the cache and we are getting cache missmatch |
| 301 | + $popts->addExtraKey( $mvdTitle->getDBkey() ); |
| 302 | + |
| 303 | + $parserOutput = $MvParserCache->get( $mvdArticle, $popts ); |
301 | 304 | }else{ |
302 | 305 | $parserOutput=false; |
303 | 306 | } |
— | — | @@ -330,7 +333,9 @@ |
331 | 334 | } |
332 | 335 | // output the page and save to cache |
333 | 336 | $wgOut->addParserOutput( $parserOutput ); |
334 | | - $MvParserCache->save( $parserOutput, $mvdArticle, $wgUser ); |
| 337 | + if( $wgEnableParserCache ) { |
| 338 | + $MvParserCache->save( $parserOutput, $mvdArticle, $popts ); |
| 339 | + } |
335 | 340 | } |
336 | 341 | } |
337 | 342 | function parse_format_text( &$text, &$mvdTile, &$mvd_page = '', $absolute_links = false ) { |