Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F24893950
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/config/CommonSettings.php b/config/CommonSettings.php
index 3d36175..8d1c2a9 100644
--- a/config/CommonSettings.php
+++ b/config/CommonSettings.php
@@ -1,111 +1,111 @@
<?php
namespace Nasqueron\SAAS\MediaWiki\Configuration;
use Nasqueron\SAAS\ConfigurationException;
use Nasqueron\SAAS\MediaWiki\WithExecutablesPathsFix;
use Nasqueron\SAAS\MediaWiki\WithLog;
use Nasqueron\SAAS\MediaWiki\WithScribunto;
class CommonSettings {
use WithExecutablesPathsFix;
use WithScribunto;
use WithLog;
///
/// Individual set of settings
///
/**
* @throws ConfigurationException
*/
private static function getRightsSettings (array $licenses) : array {
$settings = [];
foreach ($licenses as $key => $license) {
switch ($license) {
case 'CC-BY 4.0':
- $settings['wgRightsUrl'][$key] = 'http://creativecommons.org/licenses/by/4.0/';
+ $settings['wgRightsUrl'][$key] = 'https://creativecommons.org/licenses/by/4.0/';
$settings['wgRightsText'][$key] = 'Creative Commons Attribution 4.0 International License';
$settings['wgRightsIcon'][$key] = 'https://i.creativecommons.org/l/by/4.0/88x31.png';
break;
case 'CC-BY-NC-SA 3.0':
$settings['wgRightsUrl'][$key] = 'https://creativecommons.org/licenses/by-nc-sa/3.0/';
$settings['wgRightsText'][$key] = 'Attribution-NonCommercial-ShareAlike 3.0 Unported';
$settings['wgRightsIcon'][$key] = 'https://licensebuttons.net/l/by-nc-sa/3.0/88x31.png';
break;
default:
throw new ConfigurationException("License unknown: $license");
}
}
return $settings;
}
private static function getUrlSettings (array $schemes) : array {
$settings = [];
foreach ($schemes as $key => $scheme) {
switch ($scheme) {
case 'root':
$settings['wgArticlePath'][$key] = '/$1';
$settings['wgScriptPath'][$key] = '';
break;
case 'wiki':
$settings['wgArticlePath'][$key] = '/wiki/$1';
$settings['wgScriptPath'][$key] = '/w';
break;
default:
throw new ConfigurationException(
"Unknown URL scheme: $scheme"
);
}
}
return $settings;
}
/**
* Replace default permissions by custom permissions.
*/
public static function fixGroupPermissions ($groupPermissionsToOverride) {
// Code from WMF wmf-config/CommonSettings.php (groupOverrides)
// PHP array merge keep value already defined, but here we want to
// override those values by the new ones.
global $wgGroupPermissions;
foreach ($groupPermissionsToOverride as $group => $permissions) {
if (!array_key_exists( $group, $wgGroupPermissions)) {
$wgGroupPermissions[$group] = [];
}
$wgGroupPermissions[$group] = $permissions
+ $wgGroupPermissions[$group];
}
}
///
/// Helper methods to apply those settings fix
///
/**
* @throws ConfigurationException
*/
public static function mapSettings (array &$settings) : void {
$settings += self::getMappedSettings($settings);
}
/**
* @throws ConfigurationException
*/
public static function getMappedSettings (array $settings) : array {
$mappedSettings = [];
$mappedSettings += self::getRightsSettings($settings['saasLicense']);
$mappedSettings += self::getUrlSettings($settings['saasUrlScheme']);
return $mappedSettings;
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Wed, Mar 18, 12:30 (1 d, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3538735
Default Alt Text
(3 KB)
Attached To
Mode
rSAASMW SaaS MediaWiki
Attached
Detach File
Event Timeline
Log In to Comment