Multiple use cases for this one:

  • server farms, to be able to know which host performed some specific operation, although all use the same DB and hence have the same site:name
  • development, where all dev / profile / prod sites are likely to share the same site:name too, but differ in their hostname
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fgm’s picture

Status: Active » Needs review
FileSize
1.29 KB

And a possible implementation.

fgm’s picture

Added a static cache: php_uname() does not cache its result and does a uname(2) system call every time, so it is better to skip it.

Status: Needs review » Needs work

The last submitted patch, 0001-Issue-1542272-by-fgm-Add-a-site-hostname-token.patch, failed testing.

fgm’s picture

Status: Needs work » Needs review
FileSize
679 bytes

No reason for patch #2 failing: both versions pass on my machine, and here is an interdiff: the change does not touch the options.

interdiff attached.

Dave Reid’s picture

Chris Matthews’s picture

The 7 year old patch in #2 to token.tokens.inc applied cleanly to the latest token 7.x-1.x-dev and if applicable still needs review.

Checking patch token.tokens.inc...
Hunk #1 succeeded at 86 (offset 10 lines).
Hunk #2 succeeded at 920 (offset 30 lines).
Applied patch token.tokens.inc cleanly.