http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89316

Revision: 89316
Author:   demon
Date:     2011-06-02 02:03:16 +0000 (Thu, 02 Jun 2011)
Log Message:
-----------
MFT r89311

Modified Paths:
--------------
    branches/REL1_17/phase3/includes/installer/LocalSettingsGenerator.php
    branches/REL1_17/phase3/includes/installer/WebInstaller.php

Property Changed:
----------------
    branches/REL1_17/phase3/includes/installer/


Property changes on: branches/REL1_17/phase3/includes/installer
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3/includes/installer:51646
/branches/new-installer/phase3/includes/installer:43664-66004
/branches/sqlite/includes/installer:58211-58321
/branches/wmf-deployment/includes/installer:53381
/trunk/phase3/includes/installer:82845,82847-82848,84875,84881-84882,84970,84976,85021,85066
   + /branches/REL1_15/phase3/includes/installer:51646
/branches/new-installer/phase3/includes/installer:43664-66004
/branches/sqlite/includes/installer:58211-58321
/branches/wmf-deployment/includes/installer:53381
/trunk/phase3/includes/installer:82845,82847-82848,84875,84881-84882,84970,84976,85021,85066,89311

Modified: branches/REL1_17/phase3/includes/installer/LocalSettingsGenerator.php
===================================================================
--- branches/REL1_17/phase3/includes/installer/LocalSettingsGenerator.php       
2011-06-02 01:47:22 UTC (rev 89315)
+++ branches/REL1_17/phase3/includes/installer/LocalSettingsGenerator.php       
2011-06-02 02:03:16 UTC (rev 89316)
@@ -16,6 +16,7 @@
 
        private $extensions = array();
        private $values = array();
+       private $groupPermissions = array();
        private $dbSettings = '';
        private $safeMode = false;
 
@@ -77,6 +78,16 @@
        }
 
        /**
+        * For $wgGroupPermissions, set a given ['group']['permission'] value.
+        * @param $group String Group name
+        * @param $rightsArr Array An array of permissions, in the form of:
+        *   array( 'right' => true, 'right2' => false )
+        */
+       public function setGroupRights( $group, $rightsArr ) {
+               $this->groupPermissions[$group] = $rightsArr;
+       }
+
+       /**
         * Returns the escaped version of a string of php code.
         *
         * @param $string String
@@ -176,13 +187,26 @@
                        $locale = '';
                }
 
-               $rights = $this->values['wgRightsUrl'] ? '' : '#';
+               $rightsUrl = $this->values['wgRightsUrl'] ? '' : '#';
                $hashedUploads = $this->safeMode ? '' : '#';
                $metaNamespace = '';
                if( $this->values['wgMetaNamespace'] !== 
$this->values['wgSitename'] ) {
                        $metaNamespace = "\$wgMetaNamespace = 
\"{$this->values['wgMetaNamespace']}\";\n";
                }
 
+               $groupRights = '';
+               if( $this->groupPermissions ) {
+                       $groupRights .= "# The following permissions were set 
based on your choice in the installer\n";
+                       foreach( $this->groupPermissions as $group => $rightArr 
) {
+                               $group = self::escapePhpString( $group );
+                               foreach( $rightArr as $right => $perm ) {
+                                       $right = self::escapePhpString( $right 
);
+                                       $groupRights .= 
"\$wgGroupPermissions['$group']['$right'] = " .
+                                               wfBoolToStr( $perm ) . "\n";
+                               }
+                       }
+               }
+
                switch( $this->values['wgMainCacheType'] ) {
                        case 'anything':
                        case 'db':
@@ -302,7 +326,7 @@
 ## For attaching licensing metadata to pages, and displaying an
 ## appropriate copyright notice / icon. GNU Free Documentation
 ## License and Creative Commons licenses are supported so far.
-{$rights}\$wgEnableCreativeCommonsRdf = true;
+{$rightsUrl}\$wgEnableCreativeCommonsRdf = true;
 \$wgRightsPage = \"\"; # Set to the title of a wiki page that describes your 
license/copyright
 \$wgRightsUrl  = \"{$this->values['wgRightsUrl']}\";
 \$wgRightsText = \"{$this->values['wgRightsText']}\";
@@ -311,7 +335,8 @@
 
 # Path to the GNU diff3 utility. Used for conflict resolution.
 \$wgDiff3 = \"{$this->values['wgDiff3']}\";
-";
+
+{$groupRights}";
        }
 
 }

Modified: branches/REL1_17/phase3/includes/installer/WebInstaller.php
===================================================================
--- branches/REL1_17/phase3/includes/installer/WebInstaller.php 2011-06-02 
01:47:22 UTC (rev 89315)
+++ branches/REL1_17/phase3/includes/installer/WebInstaller.php 2011-06-02 
02:03:16 UTC (rev 89316)
@@ -147,6 +147,10 @@
                        );
 
                        $ls = new LocalSettingsGenerator( $this );
+                       $rightsProfile = $this->rightsProfiles[$this->getVar( 
'_RightsProfile' )];
+                       foreach( $rightsProfile as $group => $rightsArr ) {
+                               $ls->setGroupRights( $group, $rightsArr );
+                       }
                        echo $ls->getText();
                        return $this->session;
                }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to