On 7/7/06, Dan Davis hokie99cpe+wiki@gmail.com wrote:
Is there an extension or patch out there that would disable the parser cache for individual pages? I'm thinking something along the lines of a magic word such as __NOCACHE__. Unless this can be accomplished in an extension (preferred), I imagine it should be a simple matter of altering the way Article.php sets $pcache. I'm just not sure how to go about that...
After looking a little closer, it seems that my changes should be made to includes/Parser.php, includes/MagicWord.php, and languages/Language.php... unless I can figure out how to do this via an extension.
This *seems* to work for me if anyone is interested... by the way, I'm working in version 1.6.3...
diff -u languages/orig.Language.php languages/Language.php --- languages/orig.Language.php 2006-07-07 15:46:08.827024000 -0400 +++ languages/Language.php 2006-07-07 15:46:49.777024000 -0400 @@ -208,6 +208,7 @@ # ID CASE SYNONYMS MAG_REDIRECT => array( 0, '#REDIRECT' ), MAG_NOTOC => array( 0, '__NOTOC__' ), + MAG_NOCACHE => array( 0, '__NOCACHE__' ), MAG_FORCETOC => array( 0, '__FORCETOC__' ), MAG_TOC => array( 0, '__TOC__' ), MAG_NOEDITSECTION => array( 0, '__NOEDITSECTION__' ),
diff -u includes/orig.MagicWord.php includes/MagicWord.php --- includes/orig.MagicWord.php 2006-07-07 15:45:47.817024000 -0400 +++ includes/MagicWord.php 2006-07-07 15:47:00.617024000 -0400 @@ -15,6 +15,7 @@ $magicWords = array( 'MAG_REDIRECT', 'MAG_NOTOC', + 'MAG_NOCACHE', 'MAG_START', 'MAG_CURRENTMONTH', 'MAG_CURRENTMONTHNAME',
diff -u includes/orig.Parser.php includes/Parser.php --- includes/orig.Parser.php 2006-07-07 15:37:08.777024000 -0400 +++ includes/Parser.php 2006-07-09 18:56:04.032437000 -0400 @@ -211,6 +211,11 @@ $text = $this->strip( $text, $x ); wfRunHooks( 'ParserAfterStrip', array( &$this, &$text, &$x ) );
+ $mwNoCache =& MagicWord::get( MAG_NOCACHE ); + if ($mwNoCache->matchAndRemove( $text )) { + $this->disableCache(); + } + # Hook to suspend the parser in this state if ( !wfRunHooks( 'ParserBeforeInternalParse', array( &$this, &$text, &$x ) ) ) { wfProfileOut( $fname );
Dan