summaryrefslogtreecommitdiff
path: root/includes/parser/Parser_DiffTest.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
committerPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
commit9db190c7e736ec8d063187d4241b59feaf7dc2d1 (patch)
tree46d1a0dee7febef5c2d57a9f7b972be16a163b3d /includes/parser/Parser_DiffTest.php
parent78677c7bbdcc9739f6c10c75935898a20e1acd9e (diff)
update to MediaWiki 1.17.0
Diffstat (limited to 'includes/parser/Parser_DiffTest.php')
-rw-r--r--includes/parser/Parser_DiffTest.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/includes/parser/Parser_DiffTest.php b/includes/parser/Parser_DiffTest.php
index 608c883a..c6dd76e5 100644
--- a/includes/parser/Parser_DiffTest.php
+++ b/includes/parser/Parser_DiffTest.php
@@ -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;
}
}