From 547d462247652070c00840fad6ffb43597a218dd Mon Sep 17 00:00:00 2001 From: macbre Date: Mon, 22 Feb 2016 13:14:41 +0100 Subject: [PATCH] AllinfoboxesQueryPage: remove transaction wrapping DELETE + INSERT queries They affect replication as they delete and insert many rows. --- querypage/AllinfoboxesQueryPage.php | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/querypage/AllinfoboxesQueryPage.php b/querypage/AllinfoboxesQueryPage.php index a6d6a99..fb54d06 100644 --- a/querypage/AllinfoboxesQueryPage.php +++ b/querypage/AllinfoboxesQueryPage.php @@ -40,20 +40,18 @@ class AllinfoboxesQueryPage extends PageQueryPage { * @param bool $limit Only for consistency * @param bool $ignoreErrors Only for consistency * - * @return bool|int + * @return int number of rows updated */ public function recache( $limit = false, $ignoreErrors = true ) { $dbw = wfGetDB( DB_MASTER ); $infoboxes = $this->reallyDoQuery(); - $dbw->begin(); ( new WikiaSQL() ) ->DELETE( 'querycache' ) ->WHERE( 'qc_type' )->EQUAL_TO( $this->getName() ) ->run( $dbw ); - $inserted = 0; if ( !empty( $infoboxes ) ) { ( new WikiaSQL() ) ->INSERT()->INTO( 'querycache', [ @@ -64,19 +62,11 @@ class AllinfoboxesQueryPage extends PageQueryPage { ] ) ->VALUES( $infoboxes ) ->run( $dbw ); - - $inserted = $dbw->affectedRows(); - if ( $inserted === 0 ) { - $dbw->rollback(); - - return false; - } - $dbw->commit(); } wfRunHooks( 'AllInfoboxesQueryRecached' ); - return $inserted; + return count( $infoboxes ); } /**