/**
* Execute "checkAll"
+ *
+ * @param array|NULL $messages list of CRM_Utils_Check_Message; or NULL if the default list should be fetched
*/
- public function showPeriodicAlerts() {
+ public function showPeriodicAlerts($messages = NULL) {
if (CRM_Core_Permission::check('administer CiviCRM')
&& CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'securityAlert', NULL, TRUE)
) {
$config = CRM_Core_Config::singleton();
$config->cleanup(0, FALSE);
- foreach ($this->checkAll() as $message) {
+ 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 = $this->checkAll();
+ public function assertValid($messages = NULL) {
+ if ($messages === NULL) {
+ $messages = $this->checkAll();
+ }
if (!empty($messages)) {
$messagesAsArray = array();
foreach ($messages as $message) {
// also set this global hack
$GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'] = array();
- CRM_Utils_Check::singleton()->assertValid();
+ $env = new CRM_Utils_Check_Env();
+ CRM_Utils_Check::singleton()->assertValid($env->checkAll());
}
/**