X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FMovePage.php;h=736cd8d6509ff3a6b6fc6034820cbfa9dc6a5288;hb=2bfde3516cffe010426ba31c9f920b553c9f5dac;hp=964fbffff65aeaadb4d407b3f083fd9ce5431e3f;hpb=494334891b35e9ff6e6e84d3efddcc38938c9e48;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/MovePage.php b/includes/MovePage.php index 964fbffff6..736cd8d650 100644 --- a/includes/MovePage.php +++ b/includes/MovePage.php @@ -247,7 +247,7 @@ class MovePage { RepoGroup::singleton()->clearCache( $this->newTitle ); # clear false negative cache } - $dbw->begin( __METHOD__ ); # If $file was a LocalFile, its transaction would have closed our own. + $dbw->startAtomic( __METHOD__ ); $pageid = $this->oldTitle->getArticleID( Title::GAID_FOR_UPDATE ); $protected = $this->oldTitle->isProtected(); @@ -305,8 +305,8 @@ class MovePage { __METHOD__, array( 'IGNORE' ) ); - # Update the protection log - $log = new LogPage( 'protect' ); + + // Build comment for log $comment = wfMessage( 'prot_1movedto2', $this->oldTitle->getPrefixedText(), @@ -315,14 +315,6 @@ class MovePage { if ( $reason ) { $comment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $reason; } - // @todo FIXME: $params? - $logId = $log->addEntry( - 'move_prot', - $this->newTitle, - $comment, - array( $this->oldTitle->getPrefixedText() ), - $user - ); // reread inserted pr_ids for log relation $insertedPrIds = $dbw->select( @@ -335,7 +327,18 @@ class MovePage { foreach ( $insertedPrIds as $prid ) { $logRelationsValues[] = $prid->pr_id; } - $log->addRelations( 'pr_id', $logRelationsValues, $logId ); + + // Update the protection log + $logEntry = new ManualLogEntry( 'protect', 'move_prot' ); + $logEntry->setTarget( $this->newTitle ); + $logEntry->setComment( $comment ); + $logEntry->setPerformer( $user ); + $logEntry->setParameters( array( + '4::oldtitle' => $this->oldTitle->getPrefixedText(), + ) ); + $logEntry->setRelations( array( 'pr_id' => $logRelationsValues ) ); + $logId = $logEntry->insert(); + $logEntry->publish( $logId ); } // Update *_from_namespace fields as needed @@ -366,12 +369,13 @@ class MovePage { WatchedItem::duplicateEntries( $this->oldTitle, $this->newTitle ); } - $dbw->commit( __METHOD__ ); + $dbw->endAtomic( __METHOD__ ); + + $params = array( &$this->oldTitle, &$this->newTitle, &$user, $pageid, $redirid, $reason ); + $dbw->onTransactionIdle( function () use ( $params ) { + Hooks::run( 'TitleMoveComplete', $params ); + } ); - Hooks::run( - 'TitleMoveComplete', - array( &$this->oldTitle, &$this->newTitle, &$user, $pageid, $redirid, $reason ) - ); return Status::newGood(); }