Merge "Add hook EnhancedChangesListModifyBlockLineData"
[lhc/web/wiklou.git] / maintenance / storage / checkStorage.php
index 6b8b5a3..c0f6c7b 100644 (file)
@@ -39,6 +39,7 @@ if ( !defined( 'MEDIAWIKI' ) ) {
 /**
  * Maintenance script to do various checks on external storage.
  *
+ * @fixme this should extend the base Maintenance class
  * @ingroup Maintenance ExternalStorage
  */
 class CheckStorage {
@@ -322,7 +323,6 @@ class CheckStorage {
 
                        // Check targets of unresolved stubs
                        $this->checkExternalConcatBlobs( $externalConcatBlobs );
-
                        // next chunk
                }
 
@@ -403,7 +403,6 @@ class CheckStorage {
                                        );
                                }
                                unset( $oldIds[$row->blob_id] );
-
                        }
                        $extDb->freeResult( $res );
 
@@ -434,6 +433,7 @@ class CheckStorage {
                // Write revision list
                if ( !file_put_contents( $revFileName, implode( "\n", $revIds ) ) ) {
                        echo "Error writing revision list, can't restore text\n";
+
                        return;
                }
 
@@ -450,12 +450,14 @@ class CheckStorage {
 
                if ( $exitStatus ) {
                        echo "mwdumper died with exit status $exitStatus\n";
+
                        return;
                }
 
                $file = fopen( $filteredXmlFileName, 'r' );
                if ( !$file ) {
                        echo "Unable to open filtered XML file\n";
+
                        return;
                }
 
@@ -465,7 +467,10 @@ class CheckStorage {
                $dbw->ping();
 
                $source = new ImportStreamSource( $file );
-               $importer = new WikiImporter( $source );
+               $importer = new WikiImporter(
+                       $source,
+                       ConfigFactory::getDefaultInstance()->makeConfig( 'main' )
+               );
                $importer->setRevisionCallback( array( &$this, 'importRevision' ) );
                $importer->doImport();
        }
@@ -477,6 +482,7 @@ class CheckStorage {
 
                if ( $content === null ) {
                        echo "Revision $id is broken, we have no content available\n";
+
                        return;
                }
 
@@ -488,12 +494,14 @@ class CheckStorage {
                        // be safe, we'll skip it and leave it broken
 
                        echo "Revision $id is blank in the dump, may have been broken before export\n";
+
                        return;
                }
 
                if ( !$id ) {
                        // No ID, can't import
                        echo "No id tag in revision, can't import\n";
+
                        return;
                }
 
@@ -502,6 +510,7 @@ class CheckStorage {
                $oldId = $dbr->selectField( 'revision', 'rev_text_id', array( 'rev_id' => $id ), __METHOD__ );
                if ( !$oldId ) {
                        echo "Missing revision row for rev_id $id\n";
+
                        return;
                }