From 1627c222df7cadb1cfa1e25be2d844e480b2d4bc Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 19 Sep 2008 10:13:32 +0000 Subject: [PATCH] Remove some individual transactions --- includes/Article.php | 10 ---------- includes/SiteStats.php | 8 ++------ includes/Title.php | 4 ---- includes/specials/SpecialUndelete.php | 2 -- 4 files changed, 2 insertions(+), 22 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index c0ff600f6e..7d4b816573 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1659,9 +1659,7 @@ class Article { $return = Title::makeTitle( NS_SPECIAL, $returnto ); $dbw = wfGetDB( DB_MASTER ); - $dbw->begin(); $errors = $rc->doMarkPatrolled(); - $dbw->commit(); if ( in_array(array('rcpatroldisabled'), $errors) ) { $wgOut->showErrorPage( 'rcpatroldisabled', 'rcpatroldisabledtext' ); @@ -3015,7 +3013,6 @@ class Article { wfProfileIn( __METHOD__ ); $dbw = wfGetDB( DB_MASTER ); - $dbw->begin(); $revision = new Revision( array( 'page' => $this->getId(), 'text' => $text, @@ -3024,7 +3021,6 @@ class Article { ) ); $revision->insertOn( $dbw ); $this->updateRevisionOn( $dbw, $revision ); - $dbw->commit(); wfRunHooks( 'NewRevisionFromEditComplete', array($this, $revision, false) ); @@ -3453,13 +3449,7 @@ class Article { if ( count( $templates_diff ) > 0 ) { # Whee, link updates time. $u = new LinksUpdate( $this->mTitle, $parserOutput ); - - $dbw = wfGetDb( DB_MASTER ); - $dbw->begin(); - $u->doUpdate(); - - $dbw->commit(); } } diff --git a/includes/SiteStats.php b/includes/SiteStats.php index e209cc2163..3729f455a7 100644 --- a/includes/SiteStats.php +++ b/includes/SiteStats.php @@ -227,12 +227,12 @@ class SiteStatsUpdate { $dbr = wfGetDB( DB_SLAVE, array( 'SpecialStatistics', 'vslow') ); list( $page, $user ) = $dbr->tableNamesN( 'page', 'user' ); - $sql = "SELECT COUNT(page_namespace) AS total FROM $page"; + $sql = "SELECT COUNT(*) AS total FROM $page"; $res = $dbr->query( $sql, $fname ); $pageRow = $dbr->fetchObject( $res ); $pages = $pageRow->total + $this->mPages; - $sql = "SELECT COUNT(user_id) AS total FROM $user"; + $sql = "SELECT COUNT(*) AS total FROM $user"; $res = $dbr->query( $sql, $fname ); $userRow = $dbr->fetchObject( $res ); $users = $userRow->total + $this->mUsers; @@ -249,9 +249,7 @@ class SiteStatsUpdate { if ( $updates ) { $site_stats = $dbw->tableName( 'site_stats' ); $sql = $dbw->limitResultForUpdate("UPDATE $site_stats SET $updates", 1); - $dbw->begin(); $dbw->query( $sql, $fname ); - $dbw->commit(); } } @@ -262,11 +260,9 @@ class SiteStatsUpdate { $activeUsers = $dbr->selectField( 'recentchanges', 'COUNT( DISTINCT rc_user_text )', array( 'rc_user != 0', 'rc_bot' => 0, "rc_log_type != 'newusers'" ), __METHOD__ ); - $dbw->begin(); $dbw->update( 'site_stats', array( 'ss_active_users' => intval($activeUsers) ), array( 'ss_row_id' => 1 ), __METHOD__, array( 'LIMIT' => 1 ) ); - $dbw->commit(); } } diff --git a/includes/Title.php b/includes/Title.php index 22133966a6..2639e9f2cc 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2679,7 +2679,6 @@ class Title { $latest = $this->getLatestRevID(); $dbw = wfGetDB( DB_MASTER ); - $dbw->begin(); # Delete the old redirect. We don't save it to history since # by definition if we've got here it's rather uninteresting. @@ -2759,7 +2758,6 @@ class Title { } } } - $dbw->commit(); # Log the move $log = new LogPage( 'move' ); @@ -2796,7 +2794,6 @@ class Title { $latest = $this->getLatestRevId(); $dbw = wfGetDB( DB_MASTER ); - $dbw->begin(); $now = $dbw->timestamp(); # Save a null revision in the page's history notifying of the move @@ -2856,7 +2853,6 @@ class Title { } } } - $dbw->commit(); # Log the move $log = new LogPage( 'move' ); diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index ecd7d4c976..cfff82fb7b 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -481,7 +481,6 @@ class PageArchive { $ret->seek( 0 ); } - $dbw->begin(); if( $makepage ) { $newid = $article->insertOn( $dbw ); $pageId = $newid; @@ -565,7 +564,6 @@ class PageArchive { return self::UNDELETE_UNKNOWNERR; } - $dbw->commit(); return $restored; } -- 2.20.1