EBernhardson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/177100
Change subject: Gracefully restart after user interaction
......................................................................
Gracefully restart after user interaction
In the first attempt to deploy to office wiki something went wrong and
we manually reverted the moves to seven pages. On restarting the converter
it saw the first move and assumed everything was complete, when it
needed to perform the page move again.
This patch adjusts to only look at the most recent move, rather than any
move by the specified user.
Change-Id: If4287e128448bf9d3a0aa40d18815964371cacd8
---
M includes/Import/Converter.php
1 file changed, 15 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/00/177100/1
diff --git a/includes/Import/Converter.php b/includes/Import/Converter.php
index 43b21bf..378b40b 100644
--- a/includes/Import/Converter.php
+++ b/includes/Import/Converter.php
@@ -162,10 +162,14 @@
}
/**
- * Looks in the logging table to see if the provided title was moved
+ * Looks in the logging table to see if the provided title was last
moved
* there by the user provided in the constructor. The provided user
should
* be a system user for this task, as this assumes that user has never
* moved these pages outside the conversion process.
+ *
+ * This only considers the most recent move and not prior moves. This
allows
+ * for edge cases such as starting an import, canceling it, and manually
+ * reverting the move by a normal user.
*
* @param Title $title
* @return Title|null
@@ -173,12 +177,11 @@
protected function getPageMovedFrom( Title $title ) {
$row = $this->dbr->selectRow(
array( 'logging', 'page' ),
- array( 'log_namespace', 'log_title' ),
+ array( 'log_namespace', 'log_title', 'log_user' ),
array(
'page_namespace' => $title->getNamespace(),
'page_title' => $title->getDBkey(),
'log_page = page_id',
- 'log_user' => $this->user->getId(),
'log_type' => 'move',
),
__METHOD__,
@@ -188,11 +191,17 @@
)
);
- if ( $row ) {
- return Title::makeTitle( $row->log_namespace,
$row->log_title );
- } else {
+ // The page has never been moved
+ if ( !$row ) {
return null;
}
+
+ // The most recent move was not by our user
+ if ( $row->log_user != $this->user->getId() ) {
+ return null;
+ }
+
+ return Title::makeTitle( $row->log_namespace, $row->log_title );
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/177100
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If4287e128448bf9d3a0aa40d18815964371cacd8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits