Created
December 19, 2014 18:36
-
-
Save Southparkfan/fe7ac4de3dd82ef803a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Orain's playbook is free software: you can redistribute it and/or modify it | |
* under the terms of the GNU Affero General Public License as published by the | |
* Free Software Foundation, either version 3 of the License, or (at your option) | |
* any later version. | |
* | |
* Orain's playbook is distributed in the hope that it will be useful, but WITHOUT | |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more | |
* details. | |
* | |
* You should have received a copy of the GNU Affero General Public License along | |
* with Orain's playbook. If not, see <http://www.gnu.org/licenses/>. | |
*/ | |
// Protect against web entry | |
if ( !defined( 'MEDIAWIKI' ) ) { | |
exit; | |
} | |
$wgConf = new SiteConfiguration; | |
$wgConf->suffixes = array( 'wiki' ); | |
$wgConf->localVHosts = array( '{{mysql_address}}' ); | |
// @note TBLSRC_LOCALPAGE and TBLSRC_URL are defined automatically by the TitleBlacklist entry file. | |
// therefore we use the below ORAIN constants for referencing the values in LocalSettings.php | |
// as the true constants don't get defined until after we want to use them. | |
define( 'TBLSRC_LOCALPAGE_ORAIN', 1 ); | |
define( 'TBLSRC_URL_ORAIN', 2 ); | |
/** | |
* Define namespaces for all wikis | |
* | |
* @note These namespaces technically are defined across all wikis, they are simply not enabled everywhere. | |
* @note These namespaces should NEVER be removed unless all wikis that have ever used them have been deleted | |
*/ | |
/** | |
* NOTE: When changing the below variable all caches need to be updated otherwise | |
* we will continue linking to old file locations on cached pages! | |
*/ | |
$wmgUploadHostname = "static.orain.org"; | |
/** | |
* Define settings per wiki | |
* @see https://www.mediawiki.org/wiki/Manual:$wgConf | |
*/ | |
$wgConf->settings = array( | |
// Bigdelete | |
'wgDeleteRevisionsLimit' => array( | |
'default' => 2000, // Default bigdelete limit | |
), | |
// /Bigdelete | |
// Cache | |
'wgEnableSidebarCache' => array( | |
'default' => true, | |
'spiralwiki' => false, // This broke displaying of Collection portlets addshore 20-feb-2014 issue #173 | |
), | |
'wgHitcounterUpdateFreq' => array( | |
'default' => 20, | |
), | |
'wgMiserMode' => array( | |
'allthetropeswiki' => true, | |
), | |
'wgParserCacheExpireTime' => array( | |
'default' => 604800, // 7 days | |
), | |
'wgRevisionCacheExpiry' => array( | |
'default' => 259200, // 3 days | |
), | |
'wgSessionsInObjectCache' => array( | |
'default' => true, | |
), | |
'wgUseLocalMessageCache' => array( | |
'default' => false, | |
), | |
// /Cache | |
// Database | |
'wgCompressRevisions' => array( | |
'default' => true, | |
), | |
'wgDBpassword' => array( | |
'default' => "{{mw_db_password}}", | |
), | |
'wgDBprefix' => array( | |
'default' => '', | |
), | |
'wgDBserver' => array( // HHVM errors using LB for Uploads? | |
'default' => "10.131.243.243", | |
), | |
'wgDBTableOptions' => array( | |
'default' => "ENGINE=InnoDB, DEFAULT CHARSET=binary", | |
), | |
'wgDBtype' => array( | |
'default' => 'mysql', | |
), | |
'wgDBuser' => array( | |
'default' => "{{mw_db_user}}", | |
), | |
'wgSharedDB' => array( | |
'default' => 'metawiki', | |
), | |
'wgSharedTables' => array( | |
'default' => array(), | |
), | |
// /Database | |
//Debug | |
'wgDebugComments' => array( | |
'default' => false, | |
'extloadwiki' => true, | |
), | |
// /Debug | |
'wgEmailAuthentication' => array( | |
'default' => true, | |
), | |
'wgEmergencyContact' => array( | |
'default' => '[email protected]', | |
), | |
'wgEnableEmail' => array( | |
'default' => true, | |
), | |
'wgEnableUserEmail' => array( | |
'default' => true, | |
), | |
'wgEnotifMinorEdits' => array( | |
'default' => true, | |
), | |
'wgEnotifUserTalk' => array( | |
'default' => true, | |
), | |
'wgEnotifWatchlist' => array( | |
'default' => true, | |
), | |
'wgPasswordSender' => array( | |
'default' => '[email protected]', | |
), | |
'wgSMTP' => array( | |
'default' => array( | |
'host' => '10.131.232.174', | |
'port' => 25, | |
'IDHost' => 'orain.org', | |
'auth' => false, | |
'username' => 'noreply', | |
'password' => '{{email_password}}', | |
), | |
), | |
// Global Group Settings | |
'+wgAvailableRights' => array( // + to avoid any possible conflicts | |
'default' => array( | |
'debug', // Debugging for sysadmins | |
'editwidgets', // Widgets | |
'steward', // Allow this restriction level be added to the global usergroup | |
'torunblocked', // Allow this to be added to global groups | |
), | |
), | |
// /Global Group Settings | |
// GraphicsMagick | |
'wgImageMagickConvertCommand' => array( | |
'default' => "/usr/bin/convert", | |
), | |
'wgShellLocale' => array( | |
'default' => "en_US.utf8", | |
), | |
'wgUseImageMagick' => array( | |
'default' => true, | |
), | |
// /GraphicsMagick | |
// Group overrides | |
'defaultGroupOverrides' => array( | |
'default' => array( | |
), | |
), | |
'specificGroupOverrides' => array( | |
'default' => array(), | |
'closed' => array( | |
'*' => array( | |
'edit' => false, | |
'createaccount' => false, | |
), | |
'autoconfirmed' => array( | |
'editsemiprotected' => false, | |
'patrol' => false, | |
), | |
'autopatrolled' => array( | |
'patrol' => false, | |
), | |
'bot' => array( | |
'editsemiprotected' => false, | |
), | |
'rollbacker' => array( | |
'rollback' => false, | |
), | |
'sysop' => array( | |
'abusefilter-modify' => false, | |
'abusefilter-modify-restricted' => false, | |
'abusefilter-revert' => false, | |
'block' => false, | |
'blockemail' => false, | |
'createaccount' => false, | |
'delete' => false, | |
'editinterface' => false, | |
'editprotected' => false, | |
'editsemiprotected' => false, | |
'globalblock-whitelist' => false, | |
'import' => false, | |
'importupload' => false, | |
'move' => false, | |
'movefile' => false, | |
'move-rootuserpages' => false, | |
'move-subpages' => false, | |
'nuke' => false, | |
'patrol' => false, | |
'protect' => false, | |
'reupload' => false, | |
'reupload-shared' => false, | |
'rollback' => false, | |
'unblockself' => false, | |
'undelete' => false, | |
'upload' => false, | |
), | |
'user' => array( | |
'edit' => false, | |
'move' => false, | |
'move-rootuserpages' => false, | |
'move-subpages' => false, | |
'movefile' => false, | |
'reupload' => false, | |
'reupload-shared' => false, | |
'upload' => false, | |
), | |
), | |
'private' => array( | |
'*' => array( | |
'read' => false, | |
), | |
'user' => array( | |
'read' => false, | |
), | |
'member' => array( | |
'read' => true, | |
), | |
'sysop' => array( | |
'read' => true, | |
), | |
'bureaucrat' => array( | |
'read' => true, | |
), | |
), | |
), | |
// /Group overrides | |
//Hooks | |
'wgSpecialVersionShowHooks' => array( | |
'default' => false, | |
'extloadwiki' => true, | |
), | |
// /Hooks | |
// Keys | |
'wgSecretKey' => array( | |
'default' => '{{wgSecretKey}}', | |
), | |
'wgUpgradeKey' => array( | |
'default' => '{{wgUpgradeKey}}', | |
), | |
// /Keys | |
// Language | |
'wgLanguageCode' => array( | |
'default' => 'en', | |
), | |
// /Language | |
// Misc. extensions | |
'ceAllowConfirmedEmail' => array( | |
'default' => true, | |
), | |
'wmgArchivedWiki' => array( | |
'default' => false, | |
'polymetawiki' => true, | |
), | |
'wmgClosedWiki' => array( | |
'default' => false, | |
'closed' => true, | |
), | |
'wgInterwikiViewOnly' => array( | |
'default' => true, | |
'metawiki' => false, | |
), | |
'wgMFAutodetectMobileView' => array( | |
'default' => true, | |
), | |
'wmgPrivateWiki' => array( | |
'default' => false, | |
'private' => true, | |
), | |
// Names | |
'wgSitename' => array( | |
'default' => 'Unconfigured', | |
), | |
// /Names | |
// Performance | |
'wgDisableCounters' => array( | |
'default' => true, | |
), | |
// /Performance | |
// Permissions | |
'wgAddGroups' => array( | |
'default' => array( | |
'bureaucrat' => array( | |
'autopatrolled', | |
'bot', | |
'bureaucrat', | |
'confirmed', | |
'rollbacker', | |
'sysop', | |
), | |
'sysop' => array( | |
'autopatrolled', | |
'confirmed', | |
'rollbacker', | |
), | |
), | |
'+grepobotwiki' => array( | |
'bureaucrat' => array( | |
'botop', | |
), | |
), | |
'+private' => array( | |
'bureaucrat' => array( | |
'member', | |
), | |
'sysop' => array( | |
'member', | |
), | |
), | |
), | |
'wgAutoConfirmAge' => array( | |
'default' => 111600, // 31 h * 60 min/h * 60 s/min | |
'reviwiki' => 259200, | |
), | |
'wgAutoConfirmCount' => array( | |
'default' => 5, | |
'reviwiki' => 20, | |
), | |
'+wgGroupPermissions' => array( | |
'default' => array( | |
'*' => array( | |
'abusefilter-log' => true, | |
'abusefilter-log-detail' => true, | |
'abusefilter-view' => true, | |
), | |
'autoconfirmed' => array( | |
'patrol' => true, | |
'skipcaptcha' => true, | |
'upload' => true, | |
), | |
'autopatrolled' => array( | |
'autopatrol' => true, | |
'patrol' => true, | |
), | |
'bot' => array( | |
'noanalytics' => true, | |
), | |
'checkuser' => array( | |
// Leaks IP addresses | |
'abusefilter-private' => true, | |
), | |
'emailconfirmed' => array( | |
'skipcaptcha' => true, | |
), | |
'importer' => array( | |
'import' => true, | |
'importupload' => true, | |
), | |
'oversight' => array( | |
'abusefilter-hidden-log' => true, | |
'abusefilter-hide-log' => true, | |
'browsearchive' => true, | |
'deletedhistory' => true, | |
'deletedtext' => true, | |
'deletelogentry' => true, | |
'deleterevision' => true, | |
'hideuser' => true, | |
'suppressionlog' => true, | |
'suppressrevision' => true, | |
), | |
'rollbacker' => array( | |
'autoconfirmed' => true, | |
'rollback' => true, | |
), | |
'sysop' => array( | |
'abusefilter-modify' => true, | |
'abusefilter-modify-restricted' => true, | |
'abusefilter-revert' => true, | |
'deletelogentry' => true, | |
'deleterevision' => true, | |
'massmessage' => false, | |
'rollback' => true, | |
), | |
'user' => array( | |
'user' => true, // Enable a new restriction level globally | |
), | |
), | |
'+archivoespiralwiki' => array( | |
'*' => array( | |
'edit' => false, | |
'createpage' => false, | |
'createtalk' => false, | |
), | |
'user' => array( | |
'edit' => false, | |
'createpage' => false, | |
'createtalk' => false, | |
), | |
'sysop' => array( | |
'edit' => true, | |
'createpage' => true, | |
'createtalk' => true, | |
), | |
), | |
'+goldcraftmcwiki' => array( | |
'*' => array( | |
'edit' => false, | |
'createpage' => false, | |
'createtalk' => false, | |
), | |
'user' => array( | |
'edit' => false, | |
'createpage' => false, | |
'createtalk' => false, | |
), | |
'sysop' => array( | |
'edit' => true, | |
'createpage' => true, | |
'createtalk' => true, | |
), | |
), | |
'+grepobotwiki' => array( | |
'botop' => array( | |
'read' => true, | |
), | |
), | |
'+nationalewiki' => array( | |
'*' => array( | |
'edit' => false, | |
), | |
), | |
'+keionrailwiki' => array( | |
'user' => array( | |
'movefile' => false, | |
), | |
), | |
'loginwiki' => array( | |
'*' => array( | |
'createtalk' => false, | |
'centralauth-autoaccount' => true, | |
'read' => true, // Make sure read rights are present | |
), | |
'user' => array( | |
'createpage' => false, | |
'read' => true, // Make sure read rights are present | |
'edit' => false, | |
), | |
), | |
'+metawiki' => array( | |
'steward' => array( | |
'abusefilter-modify-global' => true, | |
'centralauth-lock' => true, | |
'centralauth-oversight' => true, | |
'centralauth-unmerge' => true, | |
'createwiki' => true, | |
'globalblock' => true, | |
'globalunblock' => true, | |
'interwiki' => true, | |
'massmessage' => true, | |
'noratelimit' => true, | |
'userrights' => true, | |
'userrights-interwiki' => true, | |
), | |
'sysop' => array( | |
'interwiki' => true, // Allow sysops to edit interwiki data -John | |
), | |
'wikicreator' => array( | |
'createwiki' => true, | |
), | |
'user' => array( | |
'mwoauthproposeconsumer' => true, | |
'mwoauthupdateownconsumer' => true, | |
), | |
), | |
'+reviwiki' => array( | |
'*' => array( | |
'createpage' => false, | |
), | |
'user' => array( | |
'createpage' => false, | |
'movefile' => false, | |
), | |
'autoconfirmed' => array( | |
'createpage' => true, | |
'patrol' => false, | |
), | |
), | |
), | |
'wgRemoveGroups' => array( | |
'default' => array( | |
'bureaucrat' => array( | |
'autopatrolled', | |
'bot', | |
'confirmed', | |
'member', | |
'rollbacker', | |
'sysop', | |
), | |
'sysop' => array( | |
'autopatrolled', | |
'confirmed', | |
'member', | |
'rollbacker', | |
), | |
), | |
'+grepobot' => array( | |
'bureaucrat' => array( | |
'botop', | |
), | |
), | |
'+private' => array( | |
'bureaucrat' => array( | |
'member', | |
), | |
'sysop' => array( | |
'member', | |
), | |
), | |
), | |
'wmgDisableAnonEditing' => array( | |
'default' => false, | |
'allthetropeswiki' => true, | |
'encyclopediamuricanawiki' => true, | |
'nationalewiki' => true, | |
'nlallthetropeswiki' => true, | |
'hyperiondevwiki' => true, | |
'loginwiki' => true, | |
'opensourcelearningwiki' => true, | |
'patereswiki' => true, | |
'peachywiki' => true, | |
'poserdazfreebieswiki' => true, | |
'reviwiki' => true, | |
'techwiki' => true, | |
), | |
// /Permissions | |
// Profiling | |
'wgEnableProfileInfo' => array( | |
'default' => false, | |
'allthetropeswiki' => true, | |
'nlallthetropeswiki' => true, | |
'metawiki' => true, | |
), | |
// /Profiling | |
// RC | |
'wmgUseIRCRC' => array( | |
'default' => true, | |
'private' => false, | |
), | |
// Redirects | |
'wgFixDoubleRedirects' => array( | |
'default' => false, | |
'allthetropeswiki' => true, | |
'nlallthetropeswiki' => true, | |
), | |
// /Redirects | |
// Restrictions | |
'+wgRestrictionLevels' => array( | |
'default' => array( | |
'user', | |
'steward' | |
), | |
'+metawiki' => array( | |
'createwiki' | |
), | |
), | |
'+wgRestrictionTypes' => array( | |
'default' => array( | |
'delete' | |
), | |
), | |
// Server | |
'wgArticlePath' => array( | |
'default' => '/wiki/$1', | |
), | |
'wgDisableOutputCompression' => array( | |
'default' => true, | |
), | |
'wgJobRunRate' => array( | |
'default' => 0, | |
), | |
'wgResourceLoaderMaxQueryLength' => array( | |
'default' => -1, | |
), | |
'wgScriptExtension' => array( | |
'default' => '.php', | |
), | |
'wgScriptPath' => array( | |
'default' => '/w', | |
), | |
'wgServer' => array( | |
'default' => '//$lang.orain.org', | |
'chemtalkwiki' => 'http://chemtalk.org', | |
'deguwiki' => 'http://degu.wiki', | |
'rationalwiki' => 'http://rationalwiki.ssu.lt', | |
'reviwiki' => 'http://wiki.revi.pe.kr', | |
'spiralwiki' => '//spiral.wiki', | |
'wikiconstituciowiki' => 'http://wikiconstitucio.org', | |
'wikimirsmwiki' => 'http://wikimirsm.mateis.nl', | |
), | |
'wgShowHostnames' => array( | |
'default' => true, // Show which server the request was serviced by | |
), | |
'wgUsePathInfo' => array( | |
'default' => true, | |
), | |
// /Server | |
// Style | |
'wgDefaultSkin' => array( | |
'default' => 'vector', | |
'elderlordswiki' => 'monobook', | |
'spiralwiki' => 'foreground', | |
'wikidemoswiki' => 'foreground', | |
), | |
'wgLogo' => array( | |
'default' => "//$wmgUploadHostname/meta.orain.org/images/c/c6/Orain.png", | |
'allthetropeswiki' => "//$wmgUploadHostname/allthetropes.orain.org/images/8/86/Logo-Square-v1-1x.png", | |
'athemewiki' => "//$wmgUploadHostname/meta.orain.org/images/0/03/Atheme.png", | |
'botwiki' => "//$wmgUploadHostname/meta.orain.org/images/6/65/BotWiki_logo.png", | |
'cilirowiki' => "//$wmgUploadHostname/ciliro.orain.org/images/0/02/Ciliro_wiki_logo.png", | |
'computerclanwiki' => '//upload.wikimedia.org/wikipedia/commons/f/f7/CC_Wiki_Graphic_Mark_Small.png', | |
'dangsunsnwiki' => '//upload.wikimedia.org/wikipedia/commons/e/e8/Kd-logo.png', | |
'deguwiki' => "//$wmgUploadHostname/meta.orain.org/images/b/ba/Deguwikilogo.png", | |
'enmodamobwiki' => "//$wmgUploadHostname/meta.orain.org/images/d/d6/Modamob-logo.png", | |
'electrumwiki' => "//$wmgUploadHostname/electrum.orain.org/images/0/00/Logo_text_135.png", | |
'frmodamobwiki' => "//$wmgUploadHostname/meta.orain.org/images/d/d6/Modamob-logo.png", | |
'goldcraftmcwiki' => "//$wmgUploadHostname/meta.orain.org/images/5/5c/Goldcraftwikilogo.png", | |
'grayhawkwiki' => '//upload.wikimedia.org/wikipedia/commons/4/49/GrayhawkPaladinsLogo_%28small%29.png', | |
'keionrailwiki' => '//upload.wikimedia.org/wikipedia/commons/e/e4/Subway_TokyoTozai.png', | |
'levelswiki' => '//upload.wikimedia.org/wikipedia/commons/thumb/d/d1/Wikilevels_logo_text.png/135px-Wikilevels_logo_text.png', | |
'linuxwiki' => "//$wmgUploadHostname/linux.orain.org/images/e/ed/Wiki_logo_Linux.png", | |
'mediawikitesterswiki' => '//upload.wikimedia.org/wikipedia/commons/9/9a/MediaWikiTestersWiki.png', | |
'mwmwiki' => "//$wmgUploadHostname/mwm.orain.org/images/a/a6/Wiki-Logo.png", | |
'nationalewiki' => "//$wmgUploadHostname/nationale.orain.org/images/2/29/Logo_of_the_Encyclopedia_Nationale.png", | |
'nlallthetropeswiki' => "//$wmgUploadHostname/allthetropes.orain.org/images/8/86/Logo-Square-v1-1x.png", | |
'peachywiki' => '//upload.wikimedia.org/wikipedia/commons/5/51/PeachyFrameworkLogo.png', | |
'pigawiki' => "//$wmgUploadHostname/piga.orain.org/images/2/23/PigaLore.png", | |
'portalwiki' => "//$wmgUploadHostname/portal.orain.org/images/f/fa/Portalpedia_Logo.png", | |
'reviwiki' => '//upload.wikimedia.org/wikipedia/commons/thumb/5/53/Server-multiple.svg/135px-Server-multiple.svg.png', | |
'redsecwiki' => "//$wmgUploadHostname/meta.orain.org/images/3/3a/RedSec.png", | |
'robloxclanswiki' => "//$wmgUploadHostname/robloxclans.orain.org/images/3/33/Clan-Icon-700px.png", | |
'szkwiki' => "//$wmgUploadHostname/szk.orain.org/images/c/c1/SzKLogo.png", | |
'spiralwiki' => '//upload.wikimedia.org/wikipedia/commons/thumb/b/bf/Spiral_project_logo.svg/135px-Spiral_project_logo.svg.png', | |
'testwiki' => "//$wmgUploadHostname/test.orain.org/images/8/8d/Twlogo.png", | |
'wh40kwiki' => "//$wmgUploadHostname/wh40k.orain.org/images/0/09/Encyclopedium.png", | |
'wikiconstituciowiki' => '//upload.wikimedia.org/wikipedia/commons/thumb/c/ce/Flag_of_Catalonia.svg/135px-Flag_of_Catalonia.svg.png', | |
'wikimirsmwiki' => "//$wmgUploadHostname/wikimirsm.orain.org/images/d/d9/Wikimirsm-logo-final.gif", | |
'wikinambaswiki' => '//upload.wikimedia.org/wikipedia/commons/thumb/5/53/Wikinambá.png/135px-Wikinambá.png', | |
'wikitarbeswiki' => "//$wmgUploadHostname/meta.orain.org/images/7/73/Logowikitarbes.png", | |
'wizardwiki' => "//$wmgUploadHostname/wizard.orain.org/images/7/7e/Wizard_logo.png", | |
), | |
'wgStylePath' => array( | |
'default' => "//$wmgUploadHostname/common/skins", | |
), | |
'wgUseAjax' => array( | |
'default' => true, | |
), | |
// /Style | |
// Time | |
'wgLocaltimezone' => array( | |
'default' => 'Europe/London', | |
'nsswiki' => 'Asia/Seoul', | |
'reviwiki' => 'Asia/Seoul', | |
'worldnewswiki' => 'Asia/Taipei', | |
'wikilistswiki' => 'Asia/Tokyo', | |
), | |
// Users | |
'wgAllowUserJs' => array( | |
'default' => true, | |
), | |
'wgAllowUserCss' => array( | |
'default' => true, | |
), | |
// /Users | |
); | |
// From https://www.mediawiki.org/wiki/Manual:$wgConf#for_1.14_and_newer | |
function efGetSiteParams( $conf, $wiki ) { | |
global $wikiTags; | |
$site = null; | |
$lang = null; | |
foreach ( $conf->suffixes as $suffix ) { | |
if ( substr( $wiki, -strlen( $suffix ) ) == $suffix ) { | |
$site = $suffix; | |
$lang = substr( $wiki, 0, -strlen( $suffix ) ); | |
break; | |
} | |
} | |
return array( | |
'suffix' => $site, | |
'lang' => $lang, | |
'params' => array( | |
'lang' => $lang, | |
'site' => $site, | |
'wiki' => $wiki, | |
), | |
'tags' => isset( $wikiTags ) ? $wikiTags : array(), | |
); | |
} | |
// Defaults | |
$wgGroupPermissions['bureaucrat']['renameuser'] = false; | |
$wgGroupPermissions['bureaucrat']['userrights'] = false; | |
$wgGroupPermissions['sysop']['importupload'] = false; | |
$wgGroupPermissions['sysop']['bigdelete'] = false; | |
$wgGroupPermissions['user']['upload'] = false; | |
unset( $wgGroupPermissions['steward'] ); | |
foreach ( $wgConf->settings['wgServer'] as $db => $server ) { | |
if ( substr( $server, 0, 2 ) == '//' ) { | |
$canonical =& $wgConf->settings['wgCanonicalServer'][$db]; | |
$canonical = $canonical ? : ( 'https:' . $server ); | |
} | |
} | |
$wmgDocumentURI = isset( $_SERVER['DOCUMENT_URI'] ) ? $_SERVER['DOCUMENT_URI'] : null; | |
$wmgHTTPhost = isset( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : null; | |
if ( ( basename( $_SERVER["SCRIPT_FILENAME"] ) == "thumb.php" ) && isset( $_REQUEST['sitex'] ) ) { | |
$wmgHostname = $_REQUEST['sitex']; | |
} elseif ( preg_match( '/^\/(.*?)\/load.php$/', $wmgDocumentURI, $matches ) ) { | |
$wmgHostname = $matches[1]; | |
} elseif ( preg_match( '/^www\.(.*?\..*?)$/', $wmgHTTPhost, $matches ) ) { | |
$wmgHostname = $matches[1]; | |
} else { | |
$wmgHostname = $wmgHTTPhost; | |
} | |
$wgConf->siteParamsCallback = 'efGetSiteParams'; | |
if ( defined( "MW_DB" ) ) { | |
$wgDBname = MW_DB; | |
$subdomain = substr( $wgDBname, 0, -4 ); | |
$server = & $wgConf->settings['wgServer'][$wgDBname]; | |
$wmgHostname = isset( $server ) ? $server : "$subdomain.orain.org"; | |
// TODO: Fix this routing hack | |
} elseif ( $search = array_search( '//' . $wmgHostname, $wgConf->settings['wgServer'] ) ) { | |
$wgDBname = $search; | |
} elseif ( $search = array_search( 'http://' . $wmgHostname, $wgConf->settings['wgServer'] ) ) { | |
$wgDBname = $search; | |
} elseif ( $search = array_search( 'https://' . $wmgHostname, $wgConf->settings['wgServer'] ) ) { | |
$wgDBname = $search; | |
} elseif ( preg_match( '/^(.+?)\.(.+?)\.orain\.org$/', $wmgHostname, $matches ) ) { | |
$wgDBname = $matches[1] . $matches[2]; | |
} elseif ( preg_match( '/^(.*)\.orain\.org$/', $wmgHostname, $matches ) ) { | |
$wgDBname = $matches[1] . 'wiki'; | |
} elseif ( $wmgHostname === 'meta.orain.org' ) { | |
# In case the DB list fails we ALWAYS want metawiki to be accessible so hardcode this! | |
$wgDBname = 'metawiki'; | |
} else { | |
$wgDBname = false; | |
} | |
/** | |
* Fill the database list | |
*/ | |
$DBlist = array_map( 'trim', file( "$IP/all.dblist" ) ); | |
$wgLocalDatabases = array(); | |
foreach ( $DBlist as $wiki ) { | |
$wiki = explode( '|', $wiki, 4 ); | |
list( $DBname, $siteName, $siteLang, $wikiTagList ) = array_pad( $wiki, 4, '' ); | |
$wgLocalDatabases[] = $DBname; | |
$wgConf->settings['wgSitename'][$DBname] = $siteName; | |
$wgConf->settings['wgLanguageCode'][$DBname] = $siteLang; | |
if ( $DBname == $wgDBname ) { | |
$wikiTags = array_filter( explode( '|', $wikiTagList ) ); | |
} | |
} | |
$wgConf->wikis = & $wgLocalDatabases; | |
/** | |
* Generally setup the given wiki | |
*/ | |
$wgConf->extractAllGlobals( $wgDBname ); | |
$wgGroupPermissions['confirmed'] = & $wgGroupPermissions['autoconfirmed']; | |
// Group overrides | |
foreach ( $defaultGroupOverrides as $group => $permissions ) { | |
if ( !array_key_exists( $group, $wgGroupPermissions ) ) { | |
$wgGroupPermissions[$group] = array(); | |
} | |
$wgGroupPermissions[$group] = $permissions + $wgGroupPermissions[$group]; | |
} | |
foreach ( $specificGroupOverrides as $group => $permissions ) { | |
if ( !array_key_exists( $group, $wgGroupPermissions ) ) { | |
$wgGroupPermissions[$group] = array(); | |
} | |
$wgGroupPermissions[$group] = $permissions + $wgGroupPermissions[$group]; | |
} | |
if ( $wmgPrivateWiki ) { | |
// Make it easier to privatise wikis and expand on the options variably | |
//Assign its own CentralNotice 'project' as long as its not already orain | |
if ( $wgNoticeProject !== 'orain' ) { | |
$wgNoticeProject = 'private'; | |
} | |
// Whitelist! Default carried over for tracking. | |
$wgWhitelistRead = | |
array( | |
"Main Page", | |
"Special:UserLogin", | |
"Special:UserLogout", | |
"Special:ResetPassword", | |
"MediaWiki:Common.css", | |
"Special:CentralLogin" | |
); | |
} | |
if ( isset( $wgCentralAuthAutoLoginWikis[$wmgHostname] ) ) { | |
// Don't log into self | |
unset( $wgCentralAuthAutoLoginWikis[$wmgHostname] ); | |
$wgCentralAuthCookieDomain = $wmgHostname; | |
} | |
$wgCacheDirectory = '/tmp/mw-cache'; | |
$wgFileCacheDirectory = "/var/tmp/mediawiki/cache/$wmgHostname"; | |
$wgLoadScript = "//$wmgUploadHostname/$wmgHostname/load.php"; | |
$wgLocalisationCacheConf['manualRecache'] = true; | |
$wgUploadDirectory = "/mnt/mediawiki/uploads/$wmgHostname/images"; | |
$wgUploadPath = "//$wmgUploadHostname/$wmgHostname/images"; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment