17require_once __DIR__ .
'/Maintenance.php';
27 parent::__construct();
28 $this->
addDescription(
'Re-initialise the site statistics tables' );
29 $this->
addOption(
'update',
'Update the existing statistics' );
30 $this->
addOption(
'active',
'Also update active users count' );
31 $this->
addOption(
'use-master',
'Count using the primary database' );
35 $this->
output(
"Refresh Site Statistics\n\n" );
38 $this->
output(
"Counting total edits..." );
39 $edits = $counter->edits();
40 $this->
output(
"{$edits}\nCounting number of articles..." );
42 $good = $counter->articles();
43 $this->
output(
"{$good}\nCounting total pages..." );
45 $pages = $counter->pages();
46 $this->
output(
"{$pages}\nCounting number of users..." );
48 $users = $counter->users();
49 $this->
output(
"{$users}\nCounting number of images..." );
51 $image = $counter->files();
52 $this->
output(
"{$image}\n" );
55 $this->
output(
"\nUpdating site statistics..." );
57 $this->
output(
"done.\n" );
59 $this->
output(
"\nTo update the site statistics table, run the script "
60 .
"with the --update option.\n" );
64 $this->
output(
"\nCounting and updating active users..." );
65 $active = SiteStatsUpdate::cacheUpdate( $this->
getPrimaryDB() );
66 $this->
output(
"{$active}\n" );
69 $this->
output(
"\nDone.\n" );
75require_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.
getPrimaryDB(string|false $virtualDomain=false)
addDescription( $text)
Set the description text.