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