X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FViewCountUpdate.php;h=28ba34146ba0eea5367c773b58b488de0bf32704;hb=8fc8ddfa80ddc06ab9dab54288118288468fffcd;hp=a30b0f79e70f22c0d1d016b1f5193409c3fe4739;hpb=22b599e06ca623d577bf1ac99c08f3da2414c292;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/ViewCountUpdate.php b/includes/ViewCountUpdate.php index a30b0f79e7..28ba34146b 100644 --- a/includes/ViewCountUpdate.php +++ b/includes/ViewCountUpdate.php @@ -48,8 +48,7 @@ class ViewCountUpdate implements DeferrableUpdate { $dbw = wfGetDB( DB_MASTER ); if ( $wgHitcounterUpdateFreq <= 1 || $dbw->getType() == 'sqlite' ) { - $pageTable = $dbw->tableName( 'page' ); - $dbw->query( "UPDATE $pageTable SET page_counter = page_counter + 1 WHERE page_id = {$this->id}" ); + $dbw->update( 'page', array( 'page_counter = page_counter + 1' ), array( 'page_id' => $this->id ), __METHOD__ ); return; } @@ -71,10 +70,7 @@ class ViewCountUpdate implements DeferrableUpdate { $dbw = wfGetDB( DB_MASTER ); - $hitcounterTable = $dbw->tableName( 'hitcounter' ); - $res = $dbw->query( "SELECT COUNT(*) as n FROM $hitcounterTable" ); - $row = $dbw->fetchObject( $res ); - $rown = intval( $row->n ); + $rown = $dbw->selectField( 'hitcounter', 'COUNT(*)', array(), __METHOD__ ); if ( $rown < $wgHitcounterUpdateFreq ) { return; @@ -87,6 +83,7 @@ class ViewCountUpdate implements DeferrableUpdate { $dbType = $dbw->getType(); $tabletype = $dbType == 'mysql' ? "ENGINE=HEAP " : ''; + $hitcounterTable = $dbw->tableName( 'hitcounter' ); $acchitsTable = $dbw->tableName( 'acchits' ); $pageTable = $dbw->tableName( 'page' );