public function execute() { $this->output("Refresh Site Statistics\n\n"); $counter = new SiteStatsInit($this->hasOption('use-master')); $this->output("Counting total edits..."); $edits = $counter->edits(); $this->output("{$edits}\nCounting number of articles..."); $good = $counter->articles(); $this->output("{$good}\nCounting total pages..."); $pages = $counter->pages(); $this->output("{$pages}\nCounting number of users..."); $users = $counter->users(); $this->output("{$users}\nCounting number of images..."); $image = $counter->files(); $this->output("{$image}\n"); if ($this->hasOption('update')) { $this->output("\nUpdating site statistics..."); $counter->refresh(); $this->output("done.\n"); } else { $this->output("\nTo update the site statistics table, run the script " . "with the --update option.\n"); } if ($this->hasOption('active')) { $this->output("\nCounting and updating active users..."); $active = SiteStatsUpdate::cacheUpdate($this->getDB(DB_MASTER)); $this->output("{$active}\n"); } $this->output("\nDone.\n"); }
public function execute() { $this->output("Refresh Site Statistics\n\n"); $counter = new SiteStatsInit($this->hasOption('use-master')); $this->output("Counting total edits..."); $edits = $counter->edits(); $this->output("{$edits}\nCounting number of articles..."); $good = $counter->articles(); $this->output("{$good}\nCounting total pages..."); $pages = $counter->pages(); $this->output("{$pages}\nCounting number of users..."); $users = $counter->users(); $this->output("{$users}\nCounting number of images..."); $image = $counter->files(); $this->output("{$image}\n"); if (!$this->hasOption('noviews')) { $this->output("Counting total page views..."); $views = $counter->views(); $this->output("{$views}\n"); } if ($this->hasOption('active')) { $this->output("Counting active users..."); $active = SiteStatsUpdate::cacheUpdate(); $this->output("{$active}\n"); } $this->output("\nUpdating site statistics..."); if ($this->hasOption('update')) { $counter->update(); } else { $counter->refresh(); } $this->output("done.\n"); }
public function execute($par) { global $wgMemc, $wgDisableCounters, $wgMiserMode; $this->setHeaders(); $this->getOutput()->addModuleStyles('mediawiki.special'); $this->views = SiteStats::views(); $this->edits = SiteStats::edits(); $this->good = SiteStats::articles(); $this->images = SiteStats::images(); $this->total = SiteStats::pages(); $this->users = SiteStats::users(); $this->activeUsers = SiteStats::activeUsers(); $this->hook = ''; # Staticic - views $viewsStats = ''; if (!$wgDisableCounters) { $viewsStats = $this->getViewsStats(); } # Set active user count if (!$wgMiserMode) { $key = wfMemcKey('sitestats', 'activeusers-updated'); // Re-calculate the count if the last tally is old... if (!$wgMemc->get($key)) { $dbw = wfGetDB(DB_MASTER); SiteStatsUpdate::cacheUpdate($dbw); $wgMemc->set($key, '1', 24 * 3600); // don't update for 1 day } } $text = Xml::openElement('table', array('class' => 'wikitable mw-statistics-table')); # Statistic - pages $text .= $this->getPageStats(); # Statistic - edits $text .= $this->getEditStats(); # Statistic - users $text .= $this->getUserStats(); # Statistic - usergroups $text .= $this->getGroupStats(); $text .= $viewsStats; # Statistic - popular pages if (!$wgDisableCounters && !$wgMiserMode) { $text .= $this->getMostViewedPages(); } # Statistic - other $extraStats = array(); if (wfRunHooks('SpecialStatsAddExtra', array(&$extraStats))) { $text .= $this->getOtherStats($extraStats); } $text .= Xml::closeElement('table'); #<Wikia> wfRunHooks("CustomSpecialStatistics", array(&$this, &$text)); #</Wikia> # Customizable footer $footer = wfMessage('statistics-footer'); if (!$footer->isBlank()) { $text .= "\n" . $footer->parse(); } $this->getOutput()->addHTML($text); }
public function execute($par) { global $wgOut, $wgMemc; global $wgDisableCounters, $wgMiserMode; $this->setHeaders(); $this->views = SiteStats::views(); $this->edits = SiteStats::edits(); $this->good = SiteStats::articles(); $this->images = SiteStats::images(); $this->total = SiteStats::pages(); $this->users = SiteStats::users(); $this->activeUsers = SiteStats::activeUsers(); $this->admins = SiteStats::numberingroup('sysop'); $this->hook = ''; # Staticic - views $viewsStats = ''; if (!$wgDisableCounters) { $viewsStats = $this->getViewsStats(); } # Set active user count if (!$wgMiserMode) { $key = wfMemcKey('sitestats', 'activeusers-updated'); // Re-calculate the count if the last tally is old... if (!$wgMemc->get($key)) { $dbw = wfGetDB(DB_MASTER); SiteStatsUpdate::cacheUpdate($dbw); $wgMemc->set($key, '1', 24 * 3600); // don't update for 1 day } } $text = Xml::openElement('table', array('class' => 'wikitable mw-statistics-table')); # Statistic - pages $text .= $this->getPageStats(); # Statistic - edits $text .= $this->getEditStats(); # Statistic - users $text .= $this->getUserStats(); # Statistic - usergroups $text .= $this->getGroupStats(); $text .= $viewsStats; # Statistic - popular pages if (!$wgDisableCounters && !$wgMiserMode) { $text .= $this->getMostViewedPages(); } # Statistic - other $extraStats = array(); if (wfRunHooks('SpecialStatsAddExtra', array(&$extraStats))) { $text .= $this->getOtherStats($extraStats); } $text .= Xml::closeElement('table'); # Customizable footer $footer = wfMsgExt('statistics-footer', array('parseinline')); if (!wfEmptyMsg('statistics-footer', $footer) && $footer != '') { $text .= "\n" . $footer; } $wgOut->addHTML($text); }
public function execute($par) { global $wgOut, $wgRequest, $wgMessageCache; global $wgDisableCounters, $wgMiserMode; $wgMessageCache->loadAllMessages(); $this->setHeaders(); $this->views = SiteStats::views(); $this->edits = SiteStats::edits(); $this->good = SiteStats::articles(); $this->images = SiteStats::images(); $this->total = SiteStats::pages(); $this->users = SiteStats::users(); $this->activeUsers = SiteStats::activeUsers(); $this->admins = SiteStats::numberingroup('sysop'); $this->numJobs = SiteStats::jobs(); # Staticic - views $viewsStats = ''; if (!$wgDisableCounters) { $viewsStats = $this->getViewsStats(); } # Set active user count if (!$wgMiserMode) { $dbw = wfGetDB(DB_MASTER); SiteStatsUpdate::cacheUpdate($dbw); } # Do raw output if ($wgRequest->getVal('action') == 'raw') { $this->doRawOutput(); } $text = Xml::openElement('table', array('class' => 'mw-statistics-table')); # Statistic - pages $text .= $this->getPageStats(); # Statistic - edits $text .= $this->getEditStats(); # Statistic - users $text .= $this->getUserStats(); # Statistic - usergroups $text .= $this->getGroupStats(); $text .= $viewsStats; # Statistic - popular pages if (!$wgDisableCounters && !$wgMiserMode) { $text .= $this->getMostViewedPages(); } $text .= Xml::closeElement('table'); # Customizable footer $footer = wfMsgExt('statistics-footer', array('parseinline')); if (!wfEmptyMsg('statistics-footer', $footer) && $footer != '') { $text .= "\n" . $footer; } $wgOut->addHTML($text); }
public function execute($par) { global $wgMemc; $miserMode = $this->getConfig()->get('MiserMode'); $this->setHeaders(); $this->getOutput()->addModuleStyles('mediawiki.special'); $this->edits = SiteStats::edits(); $this->good = SiteStats::articles(); $this->images = SiteStats::images(); $this->total = SiteStats::pages(); $this->users = SiteStats::users(); $this->activeUsers = SiteStats::activeUsers(); $this->hook = ''; # Set active user count if (!$miserMode) { $key = wfMemcKey('sitestats', 'activeusers-updated'); // Re-calculate the count if the last tally is old... if (!$wgMemc->get($key)) { $dbw = wfGetDB(DB_MASTER); SiteStatsUpdate::cacheUpdate($dbw); $wgMemc->set($key, '1', 24 * 3600); // don't update for 1 day } } $text = Xml::openElement('table', array('class' => 'wikitable mw-statistics-table')); # Statistic - pages $text .= $this->getPageStats(); # Statistic - edits $text .= $this->getEditStats(); # Statistic - users $text .= $this->getUserStats(); # Statistic - usergroups $text .= $this->getGroupStats(); # Statistic - other $extraStats = array(); if (Hooks::run('SpecialStatsAddExtra', array(&$extraStats, $this->getContext()))) { $text .= $this->getOtherStats($extraStats); } $text .= Xml::closeElement('table'); # Customizable footer $footer = $this->msg('statistics-footer'); if (!$footer->isBlank()) { $text .= "\n" . $footer->parse(); } $this->getOutput()->addHTML($text); }
/** * Do all updates and commit them. More or less a replacement * for the original initStats, but without output. * * @param $database DatabaseBase|bool * - Boolean: whether to use the master DB * - DatabaseBase: database connection to use * @param array $options of options, may contain the following values * - update Boolean: whether to update the current stats (true) or write fresh (false) (default: false) * - views Boolean: when true, do not update the number of page views (default: true) * - activeUsers Boolean: whether to update the number of active users (default: false) */ public static function doAllAndCommit($database, array $options = array()) { $options += array('update' => false, 'views' => true, 'activeUsers' => false); // Grab the object and count everything $counter = new SiteStatsInit($database); $counter->edits(); $counter->articles(); $counter->pages(); $counter->users(); $counter->files(); // Only do views if we don't want to not count them if ($options['views']) { $counter->views(); } // Update/refresh if ($options['update']) { $counter->update(); } else { $counter->refresh(); } // Count active users if need be if ($options['activeUsers']) { SiteStatsUpdate::cacheUpdate(wfGetDB(DB_MASTER)); } }
/** * Do all updates and commit them. More or less a replacement * for the original initStats, but without output. * * @param IDatabase|bool $database * - boolean: Whether to use the master DB * - IDatabase: Database connection to use * @param array $options Array of options, may contain the following values * - activeUsers boolean: Whether to update the number of active users (default: false) */ public static function doAllAndCommit($database, array $options = []) { $options += ['update' => false, 'activeUsers' => false]; // Grab the object and count everything $counter = new SiteStatsInit($database); $counter->edits(); $counter->articles(); $counter->pages(); $counter->users(); $counter->files(); $counter->refresh(); // Count active users if need be if ($options['activeUsers']) { SiteStatsUpdate::cacheUpdate(wfGetDB(DB_MASTER)); } }
/** * Do all updates and commit them. More or less a replacement * for the original initStats, but without the calls to wfOut() * @param $update Boolean: whether to update the current stats or write fresh * @param $noViews Boolean: when true, do not update the number of page views * @param $activeUsers Boolean: whether to update the number of active users */ public static function doAllAndCommit($update, $noViews = false, $activeUsers = false) { // Grab the object and count everything $counter = new SiteStatsInit(false); $counter->edits(); $counter->articles(); $counter->pages(); $counter->users(); $counter->files(); // Only do views if we don't want to not count them if (!$noViews) { $counter->views(); } // Update/refresh if ($update) { $counter->update(); } else { $counter->refresh(); } // Count active users if need be if ($activeUsers) { SiteStatsUpdate::cacheUpdate(wfGetDB(DB_MASTER)); } }