I'm upgrading MediaWiki from 1.20.5 to 1.21.2 (or to 1_22wmf18, same issue), backed by Postgresql database.
MediaWiki 1.20.5 PHP 5.4.5 (apache2handler) PostgreSQL 9.2.4
I've set $wgDBport to a non-default port.
I'm using the web update method. When it prompts for the wgUpgradeKey, I enter it. I got an error that it cannot connect, and asks Is the server running on host "foobar.example.local" (127.0.0.1) and accepting TCP/IP connections on port 5432?
.
Note that 5432 is the default port for PostgreSQL, but is not the port I am using.
It then asks for the upgrade key again, which I provide again. This time, it works and the upgrade completes. Why does it ignore $wgDBport the first time I enter the upgrade key, but then accepts it the second time?
That is rather confusing. Worse, it might upgrade the wrong database if one were to have multiple wikis and multiple databases.
I tried to assess the behavior when using MySQL instead of PostgreSQL, but it appears that is not possible to use MySQL on a non-default port, so this does not apply there.