From 5b8a7db0c401baec6c76b401c11059487f59d882 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 20 Jan 2009 22:57:05 +0000 Subject: [PATCH] Revert r45810 "API: (bug 17027) Allow all configuration variables in $wgAPIReadableConfigVars to be read through meta=siteinfo&siprop=configvars. I tried my best to only make useful stuff readable and skip stuff that's sensitive (like $wgDBpassword), available already (like $wgExtraNamespaces) or useless (like $wgUpdateRowsPerJob)." This is way too tightly coupled to internal implementation details. Any and all of those things could change dramatically; they're not appropriate for an external API. --- RELEASE-NOTES | 3 +- includes/DefaultSettings.php | 189 ------------------------------ includes/api/ApiQuerySiteinfo.php | 44 +------ 3 files changed, 3 insertions(+), 233 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 132890a89f..e22d675e32 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -63,8 +63,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions and listing all deleted pages possible * (bug 16844) Added clcategories parameter to prop=categories -* (bug 17025) Added siprop=fileextension to meta=siteinfo -* (bug 17027) Added siprop=configvars to meta=siteinfo +* (bug 17025) Add "fileextension" parameter to meta=siteinfo&siprop= * (bug 17048) Show the 'new' flag in list=usercontribs for the revision that created the page, even if it's not the top revision * (bug 17069) Added ucshow=patrolled|!patrolled to list=usercontribs diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 9492c55f37..6a5a2da3e3 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3647,192 +3647,3 @@ $wgUniversalEditButton = true; * 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', -); diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index b2cc013753..b4f7445769 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -79,9 +79,6 @@ class ApiQuerySiteinfo extends ApiQueryBase { case 'fileextensions': $this->appendFileExtensions( $p ); break; - case 'configvars': - $this->appendConfigvars( $p, $params['configvars'] ); - break; default : ApiBase :: dieDebug( __METHOD__, "Unknown prop=$p" ); } @@ -336,39 +333,9 @@ class ApiQuerySiteinfo extends ApiQueryBase { $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', @@ -385,7 +352,6 @@ class ApiQuerySiteinfo extends ApiQueryBase { 'usergroups', 'extensions', 'fileextensions', - 'configvars', ) ), 'filteriw' => array( @@ -395,10 +361,6 @@ class ApiQuerySiteinfo extends ApiQueryBase { ) ), 'showalldb' => false, - 'configvars' => array( - ApiBase :: PARAM_ISMULTI => true, - ApiBase :: PARAM_TYPE => $wgAPIReadableConfigVars, - ), ); } @@ -417,11 +379,9 @@ class ApiQuerySiteinfo extends ApiQueryBase { ' "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.', ); } @@ -434,7 +394,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { '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() { -- 2.20.1