I'm using the code from #860748: Config for mappers? along with #1262732: Map to existing media? to automatically match my incoming feeds to existing media items. If I forget to upload the media first, I'd like to just rerun the import after uploading my images, but it appears as though any records that haven't changed in the file (in this case that would be all of them) get skipped. I'm guessing that's expected behavior since for any use cases prior to #1262732: Map to existing media? that would have had no effect other than running some extra db updates that just left the record in more or less the same state as it started in. Is that correct? Where would I find the code that figures out which record to skip if I wanted to add a "Force Reload" option.
And, assuming I succeed, is that something that would be of general interest that I should contribute a patch for?
Thanks.
Colin
Comments
Comment #1
johnbarclay commentedI think this is important feature for debugging feeds. When nothing has changed, but you are applying patches etc., the only way to re-execute the feed is to change something in the importer configuration like the name. Whether an entity is reimported depends on if a hash of its content and the importer configuration has changed.
Here's where I think the code would change:
In feedsProcessor.inc
would become:
And $this->config['force_reimport'] parameter would be added to the processor UI.
Comment #2
colin_young commentedNever mind. I was looking in FeedsProcessor.inc, not FeedsNodeProcessor.inc. I'm going to blame it on my eyes after staring at the screen for too long today and not seeing that extra 'Node' in filename in my search results.
So, I thought I could just add a new option in the config form like this:// Update mode for existing items.define('FEEDS_SKIP_EXISTING', 0);
define('FEEDS_REPLACE_EXISTING', 1);
define('FEEDS_UPDATE_EXISTING', 2);
define('FEEDS_FORCE_UPDATE_EXISTING', 3); // this one is new
'#description' =>t('Existing @entities will be determined using mappings that are a "unique target".', $tokens),
'#options' => array(
FEEDS_SKIP_EXISTING => t('Do not update existing @entities', $tokens),
FEEDS_UPDATE_EXISTING => t('Update existing @entities', $tokens),
FEEDS_FORCE_UPDATE_EXISTING => t('Force update existing @entities', $tokens),
),
but I'm still only seeing the original 3 options, one of which (replace) doesn't even appear in the options array. I should note that making changes to the description does appear on the screen (I did that to make sure I was modifying the correct configuration form).Clearly I'm missing something. Not sure what right now though.Comment #3
colin_young commentedI've got this working now. When I finish up my current project, or get a bit of breathing room (within the next couple days I hope), I'm going to figure out how to contribute a patch (I probably need to clean up the code/text a bit).
Comment #4
thinkingcap commentedExcellent idea!! Wondering whether you could please post some quick notes on how you implemented 'Force reload'?
Comment #5
twistor commentedThis was fixed in #1364116: Option to skip hash check on re-import.