File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,10 +17,10 @@ class UnknownWikiDomainException extends Exception {}
1717
1818class MediaWikiHostResolver {
1919 // 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 backend version strings */
20+ /** @var array<string, string> Map of DB version strings to MediaWiki version strings */
2121 private const DB_VERSION_TO_MW_VERSION = [
22- 'mw1.39-wbs1 ' => '139-app ' ,
23- 'mw1.43-wbs1 ' => '143-app ' ,
22+ 'mw1.39-wbs1 ' => '139 ' ,
23+ 'mw1.43-wbs1 ' => '143 ' ,
2424 ];
2525
2626 // https://phabricator.wikimedia.org/T409530
@@ -31,7 +31,7 @@ class MediaWikiHostResolver {
3131
3232 public function getBackendHostForDomain (string $ domain ): string {
3333 // TODO: Move 'backend.default.svc.cluster.local' to an env variable (e.g. PLATFORM_MW_BACKEND_HOST_SUFFIX) for flexibility.
34- return sprintf ('mediawiki-%s-backend.default.svc.cluster.local ' , $ this ->getMwVersionForDomain ($ domain ));
34+ return sprintf ('mediawiki-%s-app- backend.default.svc.cluster.local ' , $ this ->getMwVersionForDomain ($ domain ));
3535 }
3636
3737 public function getMwVersionForDomain (string $ domain ): string {
Original file line number Diff line number Diff line change 1313class MediaWikiHostResolverTest extends TestCase {
1414 use RefreshDatabase;
1515
16+ public function testGetMwVersionForDomain (): void {
17+ $ domain = (new Factory )->create ()->unique ()->text (30 );
18+ $ this ->createWiki ($ domain , 'mw1.43-wbs1 ' );
19+ $ resolver = new MediaWikiHostResolver ;
20+ $ this ->assertSame ('143 ' , $ resolver ->getMwVersionForDomain ($ domain ));
21+ }
22+
1623 public function testResolverRoutesToCorrectHost (): void {
1724 $ domain = (new Factory )->create ()->unique ()->text (30 );
1825 $ this ->createWiki ($ domain , 'mw1.39-wbs1 ' );
You can’t perform that action at this time.
0 commit comments