New hook for "node import complete"

JohnAlbin - April 15, 2008 - 18:27
Project:Node import
Version:5.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

I have a custom module that needs to know when a full node import has been completed. But node_import doesn’t have a hook that allows that.

So here's the patch to add a "node_import_complete" hook.

AttachmentSize
import-complete-hook.patch1.77 KB

#1

JohnAlbin - April 16, 2008 - 00:50
Status:active» patch (code needs review)

Needs review, of course.

#2

Robrecht Jacques - April 18, 2008 - 12:33

Out of curiosity: what does your custom module use that for?
I'm wondering if this hook would need other parameters...

#3

JohnAlbin - April 18, 2008 - 19:31

I want to batch import some nodes of a particular type that will replace the existing nodes of that type.

So I've…

  1. set the default publishing option for that node type as Unpublished,
  2. used HOOK_node_import_static() to set a variable to the current time (the first time it is called), and
  3. when the HOOK_node_import_complete() function is called, I Unpublish all nodes of that type then publish the ones created after the time I set in #2.

So I personally don't need anymore params besides $type.

#4

Robrecht Jacques - May 3, 2008 - 08:44
Status:patch (code needs review)» fixed

Committed to 5.x-1.x-dev. Will be included in 5.x-1.6 release.

#5

JohnAlbin - May 3, 2008 - 20:32

Cool!

#6

Anonymous (not verified) - May 17, 2008 - 20:41
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.