Merge "preprocessDump.php: Fix invalid Preprocessor instantiation"
[lhc/web/wiklou.git] / maintenance / preprocessDump.php
index a62e019..05b78d4 100644 (file)
@@ -26,6 +26,7 @@
  */
 
 use MediaWiki\MediaWikiServices;
+use MediaWiki\Storage\RevisionRecord;
 
 require_once __DIR__ . '/dumpIterator.php';
 
@@ -72,8 +73,9 @@ class PreprocessDump extends DumpIterator {
                        $name = Preprocessor_DOM::class;
                }
 
-               MediaWikiServices::getInstance()->getParser()->firstCallInit();
-               $this->mPreprocessor = new $name( $this );
+               $parser = MediaWikiServices::getInstance()->getParser();
+               $parser->firstCallInit();
+               $this->mPreprocessor = new $name( $parser );
        }
 
        /**
@@ -81,11 +83,13 @@ class PreprocessDump extends DumpIterator {
         * @param Revision $rev
         */
        public function processRevision( $rev ) {
-               $content = $rev->getContent( Revision::RAW );
+               $content = $rev->getContent( RevisionRecord::RAW );
 
                if ( $content->getModel() !== CONTENT_MODEL_WIKITEXT ) {
                        return;
                }
+               /** @var WikitextContent $content */
+               '@phan-var WikitextContent $content';
 
                try {
                        $this->mPreprocessor->preprocessToObj( strval( $content->getText() ), 0 );