You are here

function ultimate_cron_background_process_message_alter in Ultimate Cron 7

Same name and namespace in other branches
  1. 8 ultimate_cron.module \ultimate_cron_background_process_message_alter()

Implements hook_background_process_message_alter().

1 call to ultimate_cron_background_process_message_alter()
ultimate_cron_progress_message_alter in ./ultimate_cron.module
Implements hook_progress_message_alter().

File

./ultimate_cron.module, line 495
@todo Add filter on overview page. @todo Add log view (with graph). @todo Make proper markup for overview page. @todo Refactor drush stuff, too many intimate relations with Background Process @todo Refactor Cron % offset stuff. Too mixed up and…

Code

function ultimate_cron_background_process_message_alter(&$message) {
  $handle_prefix = variable_get('ultimate_cron_handle_prefix', ULTIMATE_CRON_HANDLE_PREFIX);

  // Only alter Ultimate Cron background process messages
  if (substr($message->data->background_process->handle, 0, 3) !== $handle_prefix) {
    return;
  }
  $message->data->ultimate_cron['start_stamp'] = format_date((int) $message->data->background_process->start_stamp, 'custom', 'Y-m-d H:i:s');
  if ($message->data->background_process->progress >= 0) {
    $message->data->ultimate_cron['progress'] = gmdate('H:i:s', (int) (microtime(TRUE) - $message->data->background_process->start_stamp)) . sprintf(" (%3d%%)", $message->data->background_process->progress * 100);
  }
  $message->data->ultimate_cron['unlockURL'] = url('background-process/unlock/' . $message->data->background_process->handle, array(
    'query' => array(
      'destination' => 'admin/config/system/cron',
    ),
  ));
}