| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 | 
							- <?php
 
- // $Id$
 
- /**
 
-  * @file
 
-  * Munin API for Drupal: installation and runtime checks.
 
-  *
 
-  * @author Frederic G. MARAND
 
-  *
 
-  * @copyright (c) 2011 Ouest Systèmes Informatiques
 
-  *
 
-  * Licensed under the General Public License version 2 or later.
 
-  */
 
- /**
 
-  * Implements hook_requirements().
 
-  */
 
- function munin_api_requirements($phase) {
 
-   $ret = array();
 
-   if ($phase == 'runtime') {
 
-     $count = count(module_implements('munin_api_info'));
 
-     switch ($count) {
 
-       case 0:
 
-         $req = array(
 
-           'title' => t('Munin plugin modules'),
 
-           'value' => t('No plugin found'),
 
-           'description' => t('Munin API is enabled, but does not find any plugin, including the one built into the API.'),
 
-           'severity' => REQUIREMENT_ERROR,
 
-           );
 
-         break;
 
-       case 1:
 
-         $req = array(
 
-           'title' => t('Munin plugin modules'),
 
-           'value' => t('No Munin plugin module enabled beyond API'),
 
-           'description' => t('Munin API is enabled, but no plugin module is enabled to report to it except the one built within the API. You should either <a href="!link">enable some plugin modules</a> or <a href="!link">disable and uninstall Munin API</a>.', array(
 
-             '!link' => url('admin/build/modules'),
 
-           )),
 
-           'severity' => REQUIREMENT_INFO,
 
-         );
 
-         break;
 
-       default:
 
-         $req = array(
 
-           'title' => t('Munin plugin modules'),
 
-           // format plural although $count >= 2 because some languages have several plural forms
 
-           'value' => format_plural($count, '1 Munin plugin enabled.',
 
-             '<a href="!link">@count Munin plugins</a> enabled.', array('!link' => url('admin/reports/munin_api'))),
 
-           'severity' => REQUIREMENT_OK,
 
-         );
 
-     }
 
-     $ret[] = $req;
 
-   }
 
-   elseif ($phase != 'install') {
 
-     // This should never happen and points to a severe error somewhere
 
-     watchdog('munin_api', 'Invalid phase %phase passed to %function', array(
 
-       '%phase' => $phase,
 
-       '%function' => __FUNCTION__,
 
-     ), WATCHDOG_ERROR);
 
-   }
 
-   // else $phase == 'install', nothing to do.
 
-   return $ret;
 
- }
 
- /**
 
-  * Implements hook_uninstall()
 
-  */
 
- function munin_api_uninstall() {
 
-   $vars = array(
 
-     'init_path',
 
-     'last',
 
-     'next_report',
 
-     'watchdog',
 
-   );
 
-   foreach ($vars as $tail) {
 
-     $name = 'munin_api_'. $tail;
 
-     variable_del($name);
 
-   }
 
- }
 
 
  |