You are here

function xhprof_mongodb_requirements in XHProf 8

Same name and namespace in other branches
  1. 6 modules/xhprof_mongodb/xhprof_mongodb.install \xhprof_mongodb_requirements()
  2. 7 modules/xhprof_mongodb/xhprof_mongodb.install \xhprof_mongodb_requirements()

@file Install, update and uninstall functions for the XHProf module.

File

modules/xhprof_mongodb/xhprof_mongodb.install, line 8
Install, update and uninstall functions for the XHProf module.

Code

function xhprof_mongodb_requirements($phase) {
  $requirements = [];

  // Ensure translations don't break at install time
  if (extension_loaded('mongo')) {
    module_load_include('module', 'mongodb');
    $mongo = mongodb();
    if (!$mongo instanceof MongoDB) {
      $requirements['xhprof_mongodb'] = [
        'title' => t('Mongodb'),
        'value' => t('Not running'),
        'description' => t('Unable to get a Mongodb collection object. This is required to create indexes on install.'),
        'severity' => REQUIREMENT_ERROR,
      ];
    }
  }
  return $requirements;
}