Index: trunk/phase3/includes/SiteStats.php |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | */ |
7 | 7 | class SiteStats { |
8 | 8 | static $row, $loaded = false; |
9 | | - static $admins; |
| 9 | + static $admins, $jobs; |
10 | 10 | static $pageCount = array(); |
11 | 11 | |
12 | 12 | static function recache() { |
— | — | @@ -27,6 +27,8 @@ |
28 | 28 | $dbr = wfGetDB( DB_SLAVE ); |
29 | 29 | self::$row = $dbr->selectRow( 'site_stats', '*', false, __METHOD__ ); |
30 | 30 | } |
| 31 | + |
| 32 | + self::$loaded = true; |
31 | 33 | } |
32 | 34 | |
33 | 35 | static function loadAndLazyInit() { |
— | — | @@ -104,6 +106,18 @@ |
105 | 107 | return self::$admins; |
106 | 108 | } |
107 | 109 | |
| 110 | + static function jobs() { |
| 111 | + if ( !isset( self::$jobs ) ) { |
| 112 | + $dbr = wfGetDB( DB_SLAVE ); |
| 113 | + self::$jobs = $dbr->estimateRowCount('job'); |
| 114 | + /* Zero rows still do single row read for row that doesn't exist, but people are annoyed by that */ |
| 115 | + if (self::$jobs == 1) { |
| 116 | + self::$jobs = 0; |
| 117 | + } |
| 118 | + } |
| 119 | + return self::$jobs; |
| 120 | + } |
| 121 | + |
108 | 122 | static function pagesInNs( $ns ) { |
109 | 123 | wfProfileIn( __METHOD__ ); |
110 | 124 | if( !isset( self::$pageCount[$ns] ) ) { |
Index: trunk/phase3/includes/SpecialStatistics.php |
— | — | @@ -21,14 +21,9 @@ |
22 | 22 | $images = SiteStats::images(); |
23 | 23 | $total = SiteStats::pages(); |
24 | 24 | $users = SiteStats::users(); |
| 25 | + $admins = SiteStats::admins(); |
| 26 | + $numJobs = SiteStats::jobs(); |
25 | 27 | |
26 | | - $admins = $dbr->selectField( 'user_groups', 'COUNT(*)', array( 'ug_group' => 'sysop' ), $fname ); |
27 | | - $numJobs = $dbr->estimateRowCount('job'); |
28 | | - /* Zero rows still do single row read for row that doesn't exist, but people are annoyed by that */ |
29 | | - if ($numJobs == 1) { |
30 | | - $numJobs = 0; |
31 | | - } |
32 | | - |
33 | 28 | if ($action == 'raw') { |
34 | 29 | $wgOut->disable(); |
35 | 30 | header( 'Pragma: nocache' ); |