Paste P7808

LocalSettings.php file used with CentralAuth
ActivePublic

Authored by Huji on Thu, Nov 15, 2:00 AM.
<?php
# Protect against web entry
if ( !defined( 'MEDIAWIKI' ) ) {
exit;
}
# Choose the right wiki to show
if ( defined( 'MW_DB' ) ) {
$wikiId = MW_DB;
} elseif (isset($_SERVER['SERVER_NAME']) && $_SERVER['SERVER_NAME'] == 'en.localhost') {
$wikiId = 'enwiki';
} elseif (isset($_SERVER['SERVER_NAME']) && $_SERVER['SERVER_NAME'] == 'meta.localhost') {
$wikiId = 'metawiki';
} else {
echo 'Unable to determine $wikiId'."\n";
exit(1);
}
## Uncomment this to disable output compression
# $wgDisableOutputCompression = true;
$wgSitename = $wikiId;
## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs
## (like /w/index.php/Page_title to /wiki/Page_title) please see:
## https://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "";
## The protocol and server name to use in fully-qualified URLs
$wgServer = "http://" . str_replace("wiki", "", $wikiId) . ".localhost";
## The URL path to static resources (images, scripts, etc.)
$wgResourceBasePath = $wgScriptPath;
## The URL path to the logo. Make sure you change this from the default,
## or else you'll overwrite your logo when you upgrade!
$wgLogo = "$wgResourceBasePath/resources/assets/wiki.png";
## ...
## Database settings
$wgDBtype = "mysql";
$wgDBserver = "localhost";
$wgDBname = $wikiId;
$wgDBuser = "root";
$wgDBpassword = "password";
# MySQL specific settings
$wgDBprefix = "";
# MySQL table options to use during installation or update
$wgDBTableOptions = "ENGINE=InnoDB, DEFAULT CHARSET=binary";
# Experimental charset support for MySQL 5.0.
$wgDBmysql5 = false;
# LBFactory
$wgLBFactoryConf = array(
'class' => 'LBFactoryMulti',
'sectionsByDB' => array(
'enwiki' => 's1',
'metawiki' => 's1',
),
'sectionLoads' => array(
's1' => array(
'localhost' => 0,
),
),
'serverTemplate' => array(
'dbname' => $wgDBname,
'user' => $wgDBuser,
'password' => $wgDBpassword,
'type' => $wgDBtype,
'flags' => DBO_DEFAULT,
'max lag' => 30,
),
);
# Site language code, should be one of the list in ./languages/data/Names.php
if ( $wikiId == 'enwiki' ) {
$wgLanguageCode = "en";
$wgSecretKey = "704352ff89c1d2ef72156e8da04620de85dc56d69dcfe180c82e0794df6e0e20";
$wgAuthenticationTokenVersion = "1";
$wgUpgradeKey = "ee0cdab2beb9cba5";
} else { #metawiki
$wgLanguageCode = "en";
$wgSecretKey = "e905f7281e9071388db40d841133e7115820934ee602f89ba403619d4ae5ba50";
$wgAuthenticationTokenVersion = "1";
$wgUpgradeKey = "7812b3852e18f46d";
}
## Vector skin
wfLoadSkin( 'Vector' );
## CentralAuth
require_once "$IP/extensions/CentralAuth/CentralAuth.php";
# General CentralAuth configuration
# $wgCentralAuthAutoNew = true;
$wgCentralAuthAutoMigrate = true;
$wgCentralAuthCookies = true;
$wgCentralAuthCookieDomain = '.localhost';
# Create the local account on pageview, set false to require a local login to create it.
$wgCentralAuthCreateOnView = true;
$wgCentralAuthAutoMigrateNonGlobalAccounts = true;
$wgCentralAuthEnableUserMerge = true;
# Skips the "login success" page
# $wgCentralAuthSilentLogin = true;
# Auto-login
$wgCentralAuthAutoLoginWikis = [
'.localhost' => 'enwiki',
];
$wgCentralAuthLoginWiki = 'enwiki';
// You can't just set wgConf values to the globals defined in Setup.php for your
// local wiki, because it hasn't run yet. You could hard-code $wgConf settings
// here, but instead we set the wgConf values in a hook that runs later.
$wgConf = new SiteConfiguration;
# Read wiki lists
$wgLocalDatabases = array( 'enwiki', 'metawiki' );
$wgConf->wikis = $wgLocalDatabases;
$wgConf->suffixes = array(
'wiki'
);
$wgConf->suffixes = $wgLocalDatabases;
$wgConf->localVHosts = array( 'localhost' ); //your database server. could be example.com or IP address. no http://
$wgConf->settings = array(
'wgServer' => array(
'enwiki' => 'http://en.localhost',
'metawiki' => 'http://meta.localhost',
),
'wgCanonicalServer' => array(
'enwiki' => 'http://en.localhost',
'metawiki' => 'http://meta.localhost',
),
'wgScriptPath' => array(
'default' => '',
),
'wgArticlePath' => array(
'default' => '/index.php?title=$1',
),
'wgLanguageCode' => array(
'enwiki' => 'en',
'metawiki' => 'en',
),
'wgLocalInterwiki' => array(
'enwiki' => 'en',
'metawiki' => 'meta',
),
'wgAddGroups' => array(
'default' => array(
'bureaucract' => [ 'sysop', 'bureaucrat' ],
),
),
);
function efGetSiteParams( $conf, $wiki ) {
$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' => array(),
);
}
$wgConf->siteParamsCallback = 'efGetSiteParams';
$wgConf->extractAllGlobals( $wgDBname );
Huji created this paste.Thu, Nov 15, 2:00 AM
Huji edited the content of this paste. (Show Details)Thu, Nov 15, 4:38 PM
Huji edited the content of this paste. (Show Details)Thu, Nov 15, 4:58 PM