31require_once __DIR__ .
'/Maintenance.php';
41 parent::__construct();
42 $this->
addDescription(
'Re-initialise the site statistics tables' );
43 $this->
addOption(
'update',
'Update the existing statistics' );
44 $this->
addOption(
'active',
'Also update active users count' );
45 $this->
addOption(
'use-master',
'Count using the primary database' );
49 $this->
output(
"Refresh Site Statistics\n\n" );
52 $this->
output(
"Counting total edits..." );
53 $edits = $counter->edits();
54 $this->
output(
"{$edits}\nCounting number of articles..." );
56 $good = $counter->articles();
57 $this->
output(
"{$good}\nCounting total pages..." );
59 $pages = $counter->pages();
60 $this->
output(
"{$pages}\nCounting number of users..." );
62 $users = $counter->users();
63 $this->
output(
"{$users}\nCounting number of images..." );
65 $image = $counter->files();
66 $this->
output(
"{$image}\n" );
69 $this->
output(
"\nUpdating site statistics..." );
71 $this->
output(
"done.\n" );
73 $this->
output(
"\nTo update the site statistics table, run the script "
74 .
"with the --update option.\n" );
78 $this->
output(
"\nCounting and updating active users..." );
79 $active = SiteStatsUpdate::cacheUpdate( $this->
getPrimaryDB() );
80 $this->
output(
"{$active}\n" );
83 $this->
output(
"\nDone.\n" );
89require_once RUN_MAINTENANCE_IF_MAIN;
Maintenance script to re-initialise or update the site statistics table.
execute()
Do the actual work.
__construct()
Default constructor.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
output( $out, $channel=null)
Throw some output to the user.
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
hasOption( $name)
Checks to see if a particular option was set.
addDescription( $text)
Set the description text.