jenkins-bot has submitted this change and it was merged.
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
(cherry picked from commit de7aa20356d3c4c5e8852b71d84c71a509443c74)
---
M includes/Import/Converter.php
1 file changed, 15 insertions(+), 6 deletions(-)
Approvals:
EBernhardson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/Import/Converter.php b/includes/Import/Converter.php
index f2738df..0fc16ea 100644
--- a/includes/Import/Converter.php
+++ b/includes/Import/Converter.php
@@ -169,10 +169,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
@@ -180,12 +184,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__,
@@ -195,11 +198,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/178649
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If4287e128448bf9d3a0aa40d18815964371cacd8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: wmf/1.25wmf11
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: SG <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits