Scenario:

I have 2 content types
Video - one cck embedded media video field
Photo - one cck embedded media image field, 2 cck text fields

two feeds have been configured. The video feed pulls video from YouTube, the photo feed pulls images from Flickr. They are set to refersh every 30 minutes.

nodes for items from the video feed are created/updated correctly (title, body and emvideo fields)
nodes for items from the photo feed are created/updated but only the title and body fields are populated, the emimage and additional cck text fields remain empty.

If I leave the first feed configuration (in this case video) set to minimum refresh every 30 minutes and set the second (in this case photo) to minimum refresh every 15 minutes, then the photo nodes will be created/updated correctly on the times only the photo feed is refreshed.

When multiple content types are being processed any cck fields for the second (possibly third, fourth, etc.) content type are not being updated.

CommentFileSizeAuthor
#7 648080-7_static_1.patch1.55 KBpvhee
#4 648080-4_static_0.patch994 bytespvhee
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tesliana’s picture

Would you be kind enough to write up what you did to get it to work, especially the YouTube case ?
Anyone else ? Please.
Thanks in advance.

tesliana’s picture

Since I am asking for your help, to write what you did, it's only fair that I document what I did.

(1) Install has an example feed called "Feed" ... In Basic settings it is attached to content type "Feed" ... Node processor Settings has content type of "Feed item".

Parallel to this, I have set up ...

(2) Created a feed called "YT user video" ... In Basic settings it is attached to content type "yt_user" which is just a standard node ... Node processor Settings has content type of "yt_video" - a standard node plus the "embded video" field.

(3) I have tried both common syndication and simplepie parsers and in both cases the embeded video is not being mapped. Select source shows the standard 13 fields and Select target shows the standard 6 fields. There is no source_url on the source list nor my "field_em_video" emfield on the target list - hence I can not map them myself. Elsewhere somebody wrote that these mappings are not done dynamically because the layouts are static and known in advance. In that case, appearance of any mappings is confusing me. And it seems that there is somewhere a place for these "static" mappings, but where?

(4) phpMyAdmin shows me my 5 vides i feeds_node_item, node and content_type_yt_video DB tables. The problem is in that content_type_video records have not been filled in and all 5 look like this first one:

vid nid field_em_video_embed field_em_video_value field_em_video_provider field_em_video_data field_em_video_version field_em_video_duration
148 148 NULL NULL NULL N; 0 0

I am able to see title and descriptions of these 5 videos, on my front page, but without the videos themselves and the rest of emfield decorations such as source links, etc.

Regards,
Zdravko

rjkuyvenhoven’s picture

you need to add the file mappers/emfield.inc to the module which you can find here http://drupal.org/node/623432

map source Item URL (link) to your embedded field.

pvhee’s picture

Version: 6.x-1.0-alpha8 » 6.x-1.x-dev
Status: Active » Needs review
FileSize
994 bytes

I ran into exactly the same problem: I have two content types with attached importer configurations. When updating on cron, only the first one is properly updated. The second one only contains the title but all my custom CCK fields are not mapped.

The reason for this is that static caching is used for the mapping targets.

In FeedsProcessor.inc line 85-89 you have:

    // Static cache $targets as getMappingTargets() may be an expensive method.
    static $targets;
    if (empty($targets)) {
      $targets = $this->getMappingTargets();
    }

This obviously gives problems when running different feed importers (e.g. at cron): the first time the mapping targets will be statically cached and the second time they won't be recomputed, although they are different. The solution would be to have static caching per feed configuration or no static caching at all.

I've added a patch against dev that removes static caching. This solves the problem for me, could you test it for your case as well?

@ Alex: what would be the best way to solve this issue? Remove static caching (creating more overhead), static caching per config, or...? Let me know, I'm willing to help with debugging and patching.

pvhee’s picture

Title: FeedsNodeProcessor - CCK fields not getting populated » FeedsNodeProcessor - static caching of mapping targets makes mapping fail with multiple feed configurations

Changed topic to reflect #4.

alex_b’s picture

Priority: Normal » Critical

Great find. Dumb bug. I apologize.

what would be the best way to solve this issue? Remove static caching (creating more overhead), static caching per config, or...?

Static caching per configuration is the solution. So instead of

$targets = $this->getMappingTargets();

it should be

$targets[$this->id] = $this->getMappingTargets();

This is actually a critical bug. Let's get this fixed for the next release. pvhee: if you could roll a patch, that would be great.

pvhee’s picture

FileSize
1.55 KB

A patch according to #6. Thanks Alex for the feedback!

alex_b’s picture

Status: Needs review » Fixed

Committed, thank you for the great debugging and patching work!

szy’s picture

[cut]

rjkuyvenhoven’s picture

Thanks guys!

Status: Fixed » Closed (fixed)

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