* Double-escaping, checkLabel, fixed another label
[mediawiki.git] / maintenance / updateArticleCount.php
blobeda67d8f042a3039a2d8bf8db94ca3bf9cffe945
1 <?php
3 /**
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>
9 */
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" );
19 exit( 0 );
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__ );
32 echo( "done.\n" );
33 } else {
34 echo( "To update the site statistics table, run the script with the --update option.\n" );
36 } else {
37 echo( "failed.\n" );
39 echo( "\n" );