The hook_nodequeue_delete() which has been introduced in the current 7.x-2.x branch, is currently providing a queue ID to any implementations, AFTER all queue data has been deleted from the database.

This means that modules implementing the hook, does not have any information about the queue unless they are storing the data themselves.

A proper way would be to provide a nodequeue object to the hook.This is also the standard drupal way, as seen in hook_node_delete() for instance. http://api.drupal.org/api/drupal/modules!node!node.api.php/function/hook...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

esbenvb’s picture

This patches fixes the issue.

IMPORTANT! When porting this patch, make sure that the correct GIT attribution is used, as mentioned on http://drupal.org/user/989064

esbenvb’s picture

Sorry, wrong file content. THIS patch it is...

othermachines’s picture

Issue summary: View changes
Status: Needs review » Needs work

I think you're probably correct that this is a better way, but this will break modules already implementing hook_nodequeue_delete(), including smartqueue.module. I wonder if it might be better to introduce the object as an additional (optional) argument.

function nodequeue_delete($qid) {
  $queue = nodequeue_load($qid);
   ...
  module_invoke_all('nodequeue_delete', $qid, $queue);
}

// ----------------------------
/**
 * Implements hook_nodequeue_delete().
 */
function foo_nodequeue_delete($qid) {
  $args = func_get_args();
  $queue = $args[1];
  ...
}

  • fizk committed dd1f758 on 7.x-2.x
    Issue #1978764 by esbenvb, othermachines: hook_nodequeue_delete should...
fizk’s picture

Status: Needs work » Fixed

@othermachines, good call. The new hook is now module_invoke_all('nodequeue_delete', $qid, $queue);

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.