From: Aaron Schulz Date: Thu, 31 Dec 2015 00:10:31 +0000 (-0800) Subject: Make maintenance scripts use beginTransaction/commitTransaction X-Git-Tag: 1.31.0-rc.0~8503 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=2e0787cf5b7fb5133c79b31c5c2994837246d3a8;p=lhc%2Fweb%2Fwiklou.git Make maintenance scripts use beginTransaction/commitTransaction Change-Id: I700437a016a40ad82951ae56d215f6dace2bb612 --- diff --git a/maintenance/namespaceDupes.php b/maintenance/namespaceDupes.php index 28176a55dc..f67005dc47 100644 --- a/maintenance/namespaceDupes.php +++ b/maintenance/namespaceDupes.php @@ -570,6 +570,7 @@ class NamespaceConflictChecker extends Maintenance { * * @param integer $id The page_id * @param Title $newTitle The new title + * @return bool */ private function mergePage( $row, Title $newTitle ) { $id = $row->page_id; @@ -583,7 +584,7 @@ class NamespaceConflictChecker extends Maintenance { $wikiPage->loadPageData( 'fromdbmaster' ); $destId = $newTitle->getArticleId(); - $this->db->begin( __METHOD__ ); + $this->beginTransaction( $this->db, __METHOD__ ); $this->db->update( 'revision', // SET array( 'rev_page' => $destId ), @@ -604,7 +605,7 @@ class NamespaceConflictChecker extends Maintenance { */ $update = new LinksDeletionUpdate( $wikiPage ); $update->doUpdate(); - $this->db->commit( __METHOD__ ); + $this->commitTransaction( $this->db, __METHOD__ ); return true; } diff --git a/maintenance/removeUnusedAccounts.php b/maintenance/removeUnusedAccounts.php index 90dc62204a..6416407a99 100644 --- a/maintenance/removeUnusedAccounts.php +++ b/maintenance/removeUnusedAccounts.php @@ -117,7 +117,7 @@ class RemoveUnusedAccounts extends Maintenance { ); $count = 0; - $dbo->begin( __METHOD__ ); + $this->beginTransaction( $dbo, __METHOD__ ); foreach ( $checks as $table => $fprefix ) { $conds = array( $fprefix . '_user' => $id ); $count += (int)$dbo->selectField( $table, 'COUNT(*)', $conds, __METHOD__ ); @@ -126,7 +126,7 @@ class RemoveUnusedAccounts extends Maintenance { $conds = array( 'log_user' => $id, 'log_type != ' . $dbo->addQuotes( 'newusers' ) ); $count += (int)$dbo->selectField( 'logging', 'COUNT(*)', $conds, __METHOD__ ); - $dbo->commit( __METHOD__ ); + $this->commitTransaction( $dbo, __METHOD__ ); return $count == 0; }