Mattflaschen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/273536

Change subject: Fix board move DB issue using new hook TitleMoveStarting
......................................................................

Fix board move DB issue using new hook TitleMoveStarting

Bug: T127785
Depends-On: Ie772f737f917854e4cfefe52ec3bea4669c9efe0
Change-Id: I696aaa239b295d4e7837150975bab41e4813fde4
(cherry picked from commit 7c98ef815870ca6fd082ab72164b456d25939a9e)
---
M Flow.php
M Hooks.php
M includes/BoardMover.php
3 files changed, 10 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/36/273536/1

diff --git a/Flow.php b/Flow.php
index 63d77ab..b66ef84 100644
--- a/Flow.php
+++ b/Flow.php
@@ -141,8 +141,8 @@
 $wgHooks['CanonicalNamespaces'][] = 'FlowHooks::onCanonicalNamespaces';
 $wgHooks['MovePageIsValidMove'][] = 'FlowHooks::onMovePageIsValidMove';
 $wgHooks['AbortMove'][] = 'FlowHooks::onAbortMove';
-$wgHooks['TitleMove'][] = 'FlowHooks::onTitleMove';
-$wgHooks['TitleMoveComplete'][] = 'FlowHooks::onTitleMoveComplete';
+$wgHooks['TitleMoveStarting'][] = 'FlowHooks::onTitleMoveStarting';
+$wgHooks['TitleMoveCompleting'][] = 'FlowHooks::onTitleMoveCompleting';
 $wgHooks['TitleSquidURLs'][] = 'FlowHooks::onTitleSquidURLs';
 $wgHooks['WatchlistEditorBuildRemoveLine'][] = 
'FlowHooks::onWatchlistEditorBuildRemoveLine';
 $wgHooks['WatchlistEditorBeforeFormRender'][] = 
'FlowHooks::onWatchlistEditorBeforeFormRender';
diff --git a/Hooks.php b/Hooks.php
index 7412b6e..75e6bde 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -1632,10 +1632,11 @@
        }
 
        /**
-        * Occurs at the beginning of the MovePage process. Perhaps 
ContentModel should be
-        * extended to be notified about moves explicitly.
+        * Occurs at the beginning of the MovePage process (just after the 
startAtomic).
+        *
+        * Perhaps ContentModel should be extended to be notified about moves 
explicitly.
         */
-       public static function onTitleMove( Title $oldTitle, Title $newTitle, 
User $user ) {
+       public static function onTitleMoveStarting( Title $oldTitle, Title 
$newTitle, User $user ) {
                if ( $oldTitle->getContentModel() === CONTENT_MODEL_FLOW_BOARD 
) {
                        // $newTitle doesn't yet exist, but after the move 
it'll still have
                        // the same ID $oldTitle used to have
@@ -1649,14 +1650,14 @@
                        // location and rendered it doesn't throw an error 
about the wrong title
                        Container::get( 'factory.loader.workflow' 
)->pageMoveInProgress();
                        // open a database transaction and prepare everything 
for the move, but
-                       // don't commit yet. That is done below in 
self::onTitleMoveComplete
+                       // don't commit yet. That is done below in 
self::onTitleMoveCompleting
                        Container::get( 'board_mover' )->prepareMove( 
$oldTitle->getArticleID(), $bogusTitle );
                }
 
                return true;
        }
 
-       public static function onTitleMoveComplete( Title $oldTitle, Title 
$newTitle, User $user, $pageid, $redirid, $reason ) {
+       public static function onTitleMoveCompleting( Title $oldTitle, Title 
$newTitle, User $user, $pageid, $redirid, $reason, Revision $revision ) {
                if ( $newTitle->getContentModel() === CONTENT_MODEL_FLOW_BOARD 
) {
                        Container::get( 'board_mover' )->commit();
                }
diff --git a/includes/BoardMover.php b/includes/BoardMover.php
index f475c07..5370542 100644
--- a/includes/BoardMover.php
+++ b/includes/BoardMover.php
@@ -61,7 +61,7 @@
 
                // Open a transaction, this will be closed from self::commit.
                $this->dbw = $this->dbFactory->getDB( DB_MASTER );
-               $this->dbw->begin( __METHOD__ );
+               $this->dbw->startAtomic( __CLASS__ );
                $this->cache->begin();
 
                // @todo this loads every topic workflow this board has ever 
seen,
@@ -118,7 +118,7 @@
                }
 
                try {
-                       $this->dbw->commit( __METHOD__ );
+                       $this->dbw->endAtomic( __CLASS__ );
                        $this->cache->commit();
                } catch ( \Exception $e ) {
                        $this->dbw->rollback( __METHOD__ );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I696aaa239b295d4e7837150975bab41e4813fde4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: wmf/1.27.0-wmf.14
Gerrit-Owner: Mattflaschen <mflasc...@wikimedia.org>

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

Reply via email to