summaryrefslogtreecommitdiff
path: root/includes/ViewCountUpdate.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/ViewCountUpdate.php')
-rw-r--r--includes/ViewCountUpdate.php9
1 files changed, 3 insertions, 6 deletions
diff --git a/includes/ViewCountUpdate.php b/includes/ViewCountUpdate.php
index a30b0f79..28ba3414 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' );