With the replacement of hook_nodeapi() with hook_nodeapi_*(), we ended up with a bunch of one-line function hooks that just called another function. It would be best if we removed those function calls and just used the hook instead.

/**
* Implementation of hook_nodeapi_delete().
*/
function taxonomy_nodeapi_delete($node) {
taxonomy_node_delete($node);
}

/**
* Implementation of hook_nodeapi_delete_revision().
*/
function taxonomy_nodeapi_delete_revision($node) {
taxonomy_node_delete_revision($node);
}

/**
* Implementation of hook_nodeapi_validate().
*/
function taxonomy_nodeapi_validate($node, $form) {
taxonomy_node_validate($node);
}

/**
* Implementation of hook_nodeapi_rss_item().
*/

function taxonomy_nodeapi_rss_item($node) {
return taxonomy_rss_item($node);
}

/**
* Implementation of hook_nodeapi_update_index().
*/
function taxonomy_nodeapi_update_index($node) {
return taxonomy_node_update_index($node);
}
?>

..... etc.

Remove taxonomy_nodeapi_update_index, rename taxonomy_node_update_index to taxonomy_nodeapi_update_index. Also applies to the Trigger module.

Comments

robloach’s picture

recidive’s picture

Status: Postponed » Active

#319356 is in.

Changing status to active.

recidive’s picture

Title: Remove one line function hooks » Remove unnecessary nodeapi wrappers
Assigned: Unassigned » recidive
Status: Active » Needs review
StatusFileSize
new4.2 KB

Here is a patch.

Status: Needs review » Needs work

The last submitted patch failed testing.

recidive’s picture

StatusFileSize
new4.42 KB

One of the functions was being called directly elsewhere.

All tests should pass now.

recidive’s picture

Status: Needs work » Needs review
robloach’s picture

StatusFileSize
new5.54 KB

I had a look at the Trigger module, and it doesn't really look like we can do much there since we seem to do so much. Who's maintaining the Trigger module? It's broken....

  return node_load(array('nid' => arg(1)));

Anyway, here's the patch with the removal of the $op check because we're explicitly calling it from the correct hooks so we know $op is valid.

recidive’s picture

@Rob Loach: sorry, but how do your changes relates with the scope of this issue?

catch’s picture

recidive - trigger.module was part of the de-op of nodeapi, and it's also got lots of one line function calls inside nodeapi, but they're harder to factor out - but we can at least remove some cruft, which seems very much in scope here.

recidive’s picture

Title: Remove unnecessary nodeapi wrappers » Remove cruft left by de-op nodeapi patch
Assigned: recidive » Unassigned
Status: Needs review » Reviewed & tested by the community

@catch: thanks for the clarification. This makes sense.

Changing title to a more generic one.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks!

Status: Fixed » Closed (fixed)

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