You are here

public function UltimateCronBackgroundProcessLegacyLauncher::cleanup in Ultimate Cron 7.2

Background process cleanup handler.

Use drupal_set_message() to inform about the result of the cleanup.

We trap these, and log them as watchdog messages.

File

plugins/ultimate_cron/launcher/background_process_legacy.class.php, line 344
Background Process 1.x launcher for Ultimate Cron.

Class

UltimateCronBackgroundProcessLegacyLauncher
Ultimate Cron launcher plugin class.

Code

public function cleanup() {
  $before = drupal_get_messages(NULL, FALSE);
  background_process_cron();
  $after = drupal_get_messages(NULL, FALSE);
  foreach ($after as $type => $a_messages) {
    $b_messages = isset($before[$type]) ? $before[$type] : array();
    $messages = array_diff($a_messages, $b_messages);
    foreach ($messages as $message) {
      switch ($type) {
        case 'status':
          $severity = WATCHDOG_INFO;
          break;
        case 'warning':
          $severity = WATCHDOG_WARNING;
          break;
        case 'error':
          $severity = WATCHDOG_ERROR;
          break;
        default:
          $severity = WATCHDOG_CRITICAL;
          break;
      }
      watchdog('bpgl_launcher', $message, array(), $severity);
    }
  }
}