Index: trunk/extensions/ConfigureWMF/ConfigureWMF.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
5 | | - exit(1); |
| 4 | +if( !defined( 'MEDIAWIKI' ) ) { |
| 5 | + exit( 1 ); |
6 | 6 | } |
7 | 7 | |
8 | 8 | $wgExtensionCredits['other'][] = array( |
— | — | @@ -13,10 +13,10 @@ |
14 | 14 | 'descriptionmsg' => 'configurewmf-desc', |
15 | 15 | ); |
16 | 16 | |
17 | | -//Name of the database to store configuration |
| 17 | +// Name of the database to store configuration |
18 | 18 | $wgConfigureDatabase = 'wikiconfig'; |
19 | 19 | |
20 | | -//Mapping for extensions => variable to enable them |
| 20 | +// Mapping for extensions => variable to enable them |
21 | 21 | $wgConfigureExtensions = array( |
22 | 22 | 'ProofreadPage' => 'wmgUseProofreadPage', |
23 | 23 | 'LabeledTranscludedSections' => 'wmgUseLST', |
— | — | @@ -25,7 +25,7 @@ |
26 | 26 | 'Nuke' => 'wmgUseSpecialNuke', |
27 | 27 | ); |
28 | 28 | |
29 | | -//Available $wgConf tags |
| 29 | +// Available $wgConf tags |
30 | 30 | $wgConfigureAvailableTags = array( 'default' ); |
31 | 31 | |
32 | 32 | $wgConfigureStdlogo = '$stdlogo'; |
— | — | @@ -67,7 +67,7 @@ |
68 | 68 | } |
69 | 69 | |
70 | 70 | // To be applied on $wgConf->settings |
71 | | -function efApplyConfiguration( &$settings ) { |
| 71 | +function efApplyConfiguration( &$settings ) { |
72 | 72 | global $wgConfigure; |
73 | 73 | efLoadConfiguration(); |
74 | 74 | $wgConfigure->applyConfiguration( $settings ); |
Index: trunk/extensions/ConfigureWMF/ConfigureWMF.class.php |
— | — | @@ -49,11 +49,11 @@ |
50 | 50 | global $IP; |
51 | 51 | |
52 | 52 | // No Setup.php yet. Initialise everything by ourselves |
53 | | - require_once( $IP.'/includes/ObjectCache.php' ); |
| 53 | + require_once( $IP . '/includes/ObjectCache.php' ); |
54 | 54 | $wgMemc = wfGetMainCache(); |
55 | 55 | |
56 | 56 | // Caching not yet working |
57 | | - //$cached = $wgMemc->get( 'configurewmf:data' ); |
| 57 | + // $cached = $wgMemc->get( 'configurewmf:data' ); |
58 | 58 | if( $cached ) { |
59 | 59 | $this->overrides = $cached; |
60 | 60 | return; |
— | — | @@ -71,13 +71,13 @@ |
72 | 72 | |
73 | 73 | public static function getSlaveDB() { |
74 | 74 | global $wgConfigureDatabase; |
75 | | - return wfGetLB( $wgConfigureDatabase )->getConnection( DB_SLAVE, 'wikiconfig', |
| 75 | + return wfGetLB( $wgConfigureDatabase )->getConnection( DB_SLAVE, 'wikiconfig', |
76 | 76 | $wgConfigureDatabase ); |
77 | 77 | } |
78 | 78 | |
79 | 79 | public static function getMasterDB() { |
80 | 80 | global $wgConfigureDatabase; |
81 | | - return wfGetLB( $wgConfigureDatabase )->getConnection( DB_MASTER, 'wikiconfig', |
| 81 | + return wfGetLB( $wgConfigureDatabase )->getConnection( DB_MASTER, 'wikiconfig', |
82 | 82 | $wgConfigureDatabase ); |
83 | 83 | } |
84 | 84 | |
— | — | @@ -137,7 +137,7 @@ |
138 | 138 | foreach( $this->overrides as $override ) { |
139 | 139 | foreach( $override['value'] as $varname => $val ) { |
140 | 140 | if( in_array( $varname, self::$mergable ) ) { |
141 | | - //stub |
| 141 | + // stub |
142 | 142 | } else { |
143 | 143 | $settings[$varname][$override['target']] = $val; |
144 | 144 | } |
Index: trunk/extensions/ConfigureWMF/tables.sql |
— | — | @@ -0,0 +1,22 @@ |
| 2 | +-- Tables for ConfigureWMF extension |
| 3 | + |
| 4 | +CREATE TABLE config_overrides ( |
| 5 | + -- Wiki or tag of wiki to be applied |
| 6 | + -- Existing tags: private, fishbowl, default |
| 7 | + cfg_target varchar(255) binary not null, |
| 8 | + |
| 9 | + -- Configuration internal ID |
| 10 | + cfg_name varchar(255) binary not null, |
| 11 | + |
| 12 | + -- Configuration itself, serialize()'d array |
| 13 | + cfg_value mediumblob not null, |
| 14 | + |
| 15 | + -- User who last changed this override |
| 16 | + cfg_user_text varchar(255) not null, |
| 17 | + |
| 18 | + -- Last change timestamp |
| 19 | + cfg_timestamp binary(14) not null, |
| 20 | + |
| 21 | + PRIMARY KEY (cfg_target,cfg_name), |
| 22 | + KEY (cfg_target) |
| 23 | +) /*$wgDBTableOptions*/; |
\ No newline at end of file |
Property changes on: trunk/extensions/ConfigureWMF/tables.sql |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 24 | + native |
Name: svn:executable |
2 | 25 | + * |
Index: trunk/extensions/ConfigureWMF/ConfigureWMF.page.php |
— | — | @@ -65,7 +65,7 @@ |
66 | 66 | $wgOut->addHTML( '<strong id="cfgwmf-attention" style="color: red; font-size: 12pt">' . wfMsgHTML( 'configurewmf-attentionnotice' ) . '</strong>' ); |
67 | 67 | $wgOut->addWikiMsg( 'configurewmf-selectsite-help' ); |
68 | 68 | $wgOut->addHTML( "<form action='{$wgScript}' method='get'>" ); |
69 | | - $wgOut->addHTML( '<p>'. Xml::hidden( 'title', $wgTitle->getFullText() ) . '</p><table><tr>' ); |
| 69 | + $wgOut->addHTML( '<p>' . Xml::hidden( 'title', $wgTitle->getFullText() ) . '</p><table><tr>' ); |
70 | 70 | $wgOut->addHTML( '<td class="mw-label">' . Xml::label( wfMsg( 'configurewmf-site' ), 'cfg-site' ) . '</td>' ); |
71 | 71 | $wgOut->addHTML( '<td class="mw-input">' . Xml::input( 'wiki', false, false, array( 'id' => 'cfg-site' ) ) . '</td>' ); |
72 | 72 | $wgOut->addHTML( '</tr><tr><td></td><td class="mw-input">' . Xml::submitButton( wfMsg( 'configurewmf-select' ) ) . '</td>' ); |
— | — | @@ -200,7 +200,7 @@ |
201 | 201 | foreach( $rights as $right ) { |
202 | 202 | $label = wfMsgExt( 'configurewmf-permission', array( 'parseinline' ), |
203 | 203 | User::getRightDescription( $right ), $right ); |
204 | | - $checkboxes[] = Xml::checkLabel( |
| 204 | + $checkboxes[] = Xml::checkLabel( |
205 | 205 | $label, "{$var}-{$right}", "{$var}-{$right}", @$perms[$right] |
206 | 206 | ); |
207 | 207 | } |
— | — | @@ -227,7 +227,7 @@ |
228 | 228 | $r .= "<li>{$checkbox}</li>\n"; |
229 | 229 | } |
230 | 230 | $r .= '</ul>'; |
231 | | - break;; |
| 231 | + break; |
232 | 232 | } |
233 | 233 | return $r . '</td></tr>'; |
234 | 234 | } |
— | — | @@ -245,7 +245,7 @@ |
246 | 246 | break; |
247 | 247 | case 'bool': |
248 | 248 | $values[$name] = $wgRequest->getCheck( $name ); |
249 | | - $logs[] = wfMsgForContent( 'configurewmf-log-' . ($values[$name] ? 'true' : 'false') ); |
| 249 | + $logs[] = wfMsgForContent( 'configurewmf-log-' . ( $values[$name] ? 'true' : 'false' ) ); |
250 | 250 | break; |
251 | 251 | case 'stringarray': |
252 | 252 | $values[$name] = array_unique( preg_split( '/\n/', $wgRequest->getVal( $name ), -1, PREG_SPLIT_NO_EMPTY ) ); |
— | — | @@ -254,8 +254,8 @@ |
255 | 255 | case 'logo': |
256 | 256 | global $wgConfigureStdlogo; |
257 | 257 | $input = $wgRequest->getVal( $name ); |
258 | | - $values[$name] = ($input == 'stdlogo' ? $wgConfigureStdlogo : $wgRequest->getVal( "{$name}Other" )); |
259 | | - $logs[] = ($input == 'stdlogo' ? wfMsgForContent( 'configurewmf-log-stdlogo' ) : $wgRequest->getVal( "{$name}Other" )); |
| 258 | + $values[$name] = ( $input == 'stdlogo' ? $wgConfigureStdlogo : $wgRequest->getVal( "{$name}Other" ) ); |
| 259 | + $logs[] = ( $input == 'stdlogo' ? wfMsgForContent( 'configurewmf-log-stdlogo' ) : $wgRequest->getVal( "{$name}Other" ) ); |
260 | 260 | break; |
261 | 261 | case 'groupperms': |
262 | 262 | $groupperms = $wgConfigure->getGroupPermissions( $wiki ); |
— | — | @@ -264,12 +264,12 @@ |
265 | 265 | $rights = User::getAllRights(); |
266 | 266 | $changes = array(); |
267 | 267 | foreach( $rights as $right ) { |
268 | | - if( ((bool)@$perms[$right]) != $wgRequest->getCheck( "{$name}-{$right}" ) ) { |
| 268 | + if( ( (bool)@$perms[$right] ) != $wgRequest->getCheck( "{$name}-{$right}" ) ) { |
269 | 269 | $changes[$right] = $wgRequest->getCheck( "{$name}-{$right}" ); |
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
273 | | - if( $changes ) { |
| 273 | + if( $changes ) { |
274 | 274 | $override = $wgConfigure->getOverride( $config, $wiki ); |
275 | 275 | $override = $override && isset( $override->cfg_value['wgGroupPermissions'] ) ? $override->cfg_value['wgGroupPermissions'] : array(); |
276 | 276 | if( !isset( $override[$group] ) ) |