Aaron Schulz has uploaded a new change for review.
https://gerrit.wikimedia.org/r/265624
Change subject: Remove begin()/commit() calls that can break outer transactions
......................................................................
Remove begin()/commit() calls that can break outer transactions
The single statements are already atomic and will commit at
the end of the request in commitMasterChanges().
Bug: T120791
Change-Id: Iac14198d420f4a0c0cceab50ceb8de00166eb57d
---
M MathObject.php
1 file changed, 5 insertions(+), 10 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MathSearch
refs/changes/24/265624/1
diff --git a/MathObject.php b/MathObject.php
index 499c6d6..b4f2410 100644
--- a/MathObject.php
+++ b/MathObject.php
@@ -304,13 +304,10 @@
preg_match_all(
"#<(mi|mo|mtext)( ([^>].*?))?>(.*?)</\\1>#u",
$this->getMathml(), $rule, PREG_SET_ORDER
);
- if ( $dbw == null ) {
- $dbgiven = false;
- $dbw = wfGetDB( DB_MASTER );
- $dbw->begin( __METHOD__ );
- } else {
- $dbgiven = true;
- }
+
+ $dbw = $dbw ?: wfGetDB( DB_MASTER );
+
+ $dbw->startAtomic( __METHOD__ );
$dbw->delete( "mathobservation",
array( "mathobservation_inputhash" =>
$this->getInputHash() ) );
LoggerFactory::getInstance(
@@ -327,9 +324,7 @@
)->warning( 'insert observation for ' . bin2hex(
$this->getInputHash() )
. utf8_encode( trim( $feature[4] ) ) );
}
- if ( !$dbgiven ) {
- $dbw->commit( __METHOD__ );
- }
+ $dbw->endAtomic( __METHOD__ );
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/265624
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iac14198d420f4a0c0cceab50ceb8de00166eb57d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MathSearch
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits