r89316 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89315‎ | r89316 | r89317 >
Date:02:03, 2 June 2011
Author:demon
Status:ok
Tags:
Comment:
MFT r89311
Modified paths:
  • /branches/REL1_17/phase3/includes/installer (modified) (history)
  • /branches/REL1_17/phase3/includes/installer/LocalSettingsGenerator.php (modified) (history)
  • /branches/REL1_17/phase3/includes/installer/WebInstaller.php (modified) (history)

Diff [purge]

Index: branches/REL1_17/phase3/includes/installer/WebInstaller.php
@@ -147,6 +147,10 @@
148148 );
149149
150150 $ls = new LocalSettingsGenerator( $this );
 151+ $rightsProfile = $this->rightsProfiles[$this->getVar( '_RightsProfile' )];
 152+ foreach( $rightsProfile as $group => $rightsArr ) {
 153+ $ls->setGroupRights( $group, $rightsArr );
 154+ }
151155 echo $ls->getText();
152156 return $this->session;
153157 }
Index: branches/REL1_17/phase3/includes/installer/LocalSettingsGenerator.php
@@ -16,6 +16,7 @@
1717
1818 private $extensions = array();
1919 private $values = array();
 20+ private $groupPermissions = array();
2021 private $dbSettings = '';
2122 private $safeMode = false;
2223
@@ -77,6 +78,16 @@
7879 }
7980
8081 /**
 82+ * For $wgGroupPermissions, set a given ['group']['permission'] value.
 83+ * @param $group String Group name
 84+ * @param $rightsArr Array An array of permissions, in the form of:
 85+ * array( 'right' => true, 'right2' => false )
 86+ */
 87+ public function setGroupRights( $group, $rightsArr ) {
 88+ $this->groupPermissions[$group] = $rightsArr;
 89+ }
 90+
 91+ /**
8192 * Returns the escaped version of a string of php code.
8293 *
8394 * @param $string String
@@ -176,13 +187,26 @@
177188 $locale = '';
178189 }
179190
180 - $rights = $this->values['wgRightsUrl'] ? '' : '#';
 191+ $rightsUrl = $this->values['wgRightsUrl'] ? '' : '#';
181192 $hashedUploads = $this->safeMode ? '' : '#';
182193 $metaNamespace = '';
183194 if( $this->values['wgMetaNamespace'] !== $this->values['wgSitename'] ) {
184195 $metaNamespace = "\$wgMetaNamespace = \"{$this->values['wgMetaNamespace']}\";\n";
185196 }
186197
 198+ $groupRights = '';
 199+ if( $this->groupPermissions ) {
 200+ $groupRights .= "# The following permissions were set based on your choice in the installer\n";
 201+ foreach( $this->groupPermissions as $group => $rightArr ) {
 202+ $group = self::escapePhpString( $group );
 203+ foreach( $rightArr as $right => $perm ) {
 204+ $right = self::escapePhpString( $right );
 205+ $groupRights .= "\$wgGroupPermissions['$group']['$right'] = " .
 206+ wfBoolToStr( $perm ) . "\n";
 207+ }
 208+ }
 209+ }
 210+
187211 switch( $this->values['wgMainCacheType'] ) {
188212 case 'anything':
189213 case 'db':
@@ -302,7 +326,7 @@
303327 ## For attaching licensing metadata to pages, and displaying an
304328 ## appropriate copyright notice / icon. GNU Free Documentation
305329 ## License and Creative Commons licenses are supported so far.
306 -{$rights}\$wgEnableCreativeCommonsRdf = true;
 330+{$rightsUrl}\$wgEnableCreativeCommonsRdf = true;
307331 \$wgRightsPage = \"\"; # Set to the title of a wiki page that describes your license/copyright
308332 \$wgRightsUrl = \"{$this->values['wgRightsUrl']}\";
309333 \$wgRightsText = \"{$this->values['wgRightsText']}\";
@@ -311,7 +335,8 @@
312336
313337 # Path to the GNU diff3 utility. Used for conflict resolution.
314338 \$wgDiff3 = \"{$this->values['wgDiff3']}\";
315 -";
 339+
 340+{$groupRights}";
316341 }
317342
318343 }
Property changes on: branches/REL1_17/phase3/includes/installer
___________________________________________________________________
Modified: svn:mergeinfo
319344 Merged /trunk/phase3/includes/installer:r89311

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r89311Make user right selection in installer actually work, thanks Krinkle for spot...demon01:26, 2 June 2011

Status & tagging log