Aaron Schulz has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/405883 )
Change subject: Make MWCallableUpdate support a list of DB handles
......................................................................
Make MWCallableUpdate support a list of DB handles
Change-Id: I0371ecd20101c5e622497e5912676300b040865e
---
M includes/deferred/MWCallableUpdate.php
1 file changed, 8 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/83/405883/1
diff --git a/includes/deferred/MWCallableUpdate.php
b/includes/deferred/MWCallableUpdate.php
index 5b822af..9803b7a 100644
--- a/includes/deferred/MWCallableUpdate.php
+++ b/includes/deferred/MWCallableUpdate.php
@@ -14,14 +14,18 @@
/**
* @param callable $callback
* @param string $fname Calling method
- * @param IDatabase|null $dbw Abort if this DB is rolled back
[optional] (since 1.28)
+ * @param IDatabase|IDatabase[]|null $dbws Abort if any of the
specified DB handles have
+ * a currently pending transaction which later gets rolled back
[optional] (since 1.28)
*/
- public function __construct( callable $callback, $fname = 'unknown',
IDatabase $dbw = null ) {
+ public function __construct( callable $callback, $fname = 'unknown',
$dbws = [] ) {
$this->callback = $callback;
$this->fname = $fname;
- if ( $dbw && $dbw->trxLevel() ) {
- $dbw->onTransactionResolution( [ $this,
'cancelOnRollback' ], $fname );
+ $dbws = is_array( $dbws ) ? $dbws : [ $dbws ];
+ foreach ( $dbws as $dbw ) {
+ if ( $dbw && $dbw->trxLevel() ) {
+ $dbw->onTransactionResolution( [ $this,
'cancelOnRollback' ], $fname );
+ }
}
}
--
To view, visit https://gerrit.wikimedia.org/r/405883
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0371ecd20101c5e622497e5912676300b040865e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits