Topic on Project:Support desk

$wgConf and CentralAuth

7
Jasper Deng (talkcontribs)

I am using the following $wgConf for my 3 wikis:

<?PHP
$wgLocalDatabases = array(
    'mainwiki',
	'networkwiki',
	'projectwiki',
);

$wgConf->wikis = $wgLocalDatabases;
$wgConf->suffixes = array( 'wiki' );
$wgConf->localVHosts = array( 'localhost' );
 
/*require_once "$IP/InitialiseSettings.php";*/
 
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(),
    );
}
$wgBlockAllowsUTEdit=true;
$wgBlockCIDRLimit=array('IPv4'=>0, 'IPv6'=>0); 
require_once("$IP/extensions/CentralAuth/CentralAuth.php");
$wgConf->suffixes = $wgLocalDatabases;
$wgConf->siteParamsCallback = 'efGetSiteParams';
$wgConf->extractAllGlobals( $wgDBname );
$wgConf->settings=array(
#Required for CentralAuth
'+wgGroupPermissions'=>array(
	'default'=>array(
		'*'=>array(
			'edit'=>false,
			),
		),
	),
'wgServer'           => array(
	'default'=>'http://192.168.2.100',
	),
'wgCanonicalServer'=>array(
	'default'=>'http://192.168.2.100',
	),
'wgArticlePath'=>array(
	'default'=>"{$wgScript}?title=$1",
	),
'wgLocalInterwiki'=>array(
	'default'=>'$lang',
	),
'wgSitename'=>array(
	'mainwiki'=>"Jasper's Wiki",
	'networkwiki'=>"Jasper's Network",
	'projectwiki'=>"Jasper's Projects",
	),
#Other configuration settings
'+wgBlockCIDRLimit'=>array(
	'mainwiki'=>array(
		'IPv4'=>0,
		'IPv6'=>0,
		),
	
	'default'=>array(
		'IPv4'=>0,
		'IPv6'=>0,
		),
	),
'+wgBlockAllowsUTEdit'=>array(
	'mainwiki'=>true,
	'default'=>true,
	),
);

$wgCentralAuthDatabase='centralauth';
require_once("$IP/extensions/CheckUser/CheckUser.php");
$wgShowExceptionDetails=true;
# (Not installed yet) require_once("$IP/extensions/GlobalUserrrights/GlobalUserrights.php");
 
require_once($IP.'/extensions/GlobalBlocking/GlobalBlocking.php');
$wgShowExceptionDetails=true;
?>

First of all, my $wgConf settings do not seem to apply. My wikis all just use their local $wgGroupPermissions and other settings and don't read what I put into $wgConf. CentralAuth's user unification worked properly, but I get a 500 Internal Server Error whenever I try to view my own global user info. Note that I am using Windows IIS, and my version of PHP somehow is unable to run anything in CLI. I am on a private network so this is not accessible to the public. Mainwiki (my "meta") is located at the /wiki subdirectory, Projectwiki at /projectwiki, and networkwiki at /networkwiki. The above is a Commonsettings.php included on the first line of the Localsettings.php file of every wiki. Databases have been set up correctly, and I have not done the migration scripts because I have only one user. What is wrong with my setup?Jasper Deng 00:37, 21 December 2011 (UTC)

IAlex (talkcontribs)

For your first problem, you need to set $wgConf->settings before calling $wgConf->extractAllGlobals(), because the latter uses the former. For the HTTP error, you'll need to get the error message, Manual:How to debug can help you.

Jasper Deng (talkcontribs)

The error is: Fatal error: Call to undefined method WikiReference::getFullUrl() in C:\inetpub\wwwroot\networkwiki\extensions\CentralAuth\specials\SpecialCentralAuth.php on line 467

I have edited my $wgConf to the following now:

<?PHP
error_reporting(E_ALL);
ini_set('display_errors',1);
#$wgSharedDB='mainwiki';
#$wgSharedPrefix='mainwiki';
$wgLocalDatabases = array(
    'mainwiki',
	'networkwiki',
	'projectwiki',
);

$wgConf->wikis = $wgLocalDatabases;
$wgConf->suffixes = array( 'wiki' );
$wgConf->localVHosts = array( 'localhost' );
 
/*require_once "$IP/InitialiseSettings.php";*/
 
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(),
    );
}
$wgBlockAllowsUTEdit=true;
$wgBlockCIDRLimit=array('IPv4'=>0, 'IPv6'=>0); 
require_once("$IP/extensions/CentralAuth/CentralAuth.php");
$wgConf->suffixes = $wgLocalDatabases;
$wgConf->siteParamsCallback = 'efGetSiteParams';

$wgConf->settings=array(

'+wgScriptPath'=>array(
	'mainwiki'=>'/wiki',
	'projectwiki'=>'/projectwiki',
	'networkwiki'=>'/networkwiki',
	),
'+wgScript'=>array(
	'mainwiki'=>'/wiki/index.php',
	'projectwiki'=>'/projectwiki/index.php',
	'networkwiki'=>'/networkwiki/index.php',
	),
#Required for CentralAuth
'+wgGroupPermissions'=>array(
	'default'=>array(
		'*'=>array(
			'edit'=>false,
			),
		),
	),
'wgServer'           => array(
	'default'=>'http://192.168.2.100/',
	),
'wgCanonicalServer'=>array(
	'default'=>'http://192.168.2.100',
	),
'wgArticlePath'=>array(
	'mainwiki'=>'/wiki/index.php?title=$1',
	'networkwiki'=>'/networkwiki/index.php?title=$1',
	'projectwiki'=>'/projectwiki/index.php?title=$1',
	),
'wgLocalInterwiki'=>array(
	'default'=>'$lang',
	),
'wgSitename'=>array(
	'mainwiki'=>"Jasper's Wiki",
	'networkwiki'=>"Jasper's Network",
	'projectwiki'=>"Jasper's Projects",
	),
#Other configuration settings
'+wgBlockCIDRLimit'=>array(
	'mainwiki'=>array(
		'IPv4'=>0,
		'IPv6'=>0,
		),
	
	'default'=>array(
		'IPv4'=>0,
		'IPv6'=>0,
		),
	),
'+wgBlockAllowsUTEdit'=>array(
	'networkwiki'=>true,
	'projectwiki'=>true,
	'mainwiki'=>true,
	'default'=>true,
	),
);
$wgConf->extractAllGlobals( $wgDBname );
$wgCentralAuthDatabase='centralauth';
require_once("$IP/extensions/CheckUser/CheckUser.php");
$wgShowExceptionDetails=true;
# (Not installed yet) require_once("$IP/extensions/GlobalUserrrights/GlobalUserrights.php");
 
require_once($IP.'/extensions/GlobalBlocking/GlobalBlocking.php');

$wgShowExceptionDetails=true;
?>

(Each of my LocalSettings.php includes this Commonsettings.php as their first line) I got $wgConf to control $wgArticlePath and other things, but still cannot get it to control $wgBlockCIDRLimit and $wgBlockAllowsUTEdit.Jasper Deng 18:56, 21 December 2011 (UTC)

IAlex (talkcontribs)

WikiReference::getFullUrl() only exists in trunk version, you will need to download an older version of the extension.

For you problems with configuration settings, I would remove the "+" in front of setting's names except for wgGroupPermissions.

Reply to "$wgConf and CentralAuth"