当前位置: 首页>>代码示例>>PHP>>正文


PHP SiteStatsUpdate::cacheUpdate方法代码示例

本文整理汇总了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");
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:29,代码来源:initSiteStats.php

示例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");
 }
开发者ID:rocLv,项目名称:conference,代码行数:33,代码来源:initStats.php

示例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);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:59,代码来源:SpecialStatistics.php

示例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);
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:57,代码来源:SpecialStatistics.php

示例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);
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:51,代码来源:SpecialStatistics.php

示例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);
 }
开发者ID:D66Ha,项目名称:mediawiki,代码行数:46,代码来源:SpecialStatistics.php

示例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));
     }
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:37,代码来源:SiteStats.php

示例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));
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:26,代码来源:SiteStats.php

示例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));
     }
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:31,代码来源:SiteStats.php


注:本文中的SiteStatsUpdate::cacheUpdate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。