diff --git a/config/CommonSettings.php b/config/CommonSettings.php index a8944ea..3d36175 100644 --- a/config/CommonSettings.php +++ b/config/CommonSettings.php @@ -1,105 +1,111 @@ $license) { switch ($license) { case 'CC-BY 4.0': $settings['wgRightsUrl'][$key] = 'http://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; } } diff --git a/config/Settings.php b/config/Settings.php index f32ba91..4f19f0c 100644 --- a/config/Settings.php +++ b/config/Settings.php @@ -1,274 +1,275 @@ 'nasqueron_wiki', 'wolfplex' => 'wolfplexdb', ]; } static public function getMappedSettings () : array { return [ /// /// MediaWiki Core /// 'wgAllowTitlesInSVG' => [ 'default' => true, ], 'wgDBprefix' => [ 'default' => '', // Legacy installations 'arsmagica' => 'arsm_', 'utopia' => 'wiki_', 'wolfplex' => 'mw_', // shared database ], 'wgDefaultSkin' => [ 'default' => 'vector', 'agora' => 'timeless', // TODO: find utopia skin ], 'wgEnableCreativeCommonsRdf' => [ 'default' => true, ], 'wgEnableDublinCoreRdf' => [ 'default' => true, ], 'wgEnableUploads' => [ 'default' => false, 'agora' => true, 'wolfplex' => true, ], 'wgEnotifUserTalk' => [ 'default' => true, ], 'wgEnotifWatchlist' => [ 'default' => true, ], 'wgExtraNamespaces' => [ 'wolfplex' => [ 320 => 'Bulletin', 321 => 'Discussion_Bulletin', 322 => 'Event', 323 => 'Discussion_Event', ] ], 'wgUseInstantCommons' => [ 'default' => true, ], '+wgFileExtensions' => [ 'default' => [ 'svg', ] ], 'wgLanguageCode' => [ 'default' => 'en', 'arsmagica' => 'fr', 'utopia' => 'fr', 'wolfplex' => 'fr', ], 'wgLocalInterwikis' => [ 'agora' => [ 'agora', ], 'arsmagica' => [ 'arsm', 'arsmagica', ], 'utopia' => [ 'utopia', ], 'wolfplex' => [ 'wolfplex', ], ], 'wgLogo' => [ 'default' => '/images/b/bc/Wiki.png', 'agora' => 'https://assets.nasqueron.org/logos/logo-main-133px.png', 'arsmagica' => '/images/3/33/ArsMagica.png', 'wolfplex' => '/img/logo135.png', 'utopia' => '/img/BoatDesaturedBlueUtopiaIcon_135x135.png', ], 'wgMetaNamespace' => [ 'default' => false, 'utopia' => 'Utopia', 'wolfplex' => 'Wolfplex', ], '+wgNamespacesWithSubpages' => [ 'wolfplex' => [ NS_MAIN => true, 320 => true, // Bulletin ], 'agora' => [ NS_MAIN => true, ], ], 'wgPasswordSender' => [ 'default' => 'mediawiki-saas-no-reply@nasqueron.org', ], 'wgRestrictDisplayTitle' => [ 'default' => true, 'wolfplex' => false, ], 'wgSitename' => [ 'default' => 'Wiki', 'agora' => 'Nasqueron Agora', 'arsmagica' => 'Ars Magica', 'utopia' => 'Utopia', 'wolfplex' => 'Wolfplex', ], 'wgSVGConverter' => [ 'default' => 'rsvg', ], 'wgUseFileCache' => [ 'default' => false, ], 'wgUseGzip' => [ 'default' => true, ], 'wgUseImageMagick' => [ 'default' => true, ], 'wgUsePathInfo' => [ // Per https://www.dereckson.be/blog/2013/10/24/mediawiki-nginx-configuration-file/ 'default' => true, ], 'saasExtraGroupPermissions' => [ 'default' => [ '*' => [ 'edit' => false, 'createaccount' => false, ], 'sysop' => [ 'deletelogentry' => true, 'deleterevision' => true, ], ], '+utopia' => [ 'confirmed' => [ "autoconfirmed" => true, "upload" => true, ], ], ], 'saasLicense' => [ 'default' => 'CC-BY 4.0', + 'utopia' => 'CC-BY-NC-SA 3.0', // T1376 ], 'saasUrlScheme' => [ 'default' => 'wiki', 'agora' => 'root', 'arsmagica' => 'root', ], /// /// ContactPage extension /// 'wgContactConfig' => [ 'wolfplex' => [ 'default' => [ "RecipientUser" => 'Spike', "SenderEmail" => null, "SenderName" => "Contact Form on Wolfplex", "RequireDetails" => false, "IncludeIP" => false, "RLModules" => [], "RLStyleModules" => [], "AdditionalFields" => [ "Text" => [ "label-message" => "emailmessage", "type" => "textarea", "required" => true, ], ], ], ], ], /// /// Skins and extensions to load /// 'saasUseExtensionCategoryTree' => [ 'default' => true, ], 'saasUseExtensionCite' => [ 'default' => true, ], 'saasUseExtensionContactPage' => [ 'default' => false, 'wolfplex' => true, ], 'saasUseExtensionGadgets' => [ 'default' => true, ], 'saasUseExtensionParserFunctions' => [ 'default' => true, ], 'saasUseExtensionPoem' => [ 'default' => true, ], 'saasUseExtensionWolfplexMessages' => [ 'default' => false, 'wolfplex' => true, ], 'saasUseSkinMonoBook' => [ 'default' => true, ], 'saasUseSkinVector' => [ 'default' => true, ], 'saasUseSkinTimeless' => [ 'default' => true, ], 'saasUseScribunto' => [ 'default' => false, 'agora' => true, 'wolfplex' => true, ], ]; } }