4 * Maintenance script to provide a better count of the number of articles
5 * and update the site statistics table, if desired
7 * @addtogroup Maintenance
8 * @author Rob Church <robchur@gmail.com>
11 $options = array( 'update', 'help' );
12 require_once( 'commandLine.inc' );
13 require_once( 'updateArticleCount.inc.php' );
14 echo( "Update Article Count\n\n" );
16 if( isset( $options['help'] ) && $options['help'] ) {
17 echo( "Usage: php updateArticleCount.php [--update]\n\n" );
18 echo( "--update : Update site statistics table\n" );
22 echo( "Counting articles..." );
23 $counter = new ArticleCounter();
24 $result = $counter->count();
26 if( $result !== false ) {
27 echo( "found {$result}.\n" );
28 if( isset( $options['update'] ) && $options['update'] ) {
29 echo( "Updating site statistics table... " );
30 $dbw = wfGetDB( DB_MASTER
);
31 $dbw->update( 'site_stats', array( 'ss_good_articles' => $result ), array( 'ss_row_id' => 1 ), __METHOD__
);
34 echo( "To update the site statistics table, run the script with the --update option.\n" );