How can I programmatically know when a certain feed has no items?
What if in case a feed has no new items? Would this be possible?
Regards.
How can I programmatically know when a certain feed has no items?
What if in case a feed has no new items? Would this be possible?
Regards.
Comments
Comment #0.0
Yorgg commentedRephrasing the question.
Comment #1
megachrizWhen implementing the hook
hook_feeds_after_import()in a custom module you can inspect the statistics of the import result by callingstate(FEEDS_PROCESS)on the source object. If$state->createdis zero, there were no new items created.Example:
There isn't an easy way to know beforehand if the feed has new items, though it is possible to check that with custom code:
preview()on the source object.FeedsProcessor::process()to find out how an existing ID for an item can be get.