Index: trunk/phase3/includes/api/ApiQuerySiteinfo.php |
— | — | @@ -79,6 +79,10 @@ |
80 | 80 | case 'fileextensions': |
81 | 81 | $this->appendFileExtensions( $p ); |
82 | 82 | break; |
| 83 | + case 'configvars': |
| 84 | + global $wgAPIReadableConfigVars; |
| 85 | + $this->appendConfigvars( $p, $params['configvars'] ); |
| 86 | + break; |
83 | 87 | default : |
84 | 88 | ApiBase :: dieDebug( __METHOD__, "Unknown prop=$p" ); |
85 | 89 | } |
— | — | @@ -333,9 +337,39 @@ |
334 | 338 | $this->getResult()->setIndexedTagName( $data, 'ext' ); |
335 | 339 | $this->getResult()->addValue( 'query', $property, $data ); |
336 | 340 | } |
| 341 | + |
| 342 | + protected function appendConfigvars( $property, $vars ) { |
| 343 | + global $wgAPIReadableConfigVars; |
| 344 | + if(empty($vars)) |
| 345 | + $vars = $wgAPIReadableConfigVars; |
| 346 | + $data = array(); |
| 347 | + foreach((array)$vars as $var) |
| 348 | + { |
| 349 | + $value = $GLOBALS[$var]; |
| 350 | + $r = array(); |
| 351 | + $r['name'] = $var; |
| 352 | + $r['type'] = gettype($value); |
| 353 | + if(is_object($value)) |
| 354 | + $r['class'] = get_class($value); |
| 355 | + elseif(is_bool($value)) |
| 356 | + $r['value'] = ($value ? 'true' : 'false'); |
| 357 | + elseif(!is_null($value)) |
| 358 | + { |
| 359 | + $r['value'] = $value; |
| 360 | + if(is_array($value)) |
| 361 | + { |
| 362 | + $this->getResult()->setIndexedTagName($r['value'], 'elem'); |
| 363 | + $this->getResult()->setIndexedTagName_recursive($r['value'], 'elem'); |
| 364 | + } |
| 365 | + } |
| 366 | + $data[] = $r; |
| 367 | + } |
| 368 | + $this->getResult()->setIndexedTagName($data, 'config'); |
| 369 | + $this->getResult()->addValue('query', $property, $data); |
| 370 | + } |
337 | 371 | |
338 | | - |
339 | 372 | public function getAllowedParams() { |
| 373 | + global $wgAPIReadableConfigVars; |
340 | 374 | return array( |
341 | 375 | 'prop' => array( |
342 | 376 | ApiBase :: PARAM_DFLT => 'general', |
— | — | @@ -352,6 +386,7 @@ |
353 | 387 | 'usergroups', |
354 | 388 | 'extensions', |
355 | 389 | 'fileextensions', |
| 390 | + 'configvars', |
356 | 391 | ) |
357 | 392 | ), |
358 | 393 | 'filteriw' => array( |
— | — | @@ -361,6 +396,10 @@ |
362 | 397 | ) |
363 | 398 | ), |
364 | 399 | 'showalldb' => false, |
| 400 | + 'configvars' => array( |
| 401 | + ApiBase :: PARAM_ISMULTI => true, |
| 402 | + ApiBase :: PARAM_TYPE => $wgAPIReadableConfigVars, |
| 403 | + ), |
365 | 404 | ); |
366 | 405 | } |
367 | 406 | |
— | — | @@ -379,9 +418,11 @@ |
380 | 419 | ' "usergroups" - Returns user groups and the associated permissions', |
381 | 420 | ' "extensions" - Returns extensions installed on the wiki', |
382 | 421 | ' "fileextensions" - Returns list of file extensions allowed to be uploaded', |
| 422 | + ' "configvars" - Returns the value of certain configuration variables', |
383 | 423 | ), |
384 | 424 | 'filteriw' => 'Return only local or only nonlocal entries of the interwiki map', |
385 | 425 | 'showalldb' => 'List all database servers, not just the one lagging the most', |
| 426 | + 'configvars' => 'Configuration variables to get. If empty, all configuration variables will be listed.', |
386 | 427 | ); |
387 | 428 | } |
388 | 429 | |
— | — | @@ -394,7 +435,7 @@ |
395 | 436 | 'api.php?action=query&meta=siteinfo&siprop=general|namespaces|namespacealiases|statistics', |
396 | 437 | 'api.php?action=query&meta=siteinfo&siprop=interwikimap&sifilteriw=local', |
397 | 438 | 'api.php?action=query&meta=siteinfo&siprop=dbrepllag&sishowalldb', |
398 | | - ); |
| 439 | + ); |
399 | 440 | } |
400 | 441 | |
401 | 442 | public function getVersion() { |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -3647,3 +3647,192 @@ |
3648 | 3648 | * and the functionality will be enabled universally. |
3649 | 3649 | */ |
3650 | 3650 | $wgEnforceHtmlIds = true; |
| 3651 | + |
| 3652 | +/** |
| 3653 | + * Allow the variables in this array to be retrieved through the API |
| 3654 | + * (meta=siteinfo&siprop=configvars). |
| 3655 | + * WARNING: DO NOT put sensitive stuff like $wgDBpassword in here |
| 3656 | + */ |
| 3657 | + |
| 3658 | +$wgAPIReadableConfigVars = array( |
| 3659 | + 'wgVersion', |
| 3660 | + 'wgSitename', |
| 3661 | + 'wgMetaNamespace', |
| 3662 | + 'wgMetaNamespaceTalk', |
| 3663 | + 'wgServer', |
| 3664 | + 'wgServerName', |
| 3665 | + 'wgProto', |
| 3666 | + 'wgScriptPath', |
| 3667 | + 'wgUsePathInfo', |
| 3668 | + 'wgScriptExtension', |
| 3669 | + 'wgScript', |
| 3670 | + 'wgRedirectScript', |
| 3671 | + 'wgStylePath', |
| 3672 | + 'wgArticlePath', |
| 3673 | + 'wgVariantArticlePath', |
| 3674 | + 'wgUploadPath', |
| 3675 | + 'wgLogo', |
| 3676 | + 'wgFavicon', |
| 3677 | + 'wgAppleTouchIcon', |
| 3678 | + 'wgMathPath', |
| 3679 | + 'wgUploadBaseUrl', |
| 3680 | + 'wgLegalTitleChars', |
| 3681 | + 'wgUrlProtocols', |
| 3682 | + 'wgVerifyMimeType', |
| 3683 | + 'wgLoadFileinfoExtension', |
| 3684 | + 'wgTrivialMimeDetection', |
| 3685 | + 'wgActionPaths', |
| 3686 | + 'wgUseSharedUploads', |
| 3687 | + 'wgSharedUploadPath', |
| 3688 | + 'wgFetchCommonsDescriptions', |
| 3689 | + 'wgCacheSharedUploads', |
| 3690 | + 'wgAllowCopyUploads', |
| 3691 | + 'wgMaxUploadSize', |
| 3692 | + 'wgUploadNavigationUrl', |
| 3693 | + 'wgRepositoryBaseUrl', |
| 3694 | + 'wgEmergencyContact', |
| 3695 | + 'wgPasswordSender', |
| 3696 | + 'wgNoReplyAddress', |
| 3697 | + 'wgEnableEmail', |
| 3698 | + 'wgEnableUserEmail', |
| 3699 | + 'wgUserEmailUseReplyTo', |
| 3700 | + 'wgPasswordReminderResendTime', |
| 3701 | + 'wgNewPasswordExpiry', |
| 3702 | + 'wgSearchType', |
| 3703 | + 'wgLanguageCode', |
| 3704 | + 'wgGrammarForms', |
| 3705 | + 'wgInterwikiMagic', |
| 3706 | + 'wgHideInterlanguageLinks', |
| 3707 | + 'wgExtraLanguageNames', |
| 3708 | + 'wgUseDynamicDates', |
| 3709 | + 'wgAmericanDates', |
| 3710 | + 'wgTranslateNumerals', |
| 3711 | + 'wgDisableLangConversion', |
| 3712 | + 'wgDisableTitleConversion', |
| 3713 | + 'wgDefaultLanguageVariant', |
| 3714 | + 'wgLoginLanguageSelector', |
| 3715 | + 'wgLocalInterwiki', |
| 3716 | + 'wgRedirectSources', |
| 3717 | + 'wgShowIPinHeader', |
| 3718 | + 'wgMaxSigChars', |
| 3719 | + 'wgMaxArticleSize', |
| 3720 | + 'wgMaxNameChars', |
| 3721 | + 'wgMaxPPNodeCount', |
| 3722 | + 'wgMaxTemplateDepth', |
| 3723 | + 'wgMaxPPExpandDepth', |
| 3724 | + 'wgCleanSignatures', |
| 3725 | + 'wgExtraSubtitle', |
| 3726 | + 'wgSiteSupportPage', |
| 3727 | + 'wgReadOnly', |
| 3728 | + 'wgSpecialVersionShowHooks', |
| 3729 | + 'wgColorErrors', |
| 3730 | + 'wgShowHostnames', |
| 3731 | + 'wgUseCategoryBrowser', |
| 3732 | + 'wgUseCommaCount', |
| 3733 | + 'wgSysopUserBans', |
| 3734 | + 'wgSysopRangeBans', |
| 3735 | + 'wgAutoblockExpiry', |
| 3736 | + 'wgBlockAllowsUTEdit', |
| 3737 | + 'wgSysopEmailBans', |
| 3738 | + 'wgWhitelistRead', |
| 3739 | + 'wgEmailConfirmToEdit', |
| 3740 | + 'wgRestrictionTypes', |
| 3741 | + 'wgRestrictionLevels', |
| 3742 | + 'wgNamespaceProtection', |
| 3743 | + 'wgNonincludableNamespaces', |
| 3744 | + 'wgAutoConfirmAge', |
| 3745 | + 'wgAutoConfirmCount', |
| 3746 | + 'wgAutopromote', |
| 3747 | + 'wgAddGroups', |
| 3748 | + 'wgRemoveGroups', |
| 3749 | + 'wgAvailableRights', |
| 3750 | + 'wgDeleteRevisionsLimit', |
| 3751 | + 'wgActiveUserEditCount', |
| 3752 | + 'wgActiveUserDays', |
| 3753 | + 'wgEnotifFromEditor', |
| 3754 | + 'wgEmailAuthentication', |
| 3755 | + 'wgEnotifWatchlist', |
| 3756 | + 'wgEnotifUserTalk', |
| 3757 | + 'wgEnotifRevealEditorAddress', |
| 3758 | + 'wgEnotifMinorEdits', |
| 3759 | + 'wgEnotifImpersonal', |
| 3760 | + 'wgEnotifMaxRecips', |
| 3761 | + 'wgEnotifUseJobQ', |
| 3762 | + 'wgEnotifUseRealName', |
| 3763 | + 'wgUsersNotifiedOnAllChanges', |
| 3764 | + 'wgRCShowWatchingUsers', |
| 3765 | + 'wgPageShowWatchingUsers', |
| 3766 | + 'wgRCShowChangedSize', |
| 3767 | + 'wgRCChangedSizeThreshold', |
| 3768 | + 'wgShowUpdatedMarker', |
| 3769 | + 'wgCookieExpiration', |
| 3770 | + 'wgCookieDomain', |
| 3771 | + 'wgCookiePath', |
| 3772 | + 'wgCookieSecure', |
| 3773 | + 'wgDisableCookieCheck', |
| 3774 | + 'wgCookiePrefix', |
| 3775 | + 'wgSessionName', |
| 3776 | + 'wgAllowExternalImages', |
| 3777 | + 'wgAllowExternalImagesFrom', |
| 3778 | + 'wgEnableImageWhitelist', |
| 3779 | + 'wgAllowImageMoving', |
| 3780 | + 'wgUseTeX', |
| 3781 | + 'wgDisableCounters', |
| 3782 | + 'wgDisableTextSearch', |
| 3783 | + 'wgDisableSearchContext', |
| 3784 | + 'wgEnableMWSuggest', |
| 3785 | + 'wgEnableUploads', |
| 3786 | + 'wgShowEXIF', |
| 3787 | + 'wgRemoteUploads', |
| 3788 | + 'wgDisableAnonTalk', |
| 3789 | + 'wgFileBlacklist', |
| 3790 | + 'wgMimeTypeBlacklist', |
| 3791 | + 'wgCheckFileExtensions', |
| 3792 | + 'wgStrictFileExtensions', |
| 3793 | + 'wgUploadSizeWarning', |
| 3794 | + 'wgNamespacesToBeSearchedDefault', |
| 3795 | + 'wgNamespacesToBeSearchedProject', |
| 3796 | + 'wgSiteNotice', |
| 3797 | + 'wgRCMaxAge', |
| 3798 | + 'wgUseMetadataEdit', |
| 3799 | + 'wgMetadataWhitelist', |
| 3800 | + 'wgUseCopyrightUpload', |
| 3801 | + 'wgCheckCopyrightUpload', |
| 3802 | + 'wgCapitalLinks', |
| 3803 | + 'wgImportSources', |
| 3804 | + 'wgImportTargetNamespace', |
| 3805 | + 'wgExportAllowHistory', |
| 3806 | + 'wgExportMaxHistory', |
| 3807 | + 'wgExportAllowListContributors', |
| 3808 | + 'wgUseTidy', |
| 3809 | + 'wgAlwaysUseTidy', |
| 3810 | + 'wgValidateAllHtml', |
| 3811 | + 'wgDefaultSkin', |
| 3812 | + 'wgAllowUserSkin', |
| 3813 | + 'wgDefaultUserOptions', |
| 3814 | + 'wgAllowRealName', |
| 3815 | + 'wgValidSkinNames', |
| 3816 | + 'wgAllowUserJs', |
| 3817 | + 'wgAllowUserCss', |
| 3818 | + 'wgUseSiteJs', |
| 3819 | + 'wgUseSiteCss', |
| 3820 | + 'wgAllowPageInfo', |
| 3821 | + 'wgEnableHtmlDiff', |
| 3822 | + 'wgUseRCPatrol', |
| 3823 | + 'wgUseNPPatrol', |
| 3824 | + 'wgCategoryPrefixedDefaultSortkey', |
| 3825 | + 'wgLocaltimezone', |
| 3826 | + 'wgLocalTZoffset', |
| 3827 | + 'wgAllowSpecialInclusion', |
| 3828 | + 'wgEnableScaryTranscluding', |
| 3829 | + 'wgUseTrackbacks', |
| 3830 | + 'wgAllowDisplayTitle', |
| 3831 | + 'wgRestrictDisplayTitle', |
| 3832 | + 'wgContentNamespaces', |
| 3833 | + 'wgEnableAPI', |
| 3834 | + 'wgEnableWriteAPI', |
| 3835 | + 'wgExpensiveParserFunctionLimit', |
| 3836 | + 'wgMaximumMovedPages', |
| 3837 | + 'wgFixDoubleRedirects', |
| 3838 | + 'wgUseAutomaticEditSummaries', |
| 3839 | +); |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -48,7 +48,8 @@ |
49 | 49 | * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions |
50 | 50 | and listing all deleted pages possible |
51 | 51 | * (bug 16844) Added clcategories parameter to prop=categories |
52 | | -* (bug 17025) Add "fileextension" parameter to meta=siteinfo&siprop= |
| 52 | +* (bug 17025) Added siprop=fileextension to meta=siteinfo |
| 53 | +* (bug 17027) Added siprop=configvars to meta=siteinfo |
53 | 54 | |
54 | 55 | === Languages updated in 1.15 === |
55 | 56 | |