You are here

function simplenews_scheduler_scheduler_update in Simplenews Scheduler 7

Same name and namespace in other branches
  1. 8 simplenews_scheduler.module \simplenews_scheduler_scheduler_update()
  2. 6.2 simplenews_scheduler.module \simplenews_scheduler_scheduler_update()
  3. 2.0.x simplenews_scheduler.module \simplenews_scheduler_scheduler_update()

Updates a scheduler record with any housekeeping changes and saves it.

This should be called once a new edition has been created. This sets the next_run time on the scheduler.

@todo: Make this a general API function for saving a new or existing scheduler?

Parameters

$newsletter_parent_data: A row of data from {simplenews_scheduler}, as returned by simplenews_scheduler_get_newsletters_due().

$now_time: The time of the operation.

2 calls to simplenews_scheduler_scheduler_update()
SimpleNewsSchedulerEditionDueTest::testEditionsDue in tests/simplenews_scheduler.test
Test simplenews_scheduler_get_newsletters_due().
simplenews_scheduler_cron in ./simplenews_scheduler.module
Implements hook_cron().

File

./simplenews_scheduler.module, line 367
Simplenews Scheduler module allows a schedule to be set for sending (and resending) a Simplenews item.

Code

function simplenews_scheduler_scheduler_update($newsletter_parent_data, $now_time) {

  // Set the run time for the next edition.
  $newsletter_parent_data->next_run = simplenews_scheduler_calculate_next_run_time($newsletter_parent_data, $now_time);
  drupal_write_record('simplenews_scheduler', $newsletter_parent_data, 'nid');
}