From: jenkins-bot Date: Fri, 27 Sep 2019 00:13:30 +0000 (+0000) Subject: Merge "filebackend: avoid use of wfWikiId() in FileBackendGroup" X-Git-Tag: 1.34.0-rc.0~81 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=512b7cd8d73facec6b69047eedf102ae2c38c3d6;hp=fa0f6f34972c0e0f4aac24a03b3efdfc45f256f6 Merge "filebackend: avoid use of wfWikiId() in FileBackendGroup" --- diff --git a/includes/filebackend/FileBackendGroup.php b/includes/filebackend/FileBackendGroup.php index 9e04d09632..f369f00e95 100644 --- a/includes/filebackend/FileBackendGroup.php +++ b/includes/filebackend/FileBackendGroup.php @@ -123,8 +123,28 @@ class FileBackendGroup { } $class = $config['class']; - // @FIXME: ideally this would default to the DB domain (which includes the schema) - $config['domainId'] = $config['domainId'] ?? ( $config['wikiId'] ?? wfWikiID() ); + if ( isset( $config['domainId'] ) ) { + $domainId = $config['domainId']; + } elseif ( isset( $config['wikiId'] ) ) { + $domainId = $config['wikiId']; // b/c + } else { + // Only use the raw database/prefix for backwards compatibility + $ld = WikiMap::getCurrentWikiDbDomain(); + $domainId = strlen( $ld->getTablePrefix() ) + ? "{$ld->getDatabase()}-{$ld->getTablePrefix()}" + : $ld->getDatabase(); + // If the local wiki ID and local domain ID do not match, probably due to a + // non-default schema, issue a warning. A non-default schema indicates that + // it might be used to disambiguate different wikis. + $wikiId = WikiMap::getWikiIdFromDbDomain( $ld ); + if ( $ld->getSchema() !== null && $domainId !== $wikiId ) { + wfWarn( + "\$wgFileBackend entry '$name' should have 'domainId' set.\n" . + "Legacy default 'domainId' is '$domainId' but wiki ID is '$wikiId'." + ); + } + } + $config['domainId'] = $domainId; $config['readOnly'] = $config['readOnly'] ?? $readOnlyReason; unset( $config['class'] ); // backend won't need this