You are here

function revisioning_delete_archived_action in Revisioning 7

Same name and namespace in other branches
  1. 8 revisioning_triggers_actions.inc \revisioning_delete_archived_action()
  2. 6.3 revisioning_triggers_actions.inc \revisioning_delete_archived_action()

As declared in revisioning_action_info().

Called from actions.inc/actions_do()

Parameters

object $entity: in our case the node in question

array $context: an array with $context['hook'] telling us which trigger instigated this call, eg 'node_update' as specified in the 'triggers' array, in hook_action_info()

File

./revisioning_triggers_actions.inc, line 180
Triggers and actions supported by the Revisioning module.

Code

function revisioning_delete_archived_action(&$entity, $context = array()) {
  $node = $entity;
  if (empty($node->revision_moderation)) {

    // return;
  }
  $num_archived = revisioning_get_number_of_archived_revisions($node);
  if ($num_archived > 0) {
    $type = node_type_get_type($node->type);
    watchdog('revisioning', 'Executing deleting archived revisions action for @type %title', array(
      '@type' => $type->name,
      '%title' => $node->title,
    ), WATCHDOG_NOTICE, l(t('view'), "node/{$node->nid}"));
    if (revisioning_delete_archived_revisions($node)) {
      revisioning_set_status_message(format_plural($num_archived, '@type %title: one archived revision deleted.', '@type %title: @count archived revisions deleted.', array(
        '@type' => $type->name,
        '%title' => $node->title,
      )));
    }
  }
}