aboutsummaryrefslogtreecommitdiffstats
path: root/includes/import/WikiImporter.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/import/WikiImporter.php')
-rw-r--r--includes/import/WikiImporter.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/includes/import/WikiImporter.php b/includes/import/WikiImporter.php
index 06b579a7d9f7..2fc9f5e52740 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 */
@@ -147,6 +148,16 @@ class WikiImporter {
}
/**
+ * 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
*
* @param callable $callback
@@ -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 ] ) ) {