r53027 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53026‎ | r53027 | r53028 >
Date:00:27, 10 July 2009
Author:demon
Status:deferred
Tags:
Comment:
* Refactor all of InitStats crap into SiteStatsInit class. Update all code using this as needed.
** TODO: Remove ss_admins, nothing really uses it since we have numberingroup(), also make good articles mirror logic elsewhere, per bug 11868 comment #16
* Port findhooks, alltrans
Modified paths:
  • /branches/maintenance-work/includes/AutoLoader.php (modified) (history)
  • /branches/maintenance-work/includes/SiteStats.php (modified) (history)
  • /branches/maintenance-work/maintenance/Maintenance.php (modified) (history)
  • /branches/maintenance-work/maintenance/findhooks.php (modified) (history)
  • /branches/maintenance-work/maintenance/initStats.php (modified) (history)
  • /branches/maintenance-work/maintenance/language/alltrans.php (modified) (history)
  • /branches/maintenance-work/maintenance/updaters.inc (modified) (history)

Diff [purge]

Index: branches/maintenance-work/maintenance/initStats.php
@@ -19,11 +19,50 @@
2020 $this->addOption( 'update', 'Update the existing statistics (preserves the ss_total_views field)' );
2121 $this->addOption( 'noviews', "Don't update the page view counter" );
2222 $this->addOption( 'active', 'Also update active users count' );
 23+ $this->addOption( 'use-master', 'Count using the master database' );
2324 }
2425
2526 public function execute() {
2627 $this->output( "Refresh Site Statistics\n\n" );
27 - SiteStats::init( $this->hasOption('update'), $this->hasOption('noviews'), $this->hasOption('active') );
 28+ $counter = new SiteStatsInit( $this->hasOption( 'use-master' ) );
 29+
 30+ $this->output( "Counting total edits..." );
 31+ $edits = $counter->edits();
 32+ $this->output( "{$edits}\nCounting number of articles..." );
 33+
 34+ $good = $counter->articles();
 35+ $this->output( "{$good}\nCounting total pages..." );
 36+
 37+ $pages = $counter->pages();
 38+ $this->output( "{$pages}\nCounting number of users..." );
 39+
 40+ $users = $counter->users();
 41+ $this->output( "{$users}\nCounting number of images..." );
 42+
 43+ $image = $counter->files();
 44+ $this->output( "{$image}\n" );
 45+
 46+ if( !$this->hasOption('noviews') ) {
 47+ $this->output( "Counting total page views..." );
 48+ $views = $counter->views();
 49+ $this->output( "{$views}\n" );
 50+ }
 51+
 52+ if( $this->hasOption( 'active' ) ) {
 53+ $this->output( "Counting active users..." );
 54+ $active = SiteStatsUpdate::cacheUpdate();
 55+ $this->output( "{$active}\n" );
 56+ }
 57+
 58+ $this->output( "\nUpdating site statistics..." );
 59+
 60+ if( $this->hasOption( 'update' ) ) {
 61+ $counter->update();
 62+ } else {
 63+ $counter->refresh();
 64+ }
 65+
 66+ $this->output( "done.\n" );
2867 }
2968 }
3069
Index: branches/maintenance-work/maintenance/updaters.inc
@@ -1040,7 +1040,7 @@
10411041 wfOut( "ok.\n" );
10421042 return;
10431043 }
1044 - SiteStats::init( false );
 1044+ SiteStatsInit::doAllAndUpdate( false );
10451045 }
10461046
10471047 function do_active_users_init() {
Index: branches/maintenance-work/maintenance/Maintenance.php
@@ -702,6 +702,7 @@
703703 if( !self::$mCoreScripts ) {
704704 $d = dirname( __FILE__ ) . DIRECTORY_SEPARATOR;
705705 self::$mCoreScripts = array(
 706+ # Main script list
706707 'AddWiki' => $d . 'addwiki.php',
707708 'AttachLatest' => $d . 'attachLatest.php',
708709 'BenchmarkPurge' => $d . 'benchmarkPurge.php',
@@ -731,6 +732,7 @@
732733 'EditCLI' => $d . 'edit.php',
733734 'EvalPrompt' => $d . 'eval.php',
734735 'FetchText' => $d . 'fetchText.php',
 736+ 'FindHooks' => $d . 'findhooks.php',
735737 'FixSlaveDesync' => $d . 'fixSlaveDesync.php',
736738 'FixTimestamps' => $d . 'fixTimestamps.php',
737739 'FixUserRegistration' => $d . 'fixUserRegistration.php',
@@ -775,6 +777,9 @@
776778 'UpdateSearchIndex' => $d . 'updateSearchIndex.php',
777779 'UpdateSpecialPages' => $d . 'updateSpecialPages.php',
778780 'WaitForSlave' => $d . 'waitForSlave.php',
 781+
 782+ # Language scripts
 783+ 'AllTrans' => $d . 'language/alltrans.php',
779784 );
780785 }
781786 return self::$mCoreScripts;
Index: branches/maintenance-work/maintenance/findhooks.php
@@ -20,139 +20,147 @@
2121 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public Licence 2.0 or later
2222 */
2323
24 -/** This is a command line script*/
25 -require('commandLine.inc');
26 -# GLOBALS
 24+require_once( "Maintenance.php" );
2725
28 -$doc = $IP . '/docs/hooks.txt';
29 -$pathinc = array(
30 - $IP.'/',
31 - $IP.'/includes/',
32 - $IP.'/includes/api/',
33 - $IP.'/includes/db/',
34 - $IP.'/includes/diff/',
35 - $IP.'/includes/filerepo/',
36 - $IP.'/includes/parser/',
37 - $IP.'/includes/specials/',
38 - $IP.'/languages/',
39 - $IP.'/maintenance/',
40 - $IP.'/skins/',
41 -);
 26+class FindHooks extends Maintenance {
 27+ public function __construct() {
 28+ parent::__construct();
 29+ $this->mDescription = "Find hooks that are undocumented, missing, or just plain wrong";
 30+ $this->addOption( 'online', 'Check against mediawiki.org hook documentation' );
 31+ }
4232
43 -# FUNCTIONS
 33+ public function execute() {
 34+ global $IP;
4435
45 -/**
46 - * @return array of documented hooks
47 - */
48 -function getHooksFromDoc() {
49 - global $doc, $options;
50 - $m = array();
51 - if( isset( $options['online'] ) ){
52 - $content = Http::get( 'http://www.mediawiki.org/w/index.php?title=Manual:Hooks&action=raw' );
53 - preg_match_all( '/\[\[\/([a-zA-Z0-9-_:]+)\|/', $content, $m );
54 - } else {
55 - $content = file_get_contents( $doc );
56 - preg_match_all( "/\n'(.*?)'/", $content, $m );
 36+ $documented = $this->getHooksFromDoc( $IP . '/docs/hooks.txt' );
 37+ $potential = array();
 38+ $bad = array();
 39+ $pathinc = array(
 40+ $IP.'/',
 41+ $IP.'/includes/',
 42+ $IP.'/includes/api/',
 43+ $IP.'/includes/db/',
 44+ $IP.'/includes/diff/',
 45+ $IP.'/includes/filerepo/',
 46+ $IP.'/includes/parser/',
 47+ $IP.'/includes/specials/',
 48+ $IP.'/languages/',
 49+ $IP.'/maintenance/',
 50+ $IP.'/skins/',
 51+ );
 52+
 53+ foreach( $pathinc as $dir ) {
 54+ $potential = array_merge( $potential, $this->getHooksFromPath( $dir ) );
 55+ $bad = array_merge( $bad, $this->getBadHooksFromPath( $dir ) );
 56+ }
 57+
 58+ $potential = array_unique( $potential );
 59+ $bad = array_unique( $bad );
 60+ $todo = array_diff( $potential, $documented );
 61+ $deprecated = array_diff( $documented, $potential );
 62+
 63+ // let's show the results:
 64+ $this->printArray('Undocumented', $todo );
 65+ $this->printArray('Documented and not found', $deprecated );
 66+ $this->printArray('Unclear hook calls', $bad );
 67+
 68+ if ( count( $todo ) == 0 && count( $deprecated ) == 0 && count( $bad ) == 0 )
 69+ $this->output( "Looks good!\n" );
5770 }
58 - return array_unique( $m[1] );
59 -}
6071
61 -/**
62 - * Get hooks from a PHP file
63 - * @param $file Full filename to the PHP file.
64 - * @return array of hooks found.
65 - */
66 -function getHooksFromFile( $file ) {
67 - $content = file_get_contents( $file );
68 - $m = array();
69 - preg_match_all( '/wfRunHooks\(\s*([\'"])(.*?)\1/', $content, $m);
70 - return $m[2];
71 -}
72 -
73 -/**
74 - * Get hooks from the source code.
75 - * @param $path Directory where the include files can be found
76 - * @return array of hooks found.
77 - */
78 -function getHooksFromPath( $path ) {
79 - $hooks = array();
80 - if( $dh = opendir($path) ) {
81 - while(($file = readdir($dh)) !== false) {
82 - if( filetype($path.$file) == 'file' ) {
83 - $hooks = array_merge( $hooks, getHooksFromFile($path.$file) );
 72+ /**
 73+ * Get the hook documentation, either locally or from mediawiki.org
 74+ * @return array of documented hooks
 75+ */
 76+ private function getHooksFromDoc( $doc ) {
 77+ $m = array();
 78+ if( $this->hasOption( 'online' ) ){
 79+ $content = Http::get( 'http://www.mediawiki.org/w/index.php?title=Manual:Hooks&action=raw' );
 80+ preg_match_all( '/\[\[\/([a-zA-Z0-9-_:]+)\|/', $content, $m );
 81+ } else {
 82+ $content = file_get_contents( $doc );
 83+ preg_match_all( "/\n'(.*?)'/", $content, $m );
 84+ }
 85+ return array_unique( $m[1] );
 86+ }
 87+
 88+ /**
 89+ * Get hooks from a PHP file
 90+ * @param $file Full filename to the PHP file.
 91+ * @return array of hooks found.
 92+ */
 93+ private function getHooksFromFile( $file ) {
 94+ $content = file_get_contents( $file );
 95+ $m = array();
 96+ preg_match_all( '/wfRunHooks\(\s*([\'"])(.*?)\1/', $content, $m);
 97+ return $m[2];
 98+ }
 99+
 100+ /**
 101+ * Get hooks from the source code.
 102+ * @param $path Directory where the include files can be found
 103+ * @return array of hooks found.
 104+ */
 105+ private function getHooksFromPath( $path ) {
 106+ $hooks = array();
 107+ if( $dh = opendir($path) ) {
 108+ while(($file = readdir($dh)) !== false) {
 109+ if( filetype($path.$file) == 'file' ) {
 110+ $hooks = array_merge( $hooks, $this->getHooksFromFile($path.$file) );
 111+ }
84112 }
 113+ closedir($dh);
85114 }
86 - closedir($dh);
 115+ return $hooks;
87116 }
88 - return $hooks;
89 -}
90 -
91 -/**
92 - * Get bad hooks (where the hook name could not be determined) from a PHP file
93 - * @param $file Full filename to the PHP file.
94 - * @return array of bad wfRunHooks() lines
95 - */
96 -function getBadHooksFromFile( $file ) {
97 - $content = file_get_contents( $file );
98 - $m = array();
99 - # We want to skip the "function wfRunHooks()" one. :)
100 - preg_match_all( '/(?<!function )wfRunHooks\(\s*[^\s\'"].*/', $content, $m);
101 - $list = array();
102 - foreach( $m[0] as $match ){
103 - $list[] = $match . "(" . $file . ")";
 117+
 118+ /**
 119+ * Get bad hooks (where the hook name could not be determined) from a PHP file
 120+ * @param $file Full filename to the PHP file.
 121+ * @return array of bad wfRunHooks() lines
 122+ */
 123+ private function getBadHooksFromFile( $file ) {
 124+ $content = file_get_contents( $file );
 125+ $m = array();
 126+ # We want to skip the "function wfRunHooks()" one. :)
 127+ preg_match_all( '/(?<!function )wfRunHooks\(\s*[^\s\'"].*/', $content, $m);
 128+ $list = array();
 129+ foreach( $m[0] as $match ){
 130+ $list[] = $match . "(" . $file . ")";
 131+ }
 132+ return $list;
104133 }
105 - return $list;
106 -}
107 -
108 -/**
109 - * Get bad hooks from the source code.
110 - * @param $path Directory where the include files can be found
111 - * @return array of bad wfRunHooks() lines
112 - */
113 -function getBadHooksFromPath( $path ) {
114 - $hooks = array();
115 - if( $dh = opendir($path) ) {
116 - while(($file = readdir($dh)) !== false) {
117 - # We don't want to read this file as it contains bad calls to wfRunHooks()
118 - if( filetype( $path.$file ) == 'file' && !$path.$file == __FILE__ ) {
119 - $hooks = array_merge( $hooks, getBadHooksFromFile($path.$file) );
 134+
 135+ /**
 136+ * Get bad hooks from the source code.
 137+ * @param $path Directory where the include files can be found
 138+ * @return array of bad wfRunHooks() lines
 139+ */
 140+ private function getBadHooksFromPath( $path ) {
 141+ $hooks = array();
 142+ if( $dh = opendir($path) ) {
 143+ while(($file = readdir($dh)) !== false) {
 144+ # We don't want to read this file as it contains bad calls to wfRunHooks()
 145+ if( filetype( $path.$file ) == 'file' && !$path.$file == __FILE__ ) {
 146+ $hooks = array_merge( $hooks, $this->getBadHooksFromFile($path.$file) );
 147+ }
120148 }
 149+ closedir($dh);
121150 }
122 - closedir($dh);
 151+ return $hooks;
123152 }
124 - return $hooks;
 153+
 154+ /**
 155+ * Nicely output the array
 156+ * @param $msg A message to show before the value
 157+ * @param $arr An array
 158+ * @param $sort Boolean : wheter to sort the array (Default: true)
 159+ */
 160+ private function printArray( $msg, $arr, $sort = true ) {
 161+ if($sort) asort($arr);
 162+ foreach($arr as $v) $this->output( "$msg: $v\n" );
 163+ }
125164 }
126165
127 -/**
128 - * Nicely output the array
129 - * @param $msg A message to show before the value
130 - * @param $arr An array
131 - * @param $sort Boolean : wheter to sort the array (Default: true)
132 - */
133 -function printArray( $msg, $arr, $sort = true ) {
134 - if($sort) asort($arr);
135 - foreach($arr as $v) echo "$msg: $v\n";
136 -}
137 -
138 -# MAIN
139 -
140 -$documented = getHooksFromDoc($doc);
141 -$potential = array();
142 -$bad = array();
143 -foreach( $pathinc as $dir ) {
144 - $potential = array_merge( $potential, getHooksFromPath( $dir ) );
145 - $bad = array_merge( $bad, getBadHooksFromPath( $dir ) );
146 -}
147 -
148 -$potential = array_unique( $potential );
149 -$bad = array_unique( $bad );
150 -$todo = array_diff( $potential, $documented );
151 -$deprecated = array_diff( $documented, $potential );
152 -
153 -// let's show the results:
154 -printArray('undocumented', $todo );
155 -printArray('not found', $deprecated );
156 -printArray('unclear hook calls', $bad );
157 -
158 -if ( count( $todo ) == 0 && count( $deprecated ) == 0 && count( $bad ) == 0 )
159 - echo "Looks good!\n";
 166+$maintClass = "FindHooks";
 167+require_once( DO_MAINTENANCE );
Index: branches/maintenance-work/maintenance/language/alltrans.php
@@ -6,11 +6,21 @@
77 * Get all the translations messages, as defined in the English language file.
88 */
99
10 -require_once( dirname(__FILE__).'/../commandLine.inc' );
 10+require_once( dirname(__FILE__) . '/../Maintenance.php' );
1111
12 -$wgEnglishMessages = array_keys( Language::getMessagesFor( 'en' ) );
13 -foreach( $wgEnglishMessages as $key ) {
14 - echo "$key\n";
 12+class AllTrans extends Maintenance {
 13+ public function __construct() {
 14+ parent::__construct();
 15+ $this->mDescription = "Get all messages as defined by the English language file";
 16+ }
 17+
 18+ public function execute() {
 19+ $wgEnglishMessages = array_keys( Language::getMessagesFor( 'en' ) );
 20+ foreach( $wgEnglishMessages as $key ) {
 21+ $this->output( "$key\n" );
 22+ }
 23+ }
1524 }
1625
17 -
 26+$maintClass = "AllTrans";
 27+require_once( DO_MAINTENANCE );
Index: branches/maintenance-work/includes/SiteStats.php
@@ -49,9 +49,7 @@
5050 // clean schema with mwdumper.
5151 wfDebug( __METHOD__ . ": initializing damaged or missing site_stats\n" );
5252
53 - ob_start();
54 - self::init( false );
55 - ob_end_clean();
 53+ SiteStatsInit::doAllAndCommit( wfGetDB( DB_SLAVE ), false );
5654
5755 $row = self::doLoad( wfGetDB( DB_MASTER ) );
5856 }
@@ -174,69 +172,6 @@
175173 }
176174 return true;
177175 }
178 -
179 - /**
180 - * Ported from initStats.inc.
181 - * @param $update bool Whether to update the current stats write fresh
182 - * @param $noViews bool When true, do not update the number of page views
183 - */
184 - public static function init( $update, $noViews = false, $activeUsers = false ) {
185 - $dbr = wfGetDB( DB_SLAVE );
186 -
187 - wfOut( "Counting total edits..." );
188 - $edits = $dbr->selectField( 'revision', 'COUNT(*)', '', __METHOD__ );
189 - $edits += $dbr->selectField( 'archive', 'COUNT(*)', '', __METHOD__ );
190 - wfOut( "{$edits}\nCounting number of articles..." );
191 -
192 - global $wgContentNamespaces;
193 - $good = $dbr->selectField( 'page', 'COUNT(*)', array( 'page_namespace' => $wgContentNamespaces, 'page_is_redirect' => 0, 'page_len > 0' ), __METHOD__ );
194 - wfOut( "{$good}\nCounting total pages..." );
195 -
196 - $pages = $dbr->selectField( 'page', 'COUNT(*)', '', __METHOD__ );
197 - wfOut( "{$pages}\nCounting number of users..." );
198 -
199 - $users = $dbr->selectField( 'user', 'COUNT(*)', '', __METHOD__ );
200 - wfOut( "{$users}\nCounting number of admins..." );
201 -
202 - $admin = $dbr->selectField( 'user_groups', 'COUNT(*)', array( 'ug_group' => 'sysop' ), __METHOD__ );
203 - wfOut( "{$admin}\nCounting number of images..." );
204 -
205 - $image = $dbr->selectField( 'image', 'COUNT(*)', '', __METHOD__ );
206 - wfOut( "{$image}\n" );
207 -
208 - if( !$noViews ) {
209 - wfOut( "Counting total page views..." );
210 - $views = $dbr->selectField( 'page', 'SUM(page_counter)', '', __METHOD__ );
211 - wfOut( "{$views}\n" );
212 - }
213 -
214 - if( $activeUsers ) {
215 - wfOut( "Counting active users..." );
216 - $active = SiteStatsUpdate::cacheUpdate();
217 - wfOut( "{$active}\n" );
218 - }
219 -
220 - wfOut( "\nUpdating site statistics..." );
221 -
222 - $dbw = wfGetDB( DB_MASTER );
223 - $values = array( 'ss_total_edits' => $edits,
224 - 'ss_good_articles' => $good,
225 - 'ss_total_pages' => $pages,
226 - 'ss_users' => $users,
227 - 'ss_admins' => $admin,
228 - 'ss_images' => $image );
229 - $conds = array( 'ss_row_id' => 1 );
230 - $views = array( 'ss_total_views' => isset( $views ) ? $views : 0 );
231 -
232 - if( $update ) {
233 - $dbw->update( 'site_stats', $values, $conds, __METHOD__ );
234 - } else {
235 - $dbw->delete( 'site_stats', $conds, __METHOD__ );
236 - $dbw->insert( 'site_stats', array_merge( $values, $conds, $views ), __METHOD__ );
237 - }
238 -
239 - wfOut( "done.\n" );
240 - }
241176 }
242177
243178
@@ -305,3 +240,146 @@
306241 return $activeUsers;
307242 }
308243 }
 244+
 245+/**
 246+ * Class designed for counting of stats.
 247+ */
 248+class SiteStatsInit {
 249+
 250+ // Db connection
 251+ private $db;
 252+
 253+ // Various stats
 254+ private $mEdits, $mArticles, $mPages, $mUsers, $mViews, $mFiles = 0;
 255+
 256+ /**
 257+ * Constructor
 258+ * @param $useMaster bool Whether to use the master db
 259+ */
 260+ public function __construct( $useMaster = false ) {
 261+ $this->db = wfGetDB( $useMaster ? DB_MASTER : DB_SLAVE );
 262+ }
 263+
 264+ /**
 265+ * Count the total number of edits
 266+ * @return int
 267+ */
 268+ public function edits() {
 269+ $this->mEdits = $this->db->selectField( 'revision', 'COUNT(*)', '', __METHOD__ );
 270+ $this->mEdits += $this->db->selectField( 'archive', 'COUNT(*)', '', __METHOD__ );
 271+ return $this->mEdits;
 272+ }
 273+
 274+ /**
 275+ * Count pages in article space
 276+ * @return int
 277+ */
 278+ public function articles() {
 279+ global $wgContentNamespaces;
 280+ $this->mArticles = $this->db->selectField( 'page', 'COUNT(*)', array( 'page_namespace' => $wgContentNamespaces, 'page_is_redirect' => 0, 'page_len > 0' ), __METHOD__ );
 281+ return $this->mArticles;
 282+ }
 283+
 284+ /**
 285+ * Count total pages
 286+ * @return int
 287+ */
 288+ public function pages() {
 289+ $this->mPages = $this->db->selectField( 'page', 'COUNT(*)', '', __METHOD__ );
 290+ return $this->mPages;
 291+ }
 292+
 293+ /**
 294+ * Count total users
 295+ * @return int
 296+ */
 297+ public function users() {
 298+ $this->mUsers = $this->db->selectField( 'user', 'COUNT(*)', '', __METHOD__ );
 299+ return $this->mUsers;
 300+ }
 301+
 302+ /**
 303+ * Count views
 304+ * @return int
 305+ */
 306+ public function views() {
 307+ $this->mViews = $this->db->selectField( 'page', 'SUM(page_counter)', '', __METHOD__ );
 308+ return $this->mViews;
 309+ }
 310+
 311+ /**
 312+ * Count total files
 313+ * @return int
 314+ */
 315+ public function files() {
 316+ $this->mFiles = $this->db->selectField( 'image', 'COUNT(*)', '', __METHOD__ );
 317+ return $this->mFiles;
 318+ }
 319+
 320+ /**
 321+ * Do all updates and commit them. More or less a replacement
 322+ * for the original initStats, but without the calls to wfOut()
 323+ * @param $update bool Whether to update the current stats or write fresh
 324+ * @param $noViews bool When true, do not update the number of page views
 325+ * @param $activeUsers Whether to update the number of active users
 326+ */
 327+ public static function doAllAndCommit( $update, $noViews = false, $activeUsers = false ) {
 328+ // Grab the object and count everything
 329+ $counter = new InitStats( false );
 330+ $counter->edits();
 331+ $counter->articles();
 332+ $counter->pages();
 333+ $counter->users();
 334+ $counter->files();
 335+
 336+ // Only do views if we don't want to not count them
 337+ if( !$noViews )
 338+ $counter->views();
 339+
 340+ // Update/refresh
 341+ if( $update )
 342+ $counter->update();
 343+ else
 344+ $counter->refresh();
 345+
 346+ // Count active users if need be
 347+ if( $activeUsers )
 348+ SiteStatsUpdate::cacheUpdate( wfGetDB( DB_MASTER ) );
 349+ }
 350+
 351+ /**
 352+ * Update the current row with the selected values
 353+ */
 354+ public function update() {
 355+ list( $values, $conds ) = $this->getDbParams();
 356+ $dbw = wfGetDB( DB_MASTER );
 357+ $dbw->update( 'site_stats', $values, $conds, __METHOD__ );
 358+ }
 359+
 360+ /**
 361+ * Refresh site_stats. Erase the current record and save all
 362+ * the new values.
 363+ */
 364+ public function refresh() {
 365+ list( $values, $conds, $views ) = $this->getDbParams();
 366+ $dbw = wfGetDB( DB_MASTER );
 367+ $dbw->delete( 'site_stats', $conds, __METHOD__ );
 368+ $dbw->insert( 'site_stats', array_merge( $values, $conds, $views ), __METHOD__ );
 369+ }
 370+
 371+ /**
 372+ * Return three arrays of params for the db queries
 373+ * @return array
 374+ */
 375+ private function getDbParams() {
 376+ $values = array( 'ss_total_edits' => $this->mEdits,
 377+ 'ss_good_articles' => $this->mArticles,
 378+ 'ss_total_pages' => $this->mPages,
 379+ 'ss_users' => $this->mUsers,
 380+ 'ss_admins' => SiteStats::numberingroup( 'sysop' ), // @todo make this go away
 381+ 'ss_images' => $this->mFiles );
 382+ $conds = array( 'ss_row_id' => 1 );
 383+ $views = array( 'ss_total_views' => $this->mViews );
 384+ return array( $values, $conds, $views );
 385+ }
 386+}
Index: branches/maintenance-work/includes/AutoLoader.php
@@ -196,6 +196,7 @@
197197 'SearchUpdateMyISAM' => 'includes/SearchUpdate.php',
198198 'SiteConfiguration' => 'includes/SiteConfiguration.php',
199199 'SiteStats' => 'includes/SiteStats.php',
 200+ 'SiteStatsInit' => 'includes/SiteStats.php',
200201 'SiteStatsUpdate' => 'includes/SiteStats.php',
201202 'Skin' => 'includes/Skin.php',
202203 'SkinTemplate' => 'includes/SkinTemplate.php',

Follow-up revisions

RevisionCommit summaryAuthorDate
r88113Rewrote the article counting code and related:...ialex17:11, 14 May 2011

Status & tagging log