コード例 #1
0
 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);
 }
コード例 #2
0
/**
 * Show the special page
 *
 * @param mixed $par (not used)
 */
function wfSpecialStatistics($par = '')
{
    global $wgOut, $wgLang, $wgRequest;
    $dbr = wfGetDB(DB_SLAVE);
    $views = SiteStats::views();
    $edits = SiteStats::edits();
    $good = SiteStats::articles();
    $images = SiteStats::images();
    $total = SiteStats::pages();
    $users = SiteStats::users();
    $admins = SiteStats::admins();
    $numJobs = SiteStats::jobs();
    if ($wgRequest->getVal('action') == 'raw') {
        $wgOut->disable();
        header('Pragma: nocache');
        echo "total={$total};good={$good};views={$views};edits={$edits};users={$users};admins={$admins};images={$images};jobs={$numJobs}\n";
        return;
    } else {
        $text = "__NOTOC__\n";
        $text .= '==' . wfMsg('sitestats') . "==\n";
        $text .= wfMsgExt('sitestatstext', array('parsemag'), $wgLang->formatNum($total), $wgLang->formatNum($good), $wgLang->formatNum($views), $wgLang->formatNum($edits), $wgLang->formatNum(sprintf('%.2f', $total ? $edits / $total : 0)), $wgLang->formatNum(sprintf('%.2f', $edits ? $views / $edits : 0)), $wgLang->formatNum($numJobs), $wgLang->formatNum($images)) . "\n";
        $text .= "==" . wfMsg('userstats') . "==\n";
        $text .= wfMsgExt('userstatstext', array('parsemag'), $wgLang->formatNum($users), $wgLang->formatNum($admins), '[[' . wfMsgForContent('grouppage-sysop') . ']]', $wgLang->formatNum(sprintf('%.2f', $admins / $users * 100)), User::makeGroupLinkWiki('sysop')) . "\n";
        global $wgDisableCounters, $wgMiserMode, $wgUser, $wgLang, $wgContLang;
        if (!$wgDisableCounters && !$wgMiserMode) {
            $res = $dbr->select('page', array('page_namespace', 'page_title', 'page_counter'), array('page_is_redirect' => 0, 'page_counter > 0'), __METHOD__, array('ORDER BY' => 'page_counter DESC', 'LIMIT' => 10));
            if ($res->numRows() > 0) {
                $text .= "==" . wfMsg('statistics-mostpopular') . "==\n";
                while ($row = $res->fetchObject()) {
                    $title = Title::makeTitleSafe($row->page_namespace, $row->page_title);
                    if ($title instanceof Title) {
                        $text .= '* [[:' . $title->getPrefixedText() . ']] (' . $wgLang->formatNum($row->page_counter) . ")\n";
                    }
                }
                $res->free();
            }
        }
        $footer = wfMsg('statistics-footer');
        if (!wfEmptyMsg('statistics-footer', $footer) && $footer != '') {
            $text .= "\n" . $footer;
        }
        $wgOut->addWikiText($text);
    }
}
コード例 #3
0
 protected function appendStatistics($property)
 {
     global $wgDisableCounters;
     $data = array();
     $data['pages'] = intval(SiteStats::pages());
     $data['articles'] = intval(SiteStats::articles());
     if (!$wgDisableCounters) {
         $data['views'] = intval(SiteStats::views());
     }
     $data['edits'] = intval(SiteStats::edits());
     $data['images'] = intval(SiteStats::images());
     $data['users'] = intval(SiteStats::users());
     $data['activeusers'] = intval(SiteStats::activeUsers());
     $data['admins'] = intval(SiteStats::numberingroup('sysop'));
     $data['jobs'] = intval(SiteStats::jobs());
     return $this->getResult()->addValue('query', $property, $data);
 }
コード例 #4
0
 protected function appendStatistics($property)
 {
     global $wgDisableCounters;
     $data = array();
     $data['pages'] = intval(SiteStats::pages());
     $data['articles'] = intval(SiteStats::articles());
     if (!$wgDisableCounters) {
         $data['views'] = intval(SiteStats::views());
     }
     $data['edits'] = intval(SiteStats::edits());
     $data['images'] = intval(SiteStats::images());
     $data['users'] = intval(SiteStats::users());
     $data['activeusers'] = intval(SiteStats::activeUsers());
     $data['admins'] = intval(SiteStats::numberingroup('sysop'));
     $data['jobs'] = intval(SiteStats::jobs());
     // Wikia change begin
     // @author macbre
     wfRunHooks('APIQuerySiteInfoStatistics', array($this, &$data));
     // Wikia change end
     return $this->getResult()->addValue('query', $property, $data);
 }
コード例 #5
0
 protected function appendStatistics($property)
 {
     $data = array();
     $data['pages'] = intval(SiteStats::pages());
     $data['articles'] = intval(SiteStats::articles());
     $data['views'] = intval(SiteStats::views());
     $data['edits'] = intval(SiteStats::edits());
     $data['images'] = intval(SiteStats::images());
     $data['users'] = intval(SiteStats::users());
     $data['admins'] = intval(SiteStats::admins());
     $data['jobs'] = intval(SiteStats::jobs());
     $this->getResult()->addValue('query', $property, $data);
 }
コード例 #6
0
ファイル: SiteStats.php プロジェクト: amjadtbssm/website
 static function jobs()
 {
     if (!isset(self::$jobs)) {
         $dbr = wfGetDB(DB_SLAVE);
         self::$jobs = $dbr->estimateRowCount('job');
         /* Zero rows still do single row read for row that doesn't exist, but people are annoyed by that */
         if (self::$jobs == 1) {
             self::$jobs = 0;
         }
     }
     return self::$jobs;
 }
コード例 #7
0
 protected function appendStatistics($property)
 {
     $data = array();
     $data['pages'] = intval(SiteStats::pages());
     $data['articles'] = intval(SiteStats::articles());
     if (!$this->getConfig()->get('DisableCounters')) {
         $data['views'] = intval(SiteStats::views());
     }
     $data['edits'] = intval(SiteStats::edits());
     $data['images'] = intval(SiteStats::images());
     $data['users'] = intval(SiteStats::users());
     $data['activeusers'] = intval(SiteStats::activeUsers());
     $data['admins'] = intval(SiteStats::numberingroup('sysop'));
     $data['jobs'] = intval(SiteStats::jobs());
     wfRunHooks('APIQuerySiteInfoStatisticsInfo', array(&$data));
     return $this->getResult()->addValue('query', $property, $data);
 }
コード例 #8
0
ファイル: SiteStats.php プロジェクト: Tjorriemorrie/app
 /**
  * @return int
  */
 static function jobs()
 {
     if (!isset(self::$jobs)) {
         // wikia change start, eloy
         global $wgMemc;
         $key = wfMemcKey('SiteStats', 'jobs');
         self::$jobs = $wgMemc->get($key);
         if (!self::$jobs) {
             // wikia change end
             $dbr = wfGetDB(DB_SLAVE);
             self::$jobs = $dbr->estimateRowCount('job');
             /* Zero rows still do single row read for row that doesn't exist, but people are annoyed by that */
             if (self::$jobs == 1) {
                 self::$jobs = 0;
             }
             $wgMemc->set($key, self::$jobs, 3600);
         }
     }
     return self::$jobs;
 }
コード例 #9
0
 public function execute($par)
 {
     global $wgOut, $wgRequest, $wgMessageCache, $wgMemc;
     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();
     $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
         }
     }
     # Do raw output
     if ($wgRequest->getVal('action') == 'raw') {
         $this->doRawOutput();
     }
     $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);
 }
コード例 #10
0
ファイル: SiteStats.php プロジェクト: paladox/mediawiki
 /**
  * @return int
  */
 static function jobs()
 {
     if (!isset(self::$jobs)) {
         try {
             self::$jobs = array_sum(JobQueueGroup::singleton()->getQueueSizes());
         } catch (JobQueueError $e) {
             self::$jobs = 0;
         }
         /**
          * Zero rows still do single row read for row that doesn't exist,
          * but people are annoyed by that
          */
         if (self::$jobs == 1) {
             self::$jobs = 0;
         }
     }
     return self::$jobs;
 }
コード例 #11
0
ファイル: SiteStats.php プロジェクト: soumyag213/mediawiki
 /**
  * @return int
  */
 static function jobs()
 {
     if (!isset(self::$jobs)) {
         $dbr = wfGetDB(DB_SLAVE);
         self::$jobs = array_sum(JobQueueGroup::singleton()->getQueueSizes());
         /**
          * Zero rows still do single row read for row that doesn't exist,
          * but people are annoyed by that
          */
         if (self::$jobs == 1) {
             self::$jobs = 0;
         }
     }
     return self::$jobs;
 }
コード例 #12
0
 protected function appendStatistics($property)
 {
     $data = [];
     $data['pages'] = intval(SiteStats::pages());
     $data['articles'] = intval(SiteStats::articles());
     $data['edits'] = intval(SiteStats::edits());
     $data['images'] = intval(SiteStats::images());
     $data['users'] = intval(SiteStats::users());
     $data['activeusers'] = intval(SiteStats::activeUsers());
     $data['admins'] = intval(SiteStats::numberingroup('sysop'));
     $data['jobs'] = intval(SiteStats::jobs());
     Hooks::run('APIQuerySiteInfoStatisticsInfo', [&$data]);
     return $this->getResult()->addValue('query', $property, $data);
 }