Index: trunk/phase3/maintenance/importDump.php |
— | — | @@ -63,6 +63,7 @@ |
64 | 64 | $this->addOption( 'dry-run', 'Parse dump without actually importing pages' ); |
65 | 65 | $this->addOption( 'debug', 'Output extra verbose debug information' ); |
66 | 66 | $this->addOption( 'uploads', 'Process file upload data if included (experimental)' ); |
| 67 | + $this->addOption( 'no-updates', 'Disable link table updates. Is faster but leaves the wiki in an inconsistent state' ); |
67 | 68 | $this->addOption( 'image-base-path', 'Import files from a specified path', false, true ); |
68 | 69 | $this->addArg( 'file', 'Dump file to import [else use stdin]', false ); |
69 | 70 | } |
— | — | @@ -243,6 +244,9 @@ |
244 | 245 | if( $this->hasOption( 'debug' ) ) { |
245 | 246 | $importer->setDebug( true ); |
246 | 247 | } |
| 248 | + if ( $this->hasOption( 'no-updates' ) ) { |
| 249 | + $importer->setNoUpdates( true ); |
| 250 | + } |
247 | 251 | $importer->setPageCallback( array( &$this, 'reportPage' ) ); |
248 | 252 | $this->importCallback = $importer->setRevisionCallback( |
249 | 253 | array( &$this, 'handleRevision' ) ); |
Index: trunk/phase3/includes/Import.php |
— | — | @@ -36,6 +36,7 @@ |
37 | 37 | private $mSiteInfoCallback, $mTargetNamespace, $mPageOutCallback; |
38 | 38 | private $mDebug; |
39 | 39 | private $mImportUploads, $mImageBasePath; |
| 40 | + private $mNoUpdates = false; |
40 | 41 | |
41 | 42 | /** |
42 | 43 | * Creates an ImportXMLReader drawing from the source provided |
— | — | @@ -90,6 +91,13 @@ |
91 | 92 | function setDebug( $debug ) { |
92 | 93 | $this->mDebug = $debug; |
93 | 94 | } |
| 95 | + |
| 96 | + /** |
| 97 | + * Set 'no updates' mode. In this mode, the link tables will not be updated by the importer |
| 98 | + */ |
| 99 | + function setNoUpdates( $noupdates ) { |
| 100 | + $this->mNoUpdates = $noupdates; |
| 101 | + } |
94 | 102 | |
95 | 103 | /** |
96 | 104 | * Sets the action to perform as each new page in the stream is reached. |
— | — | @@ -453,6 +461,7 @@ |
454 | 462 | $revision->setTimestamp( $logInfo['timestamp'] ); |
455 | 463 | $revision->setParams( $logInfo['params'] ); |
456 | 464 | $revision->setTitle( Title::newFromText( $logInfo['logtitle'] ) ); |
| 465 | + $revision->setNoUpdates( $this->mNoUpdates ); |
457 | 466 | |
458 | 467 | if ( isset( $logInfo['comment'] ) ) { |
459 | 468 | $revision->setComment( $logInfo['comment'] ); |
— | — | @@ -587,6 +596,7 @@ |
588 | 597 | if ( isset( $revisionInfo['contributor']['username'] ) ) { |
589 | 598 | $revision->setUserName( $revisionInfo['contributor']['username'] ); |
590 | 599 | } |
| 600 | + $revision->setNoUpdates( $this->mNoUpdates ); |
591 | 601 | |
592 | 602 | return $this->revisionCallback( $revision ); |
593 | 603 | } |
— | — | @@ -677,6 +687,7 @@ |
678 | 688 | if ( isset( $uploadInfo['contributor']['username'] ) ) { |
679 | 689 | $revision->setUserName( $uploadInfo['contributor']['username'] ); |
680 | 690 | } |
| 691 | + $revision->setNoUpdates( $this->mNoUpdates ); |
681 | 692 | |
682 | 693 | return call_user_func( $this->mUploadCallback, $revision ); |
683 | 694 | } |
— | — | @@ -853,6 +864,7 @@ |
854 | 865 | var $sha1base36 = false; |
855 | 866 | var $isTemp = false; |
856 | 867 | var $archiveName = ''; |
| 868 | + private $mNoUpdates = false; |
857 | 869 | |
858 | 870 | function setTitle( $title ) { |
859 | 871 | if( is_object( $title ) ) { |
— | — | @@ -926,6 +938,10 @@ |
927 | 939 | function setParams( $params ) { |
928 | 940 | $this->params = $params; |
929 | 941 | } |
| 942 | + |
| 943 | + public function setNoUpdates( $noupdates ) { |
| 944 | + $this->mNoUpdates = $noupdates; |
| 945 | + } |
930 | 946 | |
931 | 947 | /** |
932 | 948 | * @return Title |
— | — | @@ -1056,8 +1072,9 @@ |
1057 | 1073 | $revision->insertOn( $dbw ); |
1058 | 1074 | $changed = $article->updateIfNewerOn( $dbw, $revision ); |
1059 | 1075 | |
1060 | | - if ( $changed !== false ) { |
| 1076 | + if ( $changed !== false && !$this->mNoUpdates ) { |
1061 | 1077 | wfDebug( __METHOD__ . ": running updates\n" ); |
| 1078 | + throw new MWException("BROKEN: calling doEditUpdates()"); |
1062 | 1079 | $article->doEditUpdates( $revision, $userObj, array( 'created' => $created, 'oldcountable' => $oldcountable ) ); |
1063 | 1080 | } |
1064 | 1081 | |