* and the functionality will be enabled universally.
*/
$wgEnforceHtmlIds = true;
+
+/**
+ * Allow the variables in this array to be retrieved through the API
+ * (meta=siteinfo&siprop=configvars).
+ * WARNING: DO NOT put sensitive stuff like $wgDBpassword in here
+ */
+
+$wgAPIReadableConfigVars = array(
+ 'wgVersion',
+ 'wgSitename',
+ 'wgMetaNamespace',
+ 'wgMetaNamespaceTalk',
+ 'wgServer',
+ 'wgServerName',
+ 'wgProto',
+ 'wgScriptPath',
+ 'wgUsePathInfo',
+ 'wgScriptExtension',
+ 'wgScript',
+ 'wgRedirectScript',
+ 'wgStylePath',
+ 'wgArticlePath',
+ 'wgVariantArticlePath',
+ 'wgUploadPath',
+ 'wgLogo',
+ 'wgFavicon',
+ 'wgAppleTouchIcon',
+ 'wgMathPath',
+ 'wgUploadBaseUrl',
+ 'wgLegalTitleChars',
+ 'wgUrlProtocols',
+ 'wgVerifyMimeType',
+ 'wgLoadFileinfoExtension',
+ 'wgTrivialMimeDetection',
+ 'wgActionPaths',
+ 'wgUseSharedUploads',
+ 'wgSharedUploadPath',
+ 'wgFetchCommonsDescriptions',
+ 'wgCacheSharedUploads',
+ 'wgAllowCopyUploads',
+ 'wgMaxUploadSize',
+ 'wgUploadNavigationUrl',
+ 'wgRepositoryBaseUrl',
+ 'wgEmergencyContact',
+ 'wgPasswordSender',
+ 'wgNoReplyAddress',
+ 'wgEnableEmail',
+ 'wgEnableUserEmail',
+ 'wgUserEmailUseReplyTo',
+ 'wgPasswordReminderResendTime',
+ 'wgNewPasswordExpiry',
+ 'wgSearchType',
+ 'wgLanguageCode',
+ 'wgGrammarForms',
+ 'wgInterwikiMagic',
+ 'wgHideInterlanguageLinks',
+ 'wgExtraLanguageNames',
+ 'wgUseDynamicDates',
+ 'wgAmericanDates',
+ 'wgTranslateNumerals',
+ 'wgDisableLangConversion',
+ 'wgDisableTitleConversion',
+ 'wgDefaultLanguageVariant',
+ 'wgLoginLanguageSelector',
+ 'wgLocalInterwiki',
+ 'wgRedirectSources',
+ 'wgShowIPinHeader',
+ 'wgMaxSigChars',
+ 'wgMaxArticleSize',
+ 'wgMaxNameChars',
+ 'wgMaxPPNodeCount',
+ 'wgMaxTemplateDepth',
+ 'wgMaxPPExpandDepth',
+ 'wgCleanSignatures',
+ 'wgExtraSubtitle',
+ 'wgSiteSupportPage',
+ 'wgReadOnly',
+ 'wgSpecialVersionShowHooks',
+ 'wgColorErrors',
+ 'wgShowHostnames',
+ 'wgUseCategoryBrowser',
+ 'wgUseCommaCount',
+ 'wgSysopUserBans',
+ 'wgSysopRangeBans',
+ 'wgAutoblockExpiry',
+ 'wgBlockAllowsUTEdit',
+ 'wgSysopEmailBans',
+ 'wgWhitelistRead',
+ 'wgEmailConfirmToEdit',
+ 'wgRestrictionTypes',
+ 'wgRestrictionLevels',
+ 'wgNamespaceProtection',
+ 'wgNonincludableNamespaces',
+ 'wgAutoConfirmAge',
+ 'wgAutoConfirmCount',
+ 'wgAutopromote',
+ 'wgAddGroups',
+ 'wgRemoveGroups',
+ 'wgAvailableRights',
+ 'wgDeleteRevisionsLimit',
+ 'wgActiveUserEditCount',
+ 'wgActiveUserDays',
+ 'wgEnotifFromEditor',
+ 'wgEmailAuthentication',
+ 'wgEnotifWatchlist',
+ 'wgEnotifUserTalk',
+ 'wgEnotifRevealEditorAddress',
+ 'wgEnotifMinorEdits',
+ 'wgEnotifImpersonal',
+ 'wgEnotifMaxRecips',
+ 'wgEnotifUseJobQ',
+ 'wgEnotifUseRealName',
+ 'wgUsersNotifiedOnAllChanges',
+ 'wgRCShowWatchingUsers',
+ 'wgPageShowWatchingUsers',
+ 'wgRCShowChangedSize',
+ 'wgRCChangedSizeThreshold',
+ 'wgShowUpdatedMarker',
+ 'wgCookieExpiration',
+ 'wgCookieDomain',
+ 'wgCookiePath',
+ 'wgCookieSecure',
+ 'wgDisableCookieCheck',
+ 'wgCookiePrefix',
+ 'wgSessionName',
+ 'wgAllowExternalImages',
+ 'wgAllowExternalImagesFrom',
+ 'wgEnableImageWhitelist',
+ 'wgAllowImageMoving',
+ 'wgUseTeX',
+ 'wgDisableCounters',
+ 'wgDisableTextSearch',
+ 'wgDisableSearchContext',
+ 'wgEnableMWSuggest',
+ 'wgEnableUploads',
+ 'wgShowEXIF',
+ 'wgRemoteUploads',
+ 'wgDisableAnonTalk',
+ 'wgFileBlacklist',
+ 'wgMimeTypeBlacklist',
+ 'wgCheckFileExtensions',
+ 'wgStrictFileExtensions',
+ 'wgUploadSizeWarning',
+ 'wgNamespacesToBeSearchedDefault',
+ 'wgNamespacesToBeSearchedProject',
+ 'wgSiteNotice',
+ 'wgRCMaxAge',
+ 'wgUseMetadataEdit',
+ 'wgMetadataWhitelist',
+ 'wgUseCopyrightUpload',
+ 'wgCheckCopyrightUpload',
+ 'wgCapitalLinks',
+ 'wgImportSources',
+ 'wgImportTargetNamespace',
+ 'wgExportAllowHistory',
+ 'wgExportMaxHistory',
+ 'wgExportAllowListContributors',
+ 'wgUseTidy',
+ 'wgAlwaysUseTidy',
+ 'wgValidateAllHtml',
+ 'wgDefaultSkin',
+ 'wgAllowUserSkin',
+ 'wgDefaultUserOptions',
+ 'wgAllowRealName',
+ 'wgValidSkinNames',
+ 'wgAllowUserJs',
+ 'wgAllowUserCss',
+ 'wgUseSiteJs',
+ 'wgUseSiteCss',
+ 'wgAllowPageInfo',
+ 'wgEnableHtmlDiff',
+ 'wgUseRCPatrol',
+ 'wgUseNPPatrol',
+ 'wgCategoryPrefixedDefaultSortkey',
+ 'wgLocaltimezone',
+ 'wgLocalTZoffset',
+ 'wgAllowSpecialInclusion',
+ 'wgEnableScaryTranscluding',
+ 'wgUseTrackbacks',
+ 'wgAllowDisplayTitle',
+ 'wgRestrictDisplayTitle',
+ 'wgContentNamespaces',
+ 'wgEnableAPI',
+ 'wgEnableWriteAPI',
+ 'wgExpensiveParserFunctionLimit',
+ 'wgMaximumMovedPages',
+ 'wgFixDoubleRedirects',
+ 'wgUseAutomaticEditSummaries',
+);
case 'fileextensions':
$this->appendFileExtensions( $p );
break;
+ case 'configvars':
+ global $wgAPIReadableConfigVars;
+ $this->appendConfigvars( $p, $params['configvars'] );
+ break;
default :
ApiBase :: dieDebug( __METHOD__, "Unknown prop=$p" );
}
$this->getResult()->setIndexedTagName( $data, 'ext' );
$this->getResult()->addValue( 'query', $property, $data );
}
-
+
+ protected function appendConfigvars( $property, $vars ) {
+ global $wgAPIReadableConfigVars;
+ if(empty($vars))
+ $vars = $wgAPIReadableConfigVars;
+ $data = array();
+ foreach((array)$vars as $var)
+ {
+ $value = $GLOBALS[$var];
+ $r = array();
+ $r['name'] = $var;
+ $r['type'] = gettype($value);
+ if(is_object($value))
+ $r['class'] = get_class($value);
+ elseif(is_bool($value))
+ $r['value'] = ($value ? 'true' : 'false');
+ elseif(!is_null($value))
+ {
+ $r['value'] = $value;
+ if(is_array($value))
+ {
+ $this->getResult()->setIndexedTagName($r['value'], 'elem');
+ $this->getResult()->setIndexedTagName_recursive($r['value'], 'elem');
+ }
+ }
+ $data[] = $r;
+ }
+ $this->getResult()->setIndexedTagName($data, 'config');
+ $this->getResult()->addValue('query', $property, $data);
+ }
public function getAllowedParams() {
+ global $wgAPIReadableConfigVars;
return array(
'prop' => array(
ApiBase :: PARAM_DFLT => 'general',
'usergroups',
'extensions',
'fileextensions',
+ 'configvars',
)
),
'filteriw' => array(
)
),
'showalldb' => false,
+ 'configvars' => array(
+ ApiBase :: PARAM_ISMULTI => true,
+ ApiBase :: PARAM_TYPE => $wgAPIReadableConfigVars,
+ ),
);
}
' "usergroups" - Returns user groups and the associated permissions',
' "extensions" - Returns extensions installed on the wiki',
' "fileextensions" - Returns list of file extensions allowed to be uploaded',
+ ' "configvars" - Returns the value of certain configuration variables',
),
'filteriw' => 'Return only local or only nonlocal entries of the interwiki map',
'showalldb' => 'List all database servers, not just the one lagging the most',
+ 'configvars' => 'Configuration variables to get. If empty, all configuration variables will be listed.',
);
}
'api.php?action=query&meta=siteinfo&siprop=general|namespaces|namespacealiases|statistics',
'api.php?action=query&meta=siteinfo&siprop=interwikimap&sifilteriw=local',
'api.php?action=query&meta=siteinfo&siprop=dbrepllag&sishowalldb',
- );
+ );
}
public function getVersion() {