X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fimport%2FWikiImporter.php;h=63258cbcba7a3a504ade1a7fa6522bedc3a99753;hb=d5a7166771613dfe4ed9fb75fa5efeced6134bd1;hp=06b579a7d9f701e44d9061aa13ed2d5fcb529ecf;hpb=08c266e1fdebcc13beb419ea655ca9bc487bc712;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/import/WikiImporter.php b/includes/import/WikiImporter.php index 06b579a7d9..63258cbcba 100644 --- a/includes/import/WikiImporter.php +++ b/includes/import/WikiImporter.php @@ -39,6 +39,7 @@ class WikiImporter { private $mNoticeCallback, $mDebug; private $mImportUploads, $mImageBasePath; private $mNoUpdates = false; + private $pageOffset = 0; /** @var Config */ private $config; /** @var ImportTitleFactory */ @@ -146,6 +147,16 @@ class WikiImporter { $this->mNoUpdates = $noupdates; } + /** + * Sets 'pageOffset' value. So it will skip the first n-1 pages + * and start from the nth page. It's 1-based indexing. + * @param int $nthPage + * @since 1.29 + */ + function setPageOffset( $nthPage ) { + $this->pageOffset = $nthPage; + } + /** * Set a callback that displays notice messages * @@ -383,8 +394,8 @@ class WikiImporter { * @return bool */ public function finishImportPage( $title, $foreignTitle, $revCount, - $sRevCount, $pageInfo ) { - + $sRevCount, $pageInfo + ) { // Update article count statistics (T42009) // The normal counting logic in WikiPage->doEditUpdates() is designed for // one-revision-at-a-time editing, not bulk imports. In this situation it @@ -562,9 +573,19 @@ class WikiImporter { $keepReading = $this->reader->read(); $skip = false; $rethrow = null; + $pageCount = 0; try { while ( $keepReading ) { $tag = $this->reader->localName; + if ( $this->pageOffset ) { + if ( $tag === 'page' ) { + $pageCount++; + } + if ( $pageCount < $this->pageOffset ) { + $keepReading = $this->reader->next(); + continue; + } + } $type = $this->reader->nodeType; if ( !Hooks::run( 'ImportHandleToplevelXMLTag', [ $this ] ) ) { @@ -670,7 +691,6 @@ class WikiImporter { * @return bool|mixed */ private function processLogItem( $logInfo ) { - $revision = new WikiRevision( $this->config ); if ( isset( $logInfo['id'] ) ) {