本文整理汇总了PHP中SiteStats::users方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteStats::users方法的具体用法?PHP SiteStats::users怎么用?PHP SiteStats::users使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SiteStats
的用法示例。
在下文中一共展示了SiteStats::users方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute($par)
{
$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 = '';
$text = Xml::openElement('table', ['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 = [];
if (Hooks::run('SpecialStatsAddExtra', [&$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);
}
示例2: 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);
}
示例3: 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);
}
示例4: execute
/**
* Show the special page
*
* @param $par Mixed: parameter passed to the page or null
*/
function execute( $par ) {
global $wgOut, $wgUser;
global $wgOpenIDShowUrlOnUserPage;
global $wgOpenIDTrustEmailAddress;
global $wgOpenIDAllowExistingAccountSelection;
global $wgOpenIDAllowNewAccountname;
global $wgOpenIDUseEmailAsNickname;
global $wgOpenIDProposeUsernameFromSREG;
global $wgOpenIDAllowAutomaticUsername;
global $wgOpenIDOnly;
global $wgOpenIDClientOnly;
global $wgOpenIDAllowServingOpenIDUserAccounts;
global $wgOpenIDShowProviderIcons;
if ( !$this->userCanExecute( $wgUser ) ) {
$this->displayRestrictionError();
return;
}
$totalUsers = SiteStats::users();
$OpenIDdistinctUsers = $this->getOpenIDUsers( 'distinctusers' );
$OpenIDUsers = $this->getOpenIDUsers();
$this->setHeaders();
$this->outputHeader();
$wgOut->addWikiMsg( 'openid-dashboard-introduction', 'http://www.mediawiki.org/wiki/Extension:OpenID' );
$wgOut->addHTML(
Html::openElement( 'table', array( 'style' => 'width:50%;', 'class' => 'mw-openiddashboard-table wikitable' ) )
);
# Here we show some basic version infos. Retrieval of SVN revision number of OpenID appears to be too difficult
$out = $this->show( 'OpenID ' . wfMsg( 'version-software-version' ), MEDIAWIKI_OPENID_VERSION );
$out .= $this->show( 'MediaWiki ' . wfMsg( 'version-software-version' ), SpecialVersion::getVersion() );
$out .= $this->show( '$wgOpenIDOnly', $wgOpenIDOnly );
$out .= $this->show( '$wgOpenIDClientOnly', $wgOpenIDClientOnly );
$out .= $this->show( '$wgOpenIDAllowServingOpenIDUserAccounts', $wgOpenIDAllowServingOpenIDUserAccounts );
$out .= $this->show( '$wgOpenIDTrustEmailAddress', $wgOpenIDTrustEmailAddress );
$out .= $this->show( '$wgOpenIDAllowExistingAccountSelection', $wgOpenIDAllowExistingAccountSelection );
$out .= $this->show( '$wgOpenIDAllowAutomaticUsername', $wgOpenIDAllowAutomaticUsername );
$out .= $this->show( '$wgOpenIDAllowNewAccountname', $wgOpenIDAllowNewAccountname );
$out .= $this->show( '$wgOpenIDUseEmailAsNickname', $wgOpenIDUseEmailAsNickname );
$out .= $this->show( '$wgOpenIDProposeUsernameFromSREG', $wgOpenIDProposeUsernameFromSREG );
$out .= $this->show( '$wgOpenIDShowUrlOnUserPage', $wgOpenIDShowUrlOnUserPage );
$out .= $this->show( '$wgOpenIDShowProviderIcons', $wgOpenIDShowProviderIcons );
$out .= $this->show( wfMsgExt( 'statistics-users', array( 'parseinline' ) ), $totalUsers );
$out .= $this->show( wfMsg( 'openid-dashboard-number-openid-users' ), $OpenIDdistinctUsers );
$out .= $this->show( wfMsg( 'openid-dashboard-number-openids-in-database' ), $OpenIDUsers );
$out .= $this->show( wfMsg( 'openid-dashboard-number-users-without-openid' ), $totalUsers - $OpenIDdistinctUsers );
$wgOut->addHTML( $out . Html::closeElement( 'table' ) . "\n" );
}
示例5: wfSpecialStatistics
/**
* constructor
*/
function wfSpecialStatistics()
{
global $wgOut, $wgLang, $wgRequest;
$fname = 'wfSpecialStatistics';
$action = $wgRequest->getVal('action');
$dbr = wfGetDB(DB_SLAVE);
$views = SiteStats::views();
$edits = SiteStats::edits();
$good = SiteStats::articles();
$images = SiteStats::images();
$total = SiteStats::pages();
$users = SiteStats::users();
$admins = $dbr->selectField('user_groups', 'COUNT(*)', array('ug_group' => 'sysop'), $fname);
$numJobs = $dbr->estimateRowCount('job');
if ($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 = '==' . 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));
$text .= "\n==" . 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'));
$wgOut->addWikiText($text);
global $wgDisableCounters, $wgMiserMode, $wgUser, $wgLang, $wgContLang;
if (!$wgDisableCounters && !$wgMiserMode) {
$page = $dbr->tableName('page');
$sql = "SELECT page_namespace, page_title, page_counter FROM {$page} WHERE page_is_redirect = 0 AND page_counter > 0 ORDER BY page_counter DESC";
$sql = $dbr->limitResult($sql, 10, 0);
$res = $dbr->query($sql, $fname);
if ($res) {
$wgOut->addHtml('<h2>' . wfMsgHtml('statistics-mostpopular') . '</h2>');
$skin = $wgUser->getSkin();
$wgOut->addHtml('<ol>');
while ($row = $dbr->fetchObject($res)) {
// BizzWiki begin {{
if (!$wgUser->isAllowed('browse', $row->page_namespace)) {
continue;
}
// BizzWiki end }}
$link = $skin->makeKnownLinkObj(Title::makeTitleSafe($row->page_namespace, $row->page_title));
$dirmark = $wgContLang->getDirMark();
$wgOut->addHtml('<li>' . $link . $dirmark . ' [' . $wgLang->formatNum($row->page_counter) . ']</li>');
}
$wgOut->addHtml('</ol>');
$dbr->freeResult($res);
}
}
$footer = wfMsg('statistics-footer');
if (!wfEmptyMsg('statistics-footer', $footer) && $footer != '') {
$wgOut->addWikiText($footer);
}
}
}
示例6: 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);
}
示例7: 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);
}
示例8: 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);
}
}
示例9: register
function register()
{
global $wgContLang, $wgNamespaceAliases, $wgDisableCounters;
$lib = array('getNsIndex' => array($this, 'getNsIndex'), 'pagesInCategory' => array($this, 'pagesInCategory'), 'pagesInNamespace' => array($this, 'pagesInNamespace'), 'usersInGroup' => array($this, 'usersInGroup'), 'interwikiMap' => array($this, 'interwikiMap'));
$info = array('siteName' => $GLOBALS['wgSitename'], 'server' => $GLOBALS['wgServer'], 'scriptPath' => $GLOBALS['wgScriptPath'], 'stylePath' => $GLOBALS['wgStylePath'], 'currentVersion' => SpecialVersion::getVersion());
if (!self::$namespacesCache || self::$namespacesCacheLang !== $wgContLang->getCode()) {
$namespaces = array();
$namespacesByName = array();
foreach ($wgContLang->getFormattedNamespaces() as $ns => $title) {
$canonical = MWNamespace::getCanonicalName($ns);
$namespaces[$ns] = array('id' => $ns, 'name' => $title, 'canonicalName' => strtr($canonical, '_', ' '), 'hasSubpages' => MWNamespace::hasSubpages($ns), 'hasGenderDistinction' => MWNamespace::hasGenderDistinction($ns), 'isCapitalized' => MWNamespace::isCapitalized($ns), 'isContent' => MWNamespace::isContent($ns), 'isIncludable' => !MWNamespace::isNonincludable($ns), 'isMovable' => MWNamespace::isMovable($ns), 'isSubject' => MWNamespace::isSubject($ns), 'isTalk' => MWNamespace::isTalk($ns), 'defaultContentModel' => MWNamespace::getNamespaceContentModel($ns), 'aliases' => array());
if ($ns >= NS_MAIN) {
$namespaces[$ns]['subject'] = MWNamespace::getSubject($ns);
$namespaces[$ns]['talk'] = MWNamespace::getTalk($ns);
$namespaces[$ns]['associated'] = MWNamespace::getAssociated($ns);
} else {
$namespaces[$ns]['subject'] = $ns;
}
$namespacesByName[strtr($title, ' ', '_')] = $ns;
if ($canonical) {
$namespacesByName[$canonical] = $ns;
}
}
$aliases = array_merge($wgNamespaceAliases, $wgContLang->getNamespaceAliases());
foreach ($aliases as $title => $ns) {
if (!isset($namespacesByName[$title]) && isset($namespaces[$ns])) {
$ct = count($namespaces[$ns]['aliases']);
$namespaces[$ns]['aliases'][$ct + 1] = $title;
$namespacesByName[$title] = $ns;
}
}
$namespaces[NS_MAIN]['displayName'] = wfMessage('blanknamespace')->inContentLanguage()->text();
self::$namespacesCache = $namespaces;
self::$namespacesCacheLang = $wgContLang->getCode();
}
$info['namespaces'] = self::$namespacesCache;
$info['stats'] = array('pages' => (int) SiteStats::pages(), 'articles' => (int) SiteStats::articles(), 'files' => (int) SiteStats::images(), 'edits' => (int) SiteStats::edits(), 'views' => $wgDisableCounters ? null : (int) SiteStats::views(), 'users' => (int) SiteStats::users(), 'activeUsers' => (int) SiteStats::activeUsers(), 'admins' => (int) SiteStats::numberingroup('sysop'));
return $this->getEngine()->registerInterface('mw.site.lua', $lib, $info);
}
示例10: printWikiInfo
/**
* Print basic information about this site.
*/
public function printWikiInfo()
{
global $wgSitename, $wgLanguageCode;
$this->prepareSerialization();
$this->delay_flush = 35;
// don't do intermediate flushes with default parameters
// assemble export data:
$expData = new SMWExpData(new SMWExpResource('&wiki;#wiki'));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('rdf', 'type'), new SMWExpData(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'Wikisite')));
// basic wiki information
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('rdfs', 'label'), new SMWExpLiteral($wgSitename));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'siteName'), new SMWExpLiteral($wgSitename, 'http://www.w3.org/2001/XMLSchema#string'));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'pagePrefix'), new SMWExpLiteral(SMWExporter::getInstance()->expandURI('&wikiurl;'), 'http://www.w3.org/2001/XMLSchema#string'));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'smwVersion'), new SMWExpLiteral(SMW_VERSION, 'http://www.w3.org/2001/XMLSchema#string'));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'langCode'), new SMWExpLiteral($wgLanguageCode, 'http://www.w3.org/2001/XMLSchema#string'));
$mainpage = Title::newMainPage();
if (!is_null($mainpage)) {
$ed = new SMWExpData(new SMWExpResource($mainpage->getFullURL()));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'mainPage'), $ed);
}
// statistical information
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'pageCount'), new SMWExpLiteral(SiteStats::pages(), 'http://www.w3.org/2001/XMLSchema#int'));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'contentPageCount'), new SMWExpLiteral(SiteStats::articles(), 'http://www.w3.org/2001/XMLSchema#int'));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'mediaCount'), new SMWExpLiteral(SiteStats::images(), 'http://www.w3.org/2001/XMLSchema#int'));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'editCount'), new SMWExpLiteral(SiteStats::edits(), 'http://www.w3.org/2001/XMLSchema#int'));
// SiteStats::views was deprecated in MediaWiki 1.25
// "Stop calling this function, it will be removed some time in the future"
//$expData->addPropertyObjectValue(
// SMWExporter::getInstance()->getSpecialNsResource( 'swivt', 'viewCount' ),
// new SMWExpLiteral( SiteStats::views(), 'http://www.w3.org/2001/XMLSchema#int' )
//);
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'userCount'), new SMWExpLiteral(SiteStats::users(), 'http://www.w3.org/2001/XMLSchema#int'));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('swivt', 'adminCount'), new SMWExpLiteral(SiteStats::numberingroup('sysop'), 'http://www.w3.org/2001/XMLSchema#int'));
$this->serializer->startSerialization();
$this->serializer->serializeExpData(SMWExporter::getInstance()->getOntologyExpData(''));
$this->serializer->serializeExpData($expData);
// link to list of existing pages:
if (strpos(SMWExporter::getInstance()->expandURI('&wikiurl;'), '?') === false) {
// check whether we have title as a first parameter or in URL
$nexturl = SMWExporter::getInstance()->expandURI('&export;?offset=0');
} else {
$nexturl = SMWExporter::getInstance()->expandURI('&export;&offset=0');
}
$expData = new SMWExpData(new SMWExpResource($nexturl));
$ed = new SMWExpData(SMWExporter::getInstance()->getSpecialNsResource('owl', 'Thing'));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('rdf', 'type'), $ed);
$ed = new SMWExpData(new SMWExpResource($nexturl));
$expData->addPropertyObjectValue(SMWExporter::getInstance()->getSpecialNsResource('rdfs', 'isDefinedBy'), $ed);
$this->serializer->serializeExpData($expData);
$this->serializer->finishSerialization();
$this->flush(true);
}
示例11: numberofusers
public static function numberofusers($parser, $raw = null)
{
return self::formatRaw(SiteStats::users(), $raw);
}
示例12: appendUserGroups
protected function appendUserGroups($property, $numberInGroup)
{
global $wgGroupPermissions, $wgAddGroups, $wgRemoveGroups, $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf;
$data = array();
$result = $this->getResult();
foreach ($wgGroupPermissions as $group => $permissions) {
$arr = array('name' => $group, 'rights' => array_keys($permissions, true));
if ($numberInGroup) {
global $wgAutopromote;
if ($group == 'user') {
$arr['number'] = SiteStats::users();
// '*' and autopromote groups have no size
} elseif ($group !== '*' && !isset($wgAutopromote[$group])) {
$arr['number'] = SiteStats::numberInGroup($group);
}
}
$groupArr = array('add' => $wgAddGroups, 'remove' => $wgRemoveGroups, 'add-self' => $wgGroupsAddToSelf, 'remove-self' => $wgGroupsRemoveFromSelf);
foreach ($groupArr as $type => $rights) {
if (isset($rights[$group])) {
$arr[$type] = $rights[$group];
$result->setIndexedTagName($arr[$type], 'group');
}
}
$result->setIndexedTagName($arr['rights'], 'permission');
$data[] = $arr;
}
$result->setIndexedTagName($data, 'group');
return $result->addValue('query', $property, $data);
}
示例13: wfQueriesMustScale
/**
* Should low-performance queries be disabled?
*
* @return bool
* @codeCoverageIgnore
*/
function wfQueriesMustScale()
{
global $wgMiserMode;
return $wgMiserMode || SiteStats::pages() > 100000 && SiteStats::edits() > 1000000 && SiteStats::users() > 10000;
}
示例14: getVariableValue
//.........这里部分代码省略.........
break;
case 'currenttime':
$value = $pageLang->time(wfTimestamp(TS_MW, $ts), false, false);
break;
case 'currenthour':
$value = $pageLang->formatNum(MWTimestamp::getInstance($ts)->format('H'), true);
break;
case 'currentweek':
# @bug 4594 PHP5 has it zero padded, PHP4 does not, cast to
# int to remove the padding
$value = $pageLang->formatNum((int) MWTimestamp::getInstance($ts)->format('W'));
break;
case 'currentdow':
$value = $pageLang->formatNum(MWTimestamp::getInstance($ts)->format('w'));
break;
case 'localdayname':
$value = $pageLang->getWeekdayName((int) MWTimestamp::getLocalInstance($ts)->format('w') + 1);
break;
case 'localyear':
$value = $pageLang->formatNum(MWTimestamp::getLocalInstance($ts)->format('Y'), true);
break;
case 'localtime':
$value = $pageLang->time(MWTimestamp::getLocalInstance($ts)->format('YmdHis'), false, false);
break;
case 'localhour':
$value = $pageLang->formatNum(MWTimestamp::getLocalInstance($ts)->format('H'), true);
break;
case 'localweek':
# @bug 4594 PHP5 has it zero padded, PHP4 does not, cast to
# int to remove the padding
$value = $pageLang->formatNum((int) MWTimestamp::getLocalInstance($ts)->format('W'));
break;
case 'localdow':
$value = $pageLang->formatNum(MWTimestamp::getLocalInstance($ts)->format('w'));
break;
case 'numberofarticles':
$value = $pageLang->formatNum(SiteStats::articles());
break;
case 'numberoffiles':
$value = $pageLang->formatNum(SiteStats::images());
break;
case 'numberofusers':
$value = $pageLang->formatNum(SiteStats::users());
break;
case 'numberofactiveusers':
$value = $pageLang->formatNum(SiteStats::activeUsers());
break;
case 'numberofpages':
$value = $pageLang->formatNum(SiteStats::pages());
break;
case 'numberofadmins':
$value = $pageLang->formatNum(SiteStats::numberingroup('sysop'));
break;
case 'numberofedits':
$value = $pageLang->formatNum(SiteStats::edits());
break;
case 'numberofviews':
global $wgDisableCounters;
$value = !$wgDisableCounters ? $pageLang->formatNum(SiteStats::views()) : '';
break;
case 'currenttimestamp':
$value = wfTimestamp(TS_MW, $ts);
break;
case 'localtimestamp':
$value = MWTimestamp::getLocalInstance($ts)->format('YmdHis');
break;
case 'currentversion':
$value = SpecialVersion::getVersion();
break;
case 'articlepath':
return $wgArticlePath;
case 'sitename':
return $wgSitename;
case 'server':
return $wgServer;
case 'servername':
$serverParts = wfParseUrl($wgServer);
return $serverParts && isset($serverParts['host']) ? $serverParts['host'] : $wgServer;
case 'scriptpath':
return $wgScriptPath;
case 'stylepath':
return $wgStylePath;
case 'directionmark':
return $pageLang->getDirMark();
case 'contentlanguage':
global $wgLanguageCode;
return $wgLanguageCode;
case 'cascadingsources':
$value = CoreParserFunctions::cascadingsources($this);
break;
default:
$ret = null;
wfRunHooks('ParserGetVariableValueSwitch', array(&$this, &$this->mVarCache, &$index, &$ret, &$frame));
return $ret;
}
if ($index) {
$this->mVarCache[$index] = $value;
}
return $value;
}
示例15: getVariableValue
//.........这里部分代码省略.........
$value = $pageLang->formatNum(gmdate('Y', $ts), true);
break;
case 'currenttime':
$value = $pageLang->time(wfTimestamp(TS_MW, $ts), false, false);
break;
case 'currenthour':
$value = $pageLang->formatNum(gmdate('H', $ts), true);
break;
case 'currentweek':
# @bug 4594 PHP5 has it zero padded, PHP4 does not, cast to
# int to remove the padding
$value = $pageLang->formatNum((int) gmdate('W', $ts));
break;
case 'currentdow':
$value = $pageLang->formatNum(gmdate('w', $ts));
break;
case 'localdayname':
$value = $pageLang->getWeekdayName($localDayOfWeek + 1);
break;
case 'localyear':
$value = $pageLang->formatNum($localYear, true);
break;
case 'localtime':
$value = $pageLang->time($localTimestamp, false, false);
break;
case 'localhour':
$value = $pageLang->formatNum($localHour, true);
break;
case 'localweek':
# @bug 4594 PHP5 has it zero padded, PHP4 does not, cast to
# int to remove the padding
$value = $pageLang->formatNum((int) $localWeek);
break;
case 'localdow':
$value = $pageLang->formatNum($localDayOfWeek);
break;
case 'numberofarticles':
$value = $pageLang->formatNum(SiteStats::articles());
break;
case 'numberoffiles':
$value = $pageLang->formatNum(SiteStats::images());
break;
case 'numberofusers':
$value = $pageLang->formatNum(SiteStats::users());
break;
case 'numberofactiveusers':
$value = $pageLang->formatNum(SiteStats::activeUsers());
break;
case 'numberofpages':
$value = $pageLang->formatNum(SiteStats::pages());
break;
case 'numberofadmins':
$value = $pageLang->formatNum(SiteStats::numberingroup('sysop'));
break;
case 'numberofedits':
$value = $pageLang->formatNum(SiteStats::edits());
break;
case 'numberofviews':
$value = $pageLang->formatNum(SiteStats::views());
break;
case 'currenttimestamp':
$value = wfTimestamp(TS_MW, $ts);
break;
case 'localtimestamp':
$value = $localTimestamp;
break;
case 'currentversion':
$value = SpecialVersion::getVersion();
break;
case 'articlepath':
return $wgArticlePath;
case 'sitename':
return $wgSitename;
case 'server':
return $wgServer;
case 'servername':
$serverParts = wfParseUrl($wgServer);
return $serverParts && isset($serverParts['host']) ? $serverParts['host'] : $wgServer;
case 'scriptpath':
return $wgScriptPath;
case 'stylepath':
return $wgStylePath;
case 'directionmark':
return $pageLang->getDirMark();
case 'contentlanguage':
global $wgLanguageCode;
return $wgLanguageCode;
default:
$ret = null;
if (wfRunHooks('ParserGetVariableValueSwitch', array(&$this, &$this->mVarCache, &$index, &$ret, &$frame))) {
return $ret;
} else {
return null;
}
}
if ($index) {
$this->mVarCache[$index] = $value;
}
return $value;
}