本文整理汇总了PHP中SiteStatsUpdate::cacheUpdate方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteStatsUpdate::cacheUpdate方法的具体用法?PHP SiteStatsUpdate::cacheUpdate怎么用?PHP SiteStatsUpdate::cacheUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SiteStatsUpdate
的用法示例。
在下文中一共展示了SiteStatsUpdate::cacheUpdate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
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");
}
示例2: execute
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");
}
示例3: execute
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);
}
示例4: execute
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);
}
示例5: execute
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);
}
示例6: execute
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);
}
示例7: doAllAndCommit
/**
* 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));
}
}
示例8: doAllAndCommit
/**
* 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));
}
}
示例9: doAllAndCommit
/**
* 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));
}
}