Technical blog and writings by Micah Webner.

O Drupal, where art thou?

Ever since we switched to using Aegir to manage Drupal deployment, it's gotten a lot more difficult to keep track of which platform each site is running on. This little implementation of hook_requirements() displays the site's host name and Drupal directory in the status report.

 * Implements hook_requirements().

function mysite_requirements($phase) {
  $requirements = array();
  // Ensure translations don't break during installation.
  $t = get_t();

  // Shows current platform directory in the status report.
  // This might seem like a security risk, but anyone who
  // can view this can also read admin/reports/status/php
  // which includes the same information.
  if ($phase == 'runtime') {
    $hostname = phpversion() >= '5.3.0' ? gethostname() : php_uname('n');
    $requirements['platform'] = array(
      'title' => $t('Platform'),
      'value' => $hostname . ':' . getcwd(),
      'severity' => REQUIREMENT_INFO,
      'weight' => -8,
  return $requirements;