Make maintenance scripts use beginTransaction/commitTransaction
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 31 Dec 2015 00:10:31 +0000 (16:10 -0800)
committerBryan Davis <bd808@wikimedia.org>
Thu, 31 Dec 2015 22:02:15 +0000 (15:02 -0700)
Change-Id: I700437a016a40ad82951ae56d215f6dace2bb612

maintenance/namespaceDupes.php
maintenance/removeUnusedAccounts.php

index 28176a5..f67005d 100644 (file)
@@ -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;
        }
index 90dc622..6416407 100644 (file)
@@ -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;
        }