Page MenuHomePhabricator

import_text puppet role in MediaWiki-Vagrant uses wrong server name
Closed, ResolvedPublic0 Estimated Story Points

Description

When creating a new page with the import_text puppet role introduced in T88872 / c189180, {{fullurl}} will resolve to localhost instead of the expected 127.0.0.1:<port>. (Purging or editing the page from the web interface fixes this.)

Per @bd808, this is probably caused by $wgServer = WebRequest::detectServer(); in settings.d/wikis/CommonSettings.php getting confused when executed from a maintenance script.

It would be nice to fix server detection, but if that's not feasible, we could just invalidate the cache from import_text by nulling out page_touched for the page.

Event Timeline

Tgr claimed this task.
Tgr raised the priority of this task from to Needs Triage.
Tgr updated the task description. (Show Details)
Tgr added a project: MediaWiki-Vagrant.
Tgr added subscribers: Tgr, bd808.
Tgr set Security to None.

WebRequest::detectServer() uses $_SERVER['SERVER_NAME'], which does not exist in CLI mode. Generally, there is no way a CLI script could figure out the correct hostname or port. $_SERVER is populated from the shell environment in CLI mode though, so we just need to prefix the command with SERVER_NAME=... .

Change 193550 had a related patch set uploaded (by Gergő Tisza):
Fix host detection for CLI scripts

https://gerrit.wikimedia.org/r/193550

Change 193550 merged by jenkins-bot:
Fix host detection for CLI scripts

https://gerrit.wikimedia.org/r/193550