]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blobdiff - includes/parser/Parser_DiffTest.php
MediaWiki 1.17.0
[autoinstalls/mediawiki.git] / includes / parser / Parser_DiffTest.php
index 608c883a9124fde4e7cd2b25d2bc2e6f832bf12f..c6dd76e52bbd13694bc86ed7b8ebabc7382934c1 100644 (file)
@@ -1,4 +1,9 @@
 <?php
+/**
+ * Fake parser that output the difference of two different parsers
+ *
+ * @file
+ */
 
 /**
  * @ingroup Parser
@@ -8,14 +13,13 @@ class Parser_DiffTest
        var $parsers, $conf;
        var $shortOutput = false;
 
-       var $dfUniqPrefix;
+       var $dtUniqPrefix;
 
        function __construct( $conf ) {
                if ( !isset( $conf['parsers'] ) ) {
                        throw new MWException( __METHOD__ . ': no parsers specified' );
                }
                $this->conf = $conf;
-               $this->dtUniqPrefix = "\x7fUNIQ" . Parser::getRandomString();
        }
 
        function init() {
@@ -102,14 +106,18 @@ class Parser_DiffTest
 
        function setFunctionHook( $id, $callback, $flags = 0 ) {
                $this->init();
-               foreach  ( $this->parsers as $i => $parser ) {
+               foreach  ( $this->parsers as $parser ) {
                        $parser->setFunctionHook( $id, $callback, $flags );
                }
        }
 
        function onClearState( &$parser ) {
                // hack marker prefixes to get identical output
-               $parser->mUniqPrefix = $this->dtUniqPrefix;
+               if ( !isset( $this->dtUniqPrefix ) ) {
+                       $this->dtUniqPrefix = $parser->uniqPrefix();
+               } else {
+                       $parser->mUniqPrefix = $this->dtUniqPrefix;
+               }
                return true;
        }
 }