Fix Special:NewSection showNoRedirectPage form handling (2)
[lhc/web/wiklou.git] / maintenance / compareParsers.php
index 3929a5b..2f0bcdf 100644 (file)
@@ -43,7 +43,7 @@ class CompareParsers extends DumpIterator {
        public function __construct() {
                parent::__construct();
                $this->saveFailed = false;
-               $this->mDescription = "Run a file or dump with several parsers";
+               $this->addDescription( 'Run a file or dump with several parsers' );
                $this->addOption( 'parser1', 'The first parser to compare.', true, true );
                $this->addOption( 'parser2', 'The second parser to compare.', true, true );
                $this->addOption( 'tidy', 'Run tidy on the articles.', false, false );
@@ -95,9 +95,8 @@ class CompareParsers extends DumpIterator {
                $this->options = ParserOptions::newFromUser( $user );
 
                if ( $this->hasOption( 'tidy' ) ) {
-                       global $wgUseTidy;
-                       if ( !$wgUseTidy ) {
-                               $this->error( 'Tidy was requested but $wgUseTidy is not set in LocalSettings.php', true );
+                       if ( !MWTidy::isEnabled() ) {
+                               $this->fatalError( 'Tidy was requested but $wgTidyConfig is not set in LocalSettings.php' );
                        }
                        $this->options->setTidy( true );
                }
@@ -116,6 +115,7 @@ class CompareParsers extends DumpIterator {
                if ( !$this->stripParametersEnabled ) {
                        return $text;
                }
+
                return preg_replace( '/(<a) [^>]+>/', '$1>', $text );
        }
 
@@ -144,7 +144,7 @@ class CompareParsers extends DumpIterator {
                        return;
                }
 
-               $text = strval( $content->getNativeData() );
+               $text = strval( $content->getText() );
 
                $output1 = $parser1->parse( $text, $title, $this->options );
                $output2 = $parser2->parse( $text, $title, $this->options );
@@ -179,11 +179,10 @@ class CompareParsers extends DumpIterator {
                /* Look for the parser in a file appropiately named in the current folder */
                if ( !class_exists( $parserName ) && file_exists( "$parserName.php" ) ) {
                        global $wgAutoloadClasses;
-                       $wgAutoloadClasses[ $parserName ] = realpath( '.' ) . "/$parserName.php";
+                       $wgAutoloadClasses[$parserName] = realpath( '.' ) . "/$parserName.php";
                }
        }
-
 }
 
-$maintClass = "CompareParsers";
+$maintClass = CompareParsers::class;
 require_once RUN_MAINTENANCE_IF_MAIN;