r45940 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45939‎ | r45940 | r45941 >
Date:22:57, 20 January 2009
Author:brion
Status:ok
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQuerySiteinfo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQuerySiteinfo.php
@@ -79,9 +79,6 @@
8080 case 'fileextensions':
8181 $this->appendFileExtensions( $p );
8282 break;
83 - case 'configvars':
84 - $this->appendConfigvars( $p, $params['configvars'] );
85 - break;
8683 default :
8784 ApiBase :: dieDebug( __METHOD__, "Unknown prop=$p" );
8885 }
@@ -336,39 +333,9 @@
337334 $this->getResult()->setIndexedTagName( $data, 'ext' );
338335 $this->getResult()->addValue( 'query', $property, $data );
339336 }
340 -
341 - protected function appendConfigvars( $property, $vars ) {
342 - global $wgAPIReadableConfigVars;
343 - if(empty($vars))
344 - $vars = $wgAPIReadableConfigVars;
345 - $data = array();
346 - foreach((array)$vars as $var)
347 - {
348 - $value = $GLOBALS[$var];
349 - $r = array();
350 - $r['name'] = $var;
351 - $r['type'] = gettype($value);
352 - if(is_object($value))
353 - $r['class'] = get_class($value);
354 - elseif(is_bool($value))
355 - $r['value'] = ($value ? 'true' : 'false');
356 - elseif(!is_null($value))
357 - {
358 - $r['value'] = $value;
359 - if(is_array($value))
360 - {
361 - $this->getResult()->setIndexedTagName($r['value'], 'elem');
362 - $this->getResult()->setIndexedTagName_recursive($r['value'], 'elem');
363 - }
364 - }
365 - $data[] = $r;
366 - }
367 - $this->getResult()->setIndexedTagName($data, 'config');
368 - $this->getResult()->addValue('query', $property, $data);
369 - }
370337
 338+
371339 public function getAllowedParams() {
372 - global $wgAPIReadableConfigVars;
373340 return array(
374341 'prop' => array(
375342 ApiBase :: PARAM_DFLT => 'general',
@@ -385,7 +352,6 @@
386353 'usergroups',
387354 'extensions',
388355 'fileextensions',
389 - 'configvars',
390356 )
391357 ),
392358 'filteriw' => array(
@@ -395,10 +361,6 @@
396362 )
397363 ),
398364 'showalldb' => false,
399 - 'configvars' => array(
400 - ApiBase :: PARAM_ISMULTI => true,
401 - ApiBase :: PARAM_TYPE => $wgAPIReadableConfigVars,
402 - ),
403365 );
404366 }
405367
@@ -417,11 +379,9 @@
418380 ' "usergroups" - Returns user groups and the associated permissions',
419381 ' "extensions" - Returns extensions installed on the wiki',
420382 ' "fileextensions" - Returns list of file extensions allowed to be uploaded',
421 - ' "configvars" - Returns the value of certain configuration variables',
422383 ),
423384 'filteriw' => 'Return only local or only nonlocal entries of the interwiki map',
424385 'showalldb' => 'List all database servers, not just the one lagging the most',
425 - 'configvars' => 'Configuration variables to get. If empty, all configuration variables will be listed.',
426386 );
427387 }
428388
@@ -434,7 +394,7 @@
435395 'api.php?action=query&meta=siteinfo&siprop=general|namespaces|namespacealiases|statistics',
436396 'api.php?action=query&meta=siteinfo&siprop=interwikimap&sifilteriw=local',
437397 'api.php?action=query&meta=siteinfo&siprop=dbrepllag&sishowalldb',
438 - );
 398+ );
439399 }
440400
441401 public function getVersion() {
Index: trunk/phase3/includes/DefaultSettings.php
@@ -3647,192 +3647,3 @@
36483648 * and the functionality will be enabled universally.
36493649 */
36503650 $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
@@ -63,8 +63,7 @@
6464 * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions
6565 and listing all deleted pages possible
6666 * (bug 16844) Added clcategories parameter to prop=categories
67 -* (bug 17025) Added siprop=fileextension to meta=siteinfo
68 -* (bug 17027) Added siprop=configvars to meta=siteinfo
 67+* (bug 17025) Add "fileextension" parameter to meta=siteinfo&siprop=
6968 * (bug 17048) Show the 'new' flag in list=usercontribs for the revision that created the
7069 page, even if it's not the top revision
7170 * (bug 17069) Added ucshow=patrolled|!patrolled to list=usercontribs

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r45810API: (bug 17027) Allow all configuration variables in $wgAPIReadableConfigVar...catrope21:03, 16 January 2009

Status & tagging log