Merge "Convert Special:NewFiles to use OOUI."
[lhc/web/wiklou.git] / includes / MovePage.php
index 321b7e3..70b6738 100644 (file)
@@ -19,6 +19,8 @@
  * @file
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * Handles the backend logic of moving a page from one title
  * to another.
@@ -238,7 +240,7 @@ class MovePage {
                        $file->load( File::READ_LATEST );
                        if ( $file->exists() ) {
                                $status = $file->move( $this->newTitle );
-                               if ( !$status->isOk() ) {
+                               if ( !$status->isOK() ) {
                                        return $status;
                                }
                        }
@@ -369,7 +371,7 @@ class MovePage {
                $oldsnamespace = MWNamespace::getSubject( $this->oldTitle->getNamespace() );
                $newsnamespace = MWNamespace::getSubject( $this->newTitle->getNamespace() );
                if ( $oldsnamespace != $newsnamespace || $oldtitle != $newtitle ) {
-                       $store = WatchedItemStore::getDefaultInstance();
+                       $store = MediaWikiServices::getInstance()->getWatchedItemStore();
                        $store->duplicateAllAssociatedEntries( $this->oldTitle, $this->newTitle );
                }
 
@@ -390,11 +392,16 @@ class MovePage {
                        $reason,
                        $nullRevision
                ];
-               $dbw->onTransactionIdle( function () use ( $params, $dbw ) {
-                       // Keep each single hook handler atomic
-                       $dbw->setFlag( DBO_TRX ); // flag is automatically reset by DB layer
-                       Hooks::run( 'TitleMoveComplete', $params );
-               } );
+               // Keep each single hook handler atomic
+               DeferredUpdates::addUpdate(
+                       new AtomicSectionUpdate(
+                               $dbw,
+                               __METHOD__,
+                               function () use ( $params ) {
+                                       Hooks::run( 'TitleMoveComplete', $params );
+                               }
+                       )
+               );
 
                return Status::newGood();
        }