本文整理汇总了PHP中SpecialVersion::getVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP SpecialVersion::getVersion方法的具体用法?PHP SpecialVersion::getVersion怎么用?PHP SpecialVersion::getVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpecialVersion
的用法示例。
在下文中一共展示了SpecialVersion::getVersion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param $main ApiMain
* @param $action string
*/
public function __construct($main, $action)
{
parent::__construct($main, $action);
// Allow custom modules to be added in LocalSettings.php
global $wgAPIPropModules, $wgAPIListModules, $wgAPIMetaModules, $wgMemc, $wgAPICacheHelpTimeout;
self::appendUserModules($this->mQueryPropModules, $wgAPIPropModules);
self::appendUserModules($this->mQueryListModules, $wgAPIListModules);
self::appendUserModules($this->mQueryMetaModules, $wgAPIMetaModules);
$this->mPropModuleNames = array_keys($this->mQueryPropModules);
$this->mListModuleNames = array_keys($this->mQueryListModules);
$this->mMetaModuleNames = array_keys($this->mQueryMetaModules);
// Get array of query generators from cache if present
$key = wfMemcKey('apiquerygenerators', SpecialVersion::getVersion('nodb'));
if ($wgAPICacheHelpTimeout > 0) {
$cached = $wgMemc->get($key);
if ($cached) {
$this->mAllowedGenerators = $cached;
return;
}
}
$this->makeGeneratorList($this->mQueryPropModules);
$this->makeGeneratorList($this->mQueryListModules);
if ($wgAPICacheHelpTimeout > 0) {
$wgMemc->set($key, $this->mAllowedGenerators, $wgAPICacheHelpTimeout);
}
}
示例2: heading
function heading()
{
$version = SpecialVersion::getVersion('nodb');
echo "'''Statistics are based on:''' <code>" . $version . "</code>\n\n";
echo "'''Note:''' These statistics can be generated by running <code>php maintenance/language/transstat.php</code>.\n\n";
echo "For additional information on specific languages (the message names, the actual problems, etc.), run <code>php maintenance/language/checkLanguage.php --lang=foo</code>.\n\n";
echo '{| class="sortable wikitable" border="2" cellpadding="4" cellspacing="0" style="background-color: #F9F9F9; border: 1px #AAAAAA solid; border-collapse: collapse; clear:both;" width="100%"' . "\n";
}
示例3: heading
function heading()
{
global $wgDummyLanguageCodes;
$version = SpecialVersion::getVersion('nodb');
echo "'''Statistics are based on:''' <code>" . $version . "</code>\n\n";
echo "'''Note:''' These statistics can be generated by running " . "<code>php maintenance/language/transstat.php</code>.\n\n";
echo "For additional information on specific languages (the message names, the actual " . "problems, etc.), run <code>php maintenance/language/checkLanguage.php --lang=foo</code>.\n\n";
echo 'English (en) is excluded because it is the default localization';
if (is_array($wgDummyLanguageCodes)) {
$dummyCodes = array();
foreach ($wgDummyLanguageCodes as $dummyCode => $correctCode) {
$dummyCodes[] = Language::fetchLanguageName($dummyCode) . ' (' . $dummyCode . ')';
}
echo ', as well as the following languages that are not intended for ' . 'system message translations, usually because they redirect to other ' . 'language codes: ' . implode(', ', $dummyCodes);
}
echo ".\n\n";
# dot to end sentence
echo '{| class="sortable wikitable" border="2" style="background-color: #F9F9F9; ' . 'border: 1px #AAAAAA solid; border-collapse: collapse; clear:both; width:100%;"' . "\n";
}
示例4: register
function register()
{
global $wgContLang, $wgNamespaceAliases, $wgNonincludableNamespaces;
$lib = array('loadSiteStats' => array($this, 'loadSiteStats'), 'getNsIndex' => array($this, 'getNsIndex'), 'pagesInCategory' => array($this, 'pagesInCategory'), 'pagesInNamespace' => array($this, 'pagesInNamespace'), 'usersInGroup' => array($this, 'usersInGroup'));
$info = array('siteName' => $GLOBALS['wgSitename'], 'server' => $GLOBALS['wgServer'], 'scriptPath' => $GLOBALS['wgScriptPath'], 'stylePath' => $GLOBALS['wgStylePath'], 'currentVersion' => SpecialVersion::getVersion());
if (!self::$namespacesCache) {
$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' => !($wgNonincludableNamespaces && in_array($ns, $wgNonincludableNamespaces)), 'isMovable' => MWNamespace::isMovable($ns), 'isSubject' => MWNamespace::isSubject($ns), 'isTalk' => MWNamespace::isTalk($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])) {
$ct = count($namespaces[$ns]['aliases']);
$namespaces[$ns]['aliases'][$ct + 1] = $title;
$namespacesByName[$title] = $ns;
}
}
$namespaces[NS_MAIN]['displayName'] = wfMessage('blanknamespace')->text();
self::$namespacesCache = $namespaces;
}
$info['namespaces'] = self::$namespacesCache;
if (self::$siteStatsLoaded) {
$stats = $this->loadSiteStats();
$info['stats'] = $stats[0];
}
$this->getEngine()->registerInterface('mw.site.lua', $lib, $info);
}
示例5: 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);
}
示例6: getVersion
/**
* Returns the version information of this file, plus it includes
* the versions for all files that are not callable proper API modules
*/
public function getVersion()
{
$vers = array();
$vers[] = 'MediaWiki: ' . SpecialVersion::getVersion() . "\n http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/";
$vers[] = __CLASS__ . ': $Id: ApiMain.php 76196 2010-11-06 16:11:19Z reedy $';
$vers[] = ApiBase::getBaseVersion();
$vers[] = ApiFormatBase::getBaseVersion();
$vers[] = ApiQueryBase::getBaseVersion();
return $vers;
}
示例7: tests
--run-disabled run disabled tests
--run-parsoid run parsoid tests (normally disabled)
ENDS;
exit(0);
}
# Cases of weird db corruption were encountered when running tests on earlyish
# versions of SQLite
if ($wgDBtype == 'sqlite') {
$db = wfGetDB(DB_MASTER);
$version = $db->getServerVersion();
if (version_compare($version, '3.6') < 0) {
die("Parser tests require SQLite version 3.6 or later, you have {$version}\n");
}
}
$tester = new ParserTest($options);
if (isset($options['file'])) {
$files = array($options['file']);
} else {
// Default parser tests and any set from extensions or local config
$files = $wgParserTestFiles;
}
# Print out software version to assist with locating regressions
$version = SpecialVersion::getVersion('nodb');
echo "This is MediaWiki version {$version}.\n\n";
if (isset($options['fuzz'])) {
$tester->fuzzTest($files);
} else {
$ok = $tester->runTestsFromFiles($files);
exit($ok ? 0 : 1);
}
示例8: getVersion
/**
* Returns the version information of this file, plus it includes
* the versions for all files that are not callable proper API modules
*/
public function getVersion()
{
$vers = array();
$vers[] = 'MediaWiki ' . SpecialVersion::getVersion();
$vers[] = __CLASS__ . ': $Id: ApiMain.php 24494 2007-07-31 17:53:37Z yurik $';
$vers[] = ApiBase::getBaseVersion();
$vers[] = ApiFormatBase::getBaseVersion();
$vers[] = ApiQueryBase::getBaseVersion();
$vers[] = ApiFormatFeedWrapper::getVersion();
// not accessible with format=xxx
return $vers;
}
示例9: outputWiki
/**
* Globals: $wgContLang, $IP
*/
function outputWiki()
{
global $wgContLang, $IP;
$detailText = '';
$rows[] = '! Language !! Code !! Total !! ' . implode(' !! ', $this->checks);
foreach ($this->results as $code => $results) {
$detailTextForLang = "=={$code}==\n";
$numbers = array();
$problems = 0;
$detailTextForLangChecks = array();
foreach ($results as $check => $messages) {
$count = count($messages);
if ($count) {
$problems += $count;
$messageDetails = array();
foreach ($messages as $key => $details) {
$messageDetails[] = $key;
}
$detailTextForLangChecks[] = "==={$code}-{$check}===\n* " . implode(', ', $messageDetails);
$numbers[] = "'''[[#{$code}-{$check}|{$count}]]'''";
} else {
$numbers[] = $count;
}
}
if (count($detailTextForLangChecks)) {
$detailText .= $detailTextForLang . implode("\n", $detailTextForLangChecks) . "\n";
}
if (!$problems) {
continue;
}
// Don't list languages without problems
$language = $wgContLang->getLanguageName($code);
$rows[] = "| {$language} || {$code} || {$problems} || " . implode(' || ', $numbers);
}
$tableRows = implode("\n|-\n", $rows);
$version = SpecialVersion::getVersion($IP);
echo <<<EOL
'''Check results are for:''' <code>{$version}</code>
{| class="sortable wikitable" border="2" cellpadding="4" cellspacing="0" style="background-color: #F9F9F9; border: 1px #AAAAAA solid; border-collapse: collapse; clear:both;"
{$tableRows}
|}
{$detailText}
EOL;
}
示例10: makeHelpMsg
/**
* Override the parent to generate help messages for all available modules.
*
* @deprecated since 1.25
* @return string
*/
public function makeHelpMsg()
{
wfDeprecated(__METHOD__, '1.25');
$this->setHelp();
$cacheHelpTimeout = $this->getConfig()->get('APICacheHelpTimeout');
return ObjectCache::getMainWANInstance()->getWithSetCallback(wfMemcKey('apihelp', $this->getModuleName(), str_replace(' ', '_', SpecialVersion::getVersion('nodb'))), $cacheHelpTimeout > 0 ? $cacheHelpTimeout : WANObjectCache::TTL_UNCACHEABLE, array($this, 'reallyMakeHelpMsg'));
}
示例11: 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;
}
示例12: makeHelpMsg
/**
* Override the parent to generate help messages for all available modules.
*
* @deprecated since 1.25
* @return string
*/
public function makeHelpMsg()
{
wfDeprecated(__METHOD__, '1.25');
global $wgMemc;
$this->setHelp();
// Get help text from cache if present
$key = wfMemcKey('apihelp', $this->getModuleName(), str_replace(' ', '_', SpecialVersion::getVersion('nodb')));
$cacheHelpTimeout = $this->getConfig()->get('APICacheHelpTimeout');
if ($cacheHelpTimeout > 0) {
$cached = $wgMemc->get($key);
if ($cached) {
return $cached;
}
}
$retval = $this->reallyMakeHelpMsg();
if ($cacheHelpTimeout > 0) {
$wgMemc->set($key, $retval, $cacheHelpTimeout);
}
return $retval;
}
示例13: 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;
}
示例14: tests
[--help]
Options:
--quick Suppress diff output of failed tests
--quiet Suppress notification of passed tests (shows only failed tests)
--show-output Show expected and actual output
--color Override terminal detection and force color output on or off
'light' option is similar to 'yes' but with color for dark backgrounds
--regex Only run tests whose descriptions which match given regex
--file Run test cases from a custom file instead of parserTests.txt
--help Show this help message
ENDS;
exit(0);
}
# There is a convention that the parser should never
# refer to $wgTitle directly, but instead use the title
# passed to it.
$wgTitle = Title::newFromText('Parser test script do not use');
$tester = new ParserTest();
if (isset($options['file'])) {
$files = array($options['file']);
} else {
// Default parser tests and any set from extensions or local config
$files = $wgParserTestFiles;
}
# Print out software version to assist with locating regressions
$version = SpecialVersion::getVersion();
echo "This is MediaWiki version {$version}.\n";
$ok = $tester->runTestsFromFiles($files);
exit($ok ? 0 : -1);
示例15: getGenerator
protected function getGenerator() {
return 'MediaWiki ' . SpecialVersion::getVersion() .
"; Translate extension (" . TRANSLATE_VERSION . ")";
}