+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018 |
+ | Copyright CiviCRM LLC (c) 2004-2019 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
*/
class CRM_Utils_Check {
// How often to run checks and notify admins about issues.
* @var array
* @link https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
*/
- protected static $severityList = array(
+ protected static $severityList = [
\Psr\Log\LogLevel::DEBUG,
\Psr\Log\LogLevel::INFO,
\Psr\Log\LogLevel::NOTICE,
\Psr\Log\LogLevel::CRITICAL,
\Psr\Log\LogLevel::ALERT,
\Psr\Log\LogLevel::EMERGENCY,
- );
+ ];
/**
* We only need one instance of this object, so we use the
$config = CRM_Core_Config::singleton();
$config->cleanup(0, FALSE);
- $statusMessages = array();
+ $statusMessages = [];
$maxSeverity = 0;
foreach ($this->checkAll() as $message) {
if (!$message->isVisible()) {
$messages = $this->checkAll();
}
$minLevel = self::severityMap($threshold);
- $errors = array();
+ $errors = [];
foreach ($messages as $message) {
if ($message->getLevel() >= $minLevel) {
$errors[] = $message->toArray();
* Array of CRM_Utils_Check_Message objects
*/
public static function checkAll($max = FALSE) {
- $messages = array();
+ $messages = [];
foreach (glob(__DIR__ . '/Check/Component/*.php') as $filePath) {
$className = 'CRM_Utils_Check_Component_' . basename($filePath, '.php');
/* @var CRM_Utils_Check_Component $check */
CRM_Utils_Hook::check($messages);
- uasort($messages, array(__CLASS__, 'severitySort'));
+ uasort($messages, [__CLASS__, 'severitySort']);
$maxSeverity = 1;
foreach ($messages as $message) {
break;
}
- Civi::settings()->set('systemStatusCheckResult', $maxSeverity);
+ Civi::cache('checks')->set('systemStatusCheckResult', $maxSeverity);
return ($max) ? $maxSeverity : $messages;
}