$path = $wgConf->get( 'wgArticlePath', $wikiID, $major,
[ 'lang' => $minor, 'site' => $major ] );
+
+ // If we don't have a canonical server or a path containing $1, the
+ // WikiReference isn't going to function properly. Just return null in
+ // that case.
+ if ( !is_string( $canonicalServer ) || !is_string( $path ) || strpos( $path, '$1' ) === false ) {
+ return null;
+ }
+
return new WikiReference( $canonicalServer, $path, $server );
}
* @return WikiReference|null WikiReference object or null if the wiki was not found
*/
private static function getWikiWikiReferenceFromSites( $wikiID ) {
- static $siteStore = null;
- if ( !$siteStore ) {
- // Replace once T114471 got fixed and don't do the caching here.
- $siteStore = SiteSQLStore::newInstance();
- }
-
- $site = $siteStore->getSite( $wikiID );
+ $siteLookup = \MediaWiki\MediaWikiServices::getInstance()->getSiteLookup();
+ $site = $siteLookup->getSite( $wikiID );
if ( !$site instanceof MediaWikiSite ) {
// Abort if not a MediaWikiSite, as this is about Wikis