You are here

function rules_admin_settings_integrity_check_submit in Rules 7.2

Form submit callback to check the integrity of all configurations.

1 string reference to 'rules_admin_settings_integrity_check_submit'
rules_admin_settings_advanced in rules_admin/rules_admin.inc
Advanced settings form.

File

rules_admin/rules_admin.inc, line 274
Implements rule management and configuration screens.

Code

function rules_admin_settings_integrity_check_submit($form, &$form_state) {
  $start = microtime(TRUE);
  $count = 0;
  $rules_configs = rules_config_load_multiple(FALSE);
  foreach ($rules_configs as $rules_config) {
    rules_config_update_dirty_flag($rules_config, TRUE, TRUE);
    if ($rules_config->dirty) {
      $count++;
      $variables = array(
        '%label' => $rules_config
          ->label(),
        '%name' => $rules_config->name,
        '@plugin' => $rules_config
          ->plugin(),
        '!uri' => url(RulesPluginUI::path($rules_config->name)),
      );
      drupal_set_message(t('The @plugin <a href="!uri">%label (%name)</a> fails the integrity check and cannot be executed.', $variables), 'error');
    }
  }
  drupal_set_message(t('Integrity of %count configurations checked in %duration seconds. %count_failed broken configurations found.', array(
    '%count' => count($rules_configs),
    '%count_failed' => $count,
    '%duration' => round(microtime(TRUE) - $start, 2),
  )));
}