Index: trunk/extensions/Configure/Configure.obj.php |
— | — | @@ -43,7 +43,7 @@ |
44 | 44 | $this->mOldSettings = $this->settings; |
45 | 45 | else |
46 | 46 | $this->settings = $this->mOldSettings; |
47 | | - |
| 47 | + |
48 | 48 | # We'll need to invert the order of keys as SiteConfiguration uses |
49 | 49 | # $settings[$setting][$wiki] and the extension uses $settings[$wiki][$setting] |
50 | 50 | foreach ( $this->mConf as $site => $settings ) { |
— | — | @@ -74,8 +74,10 @@ |
75 | 75 | } |
76 | 76 | } |
77 | 77 | } |
78 | | - |
| 78 | + |
79 | 79 | public function snapshotDefaults( /* options */ ) { |
| 80 | + // FIXME: don't hardcode all this stuff here |
| 81 | + static $alwaysSnapshot = array( 'wgGroupPermissions', 'wgImplicitGroups', 'wgAutopromote' ); |
80 | 82 | $options = func_get_args(); |
81 | 83 | $noOverride = in_array( 'no_override', $options ); |
82 | 84 | if( !is_array( $this->mDefaults ) || in_array( 'allow_empty', $options ) ) { |
— | — | @@ -83,8 +85,9 @@ |
84 | 86 | $this->mDefaults = array(); |
85 | 87 | } |
86 | 88 | $allSettings = ConfigurationSettings::singleton( CONF_SETTINGS_BOTH )->getEditableSettings(); |
| 89 | + $allSettings += array_flip( $alwaysSnapshot ); |
87 | 90 | foreach( $allSettings as $setting => $type ) { |
88 | | - if( array_key_exists( $setting, $GLOBALS ) && |
| 91 | + if( array_key_exists( $setting, $GLOBALS ) && |
89 | 92 | !( $noOverride && array_key_exists( $setting, $this->mDefaults ) ) ) |
90 | 93 | { |
91 | 94 | $this->mDefaults[$setting] = $GLOBALS[$setting]; |
— | — | @@ -100,7 +103,7 @@ |
101 | 104 | // Include files before so that customized settings won't be overridden |
102 | 105 | // by the default ones |
103 | 106 | $this->includeFiles(); |
104 | | - |
| 107 | + |
105 | 108 | $this->snapshotDefaults( 'allow_empty', 'no_override' ); |
106 | 109 | |
107 | 110 | list( $site, $lang ) = $this->siteFromDB( $this->mWiki ); |
— | — | @@ -108,9 +111,11 @@ |
109 | 112 | $this->extractAllGlobals( $this->mWiki, $site, $rewrites ); |
110 | 113 | } |
111 | 114 | |
112 | | - public function getIncludedFiles() { |
113 | | - if ( isset( $this->mConf[$this->mWiki]['__includes'] ) ) |
114 | | - return $this->mConf[$this->mWiki]['__includes']; |
| 115 | + public function getIncludedFiles( $wiki = null ) { |
| 116 | + if ( is_null( $wiki ) ) |
| 117 | + $wiki = $this->mWiki; |
| 118 | + if ( isset( $this->mConf[$wiki]['__includes'] ) ) |
| 119 | + return $this->mConf[$wiki]['__includes']; |
115 | 120 | else |
116 | 121 | return array(); |
117 | 122 | } |
— | — | @@ -185,13 +190,13 @@ |
186 | 191 | public function getWikisInVersion( $ts ) { |
187 | 192 | return $this->getHandler()->getWikisInVersion( $ts ); |
188 | 193 | } |
189 | | - |
| 194 | + |
190 | 195 | /** Recursive doohicky for normalising variables so we can compare them. */ |
191 | 196 | public static function filterVar( $var ) { |
192 | 197 | if ( empty( $var ) && !$var ) { |
193 | 198 | return null; |
194 | 199 | } |
195 | | - |
| 200 | + |
196 | 201 | if ( is_array( $var ) ) { |
197 | 202 | return array_filter( array_map( array( __CLASS__, 'filterVar' ), $var ) ); |
198 | 203 | } |
— | — | @@ -237,7 +242,7 @@ |
238 | 243 | $this->initialise( false ); |
239 | 244 | } |
240 | 245 | } |
241 | | - |
| 246 | + |
242 | 247 | // Hmm, a better solution would be nice! |
243 | 248 | $savedSettings = $this->settings; |
244 | 249 | $this->settings = $this->mOldSettings; |
Index: trunk/extensions/Configure/Configure.page.php |
— | — | @@ -124,12 +124,12 @@ |
125 | 125 | */ |
126 | 126 | protected function getSettingValue( $setting ) { |
127 | 127 | static $defaults; |
128 | | - |
| 128 | + |
129 | 129 | if (!$defaults) { |
130 | 130 | global $wgConf; |
131 | 131 | $defaults = $wgConf->getDefaultsForWiki( $this->mWiki ); |
132 | 132 | } |
133 | | - |
| 133 | + |
134 | 134 | if ( isset( $this->conf[$setting] ) ) { |
135 | 135 | return $this->conf[$setting]; |
136 | 136 | } else { |
— | — | @@ -312,7 +312,7 @@ |
313 | 313 | if ( $version = $wgRequest->getVal( 'version' ) ) { |
314 | 314 | if ( $version == 'default' || $wgConf->versionExists( $version ) ) { |
315 | 315 | $conf = $wgConf->getOldSettings( $version ); |
316 | | - |
| 316 | + |
317 | 317 | if ( $version == 'default' ) { ## Hacky special case. |
318 | 318 | $conf[$this->mWiki] = $conf['default']; |
319 | 319 | } |
— | — | @@ -573,20 +573,20 @@ |
574 | 574 | } |
575 | 575 | } |
576 | 576 | } |
577 | | - |
| 577 | + |
578 | 578 | break; |
579 | 579 | case 'rate-limits': |
580 | 580 | $all = array(); |
581 | 581 | ## TODO put this stuff in a central place. |
582 | 582 | $validActions = array( 'edit', 'move', 'mailpassword', 'emailuser', 'rollback' ); |
583 | 583 | $validGroups = array( 'anon', 'user', 'newbie', 'ip', 'subnet' ); |
584 | | - |
| 584 | + |
585 | 585 | foreach( $validActions as $action ) { |
586 | 586 | $all[$action] = array(); |
587 | 587 | foreach( $validGroups as $group ) { |
588 | 588 | $count = $wgRequest->getIntOrNull( "wp$name-key-$action-$group-count" ); |
589 | 589 | $period = $wgRequest->getIntOrNull( "wp$name-key-$action-$group-period" ); |
590 | | - |
| 590 | + |
591 | 591 | if ($count && $period) { |
592 | 592 | $all[$action][$group] = array( $count, $period ); |
593 | 593 | } else { |
— | — | @@ -594,7 +594,7 @@ |
595 | 595 | } |
596 | 596 | } |
597 | 597 | } |
598 | | - |
| 598 | + |
599 | 599 | $settings[$name] = $all; |
600 | 600 | break; |
601 | 601 | case 'promotion-conds': |
— | — | @@ -619,7 +619,7 @@ |
620 | 620 | if ( empty( $op ) ) { |
621 | 621 | $op = 'and'; |
622 | 622 | } |
623 | | - |
| 623 | + |
624 | 624 | if( !isset( $options[$op] ) ) |
625 | 625 | throw new MWException( "'{$op}' for group '{$group}' is not a valid operator for 'promotion-conds' type" ); |
626 | 626 | $op = $options[$op]; |
— | — | @@ -651,7 +651,7 @@ |
652 | 652 | foreach( $val as $reqGroup ) |
653 | 653 | if( $reqGroup ) |
654 | 654 | $reqGroups[] = $reqGroup; |
655 | | - |
| 655 | + |
656 | 656 | if( count( $reqGroups ) ) |
657 | 657 | $condsVal[] = array_merge( array( $condName ), $reqGroups ); |
658 | 658 | } |
— | — | @@ -668,14 +668,14 @@ |
669 | 669 | case 'lang': |
670 | 670 | case 'image-url': |
671 | 671 | $setting = $wgRequest->getVal( 'wp' . $name ); |
672 | | - |
| 672 | + |
673 | 673 | if ( $file = wfFindFile( $setting ) ) { |
674 | 674 | ## It's actually a local file. |
675 | 675 | $setting = $file->getUrl(); |
676 | 676 | } |
677 | | - |
| 677 | + |
678 | 678 | $settings[$name] = $setting; |
679 | | - |
| 679 | + |
680 | 680 | break; |
681 | 681 | case 'int': |
682 | 682 | $settings[$name] = $wgRequest->getInt( 'wp' . $name ); |
— | — | @@ -719,7 +719,7 @@ |
720 | 720 | if (!empty($val) || $val) { |
721 | 721 | return $val; |
722 | 722 | } |
723 | | - |
| 723 | + |
724 | 724 | static $list = null; |
725 | 725 | if ( $list === null ) |
726 | 726 | $list = $this->mConfSettings->getEmptyValues(); |
— | — | @@ -727,7 +727,7 @@ |
728 | 728 | static $defaults = null; |
729 | 729 | if ($defaults === null) |
730 | 730 | $defaults = $wgConf->getDefaultsForWiki( $this->mWiki ); |
731 | | - |
| 731 | + |
732 | 732 | if ( array_key_exists( $name, $list ) ) { |
733 | 733 | return $list[$name]; |
734 | 734 | } elseif ( !array_key_exists( $name, $defaults ) ) { |
— | — | @@ -817,7 +817,7 @@ |
818 | 818 | global $wgOut, $wgUser, $wgRequest; |
819 | 819 | |
820 | 820 | $action = $this->getTitle()->escapeLocalURL(); |
821 | | - |
| 821 | + |
822 | 822 | $reason = $wgRequest->getText( 'wpReason' ); |
823 | 823 | |
824 | 824 | $wgOut->addHTML( |
— | — | @@ -853,7 +853,7 @@ |
854 | 854 | ); |
855 | 855 | $this->injectScriptsAndStyles(); |
856 | 856 | } |
857 | | - |
| 857 | + |
858 | 858 | /** Show a hidden-by-default search form */ |
859 | 859 | protected function buildSearchForm() { |
860 | 860 | $form = wfMsgExt( 'configure-js-search-prompt', 'parseinline' ) . ' ' . Xml::element( 'input', array( 'id' => 'configure-search-input', 'size' => 45 ) ); |
— | — | @@ -883,7 +883,7 @@ |
884 | 884 | $biglist_hide = Xml::encodeJsVar( wfMsg( 'configure-js-biglist-hide' ) ); |
885 | 885 | $summary_none = Xml::encodeJsVar( wfMsg( 'configure-js-summary-none' ) ); |
886 | 886 | $throttle_summary = Xml::encodeJsVar( wfMsg( 'configure-throttle-summary' ) ); |
887 | | - |
| 887 | + |
888 | 888 | $ajax = isset( $wgUseAjax ) && $wgUseAjax ? 'true' : 'false'; |
889 | 889 | $script = array( |
890 | 890 | "<script type=\"$wgJsMimeType\">/*<![CDATA[*/", |
— | — | @@ -1087,32 +1087,33 @@ |
1088 | 1088 | if ( $type == 'rate-limits' ) { ## Some of this is stolen from assoc, since it's an assoc with an assoc. |
1089 | 1089 | $keydesc = wfMsgExt( "configure-setting-$conf-key", 'parseinline' ); |
1090 | 1090 | $valdesc = wfMsgExt( "configure-setting-$conf-value", 'parseinline' ); |
1091 | | - |
| 1091 | + |
1092 | 1092 | if ( wfEmptyMsg( "configure-setting-$conf-key", $keydesc ) ) |
1093 | 1093 | $keydesc = wfMsgHtml( 'configure-desc-key' ); |
1094 | 1094 | if ( wfEmptyMsg( "configure-setting-$conf-value", $valdesc ) ) |
1095 | 1095 | $valdesc = wfMsgHtml( 'configure-desc-val' ); |
1096 | | - |
| 1096 | + |
1097 | 1097 | $classes = array( 'configure-array-table', 'configure-rate-limits' ); |
1098 | 1098 | |
1099 | 1099 | if ( !$allowed ) |
1100 | 1100 | $classes[] = 'disabled'; |
1101 | | - |
| 1101 | + |
1102 | 1102 | $rows = Xml::tags( 'tr', null, Xml::tags( 'th', null, $keydesc ) . " " . Xml::tags( 'th', null, $valdesc ) )."\n"; |
1103 | | - |
| 1103 | + |
1104 | 1104 | # TODO put this stuff in one place. |
1105 | 1105 | $validActions = array( 'edit', 'move', 'mailpassword', 'emailuser', 'rollback' ); |
1106 | 1106 | $validGroups = array( 'anon', 'user', 'newbie', 'ip', 'subnet' ); |
1107 | | - |
| 1107 | + |
1108 | 1108 | foreach( $validActions as $action ) { |
1109 | 1109 | $val = array(); |
1110 | 1110 | if ( isset( $default[$action] ) ) |
1111 | 1111 | $val = $default[$action]; |
1112 | | - |
| 1112 | + |
1113 | 1113 | $key = Xml::tags( 'td', null, wfMsgExt( "configure-throttle-action-$action", 'parseinline' ) ); |
1114 | | - |
| 1114 | + |
1115 | 1115 | ## Build YET ANOTHER ASSOC TABLE ARGH! |
1116 | | - $innerRows = Xml::tags( 'tr', null, Xml::tags( 'th', null, wfMsgExt( 'configure-throttle-group', 'parseinline' ) ) . ' ' . Xml::tags( 'th', null, wfMsgExt( 'configure-throttle-limit', 'parseinline' ) ) )."\n"; |
| 1116 | + $innerRows = Xml::tags( 'tr', null, Xml::tags( 'th', null, wfMsgExt( 'configure-throttle-group', 'parseinline' ) ) . ' ' . |
| 1117 | + Xml::tags( 'th', null, wfMsgExt( 'configure-throttle-limit', 'parseinline' ) ) )."\n"; |
1117 | 1118 | foreach( $validGroups as $type ) { |
1118 | 1119 | $limits = null; |
1119 | 1120 | if ( isset( $default[$action][$type] ) ) |
— | — | @@ -1121,10 +1122,10 @@ |
1122 | 1123 | list( $count, $period ) = $limits; |
1123 | 1124 | else |
1124 | 1125 | $count = $period = 0; |
1125 | | - |
| 1126 | + |
1126 | 1127 | $id = 'wp'.$conf.'-key-'.$action.'-'.$type; |
1127 | 1128 | $left_col = Xml::tags( 'td', null, wfMsgExt( "configure-throttle-group-$type", 'parseinline' ) ); |
1128 | | - |
| 1129 | + |
1129 | 1130 | if ( $allowed ) { |
1130 | 1131 | $right_col = Xml::inputLabel( wfMsg( 'configure-throttle-count' ), "$id-count", "$id-count", 15, $count ) . ' <br /> ' . |
1131 | 1132 | Xml::inputLabel( wfMsg( 'configure-throttle-period' ), "$id-period", "$id-period", 15, $period ); |
— | — | @@ -1134,14 +1135,14 @@ |
1135 | 1136 | $right_col .= "\n" . Xml::hidden( "$id-count", $count, array( 'id' => "$id-count" ) ) . Xml::hidden( "$id-period", $period, array( 'id' => "$id-period" ) ); |
1136 | 1137 | } |
1137 | 1138 | $right_col = Xml::tags( 'td', null, $right_col ); |
1138 | | - |
| 1139 | + |
1139 | 1140 | $innerRows .= Xml::tags( 'tr', array( 'id' => $id ), $left_col . $right_col ) . "\n"; |
1140 | 1141 | } |
1141 | | - |
| 1142 | + |
1142 | 1143 | $value = Xml::tags( 'td', null, Xml::tags( 'table', array( 'class' => 'configure-biglist configure-rate-limits-action' ), Xml::tags( 'tbody', null, $innerRows ) ) ); |
1143 | 1144 | $rows .= Xml::tags( 'tr', null, $key.$value )."\n"; |
1144 | 1145 | } |
1145 | | - |
| 1146 | + |
1146 | 1147 | return Xml::tags( 'table', array( 'class' => implode( ' ', $classes ) ), Xml::tags( 'tbody', null, $rows ) ); |
1147 | 1148 | } |
1148 | 1149 | if ( $type == 'simple-dual' ) { |
— | — | @@ -1319,24 +1320,24 @@ |
1320 | 1321 | static $options = array( 'or' => '|', 'and' => '&', 'xor' => '^', 'not' => '!' ); |
1321 | 1322 | static $conds = array( APCOND_EDITCOUNT => 'int', APCOND_AGE => 'int', APCOND_EMAILCONFIRMED => 'bool', |
1322 | 1323 | APCOND_INGROUPS => 'array', APCOND_ISIP => 'text', APCOND_IPINRANGE => 'text' ); |
1323 | | - |
| 1324 | + |
1324 | 1325 | $row = '<div class="configure-biglist promotion-conds-element">'; |
1325 | 1326 | $row .= wfMsgHtml( 'configure-condition-operator' ) . ' '; |
1326 | 1327 | $encConf = htmlspecialchars( $conf ); |
1327 | 1328 | $encGroup = htmlspecialchars( $group ); |
1328 | 1329 | $encId = 'wp'.$encConf.'-'.$encGroup; |
1329 | 1330 | $curOpt = is_array( $groupConds ) ? array_shift( $groupConds ) : '&'; |
1330 | | - |
| 1331 | + |
1331 | 1332 | if ( empty($curOpt) ) |
1332 | 1333 | $curOpt = '&'; |
1333 | | - |
| 1334 | + |
1334 | 1335 | $extra = $allowed ? array() : array( 'disabled' => 'disabled' ); |
1335 | 1336 | foreach ( $options as $desc => $opt ) { |
1336 | 1337 | $row .= Xml::radioLabel( wfMsg( 'configure-condition-operator-'.$desc ), $encId.'-opt', $desc, |
1337 | 1338 | $encId.'-opt-'.$desc, $curOpt == $opt, $extra ) . "\n"; |
1338 | 1339 | } |
1339 | 1340 | $row .= "<br />\n"; |
1340 | | - |
| 1341 | + |
1341 | 1342 | if ( !is_array( $groupConds ) ) |
1342 | 1343 | $groupConds = array( $groupConds ); |
1343 | 1344 | |
— | — | @@ -1413,7 +1414,7 @@ |
1414 | 1415 | $id = Sanitizer::escapeId( 'wp' . $conf . '-' . $group . '-' . $right ); |
1415 | 1416 | if( $type == 'group-bool' ) |
1416 | 1417 | $desc = User::getRightDescription( $right ) . " (" .Xml::element( 'tt', array( 'class' => 'configure-right-id' ), $right ) . ")"; |
1417 | | - else |
| 1418 | + else |
1418 | 1419 | $desc = User::getGroupName( $right ); |
1419 | 1420 | $row .= '<li>' . Xml::check( $id, $checked, $attr + array( 'id' => $id ) ) . ' ' . Xml::tags( 'label', array( 'for' => $id ), $desc ) . "</li>\n"; |
1420 | 1421 | } |
— | — | @@ -1430,9 +1431,9 @@ |
1431 | 1432 | */ |
1432 | 1433 | protected function buildTableRow( $conf, $params ) { |
1433 | 1434 | global $wgContLang; |
1434 | | - |
| 1435 | + |
1435 | 1436 | $rowClasses = array(); |
1436 | | - |
| 1437 | + |
1437 | 1438 | if ( $params['customised'] ) |
1438 | 1439 | $rowClasses[] = 'configure-customised'; |
1439 | 1440 | |
— | — | @@ -1455,15 +1456,15 @@ |
1456 | 1457 | $msgVal = $link; |
1457 | 1458 | else |
1458 | 1459 | $msgVal = "$msgVal ($link)"; |
1459 | | - |
| 1460 | + |
1460 | 1461 | if ( $params['customised'] ) |
1461 | 1462 | $msgVal = Xml::tags( 'p', null, $msgVal ).wfMsgExt( 'configure-customised', 'parse' ); |
1462 | 1463 | $attribs['class'] = 'configure-left-column'; |
1463 | 1464 | $td1 = Xml::tags( 'td', $attribs, $msgVal ); |
1464 | | - |
| 1465 | + |
1465 | 1466 | ## Only the class is customised per-cell, so we'll just redefine that. |
1466 | 1467 | $attribs['class'] = 'configure-right-column'; |
1467 | | - |
| 1468 | + |
1468 | 1469 | $td2 = Xml::tags( 'td', $attribs, $this->buildInput( $conf, $params ) ); |
1469 | 1470 | |
1470 | 1471 | return Xml::tags( 'tr', array( 'class' => implode( ' ', $rowClasses ) ), $td1 . $td2 ) . "\n"; |
— | — | @@ -1478,7 +1479,7 @@ |
1479 | 1480 | */ |
1480 | 1481 | protected function buildSettings( $settings, $param = array() ) { |
1481 | 1482 | wfLoadExtensionMessages( 'ConfigureSettings' ); |
1482 | | - |
| 1483 | + |
1483 | 1484 | global $wgConf; |
1484 | 1485 | $defaults = $wgConf->getDefaultsForWiki( $this->mWiki ); |
1485 | 1486 | |
— | — | @@ -1540,9 +1541,9 @@ |
1541 | 1542 | |
1542 | 1543 | $customised = !array_key_exists( $setting, $defaults ); |
1543 | 1544 | $customised = $customised || ( WebConfiguration::filterVar( $defaults[$setting] ) != WebConfiguration::filterVar( $params['value'] ) ); |
1544 | | - |
| 1545 | + |
1545 | 1546 | $params['customised'] = $customised; |
1546 | | - |
| 1547 | + |
1547 | 1548 | $show = $this->mCanEdit ? |
1548 | 1549 | ( isset( $params['edit'] ) ? $params['edit'] : $this->userCanEdit( $setting ) ) : |
1549 | 1550 | ( isset( $params['read'] ) ? $params['read'] : $this->userCanRead( $setting ) ); |
Index: trunk/extensions/Configure/Configure.handler-files.php |
— | — | @@ -58,10 +58,10 @@ |
59 | 59 | if ( !is_array( $settings ) ) |
60 | 60 | # Weird, should not happen too |
61 | 61 | return array(); |
62 | | - |
| 62 | + |
63 | 63 | if ( isset( $settings['__metadata'] ) ) |
64 | 64 | unset( $settings['__metadata'] ); |
65 | | - |
| 65 | + |
66 | 66 | return $settings; |
67 | 67 | } |
68 | 68 | |
— | — | @@ -94,17 +94,17 @@ |
95 | 95 | */ |
96 | 96 | public function saveNewSettings( $settings, $wiki, $ts = false, $reason = '' ) { |
97 | 97 | global $wgUser; |
98 | | - |
| 98 | + |
99 | 99 | $arch = $this->getArchiveFileName(); |
100 | 100 | $cur = $this->getFileName(); |
101 | | - |
| 101 | + |
102 | 102 | ## Add meta-data |
103 | 103 | $settings['__metadata'] = array( |
104 | 104 | 'user_wiki' => wfWikiID(), |
105 | 105 | 'user_name' => $wgUser->getName(), |
106 | 106 | 'reason' => $reason |
107 | 107 | ); |
108 | | - |
| 108 | + |
109 | 109 | $cont = '<?php $settings = '.var_export( $settings, true ).";"; |
110 | 110 | @file_put_contents( $arch, $cont ); |
111 | 111 | return ( @file_put_contents( $cur, $cont ) !== false ); |
— | — | @@ -118,19 +118,19 @@ |
119 | 119 | if ( !$dir = opendir( $this->mDir ) ) |
120 | 120 | return array(); |
121 | 121 | $files = array(); |
122 | | - |
| 122 | + |
123 | 123 | while ( ( $file = readdir( $dir ) ) !== false ) { |
124 | 124 | if ( preg_match( '/^conf-(\d{14})\.php$/', $file, $m ) ) { |
125 | 125 | ## Read the data. |
126 | 126 | require( $this->mDir."/$file" ); |
127 | | - |
| 127 | + |
128 | 128 | if( isset( $options['wiki'] ) && !isset( $settings[$options['wiki']] ) ) |
129 | 129 | continue; |
130 | | - |
| 130 | + |
131 | 131 | if ( isset( $settings['__metadata'] ) ) { |
132 | 132 | $metadata = $settings['__metadata']; |
133 | | - |
134 | | - $files[$m[1]] = array( 'username' => $metadata['user_name'], |
| 133 | + |
| 134 | + $files[$m[1]] = array( 'username' => $metadata['user_name'], |
135 | 135 | 'userwiki' => $metadata['user_wiki'], 'reason' => $metadata['reason'], 'timestamp' => $m[1] ); |
136 | 136 | } else { |
137 | 137 | $files[$m[1]] = array( 'username' => false, 'userwiki' => false, 'reason' => false, 'timestamp' => $m[1] ); |
— | — | @@ -205,17 +205,17 @@ |
206 | 206 | */ |
207 | 207 | public function getArchiveFileName( $ts = null ) { |
208 | 208 | $ts_orig = $ts; |
209 | | - |
| 209 | + |
210 | 210 | if ( $ts === null ) |
211 | 211 | $ts = wfTimestampNow(); |
212 | 212 | |
213 | 213 | $file = "{$this->mDir}conf-$ts.php"; |
214 | | - |
| 214 | + |
215 | 215 | ## Hack hack hack |
216 | 216 | ## Basically, if the file already exists, pretend that the setting change was made in a second's time. |
217 | 217 | if ( $ts_orig === null && file_exists( $file ) ) |
218 | 218 | return $this->getArchiveFileName( $ts+1 ); |
219 | | - |
| 219 | + |
220 | 220 | return $file; |
221 | 221 | } |
222 | 222 | |
Index: trunk/extensions/Configure/SpecialViewConfig.php |
— | — | @@ -32,11 +32,11 @@ |
33 | 33 | $versions = $wgConf->listArchiveVersions(); |
34 | 34 | if ( in_array( $version, $versions ) || $version == 'default' ) { |
35 | 35 | $conf = $wgConf->getOldSettings( $version ); |
36 | | - |
| 36 | + |
37 | 37 | if ($version == 'default') { ## Yucky special case. |
38 | 38 | $conf[$this->mWiki] = $conf['default']; |
39 | 39 | } |
40 | | - |
| 40 | + |
41 | 41 | if ( $this->isUserAllowedAll() ) { |
42 | 42 | $wiki = $wgRequest->getVal( 'wiki', $wgConf->getWiki() ); |
43 | 43 | } else { |
— | — | @@ -176,7 +176,7 @@ |
177 | 177 | |
178 | 178 | extract( $this->formatConf ); |
179 | 179 | $time = $wgLang->timeAndDate( $ts ); |
180 | | - |
| 180 | + |
181 | 181 | ## Make user link... |
182 | 182 | $userLink = ''; |
183 | 183 | if (!$arr['user_wiki'] && !$arr['user_name'] ) { |
— | — | @@ -254,14 +254,14 @@ |
255 | 255 | Xml::element( 'input', array_merge( |
256 | 256 | array( 'type' => 'radio', 'name' => 'version', 'value' => $ts ), |
257 | 257 | $versionCheck ) ); |
258 | | - |
| 258 | + |
259 | 259 | $actions[] = $skin->link( $this->getTitle(), wfMsgHtml( 'configure-viewconfig-default-diff' ), array(), array( 'version' => $ts, 'diff' => 'default' ) ); |
260 | 260 | } else { |
261 | 261 | $buttons = ''; |
262 | 262 | } |
263 | | - |
| 263 | + |
264 | 264 | $comment = $arr['reason'] ? $skin->commentBlock( $arr['reason'] ) : ''; |
265 | | - |
| 265 | + |
266 | 266 | $action = implode( ', ', $actions ); |
267 | 267 | return Xml::tags( 'li', null, wfMsgExt( 'configure-viewconfig-line', array( 'parseinline', 'replaceafter' ), array( $buttons, $time, $userLink, $action, $comment ) ) )."\n"; |
268 | 268 | } |
— | — | @@ -281,7 +281,7 @@ |
282 | 282 | $form .= Xml::radioLabel( wfMsg( 'configure-select-wiki-view-all' ), 'view', 'all', 'wiki-all', $all ); |
283 | 283 | $form .= "<br />\n"; |
284 | 284 | $form .= Xml::radioLabel( wfMsg( 'configure-select-wiki-view-specific' ), 'view', 'specific', 'wiki-specific', !$all ) . ' '; |
285 | | - |
| 285 | + |
286 | 286 | if ( is_array( $wgConfigureWikis ) ) { |
287 | 287 | $selector = new XmlSelect( 'wiki', 'wiki', $this->mWiki ); |
288 | 288 | foreach( $wgConfigureWikis as $wiki ) { |
— | — | @@ -291,7 +291,7 @@ |
292 | 292 | } else { |
293 | 293 | $form .= Xml::input( 'wiki', false, $this->mWiki )."<br/>"; |
294 | 294 | } |
295 | | - |
| 295 | + |
296 | 296 | $form .= Xml::submitButton( wfMsg( 'configure-select-wiki-submit' ) ); |
297 | 297 | $form .= '</form></fieldset>'; |
298 | 298 | return $form; |
Index: trunk/extensions/Configure/CHANGELOG |
— | — | @@ -5,6 +5,10 @@ |
6 | 6 | * Added support for Redirect |
7 | 7 | * Fixed Special:Extensions: was sometimes throwing an error when saving the |
8 | 8 | configuration |
| 9 | + * (bug 16953) Fixed error on Special:Configure and Special:ViewConfig |
| 10 | + * Added $wgImplicitGroups to the default list of editable settings |
| 11 | + * Enabled extension are no more resetted when after an edit on |
| 12 | + Special:Configure |
9 | 13 | |
10 | 14 | 0.11.6 - 7 January 2009 |
11 | 15 | * Added support for OpenID, NewUserMessage and ReplaceText extensions. |
Index: trunk/extensions/Configure/Configure.ext.php |
— | — | @@ -187,12 +187,12 @@ |
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
191 | | - * Whether this extension |
| 191 | + * Whether this extension |
192 | 192 | */ |
193 | 193 | public function useVariable(){ |
194 | 194 | return !is_null( $this->mExtVar ); |
195 | 195 | } |
196 | | - |
| 196 | + |
197 | 197 | /** |
198 | 198 | * Get the variable for this extension |
199 | 199 | */ |
Index: trunk/extensions/Configure/Configure.handler-db.php |
— | — | @@ -207,15 +207,15 @@ |
208 | 208 | */ |
209 | 209 | protected function saveSettingsForWiki( $settings, $wiki, $ts, $reason = '' ) { |
210 | 210 | global $wgUser; |
211 | | - |
| 211 | + |
212 | 212 | $dbw = $this->getMasterDB(); |
213 | 213 | if ( !$ts ) |
214 | 214 | $ts = wfTimestampNow(); |
215 | | - |
| 215 | + |
216 | 216 | ## Look for dupes |
217 | 217 | if ($this->versionExists( $ts )) |
218 | 218 | $this->saveSettingsForWiki( $settings, $wiki, $ts+1, $reason ); |
219 | | - |
| 219 | + |
220 | 220 | $dbw->begin(); |
221 | 221 | $dbw->insert( 'config_version', |
222 | 222 | array( |
Index: trunk/extensions/Configure/Configure.php |
— | — | @@ -129,10 +129,10 @@ |
130 | 130 | 'wgSitename', 'wgLogo', 'wgContentNamespaces', 'wgMetaNamespace', 'wgMetaNamespaceTalk', |
131 | 131 | 'wgNamespaceAliases', 'wgNamespaceProtection', 'wgNamespaceRobotPolicies', 'wgNamespacesToBeSearchedDefault', |
132 | 132 | 'wgNamespacesToBeSearchedProject', 'wgNamespacesWithSubpages', 'wgNoFollowNsExceptions', 'wgNonincludableNamespaces', |
133 | | - 'wgSitemapNamespaces', 'wgAutopromote', 'wgGroupPermissions', 'wgAddGroups', 'wgRemoveGroups', 'wgGroupsAddToSelf', |
134 | | - 'wgGroupsRemoveFromSelf', 'wgArticleRobotPolicies', 'wgCapitalLinks', 'wgDefaultLanguageVariant', 'wgExtraSubtitle', |
135 | | - 'wgImportSources', 'wgRateLimits', 'wgAutoConfirmAge', 'wgAutoConfirmCount', 'wgMaxSigChars', 'wgExtraNamespaces', |
136 | | - 'wgLocaltimezone', 'wgExemptFromUserRobotsControl', |
| 133 | + 'wgSitemapNamespaces', 'wgAutopromote', 'wgGroupPermissions', 'wgImplicitGroups', 'wgAddGroups', 'wgRemoveGroups', |
| 134 | + 'wgGroupsAddToSelf', 'wgGroupsRemoveFromSelf', 'wgArticleRobotPolicies', 'wgCapitalLinks', 'wgDefaultLanguageVariant', |
| 135 | + 'wgExtraSubtitle', 'wgImportSources', 'wgRateLimits', 'wgAutoConfirmAge', 'wgAutoConfirmCount', 'wgMaxSigChars', |
| 136 | + 'wgExtraNamespaces', 'wgLocaltimezone', 'wgExemptFromUserRobotsControl', |
137 | 137 | ); |
138 | 138 | |
139 | 139 | /** |
Index: trunk/extensions/Configure/Configure.handler.php |
— | — | @@ -69,7 +69,7 @@ |
70 | 70 | * @return Array of versions |
71 | 71 | */ |
72 | 72 | public function listArchiveVersions( $options = array() ); |
73 | | - |
| 73 | + |
74 | 74 | /** |
75 | 75 | * Return a bool whether the version exists |
76 | 76 | * |
Index: trunk/extensions/Configure/SpecialExtensions.php |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | $new = $this->removeDefaults( $new ); |
33 | 33 | $new['__includes'] = $this->getRequiredFiles(); |
34 | 34 | $ok = $wgConf->saveNewSettings( $new, $this->mWiki, $reason ); |
35 | | - |
| 35 | + |
36 | 36 | $result = $ok ? 'success' : 'failure'; |
37 | 37 | |
38 | 38 | $url = $this->getTitle()->getLocalURL( "result=$result" ); |
— | — | @@ -100,7 +100,7 @@ |
101 | 101 | if ( !$globalDone ) { |
102 | 102 | extract( $GLOBALS, EXTR_REFS ); |
103 | 103 | global $wgHooks; |
104 | | - |
| 104 | + |
105 | 105 | $oldHooks = $wgHooks; |
106 | 106 | $globalDone = true; |
107 | 107 | } |
Index: trunk/extensions/Configure/Configure.settings-core.php |
— | — | @@ -883,7 +883,7 @@ |
884 | 884 | 'wgSearchForwardUrl' => null, |
885 | 885 | 'wgExemptFromUserRobotsControl' => null, |
886 | 886 | 'wgArticlePath' => false, |
887 | | - |
| 887 | + |
888 | 888 | ); |
889 | 889 | |
890 | 890 | /** |
Index: trunk/extensions/Configure/Configure.func.php |
— | — | @@ -70,9 +70,9 @@ |
71 | 71 | $wgConf->settings = $oldConf->settings; |
72 | 72 | $wgConf->localVHosts = $oldConf->localVHosts; |
73 | 73 | $wgConf->siteParamsCallback = $oldConf->siteParamsCallback; |
74 | | - |
| 74 | + |
75 | 75 | $wgConf->snapshotDefaults(); |
76 | | - |
| 76 | + |
77 | 77 | global $wgConfigureHandler; |
78 | 78 | if ( $wgConfigureHandler == 'db' ) { |
79 | 79 | // Defer to after caches and database are set up. |
Index: trunk/extensions/Configure/Configure.pager-files.php |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | $ret = array(); |
23 | 23 | if( $this->mWiki ) |
24 | 24 | $ret['wiki'] = $this->mWiki; |
25 | | - return $ret; |
| 25 | + return $ret; |
26 | 26 | } |
27 | 27 | |
28 | 28 | function getBody() { |
Index: trunk/extensions/Configure/SpecialConfigure.php |
— | — | @@ -29,6 +29,8 @@ |
30 | 30 | if( isset( $current[$name] ) ) |
31 | 31 | $settings[$name] = $current[$name]; |
32 | 32 | } |
| 33 | + ## Also save activated extensions :) |
| 34 | + $settings['__includes'] = $wgConf->getIncludedFiles( $this->mWiki ); |
33 | 35 | |
34 | 36 | $settings = $this->removeDefaults( $settings ); |
35 | 37 | if ( $wgConfigureUpdateCacheEpoch ) |