dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Rename autonym for 'no' from 'norsk bokmål' to 'norsk'"
[lhc/web/wiklou.git]
/
includes
/
import
/
WikiImporter.php
diff --git
a/includes/import/WikiImporter.php
b/includes/import/WikiImporter.php
index
06b579a
..
63258cb
100644
(file)
--- 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 $mNoticeCallback, $mDebug;
private $mImportUploads, $mImageBasePath;
private $mNoUpdates = false;
+ private $pageOffset = 0;
/** @var Config */
private $config;
/** @var ImportTitleFactory */
/** @var Config */
private $config;
/** @var ImportTitleFactory */
@@
-146,6
+147,16
@@
class WikiImporter {
$this->mNoUpdates = $noupdates;
}
$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
*
/**
* Set a callback that displays notice messages
*
@@
-383,8
+394,8
@@
class WikiImporter {
* @return bool
*/
public function finishImportPage( $title, $foreignTitle, $revCount,
* @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
// 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;
$keepReading = $this->reader->read();
$skip = false;
$rethrow = null;
+ $pageCount = 0;
try {
while ( $keepReading ) {
$tag = $this->reader->localName;
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 ] ) ) {
$type = $this->reader->nodeType;
if ( !Hooks::run( 'ImportHandleToplevelXMLTag', [ $this ] ) ) {
@@
-670,7
+691,6
@@
class WikiImporter {
* @return bool|mixed
*/
private function processLogItem( $logInfo ) {
* @return bool|mixed
*/
private function processLogItem( $logInfo ) {
-
$revision = new WikiRevision( $this->config );
if ( isset( $logInfo['id'] ) ) {
$revision = new WikiRevision( $this->config );
if ( isset( $logInfo['id'] ) ) {