Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/263862

Change subject: Convert code to using startAtomic()/endAtomic()
......................................................................

Convert code to using startAtomic()/endAtomic()

Bug: T120791
Change-Id: I57502d6f503201677d85cc4964ffcf85ea7157c8
---
M includes/pages/ListPage.php
M includes/pages/VotePage.php
2 files changed, 5 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SecurePoll 
refs/changes/62/263862/1

diff --git a/includes/pages/ListPage.php b/includes/pages/ListPage.php
index 17813c1..9a53aba 100644
--- a/includes/pages/ListPage.php
+++ b/includes/pages/ListPage.php
@@ -89,8 +89,8 @@
                if ( $action != 'strike' ) {
                        $action = 'unstrike';
                }
-               $dbw->begin( __METHOD__ );
 
+               $dbw->startAtomic( __METHOD__ );
                // Add it to the strike log
                $strikeId = $dbw->nextSequenceValue( 'securepoll_strike_st_id' 
);
                $dbw->insert( 'securepoll_strike',
@@ -104,15 +104,14 @@
                        ),
                        __METHOD__
                );
-               $strikeId = $dbw->insertId();
-
                // Update the status cache
                $dbw->update( 'securepoll_votes',
                        array( 'vote_struck' => intval( $action == 'strike' ) ),
                        array( 'vote_id' => $voteId ),
                        __METHOD__
                );
-               $dbw->commit( __METHOD__ );
+               $dbw->endAtomic( __METHOD__ );
+
                return Status::newGood();
        }
 
diff --git a/includes/pages/VotePage.php b/includes/pages/VotePage.php
index ed0cd6e..8cc5777 100644
--- a/includes/pages/VotePage.php
+++ b/includes/pages/VotePage.php
@@ -165,7 +165,7 @@
                }
 
                $dbw = $this->context->getDB();
-               $dbw->begin( __METHOD__ );
+               $dbw->startAtomic( __METHOD__ );
 
                # Mark previous votes as old
                $dbw->update( 'securepoll_votes',
@@ -203,7 +203,7 @@
                        ),
                        __METHOD__ );
                $voteId = $dbw->insertId();
-               $dbw->commit( __METHOD__ );
+               $dbw->endAtomic( __METHOD__ );
 
                if ( $crypt ) {
                        $receipt = sprintf( "SPID: %10d\n%s", $voteId, 
$encrypted );

-- 
To view, visit https://gerrit.wikimedia.org/r/263862
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I57502d6f503201677d85cc4964ffcf85ea7157c8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SecurePoll
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to