r90024 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90023‎ | r90024 | r90025 >
Date:00:30, 14 June 2011
Author:aaron
Status:ok
Tags:
Comment:
* Moved stats storage to new table. This makes adding stats easier and allows for historical stats.
* Added new FlaggedRevsStats class
* Track sample size for review lag data (not displayed yet)
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevsStats.php (added) (history)
  • /trunk/extensions/FlaggedRevs/maintenance/updateStats.inc (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/specialpages/reports/ValidationStatistics_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/schema/FlaggedRevsUpdater.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/schema/mysql/FlaggedRevs.sql (modified) (history)
  • /trunk/extensions/FlaggedRevs/schema/mysql/patch-flaggedrevs_statistics.sql (added) (history)
  • /trunk/extensions/FlaggedRevs/schema/postgres/patch-flaggedrevs_statistics.sql (added) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -248,6 +248,7 @@
249249 $wgAutoloadClasses['FlaggedPageConfig'] = $accessDir . 'FlaggedPageConfig.php';
250250 $wgAutoloadClasses['FlaggedRevsLog'] = $accessDir . 'FlaggedRevsLog.php';
251251 $wgAutoloadClasses['FRInclusionCache'] = $accessDir . 'FRInclusionCache.php';
 252+$wgAutoloadClasses['FlaggedRevsStats'] = $accessDir . 'FlaggedRevsStats.php';
252253 # Data object classes...
253254 $wgAutoloadClasses['FRExtraCacheUpdate'] = $accessDir . 'FRExtraCacheUpdate.php';
254255 $wgAutoloadClasses['FRExtraCacheUpdateJob'] = $accessDir . 'FRExtraCacheUpdate.php';
Index: trunk/extensions/FlaggedRevs/schema/mysql/FlaggedRevs.sql
@@ -139,16 +139,14 @@
140140 frp_user_params mediumblob NOT NULL
141141 ) /*$wgDBTableOptions*/;
142142
143 -CREATE TABLE /*_*/flaggedrevs_stats (
144 - namespace int unsigned NOT NULL DEFAULT 0 PRIMARY KEY,
145 - total int unsigned NOT NULL DEFAULT 0,
146 - reviewed int unsigned NOT NULL DEFAULT 0,
147 - synced int unsigned NOT NULL DEFAULT 0
 143+-- This stores overall stats
 144+CREATE TABLE /*_*/flaggedrevs_statistics (
 145+ -- Timestamp stat was recorded
 146+ frs_timestamp varbinary(14) NOT NULL,
 147+ -- Stat key name, colons separate paramaters
 148+ frs_stat_key varchar(255) NOT NULL,
 149+ -- Stat value as an integer
 150+ frs_stat_val integer unsigned NOT NULL,
 151+ PRIMARY KEY(frs_stat_key,frs_timestamp)
148152 ) /*$wgDBTableOptions*/;
149 -
150 -CREATE TABLE /*_*/flaggedrevs_stats2 (
151 - stat_id int unsigned NOT NULL DEFAULT 1 PRIMARY KEY,
152 - ave_review_time int unsigned NOT NULL DEFAULT 0,
153 - med_review_time int unsigned NOT NULL DEFAULT 0,
154 - ave_pending_time int unsigned NOT NULL DEFAULT 0
155 -) /*$wgDBTableOptions*/;
 153+CREATE INDEX /*i*/frs_timestamp ON /*_*/flaggedrevs_statistics (frs_timestamp);
Index: trunk/extensions/FlaggedRevs/schema/mysql/patch-flaggedrevs_statistics.sql
@@ -0,0 +1,15 @@
 2+-- old format --
 3+DROP TABLE IF EXISTS /*_*/flaggedrevs_stats;
 4+DROP TABLE IF EXISTS /*_*/flaggedrevs_stats2;
 5+
 6+-- This stores overall stats
 7+CREATE TABLE /*_*/flaggedrevs_statistics (
 8+ -- Timestamp stat was recorded
 9+ frs_timestamp varbinary(14) NOT NULL,
 10+ -- Stat key name, colons separate paramaters
 11+ frs_stat_key varchar(255) NOT NULL,
 12+ -- Stat value as an integer
 13+ frs_stat_val integer unsigned NOT NULL,
 14+ PRIMARY KEY(frs_stat_key,frs_timestamp)
 15+) /*$wgDBTableOptions*/;
 16+CREATE INDEX /*i*/frs_timestamp ON /*_*/flaggedrevs_statistics (frs_timestamp);
Property changes on: trunk/extensions/FlaggedRevs/schema/mysql/patch-flaggedrevs_statistics.sql
___________________________________________________________________
Added: svn:eol-style
117 + native
Index: trunk/extensions/FlaggedRevs/schema/FlaggedRevsUpdater.hooks.php
@@ -29,12 +29,12 @@
3030 'flaggedpage_config', 'fpc_level', "$base/patch-fpc_level.sql", true ) );
3131 $du->addExtensionUpdate( array( 'addTable',
3232 'flaggedpage_pending', "$base/patch-flaggedpage_pending.sql", true ) );
33 - $du->addExtensionUpdate( array( 'addTable',
34 - 'flaggedrevs_stats', "$base/patch-flaggedrevs_stats.sql", true ) );
3533 $du->addExtensionUpdate( array( 'FlaggedRevsUpdaterHooks::doFlaggedImagesTimestampNULL',
3634 "$base/patch-fi_img_timestamp.sql" ) );
3735 $du->addExtensionUpdate( array( 'FlaggedRevsUpdaterHooks::doFlaggedRevsRevTimestamp',
3836 "$base/patch-fr_page_rev-index.sql" ) );
 37+ $du->addExtensionUpdate( array( 'addTable',
 38+ 'flaggedrevs_statistics', "$base/patch-flaggedrevs_statistics.sql", true ) );
3939 } elseif ( $wgDBtype == 'postgres' ) {
4040 $base = dirname( __FILE__ ) . '/postgres';
4141 // Initial install tables (current schema)
@@ -59,11 +59,12 @@
6060 'flaggedpage_config', 'fpc_level', "TEXT NULL" ) );
6161 $du->addExtensionUpdate( array( 'addTable',
6262 'flaggedpage_pending', "$base/patch-flaggedpage_pending.sql", true ) );
63 - // @TODO: PG stats table???
6463 $du->addExtensionUpdate( array( 'FlaggedRevsUpdaterHooks::doFlaggedImagesTimestampNULL',
6564 "$base/patch-fi_img_timestamp.sql" ) );
6665 $du->addExtensionUpdate( array( 'FlaggedRevsUpdaterHooks::doFlaggedRevsRevTimestamp',
6766 "$base/patch-fr_page_rev-index.sql" ) );
 67+ $du->addExtensionUpdate( array( 'addTable',
 68+ 'flaggedrevs_statistics', "$base/patch-flaggedrevs_statistics.sql", true ) );
6869 } elseif ( $wgDBtype == 'sqlite' ) {
6970 $base = dirname( __FILE__ ) . '/mysql';
7071 $du->addExtensionUpdate( array( 'addTable',
Index: trunk/extensions/FlaggedRevs/schema/postgres/patch-flaggedrevs_statistics.sql
@@ -0,0 +1,11 @@
 2+-- old format --
 3+DROP TABLE IF EXISTS flaggedrevs_stats;
 4+DROP TABLE IF EXISTS flaggedrevs_stats2;
 5+
 6+CREATE TABLE flaggedrevs_statistics (
 7+ frs_timestamp TIMESTAMPTZ NOT NULL,
 8+ frs_stat_key TEXT NOT NULL,
 9+ frs_stat_val BIGINT NOT NULL,
 10+ PRIMARY KEY(frs_stat_key,frs_timestamp)
 11+) /*$wgDBTableOptions*/;
 12+CREATE INDEX frs_timestamp ON flaggedrevs_statistics (frs_timestamp);
Property changes on: trunk/extensions/FlaggedRevs/schema/postgres/patch-flaggedrevs_statistics.sql
___________________________________________________________________
Added: svn:eol-style
113 + native
Index: trunk/extensions/FlaggedRevs/maintenance/updateStats.inc
@@ -52,51 +52,62 @@
5353 array( 'USE INDEX' => array('flaggedpages' => 'fp_pending_since') )
5454 );
5555 # Get wait times for anon edits...
56 - list( $aveRT, $medianRT, $rPerTable ) = getAveReviewTimesAnons( $dbr, $dbCache );
 56+ list( $aveRT, $medianRT, $rPerTable, $rSize ) = getAveReviewTimesAnons( $dbr, $dbCache );
5757
5858 // Save the data...
59 - // @TODO: new permanent schema
6059 #echo "\nAve=".($aveRT/3600)." Med=".($medianRT/3600)."\n";
6160 $dbw = wfGetDB( DB_MASTER );
62 - // Make sure the master has flaggedrevs_stats and _stats2
63 - if ( !$dbw->tableExists( 'flaggedrevs_stats' ) ||
64 - !$dbw->tableExists( 'flaggedrevs_stats2' ) )
65 - {
66 - print( "Need to run update.php to create flaggedrevs_stats and flaggedrevs_stats2. Stopping." );
67 - die( 1 );
 61+ // The timestamp to identify this whole batch of data
 62+ $encDataTimestamp = $dbw->timestamp();
 63+
 64+ $dataSet = array();
 65+ // All-namespace percentiles...
 66+ foreach( $rPerTable as $percentile => $seconds ) {
 67+ $dataSet[] = array(
 68+ 'frs_stat_key' => 'reviewLag-percentile:'.(int)$percentile,
 69+ 'frs_stat_val' => $seconds,
 70+ 'frs_timestamp' => $encDataTimestamp );
6871 }
69 - $dbw->begin();
70 - // Save/cache percentiles
71 - $key = wfMemcKey( 'flaggedrevs', 'reviewPercentiles' );
72 - $dbCache->set( $key, $rPerTable, 30*24*3600 );
73 - // Per-namespace stats...
 72+ // Sample size...
 73+ $dataSet[] = array(
 74+ 'frs_stat_key' => 'reviewLag-sampleSize',
 75+ 'frs_stat_val' => $rSize,
 76+ 'frs_timestamp' => $encDataTimestamp );
 77+
 78+ // All-namespace ave/med review lag & ave pending lag stats...
 79+ $dataSet[] = array(
 80+ 'frs_stat_key' => 'reviewLag-average',
 81+ 'frs_stat_val' => $aveRT,
 82+ 'frs_timestamp' => $encDataTimestamp );
 83+ $dataSet[] = array(
 84+ 'frs_stat_key' => 'reviewLag-median',
 85+ 'frs_stat_val' => $medianRT,
 86+ 'frs_timestamp' => $encDataTimestamp );
 87+ $dataSet[] = array(
 88+ 'frs_stat_key' => 'pendingLag-average',
 89+ 'frs_stat_val' => $avePET,
 90+ 'frs_timestamp' => $encDataTimestamp );
 91+
 92+ // Per-namespace total/reviewed/synced stats...
7493 foreach( $wgFlaggedRevsNamespaces as $namespace ) {
75 - $dbw->replace( 'flaggedrevs_stats',
76 - array( 'namespace' ),
77 - array( 'namespace' => intval($namespace),
78 - 'total' => isset($ns_total[$namespace]) ? $ns_total[$namespace] : 0,
79 - 'reviewed' => isset($ns_reviewed[$namespace]) ? $ns_reviewed[$namespace] : 0,
80 - 'synced' => isset($ns_synced[$namespace]) ? $ns_synced[$namespace] : 0
81 - ),
82 - __METHOD__
83 - );
 94+ $dataSet[] = array(
 95+ 'frs_stat_key' => 'totalPages-NS:'.(int)$namespace,
 96+ 'frs_stat_val' => isset($ns_total[$namespace]) ? $ns_total[$namespace] : 0,
 97+ 'frs_timestamp' => $encDataTimestamp );
 98+ $dataSet[] = array(
 99+ 'frs_stat_key' => 'reviewedPages-NS:'.(int)$namespace,
 100+ 'frs_stat_val' => isset($ns_reviewed[$namespace]) ? $ns_reviewed[$namespace] : 0,
 101+ 'frs_timestamp' => $encDataTimestamp );
 102+ $dataSet[] = array(
 103+ 'frs_stat_key' => 'syncedPages-NS:'.(int)$namespace,
 104+ 'frs_stat_val' => isset($ns_synced[$namespace]) ? $ns_synced[$namespace] : 0,
 105+ 'frs_timestamp' => $encDataTimestamp );
84106 }
85 - // Overall stats...
86 - $dbw->replace( 'flaggedrevs_stats2',
87 - array( 'stat_id' ),
88 - array( 'stat_id' => 1,
89 - 'ave_review_time' => $aveRT,
90 - 'med_review_time' => $medianRT,
91 - 'ave_pending_time' => $avePET
92 - ),
93 - __METHOD__
94 - );
95 - // Update timestamp
96 - $dbw->replace( 'querycache_info', array('qci_type'),
97 - array('qci_type' => 'validationstats', 'qci_timestamp' => $dbw->timestamp()),
98 - __METHOD__
99 - );
 107+
 108+ $dbw->begin();
 109+ $dbw->insert( 'flaggedrevs_statistics', $dataSet, __FUNCTION__, array( 'IGNORE' ) );
100110 $dbw->commit();
 111+
101112 // Stats are now up to date!
102113 $key = wfMemcKey( 'flaggedrevs', 'statsUpdated' );
103114 $dbCache->set( $key, '1', $wgFlaggedRevsStatsAge );
@@ -252,5 +263,5 @@
253264 }
254265 echo "(sampled ".count($times)." edits)...";
255266 }
256 - return array($aveRT,$medianRT,$rPerTable);
 267+ return array($aveRT,$medianRT,$rPerTable,count($times));
257268 }
Index: trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevs.hooks.php
@@ -261,12 +261,12 @@
262262
263263 static $pcCounts = null;
264264 if ( !$pcCounts ) {
265 - $dbr = wfGetDB( DB_SLAVE );
266 - $res = $dbr->select( 'flaggedrevs_stats', '*', array(), __METHOD__ );
 265+ $stats = FlaggedRevsStats::getLatestStats();
 266+ $reviewedPerNS = $stats['reviewedPages-NS'];
267267 $totalCount = 0;
268 - foreach( $res as $row ) {
269 - $nsList[ "ns-{$row->namespace}" ] = $row->reviewed;
270 - $totalCount += $row->reviewed;
 268+ foreach ( $reviewedPerNS as $ns => $reviewed ) {
 269+ $nsList[ "ns-{$ns}" ] = $reviewed;
 270+ $totalCount += $reviewed;
271271 }
272272 $nsList[ 'all' ] = $totalCount;
273273 }
Index: trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevsStats.php
@@ -0,0 +1,51 @@
 2+<?php
 3+/**
 4+ * FlaggedRevs stats functions
 5+ */
 6+class FlaggedRevsStats {
 7+ /*
 8+ * Get latest FR-related stats
 9+ * @return Array of current FR stats
 10+ */
 11+ public static function getLatestStats() {
 12+ $dbr = wfGetDB( DB_SLAVE );
 13+ $dbTs = $dbr->selectField( 'flaggedrevs_statistics', 'MAX(frs_timestamp)' );
 14+ $res = $dbr->select( 'flaggedrevs_statistics',
 15+ array( 'frs_stat_key', 'frs_stat_val' ),
 16+ array( 'frs_timestamp' => $dbTs ),
 17+ __METHOD__
 18+ );
 19+
 20+ $data = array();
 21+ $data['reviewLag-sampleSize'] = '-';
 22+ $data['reviewLag-average'] = '-';
 23+ $data['reviewLag-median'] = '-';
 24+ $data['reviewLag-percentiles'] = array();
 25+ $data['totalPages-NS'] = array();
 26+ $data['reviewedPages-NS'] = array();
 27+ $data['syncedPages-NS'] = array();
 28+ $data['pendingLag-average'] = '-';
 29+ $data['statTimestamp'] = wfTimestamp( TS_MW, $dbTs );
 30+
 31+ foreach( $res as $row ) {
 32+ $key = explode( ':', $row->frs_stat_key );
 33+ switch ( $key[0] ) {
 34+ case 'reviewLag-sampleSize':
 35+ case 'reviewLag-average':
 36+ case 'reviewLag-median':
 37+ case 'pendingLag-average':
 38+ $data[$key[0]] = (int)$row->frs_stat_val;
 39+ break;
 40+ case 'reviewLag-percentile': // <stat name,percentile)
 41+ $data[$key[0]][$key[1]] = (int)$row->frs_stat_val;
 42+ break;
 43+ case 'totalPages-NS': // <stat name,namespace)
 44+ case 'reviewedPages-NS': // <stat name,namespace)
 45+ case 'syncedPages-NS': // <stat name,namespace)
 46+ $data[$key[0]][$key[1]] = (int)$row->frs_stat_val;
 47+ break;
 48+ }
 49+ }
 50+ return $data;
 51+ }
 52+}
Property changes on: trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevsStats.php
___________________________________________________________________
Added: svn:eol-style
153 + native
Index: trunk/extensions/FlaggedRevs/presentation/specialpages/reports/ValidationStatistics_body.php
@@ -1,6 +1,8 @@
22 <?php
33
44 class ValidationStatistics extends IncludableSpecialPage {
 5+ protected $latestData = null;
 6+
57 public function __construct() {
68 parent::__construct( 'ValidationStatistics' );
79 }
@@ -18,6 +20,7 @@
1921 $mt = $this->getMeanReviewWait();
2022 $mdt = $this->getMedianReviewWait();
2123 $pt = $this->getMeanPendingWait();
 24+ $pData = $this->getPercentiles();
2225 $timestamp = $this->getLastUpdate();
2326
2427 $wgOut->addWikiMsg( 'validationstatistics-users',
@@ -28,13 +31,10 @@
2932 return false;
3033 }
3134
32 - $key = wfMemcKey( 'flaggedrevs', 'reviewPercentiles' );
33 - $dbCache = wfGetCache( CACHE_DB );
34 - $data = $dbCache->get( $key );
3535 # Is there a review time table available?
36 - if ( is_array( $data ) && count( $data ) ) {
 36+ if ( is_array( $pData ) && count( $pData ) ) {
3737 $headerRows = $dataRows = '';
38 - foreach ( $data as $percentile => $perValue ) {
 38+ foreach ( $pData as $percentile => $perValue ) {
3939 $headerRows .= "<th>P<sub>" . intval( $percentile ) . "</sub></th>";
4040 $dataRows .= '<td>' . $wgLang->formatTimePeriod( $perValue ) . '</td>';
4141 }
@@ -82,36 +82,39 @@
8383 $wgOut->addHTML( "</tr>\n" );
8484 $namespaces = FlaggedRevs::getReviewNamespaces();
8585 foreach ( $namespaces as $namespace ) {
86 - $row = $this->db->selectRow( 'flaggedrevs_stats', '*',
87 - array( 'namespace' => $namespace ) );
88 - if( !$row ) continue; // NS added to config recently?
 86+ $total = $this->getTotalPages( $namespace );
 87+ $reviewed = $this->getReviewedPages( $namespace );
 88+ $synced = $this->getSyncedPages( $namespace );
 89+ if ( $total === '-' || $reviewed === '-' || $synced === '-' ) {
 90+ continue; // NS added to config recently?
 91+ }
8992
90 - $NsText = $wgContLang->getFormattedNsText( $row->namespace );
 93+ $NsText = $wgContLang->getFormattedNsText( $namespace );
9194 $NsText = $NsText ? $NsText : wfMsgHTML( 'blanknamespace' );
9295
93 - $percRev = intval( $row->total ) == 0
 96+ $percRev = intval( $total ) == 0
9497 ? '-' // devision by zero
9598 : wfMsg( 'parentheses',
9699 wfMsgExt( 'percent', array( 'escapenoentities' ),
97100 $wgLang->formatnum( sprintf( '%4.2f',
98 - 100 * intval( $row->reviewed ) / intval( $row->total ) ) )
 101+ 100 * intval( $reviewed ) / intval( $total ) ) )
99102 )
100103 );
101 - $percLatest = intval( $row->total ) == 0
 104+ $percLatest = intval( $total ) == 0
102105 ? '-' // devision by zero
103106 : wfMsg( 'parentheses',
104107 wfMsgExt( 'percent', array( 'escapenoentities' ),
105108 $wgLang->formatnum( sprintf( '%4.2f',
106 - 100 * intval( $row->synced ) / intval( $row->total ) ) )
 109+ 100 * intval( $synced ) / intval( $total ) ) )
107110 )
108111 );
109 - $percSynced = intval( $row->reviewed ) == 0
 112+ $percSynced = intval( $reviewed ) == 0
110113 ? '-' // devision by zero
111114 : wfMsgExt( 'percent', array( 'escapenoentities' ),
112115 $wgLang->formatnum( sprintf( '%4.2f',
113 - 100 * intval( $row->synced ) / intval( $row->reviewed ) ) )
 116+ 100 * intval( $synced ) / intval( $reviewed ) ) )
114117 );
115 - $outdated = intval( $row->reviewed ) - intval( $row->synced );
 118+ $outdated = intval( $reviewed ) - intval( $synced );
116119 $outdated = $wgLang->formatnum( max( 0, $outdated ) ); // lag between queries
117120
118121 $wgOut->addHTML(
@@ -120,14 +123,14 @@
121124 htmlspecialchars( $NsText ) .
122125 "</td>
123126 <td>" .
124 - htmlspecialchars( $wgLang->formatnum( $row->total ) ) .
 127+ htmlspecialchars( $wgLang->formatnum( $total ) ) .
125128 "</td>
126129 <td>" .
127 - htmlspecialchars( $wgLang->formatnum( $row->reviewed ) .
 130+ htmlspecialchars( $wgLang->formatnum( $reviewed ) .
128131 $wgContLang->getDirMark() ) . " <i>$percRev</i>
129132 </td>
130133 <td>" .
131 - htmlspecialchars( $wgLang->formatnum( $row->synced ) .
 134+ htmlspecialchars( $wgLang->formatnum( $synced ) .
132135 $wgContLang->getDirMark() ) . " <i>$percLatest</i>
133136 </td>
134137 <td>" .
@@ -193,10 +196,10 @@
194197 }
195198
196199 protected function readyForQuery() {
197 - if ( !$this->db->tableExists( 'flaggedrevs_stats' ) ) {
 200+ if ( !$this->db->tableExists( 'flaggedrevs_statistics' ) ) {
198201 return false;
199202 } else {
200 - return ( 0 != $this->db->selectField( 'flaggedrevs_stats', 'COUNT(*)' ) );
 203+ return ( 0 != $this->db->selectField( 'flaggedrevs_statistics', 'COUNT(*)' ) );
201204 }
202205 }
203206
@@ -211,30 +214,59 @@
212215 array( 'ug_group' => 'reviewer' ),
213216 __METHOD__ );
214217 }
215 -
 218+
 219+ protected function getLatestStats() {
 220+ if ( $this->latestData !== null ) {
 221+ return $this->latestData;
 222+ }
 223+ $this->latestData = FlaggedRevsStats::getLatestStats();
 224+ return $this->latestData;
 225+ }
 226+
216227 protected function getMeanReviewWait() {
217 - if ( !$this->db->tableExists( 'flaggedrevs_stats2' ) ) return '-';
218 - $val = $this->db->selectField( 'flaggedrevs_stats2', 'ave_review_time' );
219 - return ( $val == false ? '-' : $val );
 228+ $stats = $this->getLatestStats();
 229+ return $stats['reviewLag-average'];
220230 }
221231
222232 protected function getMedianReviewWait() {
223 - if ( !$this->db->tableExists( 'flaggedrevs_stats2' ) ) return '-';
224 - $val = $this->db->selectField( 'flaggedrevs_stats2', 'med_review_time' );
225 - return ( $val == false ? '-' : $val );
 233+ $stats = $this->getLatestStats();
 234+ return $stats['reviewLag-median'];
226235 }
227236
228237 protected function getMeanPendingWait() {
229 - if ( !$this->db->tableExists( 'flaggedrevs_stats2' ) ) return '-';
230 - $val = $this->db->selectField( 'flaggedrevs_stats2', 'ave_pending_time' );
231 - return ( $val == false ? '-' : $val );
 238+ $stats = $this->getLatestStats();
 239+ return $stats['pendingLag-average'];
232240 }
 241+
 242+ protected function getTotalPages( $ns ) {
 243+ $stats = $this->getLatestStats();
 244+ return isset( $stats['totalPages-NS'][$ns] )
 245+ ? $stats['totalPages-NS'][$ns]
 246+ : '-';
 247+ }
233248
 249+ protected function getReviewedPages( $ns ) {
 250+ $stats = $this->getLatestStats();
 251+ return isset( $stats['reviewedPages-NS'][$ns] )
 252+ ? $stats['reviewedPages-NS'][$ns]
 253+ : '-';
 254+ }
 255+
 256+ protected function getSyncedPages( $ns ) {
 257+ $stats = $this->getLatestStats();
 258+ return isset( $stats['syncedPages-NS'][$ns] )
 259+ ? $stats['syncedPages-NS'][$ns]
 260+ : '-';
 261+ }
 262+
 263+ protected function getPercentiles() {
 264+ $stats = $this->getLatestStats();
 265+ return $stats['reviewLag-percentile'];
 266+ }
 267+
234268 protected function getLastUpdate() {
235 - if ( !$this->db->tableExists( 'querycache_info' ) ) return '-';
236 - $val = $this->db->selectField( 'querycache_info', 'qci_timestamp',
237 - array( 'qci_type' => 'validationstats' ) );
238 - return ( $val == false ? '-' : $val );
 269+ $stats = $this->getLatestStats();
 270+ return $stats['statTimestamp'];
239271 }
240272
241273 // top X reviewers in the last Y hours

Sign-offs

UserFlagDate
😂inspected01:38, 14 June 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r90032Code style cleanup from r90024aaron03:23, 14 June 2011
r90304Fix r90024: missing one PG sql file changeaaron18:32, 17 June 2011
r90380Fixed array key typo in getStats() (from r90024)aaron01:07, 19 June 2011
r90383Follow-up r90024: make frs_stat_val a BIGINT as in PGaaron04:57, 19 June 2011

Status & tagging log