* Convert "$dbw =& wfGetDB( DB_MASTER );" --> "$dbw = wfGetDB( DB_MASTER );" * convert "$skin =& $wgUser->getSkin();" --> "$skin = $wgUser->getSkin();" For the time being have not changed the function definitions of wfGetDB() or User::getSkin() [i.e. they are still both return-by-ref], so as to ensure the interface does not change for extensions [some of which may still be trying to run on PHP4 environments]. However presumably at some point this can be changed too. Also includes tiny tweak to newlines in parserTests - will show 1 rather than 2 newlines between the "Reading tests from" strings when in quiet mode.
41 lines
No EOL
1.1 KiB
PHP
41 lines
No EOL
1.1 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Maintenance script to provide a better count of the number of articles
|
|
* and update the site statistics table, if desired
|
|
*
|
|
* @addtogroup Maintenance
|
|
* @author Rob Church <robchur@gmail.com>
|
|
*/
|
|
|
|
$options = array( 'update', 'help' );
|
|
require_once( 'commandLine.inc' );
|
|
require_once( 'updateArticleCount.inc.php' );
|
|
echo( "Update Article Count\n\n" );
|
|
|
|
if( isset( $options['help'] ) && $options['help'] ) {
|
|
echo( "Usage: php updateArticleCount.php [--update]\n\n" );
|
|
echo( "--update : Update site statistics table\n" );
|
|
exit( 0 );
|
|
}
|
|
|
|
echo( "Counting articles..." );
|
|
$counter = new ArticleCounter();
|
|
$result = $counter->count();
|
|
|
|
if( $result !== false ) {
|
|
echo( "found {$result}.\n" );
|
|
if( isset( $options['update'] ) && $options['update'] ) {
|
|
echo( "Updating site statistics table... " );
|
|
$dbw = wfGetDB( DB_MASTER );
|
|
$dbw->update( 'site_stats', array( 'ss_good_articles' => $result ), array( 'ss_row_id' => 1 ), __METHOD__ );
|
|
echo( "done.\n" );
|
|
} else {
|
|
echo( "To update the site statistics table, run the script with the --update option.\n" );
|
|
}
|
|
} else {
|
|
echo( "failed.\n" );
|
|
}
|
|
echo( "\n" );
|
|
|
|
?>
|