HomePhabricator

GlobalFunctions: Use php_uname instead of posix_uname
e01ae3d0286dUnpublished

Tags
None
Referenced Files
None
Subscribers
None

Unpublished Commit · Learn More

  • Publishing Disabled: All publishing is disabled for this repository.
  • Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

GlobalFunctions: Use php_uname instead of posix_uname

  • posix_uname() is only available when PHP is compiled with ext-posix, which MW installer and composer.json do not currently require. That's why it was conditionally used (good), but we can simply use php_uname() instead and not worry about this.
  • php_uname uses POSIX on *nix systems whenever possible (even if compiled without ext-posix), and has a C-level fallback to ComputerName on Windows built-in as well.
  • Remove the fallback to SERVER_NAME was imho quite poor because:
    • The domain name used as virtual host (e.g. on Apache) isn't relevant to what wfHostname() is about.
    • It can change from request to request, even influenced by end-users, thus could be problematic, poison caches, or behave in other unexpected ways.
    • It is unreliable because it is only expected to be set on web requests. Even on POSIX or Windows, it would be unset when on the command-line, so this would need to use an additional fallback either way.

Bug: T172060
Change-Id: I6251122f38db1edf5f85aecc8d8733b56c8222ee

Details

Provenance
KrinkleAuthored on Jun 14 2020, 10:15 PM
Parents
rMWca343fd5a333: Add Edge to MediaWiki:Clearyourcache
Branches
Unknown
Tags
Unknown
ChangeId
I6251122f38db1edf5f85aecc8d8733b56c8222ee

Event Timeline