timer('check_' . __CLASS__, self::CHECK_TIMER)) { // Best attempt at re-securing folders $config = CRM_Core_Config::singleton(); $config->cleanup(0, FALSE); if ($messages === NULL) { $messages = $this->checkAll(); } foreach ($messages as $message) { CRM_Core_Session::setStatus($message->getMessage(), $message->getTitle()); } } } } /** * Throw an exception if any of the checks fail * * @param array|NULL $messages list of CRM_Utils_Check_Message; or NULL if the default list should be fetched */ public function assertValid($messages = NULL) { if ($messages === NULL) { $messages = $this->checkAll(); } if (!empty($messages)) { $messagesAsArray = array(); foreach ($messages as $message) { $messagesAsArray[] = $message->toArray(); } throw new Exception('There are configuration problems with this installation: ' . print_r($messagesAsArray, TRUE)); } } /** * 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 of messages * @see Drupal's hook_requirements() - * https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_requirements */ public function checkAll() { $security = new CRM_Utils_Check_Security(); $env = new CRM_Utils_Check_Env(); $messages = array_merge( $security->checkAll(), $env->checkAll() ); return $messages; } }