Starting from Mediawiki 1.31, Mediawiki will always looking for LocalSettings.php from where the MW code located, instead of the folder containing symlink.
This is not a problem for many single wiki setup. Since their LocalSettings.php are placed right under Mediawiki codes folder.
However, it cause fatal issue to wiki farms where symlink where widely used to set up multiple wikis.
E.G.
We are loading wiki farms in following method:
/www/mediawiki (all MW code, no config file, no web access)
/www/a (web access point, own LocalSettings.php, symlinked to /www/mediawiki)
/www/b (same)
/www/c (...)
/www/d
......
All the wiki failed, due to Mediawiki now only looking for LocalSettings.php under /www/mediawiki folder.
It also break the distribute version of Mediawiki in Debian std. They put MediaWiki core files under /usr/share/mediawiki and then /etc/mediawiki/LocalSettings.php. Mediawiki is loaded via symlink from web-server directory. Therefore, after upgrade to 1.31, Mediawiki will start to load LocalSettings.php under /usr/share/mediawiki, instead of where the symlink LocalSettings.php, which break the site.
This problem seems to be caused by this change: https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/0d5f8f6bee296c4e29f03acbd5c07f34d6c8a88a%5E%21/ in WebStart.php.
Where $IP is set to the folder of Mediawiki codes' absolute path in 1.31, instead of the original path.
Therefore, in line 61
define( 'MW_CONFIG_FILE', "$IP/LocalSettings.php" );
will point LocalSettings.php path to MW code folder, instead of the folder where MW was called.
We'd like Mediawiki to add a specify extra check for and only for LocalSettings.php under where the symlink initiated from MW 1.31 to newest master verison. Because it is easier and safer to Debian/Ubuntu users, and judging which folder to load by nginx/Apache is much faster than a giant LocalSettings.php files with hundreds of if statements for wiki farm.
get the calling url if ( strpos( $callingurl, '/wiki1' ) === 0 ) { require_once 'LocalSettings_wiki1.php'; } elseif ......
few more lines of if statement needs to be add to WebStart.php to fix this problem.
such as
// If no LocalSettings file exists, try to display an error page // (use a callback because it depends on TemplateParser) $possibleCurrentDirectoryLocalSettings = getcwd().'/LocalSettings.php'; //an extra check for LocalSettings.php under current Directory incase of symlink used. if ( !defined( 'MW_CONFIG_CALLBACK' ) ) { if ( !defined( 'MW_CONFIG_FILE' ) ) { if ( is_readable($possibleCurrentDirectoryLocalSettings) ) { define( 'MW_CONFIG_FILE', $possibleCurrentDirectoryLocalSettings ); }else{ define( 'MW_CONFIG_FILE', "$IP/LocalSettings.php" ); } }
We tested it, and could confirm that by modify WebStart.php like so, we get the wiki farm run again as well as the Debian distribution MW in version 1.31.
It seems that by setting $IP to the actual MW code path, Mediawiki get slightly better performance due to file path unify in apc. But not much. Therefore, switch back to the way Mediawiki 1.30 used to use(relative path) could be a choice too.