jenkins-bot has submitted this change and it was merged.

Change subject: Don't attempt to convert pages that have just been converted
......................................................................


Don't attempt to convert pages that have just been converted

Even though maintenance/convertNamespaceFromWikitext.php convertes
an entire namespace at once, there's no guarantee all pages are
wikitext:
* previous import runs can have converted some pages already
* or even in the same run, because conversion creates new (flow)
  pages in the process of importing
* or there may already have been some (test) pages

Whatever the reason, it makes no sense to error out when flow-board
pages are encountered. While it didn't really fail the script (all
it does is log an exception and move on with the next one), it can
get really confusing to see exceptions for valid cases like this.

Change-Id: I1300909ee4bbe7aae7a21ceeb7b73520a362c3cf
---
M includes/Import/Converter.php
M includes/Import/Wikitext/ConversionStrategy.php
2 files changed, 11 insertions(+), 3 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Import/Converter.php b/includes/Import/Converter.php
index 893d3da..a925a0f 100644
--- a/includes/Import/Converter.php
+++ b/includes/Import/Converter.php
@@ -121,7 +121,12 @@
         * @throws FlowException
         */
        public function convert( Title $title ) {
-               // conversion is already done
+               /*
+                * $title is the title we're currently considering to import.
+                * It could be a page we need to import, but could also e.g.
+                * be an archive page of a previous import run (in which case
+                * $movedFrom will be the Title object of that original page)
+                */
                $movedFrom = $this->getPageMovedFrom( $title );
                if ( $this->strategy->isConversionFinished( $title, $movedFrom 
) ) {
                        return;
diff --git a/includes/Import/Wikitext/ConversionStrategy.php 
b/includes/Import/Wikitext/ConversionStrategy.php
index 43eb6c8..6b62022 100644
--- a/includes/Import/Wikitext/ConversionStrategy.php
+++ b/includes/Import/Wikitext/ConversionStrategy.php
@@ -106,8 +106,11 @@
         * @{inheritDoc}
         */
        public function isConversionFinished( Title $title, Title $movedFrom = 
null ) {
-               if ( $movedFrom ) {
-                       // no good way to pick up where we left off
+               if ( $title->getContentModel() === CONTENT_MODEL_FLOW_BOARD ) {
+                       // page is a flow board already
+                       return true;
+               } elseif ( $movedFrom ) {
+                       // page was moved out of the way by import - leave it 
alone
                        return true;
                } else {
                        return false;

-- 
To view, visit https://gerrit.wikimedia.org/r/215331
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1300909ee4bbe7aae7a21ceeb7b73520a362c3cf
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <mmul...@wikimedia.org>
Gerrit-Reviewer: Catrope <roan.katt...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to