Index: trunk/phase3/includes/ViewCountUpdate.php |
— | — | @@ -48,8 +48,7 @@ |
49 | 49 | $dbw = wfGetDB( DB_MASTER ); |
50 | 50 | |
51 | 51 | if ( $wgHitcounterUpdateFreq <= 1 || $dbw->getType() == 'sqlite' ) { |
52 | | - $pageTable = $dbw->tableName( 'page' ); |
53 | | - $dbw->query( "UPDATE $pageTable SET page_counter = page_counter + 1 WHERE page_id = {$this->id}" ); |
| 52 | + $dbw->update( 'page', array( 'page_counter = page_counter + 1' ), array( 'page_id' => $this->id ), __METHOD__ ); |
54 | 53 | return; |
55 | 54 | } |
56 | 55 | |
— | — | @@ -71,10 +70,7 @@ |
72 | 71 | |
73 | 72 | $dbw = wfGetDB( DB_MASTER ); |
74 | 73 | |
75 | | - $hitcounterTable = $dbw->tableName( 'hitcounter' ); |
76 | | - $res = $dbw->query( "SELECT COUNT(*) as n FROM $hitcounterTable" ); |
77 | | - $row = $dbw->fetchObject( $res ); |
78 | | - $rown = intval( $row->n ); |
| 74 | + $rown = $dbw->selectField( 'hitcounter', 'COUNT(*)', array(), __METHOD__ ); |
79 | 75 | |
80 | 76 | if ( $rown < $wgHitcounterUpdateFreq ) { |
81 | 77 | return; |
— | — | @@ -87,6 +83,7 @@ |
88 | 84 | |
89 | 85 | $dbType = $dbw->getType(); |
90 | 86 | $tabletype = $dbType == 'mysql' ? "ENGINE=HEAP " : ''; |
| 87 | + $hitcounterTable = $dbw->tableName( 'hitcounter' ); |
91 | 88 | $acchitsTable = $dbw->tableName( 'acchits' ); |
92 | 89 | $pageTable = $dbw->tableName( 'page' ); |
93 | 90 | |