File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,13 +16,6 @@ class UnknownDBVersionException extends Exception {}
1616class UnknownWikiDomainException extends Exception {}
1717
1818class MediaWikiHostResolver {
19- // TODO: Move this mapping to a config file so that MW updates do not require code changes here.
20- /** @var array<string, string> Map of DB version strings to MediaWiki version strings */
21- private const DB_VERSION_TO_MW_VERSION = [
22- 'mw1.39-wbs1 ' => '139 ' ,
23- 'mw1.43-wbs1 ' => '143 ' ,
24- ];
25-
2619 /**
2720 * @throws UnknownDBVersionException
2821 * @throws UnknownWikiDomainException
@@ -53,8 +46,9 @@ private function getMwVersionForDomain(string $domain): string {
5346
5447 $ dbVersion = $ wiki ->wikiDb ->version ;
5548
56- if (array_key_exists ($ dbVersion , self ::DB_VERSION_TO_MW_VERSION )) {
57- return self ::DB_VERSION_TO_MW_VERSION [$ dbVersion ];
49+ $ versionMap = config ('mw-db-version-map ' );
50+ if (array_key_exists ($ dbVersion , $ versionMap )) {
51+ return $ versionMap [$ dbVersion ];
5852 }
5953 throw new UnknownDBVersionException ("Unknown DB version ' {$ dbVersion }' for domain ' {$ domain }'. " );
6054 }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ // TODO: Read from outside of this codebase so that MW updates do not require code changes here.
4+ $ versionMap = [
5+ 'mw1.39-wbs1 ' => '139 ' ,
6+ 'mw1.43-wbs1 ' => '143 ' ,
7+ ];
8+
9+ return $ versionMap ;
You can’t perform that action at this time.
0 commit comments