Topic on Project:Support desk

When I attempted to configure a wiki family in Localsettings.php, it failed gracefully.

6
Newman2 (talkcontribs)

MediaWiki Version: 1.30

PHP Version: 5.6.36

MySQL Version: 5.6.39-cll-lve

In my Localsettings.php file I have been trying to configure a wiki family on my wiki, and it did not work well at the time. The site failed gracefully, leaving an error message saying that it was not possible to determine the wiki ID. Is there a way to fix this problem? What is wrong with the wiki family setup code? The code that the wiki had looked like this:

if ( defined( 'MW_DB' ) ) {

''// Set $wikiId from the defined constant 'MW_DB' that is set by maintenance scripts.''

$wikiId = MW_DB;

} elseif (isset($_SERVER['SERVER_NAME']) && $_SERVER['SERVER_NAME'] == 'wiki1.example.org') {

''// Add a value to the $wikiId variable for e.g. https://wiki1.example.org/'' 

$wikiId = 'wiki1';

} elseif (isset($_SERVER['SERVER_NAME']) && $_SERVER['SERVER_NAME'] == 'example.org' && substr($_SERVER['REQUEST_URI'], 0, 6) == '/wiki2') {

''// Add a value to the $wikiId variable for e.g. https://example.org/wiki2''

$wikiId = 'wiki2';
} else {
''// Fail gracefully if no value was set to the $wikiId variable, i.e. if no wiki was determined''
die( 'It was not possible to determine the wiki ID.' );
}
Bawolff (talkcontribs)

If using $wgConf and SiteConfiguration, you can use the --wiki command line option to select the right wiki

Newman2 (talkcontribs)

How do you get to use the wiki command line option? Where is it located? It is hard to locate things in SiteConfiguration.

Bawolff (talkcontribs)

Sorry, i read too quickly. I thought you were talking about maintenance scripts.

You could try and get what the current server is by looking at $wgServer (That variable should be registered by the time LocalSettings.php is loaded)

Newman2 (talkcontribs)
Newman2 (talkcontribs)

I get errors when trying to configure the site. When I tried to extract configuration settings in global context, I got this error:

PHP Fatal error:  Call to a member function getAll() on null in /home/gjlxrtap/public_html/mw19/LocalSettings.php on line 238

What can I do to get around this error? What is there in the SiteConfiguration.php file to make it possible to determine the wiki ID? I have no clue on what to do when I get an error like this.

Reply to "When I attempted to configure a wiki family in Localsettings.php, it failed gracefully."