Add some __METHOD__ to begin/commit/rollback calls
authorumherirrender <umherirrender_de.wp@web.de>
Sat, 1 Dec 2012 14:04:10 +0000 (15:04 +0100)
committerumherirrender <umherirrender_de.wp@web.de>
Sat, 1 Dec 2012 14:04:10 +0000 (15:04 +0100)
Change-Id: I20dad8d6bb7a523e8a6f50bc0af5cdba57d7160f

includes/WikiPage.php
includes/filerepo/file/LocalFile.php
includes/job/JobQueueDB.php
includes/upload/UploadFromChunks.php
maintenance/cleanupPreferences.php
maintenance/convertUserOptions.php
maintenance/deleteOrphanedRevisions.php
tests/testHelpers.inc

index a4bc6ee..0b588cb 100644 (file)
@@ -1736,7 +1736,7 @@ class WikiPage extends Page implements IDBAccessObject {
                                $status->merge( $prepStatus );
 
                                if ( !$status->isOK() ) {
-                                       $dbw->rollback();
+                                       $dbw->rollback( __METHOD__ );
 
                                        wfProfileOut( __METHOD__ );
                                        return $status;
@@ -1815,7 +1815,7 @@ class WikiPage extends Page implements IDBAccessObject {
                        $status->merge( $prepStatus );
 
                        if ( !$status->isOK() ) {
-                               $dbw->rollback();
+                               $dbw->rollback( __METHOD__ );
 
                                wfProfileOut( __METHOD__ );
                                return $status;
index e8f2540..3525594 100644 (file)
@@ -1213,13 +1213,13 @@ class LocalFile extends File {
                        $status = $wikiPage->doEditContent( $content, $comment, EDIT_NEW | EDIT_SUPPRESS_RC, false, $user );
 
                        if ( isset( $status->value['revision'] ) ) { // XXX; doEdit() uses a transaction
-                               $dbw->begin();
+                               $dbw->begin( __METHOD__ );
                                $dbw->update( 'logging',
                                        array( 'log_page' => $status->value['revision']->getPage() ),
                                        array( 'log_id' => $logId ),
                                        __METHOD__
                                );
-                               $dbw->commit(); // commit before anything bad can happen
+                               $dbw->commit( __METHOD__ ); // commit before anything bad can happen
                        }
                }
                wfProfileOut( __METHOD__ . '-edit' );
index 0c01db7..80bc6d5 100644 (file)
@@ -77,7 +77,7 @@ class JobQueueDB extends JobQueue {
 
                                $autoTrx = $dbw->getFlag( DBO_TRX ); // automatic begin() enabled?
                                if ( $atomic ) {
-                                       $dbw->begin(); // wrap all the job additions in one transaction
+                                       $dbw->begin( __METHOD__ ); // wrap all the job additions in one transaction
                                } else {
                                        $dbw->clearFlag( DBO_TRX ); // make each query its own transaction
                                }
@@ -87,14 +87,14 @@ class JobQueueDB extends JobQueue {
                                        }
                                } catch ( DBError $e ) {
                                        if ( $atomic ) {
-                                               $dbw->rollback();
+                                               $dbw->rollback( __METHOD__ );
                                        } else {
                                                $dbw->setFlag( $autoTrx ? DBO_TRX : 0 ); // restore automatic begin()
                                        }
                                        throw $e;
                                }
                                if ( $atomic ) {
-                                       $dbw->commit();
+                                       $dbw->commit( __METHOD__ );
                                } else {
                                        $dbw->setFlag( $autoTrx ? DBO_TRX : 0 ); // restore automatic begin()
                                }
index e923c20..0a13683 100644 (file)
@@ -212,7 +212,7 @@ class UploadFromChunks extends UploadFromFile {
                $dbw = $this->repo->getMasterDb();
                // Use a quick transaction since we will upload the full temp file into shared
                // storage, which takes time for large files. We don't want to hold locks then.
-               $dbw->begin();
+               $dbw->begin( __METHOD__ );
                $dbw->update(
                        'uploadstash',
                        array(
@@ -223,7 +223,7 @@ class UploadFromChunks extends UploadFromFile {
                        array( 'us_key' => $this->mFileKey ),
                        __METHOD__
                );
-               $dbw->commit();
+               $dbw->commit( __METHOD__ );
        }
 
        /**
index 3539689..c0a526b 100644 (file)
@@ -35,7 +35,7 @@ class CleanupPreferences extends Maintenance {
                global $wgHiddenPrefs;
 
                $dbw = wfGetDB( DB_MASTER );
-               $dbw->begin();
+               $dbw->begin( __METHOD__ );
                foreach( $wgHiddenPrefs as $item ) {
                        $dbw->delete(
                                'user_properties',
@@ -43,7 +43,7 @@ class CleanupPreferences extends Maintenance {
                                __METHOD__
                        );
                };
-               $dbw->commit();
+               $dbw->commit( __METHOD__ );
                $this->output( "Finished!\n" );
        }
 }
index 7c9ca26..e2223e1 100644 (file)
@@ -56,7 +56,7 @@ class ConvertUserOptions extends Maintenance {
                                array( 'LIMIT' => 50, 'FOR UPDATE' )
                        );
                        $id = $this->convertOptionBatch( $res, $dbw );
-                       $dbw->commit();
+                       $dbw->commit( __METHOD__ );
 
                        wfWaitForSlaves();
 
index 5dc7567..dcbf739 100644 (file)
@@ -61,7 +61,7 @@ class DeleteOrphanedRevisions extends Maintenance {
 
                # Nothing to do?
                if ( $report || $count == 0 ) {
-                       $dbw->commit();
+                       $dbw->commit( __METHOD__ );
                        exit( 0 );
                }
 
index 4b2e923..f1eb833 100644 (file)
@@ -275,7 +275,7 @@ class DbTestRecorder extends DbTestPreviewer  {
         * and all that fun stuff
         */
        function start() {
-               $this->db->begin();
+               $this->db->begin( __METHOD__ );
 
                if ( ! $this->db->tableExists( 'testrun' )
                        || ! $this->db->tableExists( 'testitem' ) )