jenkins-bot has submitted this change and it was merged.
Change subject: Pass created revision to TitleMoveComplete hook
......................................................................
Pass created revision to TitleMoveComplete hook
The EventBus extension needs to forward the created (null) revision ID as
part of the page move event. Looking this value up when the hook fires is
problematic, because without a connection to the master DB the query might
very well return nothing (if it races in before the entry is replicated to
the slave).
This changeset passes the newly created Revision on to the hook so that it
doesn't need to be queried separately.
Bug: T116786
Change-Id: I1b48e2904fc8d99f2cde604f274f79a2b47d7fc2
---
M docs/hooks.txt
M includes/MovePage.php
2 files changed, 14 insertions(+), 2 deletions(-)
Approvals:
Aaron Schulz: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/hooks.txt b/docs/hooks.txt
index 0cb4756..6afeab8 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -3040,6 +3040,7 @@
$pageid: database ID of the page that's been moved
$redirid: database ID of the created redirect
$reason: reason for the move
+$revision: the revision created by the move
'TitleMoveCompleting': After moving an article (title), pre-commit.
$old: old title
diff --git a/includes/MovePage.php b/includes/MovePage.php
index b918955..936b94a 100644
--- a/includes/MovePage.php
+++ b/includes/MovePage.php
@@ -252,7 +252,7 @@
$protected = $this->oldTitle->isProtected();
// Do the actual move
- $this->moveToInternal( $user, $this->newTitle, $reason,
$createRedirect );
+ $nullRevision = $this->moveToInternal( $user, $this->newTitle,
$reason, $createRedirect );
// Refresh the sortkey for this row. Be careful to avoid
resetting
// cl_timestamp, which may disturb time-based lists on some
sites.
@@ -376,7 +376,15 @@
$dbw->endAtomic( __METHOD__ );
- $params = array( &$this->oldTitle, &$this->newTitle, &$user,
$pageid, $redirid, $reason );
+ $params = array(
+ &$this->oldTitle,
+ &$this->newTitle,
+ &$user,
+ $pageid,
+ $redirid,
+ $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
@@ -396,6 +404,7 @@
* @param string $reason The reason for the move
* @param bool $createRedirect Whether to leave a redirect at the old
title. Does not check
* if the user has the suppressredirect right
+ * @return Revision the revision created by the move
* @throws MWException
*/
private function moveToInternal( User $user, &$nt, $reason = '',
$createRedirect = true ) {
@@ -552,5 +561,7 @@
# Log the move
$logid = $logEntry->insert();
$logEntry->publish( $logid );
+
+ return $nullRevision;
}
}
--
To view, visit https://gerrit.wikimedia.org/r/259604
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1b48e2904fc8d99f2cde604f274f79a2b47d7fc2
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Eevans <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Mobrovac <[email protected]>
Gerrit-Reviewer: Ottomata <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits