r39670 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r39669‎ | r39670 | r39671 >
Date:22:47, 19 August 2008
Author:vasilievvv
Status:old
Tags:
Comment:
* Add SQL layout
* Whitespace fixes
Modified paths:
  • /trunk/extensions/ConfigureWMF/ConfigureWMF.class.php (modified) (history)
  • /trunk/extensions/ConfigureWMF/ConfigureWMF.page.php (modified) (history)
  • /trunk/extensions/ConfigureWMF/ConfigureWMF.php (modified) (history)
  • /trunk/extensions/ConfigureWMF/tables.sql (added) (history)

Diff [purge]

Index: trunk/extensions/ConfigureWMF/ConfigureWMF.php
@@ -1,7 +1,7 @@
22 <?php
33
4 -if ( !defined( 'MEDIAWIKI' ) ) {
5 - exit(1);
 4+if( !defined( 'MEDIAWIKI' ) ) {
 5+ exit( 1 );
66 }
77
88 $wgExtensionCredits['other'][] = array(
@@ -13,10 +13,10 @@
1414 'descriptionmsg' => 'configurewmf-desc',
1515 );
1616
17 -//Name of the database to store configuration
 17+// Name of the database to store configuration
1818 $wgConfigureDatabase = 'wikiconfig';
1919
20 -//Mapping for extensions => variable to enable them
 20+// Mapping for extensions => variable to enable them
2121 $wgConfigureExtensions = array(
2222 'ProofreadPage' => 'wmgUseProofreadPage',
2323 'LabeledTranscludedSections' => 'wmgUseLST',
@@ -25,7 +25,7 @@
2626 'Nuke' => 'wmgUseSpecialNuke',
2727 );
2828
29 -//Available $wgConf tags
 29+// Available $wgConf tags
3030 $wgConfigureAvailableTags = array( 'default' );
3131
3232 $wgConfigureStdlogo = '$stdlogo';
@@ -67,7 +67,7 @@
6868 }
6969
7070 // To be applied on $wgConf->settings
71 -function efApplyConfiguration( &$settings ) {
 71+function efApplyConfiguration( &$settings ) {
7272 global $wgConfigure;
7373 efLoadConfiguration();
7474 $wgConfigure->applyConfiguration( $settings );
Index: trunk/extensions/ConfigureWMF/ConfigureWMF.class.php
@@ -49,11 +49,11 @@
5050 global $IP;
5151
5252 // No Setup.php yet. Initialise everything by ourselves
53 - require_once( $IP.'/includes/ObjectCache.php' );
 53+ require_once( $IP . '/includes/ObjectCache.php' );
5454 $wgMemc = wfGetMainCache();
5555
5656 // Caching not yet working
57 - //$cached = $wgMemc->get( 'configurewmf:data' );
 57+ // $cached = $wgMemc->get( 'configurewmf:data' );
5858 if( $cached ) {
5959 $this->overrides = $cached;
6060 return;
@@ -71,13 +71,13 @@
7272
7373 public static function getSlaveDB() {
7474 global $wgConfigureDatabase;
75 - return wfGetLB( $wgConfigureDatabase )->getConnection( DB_SLAVE, 'wikiconfig',
 75+ return wfGetLB( $wgConfigureDatabase )->getConnection( DB_SLAVE, 'wikiconfig',
7676 $wgConfigureDatabase );
7777 }
7878
7979 public static function getMasterDB() {
8080 global $wgConfigureDatabase;
81 - return wfGetLB( $wgConfigureDatabase )->getConnection( DB_MASTER, 'wikiconfig',
 81+ return wfGetLB( $wgConfigureDatabase )->getConnection( DB_MASTER, 'wikiconfig',
8282 $wgConfigureDatabase );
8383 }
8484
@@ -137,7 +137,7 @@
138138 foreach( $this->overrides as $override ) {
139139 foreach( $override['value'] as $varname => $val ) {
140140 if( in_array( $varname, self::$mergable ) ) {
141 - //stub
 141+ // stub
142142 } else {
143143 $settings[$varname][$override['target']] = $val;
144144 }
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
124 + native
Name: svn:executable
225 + *
Index: trunk/extensions/ConfigureWMF/ConfigureWMF.page.php
@@ -65,7 +65,7 @@
6666 $wgOut->addHTML( '<strong id="cfgwmf-attention" style="color: red; font-size: 12pt">' . wfMsgHTML( 'configurewmf-attentionnotice' ) . '</strong>' );
6767 $wgOut->addWikiMsg( 'configurewmf-selectsite-help' );
6868 $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>' );
7070 $wgOut->addHTML( '<td class="mw-label">' . Xml::label( wfMsg( 'configurewmf-site' ), 'cfg-site' ) . '</td>' );
7171 $wgOut->addHTML( '<td class="mw-input">' . Xml::input( 'wiki', false, false, array( 'id' => 'cfg-site' ) ) . '</td>' );
7272 $wgOut->addHTML( '</tr><tr><td></td><td class="mw-input">' . Xml::submitButton( wfMsg( 'configurewmf-select' ) ) . '</td>' );
@@ -200,7 +200,7 @@
201201 foreach( $rights as $right ) {
202202 $label = wfMsgExt( 'configurewmf-permission', array( 'parseinline' ),
203203 User::getRightDescription( $right ), $right );
204 - $checkboxes[] = Xml::checkLabel(
 204+ $checkboxes[] = Xml::checkLabel(
205205 $label, "{$var}-{$right}", "{$var}-{$right}", @$perms[$right]
206206 );
207207 }
@@ -227,7 +227,7 @@
228228 $r .= "<li>{$checkbox}</li>\n";
229229 }
230230 $r .= '</ul>';
231 - break;;
 231+ break;
232232 }
233233 return $r . '</td></tr>';
234234 }
@@ -245,7 +245,7 @@
246246 break;
247247 case 'bool':
248248 $values[$name] = $wgRequest->getCheck( $name );
249 - $logs[] = wfMsgForContent( 'configurewmf-log-' . ($values[$name] ? 'true' : 'false') );
 249+ $logs[] = wfMsgForContent( 'configurewmf-log-' . ( $values[$name] ? 'true' : 'false' ) );
250250 break;
251251 case 'stringarray':
252252 $values[$name] = array_unique( preg_split( '/\n/', $wgRequest->getVal( $name ), -1, PREG_SPLIT_NO_EMPTY ) );
@@ -254,8 +254,8 @@
255255 case 'logo':
256256 global $wgConfigureStdlogo;
257257 $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" ) );
260260 break;
261261 case 'groupperms':
262262 $groupperms = $wgConfigure->getGroupPermissions( $wiki );
@@ -264,12 +264,12 @@
265265 $rights = User::getAllRights();
266266 $changes = array();
267267 foreach( $rights as $right ) {
268 - if( ((bool)@$perms[$right]) != $wgRequest->getCheck( "{$name}-{$right}" ) ) {
 268+ if( ( (bool)@$perms[$right] ) != $wgRequest->getCheck( "{$name}-{$right}" ) ) {
269269 $changes[$right] = $wgRequest->getCheck( "{$name}-{$right}" );
270270 }
271271 }
272272
273 - if( $changes ) {
 273+ if( $changes ) {
274274 $override = $wgConfigure->getOverride( $config, $wiki );
275275 $override = $override && isset( $override->cfg_value['wgGroupPermissions'] ) ? $override->cfg_value['wgGroupPermissions'] : array();
276276 if( !isset( $override[$group] ) )

Status & tagging log