/** * Run all system checks. * * This functon is wrapped by the System.check api. * * Calls hook_civicrm_check() for extensions to add or modify messages. * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_check * * @param bool $max * Whether to return just the maximum non-hushed severity * * @return array * Array of CRM_Utils_Check_Message objects */ public static function checkAll($max = FALSE) { $messages = array(); foreach (glob(__DIR__ . '/Check/Component/*.php') as $filePath) { $className = 'CRM_Utils_Check_Component_' . basename($filePath, '.php'); /* @var CRM_Utils_Check_Component $check */ $check = new $className(); if ($check->isEnabled()) { $messages = array_merge($messages, $check->checkAll()); } } CRM_Utils_Hook::check($messages); uasort($messages, array(__CLASS__, 'severitySort')); $maxSeverity = 1; foreach ($messages as $message) { if (!$message->isVisible()) { continue; } $maxSeverity = max(1, $message->getLevel()); break; } Civi::settings()->set('systemStatusCheckResult', $maxSeverity); return $max ? $maxSeverity : $messages; }
/** * Run some sanity checks. * * This could become a hook so that CiviCRM can run both built-in * configuration & sanity checks, and modules/extensions can add * their own checks. * * We might even expose the results of these checks on the Wordpress * plugin status page or the Drupal admin/reports/status path. * * @return array * Array of messages * @link https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_requirements */ public function checkAll() { $checks = array(); $checks[] = new CRM_Utils_Check_Security(); $checks[] = new CRM_Utils_Check_Env(); $compInfo = CRM_Core_Component::getEnabledComponents(); foreach ($compInfo as $compObj) { switch ($compObj->info['name']) { case 'CiviCase': $checks[] = new CRM_Utils_Check_Case(CRM_Case_XMLRepository::singleton(), CRM_Case_PseudoConstant::caseType('name')); break; default: } } $messages = array(); foreach ($checks as $check) { $messages = array_merge($messages, $check->checkAll()); } CRM_Utils_Hook::check($messages); return $messages; }
/** * Run all system checks. * * This functon is wrapped by the System.check api. * * Calls hook_civicrm_check() for extensions to add or modify messages. * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_check * * @param bool $max * Whether to return just the maximum non-hushed severity * * @return array * Array of CRM_Utils_Check_Message objects */ public static function checkAll($max = FALSE) { $checks = array(); $checks[] = new CRM_Utils_Check_Security(); $checks[] = new CRM_Utils_Check_Env(); $compInfo = CRM_Core_Component::getEnabledComponents(); foreach ($compInfo as $compObj) { switch ($compObj->info['name']) { case 'CiviCase': $checks[] = new CRM_Utils_Check_Case(CRM_Case_XMLRepository::singleton(), CRM_Case_PseudoConstant::caseType('name')); break; default: } } $messages = array(); foreach ($checks as $check) { $messages = array_merge($messages, $check->checkAll()); } CRM_Utils_Hook::check($messages); uasort($messages, array(__CLASS__, 'severitySort')); $maxSeverity = 1; foreach ($messages as $message) { if (!$message->isVisible()) { continue; } $maxSeverity = max(1, $message->getLevel()); break; } Civi::settings()->set('systemStatusCheckResult', $maxSeverity); return $max ? $maxSeverity : $messages; }
/** * Run some sanity checks. * * This could become a hook so that CiviCRM can run both built-in * configuration & sanity checks, and modules/extensions can add * their own checks. * * We might even expose the results of these checks on the Wordpress * plugin status page or the Drupal admin/reports/status path. * * @return array * Array of messages * @link https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_requirements */ public function checkAll($showHushed = FALSE) { $checks = array(); $checks[] = new CRM_Utils_Check_Security(); $checks[] = new CRM_Utils_Check_Env(); $compInfo = CRM_Core_Component::getEnabledComponents(); foreach ($compInfo as $compObj) { switch ($compObj->info['name']) { case 'CiviCase': $checks[] = new CRM_Utils_Check_Case(CRM_Case_XMLRepository::singleton(), CRM_Case_PseudoConstant::caseType('name')); break; default: } } $messages = array(); foreach ($checks as $check) { $messages = array_merge($messages, $check->checkAll()); } CRM_Utils_Hook::check($messages); if (!$showHushed) { foreach ($messages as $key => $message) { $hush = self::checkHushSnooze($message); if ($hush) { unset($messages[$key]); } } } uasort($messages, array(__CLASS__, 'severitySort')); return $messages; }