https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112953
Revision: 112953
Author: ialex
Date: 2012-03-03 17:33:26 +0000 (Sat, 03 Mar 2012)
Log Message:
-----------
Change some DatabaseBase::query() calls to use more specific methods
Modified Paths:
--------------
trunk/phase3/includes/ViewCountUpdate.php
Modified: trunk/phase3/includes/ViewCountUpdate.php
===================================================================
--- trunk/phase3/includes/ViewCountUpdate.php 2012-03-03 17:27:09 UTC (rev
112952)
+++ trunk/phase3/includes/ViewCountUpdate.php 2012-03-03 17:33:26 UTC (rev
112953)
@@ -48,8 +48,7 @@
$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 @@
$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 @@
$dbType = $dbw->getType();
$tabletype = $dbType == 'mysql' ? "ENGINE=HEAP " : '';
+ $hitcounterTable = $dbw->tableName( 'hitcounter' );
$acchitsTable = $dbw->tableName( 'acchits' );
$pageTable = $dbw->tableName( 'page' );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs