private $mNoticeCallback, $mDebug;
private $mImportUploads, $mImageBasePath;
private $mNoUpdates = false;
+ private $pageOffset = 0;
/** @var Config */
private $config;
/** @var ImportTitleFactory */
$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
*
* @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
public function doImport() {
// Calls to reader->read need to be wrapped in calls to
// libxml_disable_entity_loader() to avoid local file
- // inclusion attacks (bug 46932).
+ // inclusion attacks (T48932).
$oldDisable = libxml_disable_entity_loader( true );
$this->reader->read();
$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 ] ) ) {
* @return bool|mixed
*/
private function processLogItem( $logInfo ) {
-
$revision = new WikiRevision( $this->config );
if ( isset( $logInfo['id'] ) ) {