Replaced more trx DIY with startAtomic()
[lhc/web/wiklou.git] / includes / site / SiteSQLStore.php
index 6659407..d133468 100644 (file)
@@ -314,11 +314,7 @@ class SiteSQLStore implements SiteStore {
 
                $dbw = $this->sitesTable->getWriteDbConnection();
 
-               $trx = $dbw->trxLevel();
-
-               if ( $trx == 0 ) {
-                       $dbw->begin( __METHOD__ );
-               }
+               $dbw->startAtomic( __METHOD__ );
 
                $success = true;
 
@@ -360,9 +356,7 @@ class SiteSQLStore implements SiteStore {
                        );
                }
 
-               if ( $trx == 0 ) {
-                       $dbw->commit( __METHOD__ );
-               }
+               $dbw->endAtomic( __METHOD__ );
 
                // purge cache
                $this->reset();
@@ -398,18 +392,10 @@ class SiteSQLStore implements SiteStore {
                wfProfileIn( __METHOD__ );
                $dbw = $this->sitesTable->getWriteDbConnection();
 
-               $trx = $dbw->trxLevel();
-
-               if ( $trx == 0 ) {
-                       $dbw->begin( __METHOD__ );
-               }
-
+               $dbw->startAtomic( __METHOD__ );
                $ok = $dbw->delete( 'sites', '*', __METHOD__ );
                $ok = $dbw->delete( 'site_identifiers', '*', __METHOD__ ) && $ok;
-
-               if ( $trx == 0 ) {
-                       $dbw->commit( __METHOD__ );
-               }
+               $dbw->endAtomic( __METHOD__);
 
                $this->reset();