Project:SimpleFeed
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I am using Simplefeed to import my 'lifefeed' from other sites like twitter.com, soup.io, vox.com etc. This works splendid but it all depends on the taxonomy / vocabulary that needs to be assigned to each item imported. For some strange reason sometimes the taxonomy is not assigned, leaving me with feed-items with no taxonomy assigned at all. These won't show up on my site.
A few hours later items from the same source show up under the correct category again. With leaves me baffled. It's not like something is broken because then the taxonomy would never be assigned.
I've had a quick look at the code but could not find anything wrong with that part.

Comments

#1

Some extra information I think this only happens when two or more feeds have fresh items. The first feed does get it's taxonomy assigned, but the second and third not always. I'll dive into the code again to see if this makes sense.

#2

I think I found the problem.
$type is declared static. Now if $type is not set, $vid will get set to the appropriate vocabulary. But $vid is not static, and will loose it's value when we re-enter simplefeed_item_feed_parse. Since $vid lost it's value, taxonomy parsing is not done for any subsequent feed that has items in the same cron run.
Either $vid needs to be static as well, but I think it's best to take the small performance hit and perform the lookup of both $type and $vid once outside the for($i ...) loop.
I'll patch my installation and try both sugestions ($vid static as well or outside the loop non-static declaration).
I'll be back.

#3

Tested my own suggestion; declaring $vid as static as well; after static $type; resolves the issue when more tehn one feed needs taxonomy assigned and are present in the same batchrun.

#4

Hi xiffy,
I'm having the exact same issue using SimpleFeed 5.x-2.2.

I see that you've found a solution for 6.x - inserting :
static $vid
into the simplefeed_item.module file.

Could you tell me exactly where you insert the new code. When you say 'after static $type' do you mean literally the very next line?

Thanks.

#5

Yes, laurence_m,
Where you have:

    if (!$duplicate) {
      static $type;

inside simplefeed_item.module. You should have:
    if (!$duplicate) {
      static $type;
      static $vid;
and the taxonomy issue should disappear.

#6

Thanks for the clarification xiffy, I'll give it a go and post the results back here later.

#7

looks like $categories needs to be static as well.

#8

Status:active» needs review

Here are a couple patches. One for D5 and one for D6. It looks like the $categories variable needs to be static as well. I'm going to test these out. If there are no issues I'll commit them.

AttachmentSize
taxonomy-not-assigned-d5-269029-8.patch 781 bytes
taxonomy-not-assigned-d6-269029-8.patch 802 bytes

#9

This seems to work in my tests. I'll commit tomorrow unless someone sees any issues.

#10

Status:needs review» fixed

Thanks guys, I've applied this to 5.x and 6.x branches!

#11

Status:fixed» closed (fixed)

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

nobody click here