Merge "Handle missing namespace prefix in XML dumps more gracefully"
[lhc/web/wiklou.git] / maintenance / importDump.php
index 7c452a6..6717a8e 100644 (file)
@@ -109,7 +109,8 @@ TEXT
                }
 
                $this->output( "Done!\n" );
-               $this->output( "You might want to run rebuildrecentchanges.php to regenerate RecentChanges\n" );
+               $this->output( "You might want to run rebuildrecentchanges.php to regenerate RecentChanges,\n" );
+               $this->output( "and initSiteStats.php to update page and revision counts\n" );
        }
 
        function setNsfilter( array $namespaces ) {
@@ -118,7 +119,7 @@ TEXT
 
                        return;
                }
-               $this->nsFilter = array_unique( array_map( array( $this, 'getNsIndex' ), $namespaces ) );
+               $this->nsFilter = array_unique( array_map( [ $this, 'getNsIndex' ], $namespaces ) );
        }
 
        private function getNsIndex( $namespace ) {
@@ -205,7 +206,7 @@ TEXT
                                // call_user_func( $this->uploadCallback, $revision );
                                $dbw = $this->getDB( DB_MASTER );
 
-                               return $dbw->deadlockLoop( array( $revision, 'importUpload' ) );
+                               return $dbw->deadlockLoop( [ $revision, 'importUpload' ] );
                        }
                }
 
@@ -283,6 +284,9 @@ TEXT
                $source = new ImportStreamSource( $handle );
                $importer = new WikiImporter( $source, $this->getConfig() );
 
+               // Updating statistics require a lot of time so disable it
+               $importer->disableStatisticsUpdate();
+
                if ( $this->hasOption( 'debug' ) ) {
                        $importer->setDebug( true );
                }
@@ -297,13 +301,13 @@ TEXT
                                return false;
                        }
                }
-               $importer->setPageCallback( array( &$this, 'reportPage' ) );
+               $importer->setPageCallback( [ $this, 'reportPage' ] );
                $this->importCallback = $importer->setRevisionCallback(
-                       array( &$this, 'handleRevision' ) );
+                       [ $this, 'handleRevision' ] );
                $this->uploadCallback = $importer->setUploadCallback(
-                       array( &$this, 'handleUpload' ) );
+                       [ $this, 'handleUpload' ] );
                $this->logItemCallback = $importer->setLogItemCallback(
-                       array( &$this, 'handleLogItem' ) );
+                       [ $this, 'handleLogItem' ] );
                if ( $this->uploads ) {
                        $importer->setImportUploads( true );
                }