One of my largest Drupal installs which supports the Beehive family sites is quite a lot of core, contrib and custom code. Most of the updates are scripted if at all possible but since we have more than one actual install of the same code base and our maintenance days can vary for different installs I kept on running into the issue where there was no easy way to determine which release the install was actually running.  

Ever wondered about that notification on status report page and where it came from? Here's where hook_requirements comes in handy. Not only does it check for install requirements but it also does status reporting. hook_requirements has four severity levels:

  1. REQUIREMENT_INFO: For info only.
  2. REQUIREMENT_OK: The requirement is satisfied.

  3. REQUIREMENT_WARNING: The requirement failed with a warning.

  4. REQUIREMENT_ERROR: The requirement failed with an error.

Most modules use levels 2-4 , level 1 however is useful in my specific use case. While I only care about current internal release numbers one might use it to display the last maintenance update date or other information that might help troubleshooting issues.

Here's the code snippet that did it for me:
 

/**
  * Implementation of hook_requirements().
  *
  */
function beehive_requirements($phase) {
    $requirements = array();
    $t = get_t();
    $requirements['beehive'] = array(
      'title' =>  $t('Beehive version'),
      'value' => '4.3.1',
      'severity' => REQUIREMENT_INFO,
    );
    return $requirements;
}

 

It's quiet in here! Why not leave a response?

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.