r41117 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41116‎ | r41117 | r41118 >
Date:15:15, 21 September 2008
Author:ialex
Status:old
Tags:
Comment:
* findSettings.php now works for extensions (--ext option)
* Updated extensions settings
Modified paths:
  • /trunk/extensions/Configure/CHANGELOG (modified) (history)
  • /trunk/extensions/Configure/Configure.php (modified) (history)
  • /trunk/extensions/Configure/Configure.settings-ext.php (modified) (history)
  • /trunk/extensions/Configure/findSettings.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Configure/findSettings.php
@@ -26,10 +26,11 @@
2727 echo "Script that find settings that aren't configurable by the extension.\n";
2828 echo "\n";
2929 echo "Usage:\n";
30 - echo " php findSettings.php [--help|--from-doc [--alpha]]\n";
 30+ echo " php findSettings.php [--help|--ext|--from-doc [--alpha]]\n";
3131 echo "\n";
3232 echo "options:\n";
3333 echo "--help: display this screen\n";
 34+ echo "--ext: search for extensions settings\n";
3435 echo "--from-doc: compare with settings from mediawiki.org instead settings\n";
3536 echo " from this extension\n";
3637 echo "--alpha: get the alphabetical list of settings\n";
@@ -53,38 +54,79 @@
5455 if( isset( $options['help'] ) )
5556 printHelp();
5657
57 -// Get our settings defs
58 -if( isset( $options['from-doc'] ) ){
59 - if( isset( $options['alpha'] ) ){
60 - $page = "Manual:Configuration_settings_(alphabetical)";
 58+$coreSettings = ConfigurationSettings::singleton( CONF_SETTINGS_CORE );
 59+if( isset( $options['ext'] ) ){
 60+ $exts = ConfigurationSettings::singleton( CONF_SETTINGS_EXT )->getAllExtensionsObjects();
 61+ $ingnoreList = array(
 62+ # Core
 63+ 'wgTitle', 'wgArticle', 'wgContLang', 'wgLang', 'wgOut', 'wgParser', 'wgMessageCache',
 64+ # Extensions
 65+ 'wgCaptcha', 'wgConfirmEditIP',
 66+ 'wgCitationCache', 'wgCitationCounter', 'wgCitationRunning',
 67+ 'wgCSS',
 68+ 'wgErrorHandlerErrors', 'wgErrorHandlerOutputDone',
 69+ 'wgExtParserFunctions',
 70+ 'wgTitleBlacklist',
 71+ );
 72+ foreach( $exts as $ext ){
 73+ if( !$ext->isInstalled() )
 74+ continue;
 75+ $file = file_get_contents( $ext->getFile() );
 76+ $name = $ext->getName();
 77+ $m = array();
 78+ preg_match_all( '/\$(wg[A-Za-z0-9]+)\s*\=/', $file, $m );
 79+ $definedSettings = array_unique( $m[1] );
 80+ $allSettings = array_keys( $ext->getSettings() );
 81+
 82+ $remain = array_diff( $definedSettings, $allSettings );
 83+ $obsolete = array_diff( $allSettings, $definedSettings );
 84+ $missing = array();
 85+ foreach( $remain as $setting ){
 86+ if( !$coreSettings->isSettingAvailable( $setting ) && !in_array( $setting, $ingnoreList ) )
 87+ $missing[] = $setting;
 88+ }
 89+ if( count( $missing ) == 0 && count( $obsolete ) == 0 ) {
 90+ #echo "Extension $name ok\n";
 91+ } else {
 92+ echo "Extension $name:\n";
 93+ printArray( ' missing', $missing );
 94+ printArray( ' obsolete', $obsolete );
 95+ }
 96+ }
 97+} else {
 98+ // Get our settings defs
 99+ if( isset( $options['from-doc'] ) ){
 100+ if( isset( $options['alpha'] ) ){
 101+ $page = "Manual:Configuration_settings_(alphabetical)";
 102+ } else {
 103+ $page = "Manual:Configuration_settings";
 104+ }
 105+ $cont = Http::get( "http://www.mediawiki.org/w/index.php?title={$page}&action=raw" );
 106+ $m = array();
 107+ preg_match_all( '/\[\[[Mm]anual:\$(wg[A-Za-z0-9]+)\|/', $cont, $m );
 108+ $allSettings = array_unique( $m[1] );
61109 } else {
62 - $page = "Manual:Configuration_settings";
 110+ $allSettings = array_keys( $coreSettings->getAllSettings() );
63111 }
64 - $cont = Http::get( "http://www.mediawiki.org/w/index.php?title={$page}&action=raw" );
 112+
 113+ // Now we'll need to open DefaultSettings.php
65114 $m = array();
66 - preg_match_all( '/\[\[[Mm]anual:\$(wg[A-Za-z0-9]+)\|/', $cont, $m );
67 - $allSettings = array_unique( $m[1] );
68 -} else {
69 - $allSettings = array_keys( ConfigurationSettings::singleton( CONF_SETTINGS_CORE )->getAllSettings() );
70 -}
71 -
72 -// Now we'll need to open DefaultSettings.php
73 -$m = array();
74 -$defaultSettings = file_get_contents( "$IP/includes/DefaultSettings.php" );
75 -preg_match_all( '/\$(wg[A-Za-z0-9]+)\s*\=/', $defaultSettings, $m );
76 -$definedSettings = array_unique( $m[1] );
77 -
78 -$missing = array_diff( $definedSettings, $allSettings );
79 -$remain = array_diff( $allSettings, $definedSettings );
80 -$obsolete = array();
81 -foreach( $remain as $setting ){
82 - if( ConfigurationSettings::singleton( CONF_SETTINGS_CORE )->isSettingAvailable( $setting ) )
83 - $obsolete[] = $setting;
84 -}
85 -
86 -// let's show the results:
87 -printArray('missing', $missing );
88 -printArray('obsolete', $obsolete );
89 -
90 -if( count( $missing ) == 0 && count( $obsolete ) == 0 )
91 - echo "Looks good!\n";
\ No newline at end of file
 115+ $defaultSettings = file_get_contents( "$IP/includes/DefaultSettings.php" );
 116+ preg_match_all( '/\$(wg[A-Za-z0-9]+)\s*\=/', $defaultSettings, $m );
 117+ $definedSettings = array_unique( $m[1] );
 118+
 119+ $missing = array_diff( $definedSettings, $allSettings );
 120+ $remain = array_diff( $allSettings, $definedSettings );
 121+ $obsolete = array();
 122+ foreach( $remain as $setting ){
 123+ if( $coreSettings->isSettingAvailable( $setting ) )
 124+ $obsolete[] = $setting;
 125+ }
 126+
 127+ // let's show the results:
 128+ printArray('missing', $missing );
 129+ printArray('obsolete', $obsolete );
 130+
 131+ if( count( $missing ) == 0 && count( $obsolete ) == 0 )
 132+ echo "Looks good!\n";
 133+}
\ No newline at end of file
Index: trunk/extensions/Configure/CHANGELOG
@@ -1,6 +1,10 @@
22 This file lists changes on this extension.
33 Localisation updates are done on betawiki and aren't listed here.
44
 5+0.7.10 - 21 September 2008
 6+ * findSettings.php now works for extensions (--ext option)
 7+ * Updated extensions settings
 8+
59 0.7.9 - 20 September 2008
610 Dropped $wgDBminWordLen, was obsolete since MediaWiki 1.6.0.
711
Index: trunk/extensions/Configure/Configure.settings-ext.php
@@ -24,7 +24,18 @@
2525 'name' => 'AbuseFilter',
2626 'settings' => array(
2727 'wgAbuseFilterAvailableActions' => 'array',
 28+ 'wgAbuseFilterConditionLimit' => 'int',
 29+ 'wgAbuseFilterEmergencyDisableThreshold' => 'text', // FIXME: float
 30+ 'wgAbuseFilterEmergencyDisableCount' => 'int',
 31+ 'wgAbuseFilterEmergencyDisableAge' => 'int',
 32+ 'wgAbuseFilterParserClass' => 'text',
 33+ 'wgAbuseFilterNativeParser' => 'text',
 34+ 'wgAbuseFilterNativeSyntaxCheck' => 'text',
 35+ 'wgAbuseFilterNativeExpressionEvaluator' => 'text',
2836 ),
 37+ 'array' => array(
 38+ 'wgAbuseFilterAvailableActions' => 'simple',
 39+ ),
2940 'schema' => true,
3041 'url' => 'http://www.mediawiki.org/wiki/Extension:AbuseFilter',
3142 ),
@@ -111,6 +122,9 @@
112123 ),
113124 array(
114125 'name' => 'BadImage',
 126+ 'settings' => array(
 127+ 'wgBadImageCache' => 'bool',
 128+ ),
115129 'schema' => true,
116130 'url' => 'http://www.mediawiki.org/wiki/Extension:Bad_Image_List',
117131 ),
@@ -210,10 +224,14 @@
211225 'wgCategoryTreeUnifiedView' => 'bool',
212226 'wgCategoryTreeMaxDepth' => 'array',
213227 'wgCategoryTreeExtPath' => 'text',
 228+ #'wgCategoryTreeVersion' => 'int',
 229+ #'wgCategoryTreeUseCategoryTable' => 'bool',
 230+ 'wgCategoryTreeOmitNamespace' => array( 0 => 'Never', 10 => 'Always', 20 => 'Category', 30 => 'Auto' ),
214231 'wgCategoryTreeDefaultMode' => array( 0 => 'Categories', 10 => 'Pages', 20 => 'All' ),
215232 'wgCategoryTreeCategoryPageMode' => array( 0 => 'Categories', 10 => 'Pages', 20 => 'All' ),
216233 'wgCategoryTreeDefaultOptions' => 'array',
217234 'wgCategoryTreeCategoryPageOptions' => 'array',
 235+ 'wgCategoryTreeSpecialPageOptions' => 'array',
218236 'wgCategoryTreeSidebarOptions' => 'array',
219237 'wgCategoryTreePageCategoryOptions' => 'array',
220238 ),
@@ -221,6 +239,7 @@
222240 'wgCategoryTreeMaxDepth' => 'assoc',
223241 'wgCategoryTreeDefaultOptions' => 'assoc',
224242 'wgCategoryTreeCategoryPageOptions' => 'assoc',
 243+ 'wgCategoryTreeSpecialPageOptions' => 'assoc',
225244 'wgCategoryTreeSidebarOptions' => 'assoc',
226245 'wgCategoryTreePageCategoryOptions' => 'assoc',
227246 ),
@@ -287,6 +306,7 @@
288307 'settings' => array(
289308 'wgCheckUserLog' => 'text',
290309 'wgCUDMaxAge' => 'int',
 310+ 'wgCheckUserMaxBlocks' => 'int',
291311 ),
292312 'url' => 'http://www.mediawiki.org/wiki/Extension:CheckUser',
293313 ),
@@ -303,6 +323,9 @@
304324 ),
305325 array(
306326 'name' => 'Citation',
 327+ 'settings' => array(
 328+
 329+ ),
307330 ),
308331 array(
309332 'name' => 'Cite',
@@ -331,12 +354,12 @@
332355 array(
333356 'name' => 'Collection',
334357 'settings' => array(
335 - 'wgCollectionStartPage' => 'text',
336358 'wgCollectionMWServeURL' => 'text',
337359 'wgCollectionMWServeCredentials' => 'text',
338360 'wgCommunityCollectionNamespace' => 'int',
339 - 'wgSharedBaseURL' => 'text',
340 - 'wgLicenseArticle' => 'text',
 361+ 'wgCollectionMaxArticles' => 'int',
 362+ 'wgLicenseName' => 'text',
 363+ 'wgLicenseURL' => 'text',
341364 'wgPDFTemplateBlacklist' => 'text',
342365 'wgCollectionTemplateExclusionCategory' => 'text',
343366 'wgCollectionFormats' => 'array',
@@ -345,6 +368,10 @@
346369 'array' => array(
347370 'wgCollectionFormats' => 'assoc',
348371 ),
 372+ 'empty' => array(
 373+ 'wgLicenseName' => null,
 374+ 'wgLicenseURL' => null,
 375+ ),
349376 'url' => 'http://www.mediawiki.org/wiki/Extension:Collection',
350377 ),
351378 array(
@@ -399,12 +426,22 @@
400427 'name' => 'ConfirmEdit',
401428 'settings' => array(
402429 'wgCaptchaClass' => 'text',
 430+ 'wgCaptchaWhitelistIP' => 'array',
403431 'wgCaptchaTriggers' => 'array',
404432 'wgCaptchaTriggersOnNamespace' => 'array',
 433+ 'wgCaptchaStorageClass' => 'text',
 434+ 'wgCaptchaSessionExpiration' => 'int',
 435+ 'wgCaptchaBadLoginExpiration' => 'int',
 436+ 'ceAllowConfirmedEmail' => 'bool',
 437+ 'wgCaptchaBadLoginAttempts' => 'int',
 438+ 'wgCaptchaWhitelist' => 'text',
 439+ 'wgCaptchaRegexes' => 'array',
405440 ),
406441 'array' => array(
 442+ 'wgCaptchaWhitelistIP' => 'simple',
407443 'wgCaptchaTriggers' => 'assoc',
408444 'wgCaptchaTriggersOnNamespace' => 'array',
 445+ 'wgCaptchaRegexes' => 'simple',
409446 ),
410447 'url' => 'http://www.mediawiki.org/wiki/Extension:ConfirmEdit',
411448 ),
@@ -449,6 +486,10 @@
450487 ),
451488 array(
452489 'name' => 'Contributors',
 490+ 'settings' => array(
 491+ 'wgContributorsLimit' => 'int',
 492+ 'wgContributorsThreshold' => 'int',
 493+ ),
453494 'url' => 'http://www.mediawiki.org/wiki/Extension:Contributors',
454495 'schema' => true,
455496 ),
@@ -555,11 +596,13 @@
556597 'wgFlaggedRevsPatrolNamespaces' => 'array',
557598 'wgFlaggedRevsWhitelist' => 'array',
558599 'wgFlaggedRevsOverride' => 'bool',
 600+ 'wgFlaggedRevsReviewForDefault' => 'bool',
559601 'wgFlaggedRevsPrecedence' => 'bool',
560602 'wgFlaggedRevsExceptions' => 'array',
561603 'wgFlaggedRevsComments' => 'bool',
562604 'wgReviewChangesAfterEdit' => 'bool',
563605 'wgFlaggedRevsAutoReview' => 'bool',
 606+ 'wgFlaggedRevsAutoReviewNew' => 'bool',
564607 'wgUseStableTemplates' => 'bool',
565608 'wgUseCurrentTemplates' => 'bool',
566609 'wgUseStableImages' => 'bool',
@@ -569,11 +612,11 @@
570613 'wgFlaggedRevPristine' => 'int',
571614 'wgFlagRestrictions' => 'array',
572615 'wgReviewCodes' => 'array',
 616+ 'wgFlaggedRevsStylePath' => 'text',
573617 'wgFlaggedRevsAutopromote' => 'array',
574618 'wgFlaggedRevsExternalStore' => 'array',
575619 'wgFlaggedRevsLogInRC' => 'bool',
576620 'wgFlaggedRevsOversightAge' => 'int',
577 - 'wgFlaggedRevsLongPending' => 'array',
578621 'wgFlaggedRevsBacklog' => 'int',
579622 'wgFlaggedRevsVisible' => 'array',
580623 'wgFlaggedRevsTalkVisible' => 'bool',
@@ -582,6 +625,7 @@
583626 'wgFlaggedRevsFeedbackAge' => 'int',
584627 'wgFlaggedRevsStatsAge' => 'int',
585628 'wgPHPlotDir' => 'text',
 629+ 'wgSvgGraphDir' => 'text',
586630 ),
587631 'array' => array(
588632 'wgFlaggedRevsNamespaces' => 'ns-simple',
@@ -593,7 +637,6 @@
594638 'wgReviewCodes' => 'simple',
595639 'wgFlaggedRevsAutopromote' => 'assoc',
596640 'wgFlaggedRevsExternalStore' => 'simple',
597 - 'wgFlaggedRevsLongPending' => 'simple',
598641 'wgFlaggedRevsVisible' => 'simple',
599642 'wgFeedbackNamespaces' => 'ns-simple',
600643 'wgFlaggedRevsFeedbackTags' => 'assoc',
@@ -772,6 +815,14 @@
773816 ),
774817 array(
775818 'name' => 'TitleBlacklist',
 819+ 'settings' => array(
 820+ 'wgTitleBlacklistCaching' => 'array',
 821+ 'wgTitleBlacklistSources' => 'array',
 822+ ),
 823+ 'array' => array(
 824+ 'wgTitleBlacklistCaching' => 'assoc',
 825+ 'wgTitleBlacklistSources' => 'array',
 826+ ),
776827 'url' => 'http://www.mediawiki.org/wiki/Extension:Title_Blacklist',
777828 ),
778829 array(
@@ -812,9 +863,11 @@
813864 'wgTranslateGroupStructure' => 'array',
814865 'wgTranslateAddMWExtensionGroups' => 'bool',
815866 'wgTranslateEC' => 'array',
 867+ 'wgTranslateCC' => 'array',
816868 'wgTranslateTasks' => 'array',
817869 'wgTranslatePHPlot' => 'text',
818870 'wgTranslatePHPlotFont' => 'text',
 871+ 'wgTranslateTagTranslationLocation' => 'array',
819872 ),
820873 'array' => array(
821874 'wgTranslateLanguageFallbacks' => 'assoc',
@@ -824,7 +877,9 @@
825878 'wgTranslateAC' => 'assoc',
826879 'wgTranslateGroupStructure' => 'array',
827880 'wgTranslateEC' => 'simple',
 881+ 'wgTranslateCC' => 'assoc',
828882 'wgTranslateTasks' => 'assoc',
 883+ 'wgTranslateTagTranslationLocation' => 'simple',
829884 ),
830885 'url' => 'http://www.mediawiki.org/wiki/Extension:Translate',
831886 ),
Index: trunk/extensions/Configure/Configure.php
@@ -17,7 +17,7 @@
1818 'url' => 'http://www.mediawiki.org/wiki/Extension:Configure',
1919 'description' => 'Allow authorised users to configure the wiki by a web-based interface',
2020 'descriptionmsg' => 'configure-desc',
21 - 'version' => '0.7.9',
 21+ 'version' => '0.7.10',
2222 );
2323
2424 ## Configuration part