Index: trunk/extensions/Configure/Configure.api.php |
— | — | @@ -251,8 +251,50 @@ |
252 | 252 | $result->setIndexedTagName( $arr, 'group' ); |
253 | 253 | $settingRet['values'][] = $arr; |
254 | 254 | } |
| 255 | + break; |
| 256 | + case 'promotion-conds': |
| 257 | + $opToName = array_flip( array( 'or' => '|', 'and' => '&', 'xor' => '^', 'not' => '!' ) ); |
| 258 | + $condsName = array( 1 => 'editcount', 2 => 'age', 3 => 'emailconfirmed', 4 => 'in-groups' ); |
| 259 | + $validOps = array_keys( $opToName ); |
| 260 | + |
| 261 | + $settingRet['values'] = array(); |
| 262 | + $result->setIndexedTagName( $settingRet['values'], 'group' ); |
| 263 | + |
| 264 | + foreach( $settingVal as $group => $conds ) { |
| 265 | + $retConds = array( 'group' => $group ); |
| 266 | + $result->setIndexedTagName( $retConds, 'condition' ); |
| 267 | + do { |
| 268 | + if ( !is_array( $conds ) ) { |
| 269 | + $retConds[] = array( 'name' => $condsName[$conds] ); |
| 270 | + continue; |
| 271 | + } |
| 272 | + if ( count( $conds ) == 0 ) { |
| 273 | + continue; |
| 274 | + } |
| 275 | + if ( count( $conds ) > 1 && in_array( $conds[0], $validOps ) ) { |
| 276 | + $boolop = array_shift( $conds ); |
| 277 | + $boolop = $opToName[$boolop]; |
| 278 | + $retConds['operator'] = $boolop; |
| 279 | + } else { |
| 280 | + $conds = array( $conds ); |
| 281 | + } |
| 282 | + // Analyse each individual one... |
| 283 | + foreach( $conds as $cond ) { |
| 284 | + if ( $cond == array( APCOND_AGE, -1 ) ) { |
| 285 | + continue; |
| 286 | + } |
| 287 | + if( !is_array( $cond ) ) { |
| 288 | + $cond = array( $cond ); |
| 289 | + } |
| 290 | + $name = array_shift( $cond ); |
| 291 | + $argSummary = implode( ', ', $cond ); |
| 292 | + $retConds[] = array( 'name' => $condsName[$name], 'value' => $argSummary ); |
| 293 | + } |
| 294 | + } while( false ); |
| 295 | + $settingRet['values'][] = $retConds; |
| 296 | + } |
| 297 | + break; |
255 | 298 | } |
256 | | - break; |
257 | 299 | default: |
258 | 300 | if ( is_array( $type ) ) { |
259 | 301 | $allowed = array(); |
Index: trunk/extensions/Configure/Configure.page.php |
— | — | @@ -880,18 +880,9 @@ |
881 | 881 | */ |
882 | 882 | protected function injectScriptsAndStyles() { |
883 | 883 | global $wgOut, $wgScriptPath, $wgUseAjax, $wgJsMimeType, $wgConfigureStyleVersion; |
884 | | - $href = "{$wgScriptPath}/extensions/Configure/Configure.css?{$wgConfigureStyleVersion}"; |
885 | | - if ( is_callable( array( $wgOut, 'addExtensionStyle' ) ) ) { # 1.14+ |
886 | | - $wgOut->addExtensionStyle( $href ); |
887 | | - } else { |
888 | | - $wgOut->addLink( |
889 | | - array( |
890 | | - 'rel' => 'stylesheet', |
891 | | - 'type' => 'text/css', |
892 | | - 'href' => $href, |
893 | | - ) |
894 | | - ); |
895 | | - } |
| 884 | + |
| 885 | + $wgOut->addExtensionStyle( "{$wgScriptPath}/extensions/Configure/Configure.css?{$wgConfigureStyleVersion}" ); |
| 886 | + |
896 | 887 | $add = Xml::encodeJsVar( wfMsg( 'configure-js-add' ) ); |
897 | 888 | $remove = Xml::encodeJsVar( wfMsg( 'configure-js-remove' ) ); |
898 | 889 | $removeRow = Xml::encodeJsVar( wfMsg( 'configure-js-remove-row' ) ); |
Index: trunk/extensions/Configure/Configure.diff.php |
— | — | @@ -273,7 +273,7 @@ |
274 | 274 | list( $count, $period ) = $limit; |
275 | 275 | if ($count == 0 || $period == 0) |
276 | 276 | continue; |
277 | | - |
| 277 | + |
278 | 278 | $val[] = "$action, $group: " . wfMsg( 'configure-throttle-summary', $count, $period ); |
279 | 279 | } |
280 | 280 | } |
— | — | @@ -281,10 +281,10 @@ |
282 | 282 | } else if ( $arrType == 'promotion-conds' ) { |
283 | 283 | ## For each group, print out the full conditions. |
284 | 284 | $val = array(); |
285 | | - |
| 285 | + |
286 | 286 | $opToName = array_flip( array( 'or' => '|', 'and' => '&', 'xor' => '^', 'not' => '!' ) ); |
287 | 287 | $validOps = array_keys( $opToName ); |
288 | | - |
| 288 | + |
289 | 289 | foreach( $setting as $group => $conds ) { |
290 | 290 | if ( !is_array( $conds ) ) { |
291 | 291 | $val[] = "$group: ".wfMsg( "configure-condition-description-$conds" ); |
— | — | @@ -294,31 +294,31 @@ |
295 | 295 | $val[] = "$group: ".wfMsg( 'configure-autopromote-noconds' ); |
296 | 296 | continue; |
297 | 297 | } |
298 | | - |
| 298 | + |
299 | 299 | if ( count( $conds ) > 1 && in_array( $conds[0], $validOps ) ) { |
300 | 300 | $boolop = array_shift( $conds ); |
301 | 301 | $boolop = $opToName[$boolop]; |
302 | | - |
| 302 | + |
303 | 303 | $val[] = "$group: ".wfMsg( "configure-boolop-description-$boolop" ); |
304 | 304 | } else { |
305 | 305 | $conds = array( $conds ); |
306 | 306 | } |
307 | | - |
| 307 | + |
308 | 308 | // Analyse each individual one... |
309 | 309 | foreach( $conds as $cond ) { |
310 | 310 | if ($cond == array( APCOND_AGE, -1 ) ) { |
311 | 311 | $val[] = "$group: ".wfMsg( 'configure-autopromote-noconds' ); |
312 | 312 | continue; |
313 | 313 | } |
314 | | - |
| 314 | + |
315 | 315 | if( !is_array( $cond ) ) { |
316 | 316 | $cond = array( $cond ); |
317 | 317 | } |
318 | 318 | $name = array_shift( $cond ); |
319 | 319 | |
320 | | - |
| 320 | + |
321 | 321 | $argSummary = implode( ', ', $cond ); |
322 | | - |
| 322 | + |
323 | 323 | $val[] = "$group: ".wfMsg( "configure-condition-description-$name", $argSummary ); |
324 | 324 | } |
325 | 325 | } |
— | — | @@ -391,30 +391,30 @@ |
392 | 392 | |
393 | 393 | protected function getOldVersion() { |
394 | 394 | global $wgConf; |
395 | | - |
| 395 | + |
396 | 396 | $settings = $wgConf->getOldSettings( $this->diff ); |
397 | | - |
| 397 | + |
398 | 398 | if ($this->diff == 'default') { ## Special case: Replicate settings across all wikis for a fair comparison. |
399 | 399 | $new = $this->getNewVersion(); |
400 | | - |
| 400 | + |
401 | 401 | $defaultSettings = array(); |
402 | | - |
| 402 | + |
403 | 403 | ## This is kinda annoying. We can't copy ALL settings over, because not all settings are stored. |
404 | 404 | foreach( $new as $wiki => $newSettings ) { |
405 | 405 | if ($wiki == '__metadata') ## Ignore metadata. |
406 | 406 | continue; |
407 | | - |
| 407 | + |
408 | 408 | $defaultSettings[$wiki] = array(); |
409 | | - |
| 409 | + |
410 | 410 | foreach( $newSettings as $key => $value ) { |
411 | 411 | if (isset($settings['default'][$key])) |
412 | 412 | $defaultSettings[$wiki][$key] = $settings['default'][$key]; |
413 | 413 | } |
414 | 414 | } |
415 | | - |
| 415 | + |
416 | 416 | $settings = $defaultSettings; |
417 | 417 | } |
418 | | - |
| 418 | + |
419 | 419 | return $settings; |
420 | 420 | } |
421 | 421 | |
Index: trunk/extensions/Configure/Configure.func.php |
— | — | @@ -71,8 +71,7 @@ |
72 | 72 | $wgConf->wikis = $oldConf->wikis; |
73 | 73 | $wgConf->settings = $oldConf->settings; |
74 | 74 | $wgConf->localVHosts = $oldConf->localVHosts; |
75 | | - if ( isset( $oldConf->siteParamsCallback ) ) # 1.14+ |
76 | | - $wgConf->siteParamsCallback = $oldConf->siteParamsCallback; |
| 75 | + $wgConf->siteParamsCallback = $oldConf->siteParamsCallback; |
77 | 76 | |
78 | 77 | $wgConf->snapshotDefaults(); |
79 | 78 | |