As documented in #2283489: Add change record for file/image target is missing when upgrading from 7.x-2.0-alpha8, existing file and image mappings were broken by #1080386: Add mapping for title and alt fields on images. and requires these mappings to be recreated with the new :uri option. This is problematic for an importer running on many sites. Attached is a patch against 7.x-2.x-dev that attempts to fix these mappings in an upgrade hook. Thanks!
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | fix_missing_file_image-2341407-6.patch | 2.66 KB | vinmassaro |
Comments
Comment #1
vinmassaro commentedComment #2
vinmassaro commentedComment #3
twistor commentedThis needs to batch. It can very easily run into problems with memory/time.
Comment #4
vinmassaro commentedHere's an updated patch that batches. Thanks!
Comment #5
twistor commentedWe don't want to store all of the importers. Just the importer ids.
Which means we should be loading the importer here.
processor->getMappings();
strpos() === FALSE
We should only save the importer if it was changed.
Also, the comments need to wrap at 80 chars.
Nice work!
Comment #6
vinmassaro commentedOk, I modified it to include your changes and also added two other things:
Comment #7
vinmassaro commented@twistor: could you give this another review? Since it relies on the change in #1080386: Add mapping for title and alt fields on images., it should be included with it in the next stable release. Thanks!
Comment #9
twistor commentedRearranged things a little bit. Thanks!
Comment #10
PascalAnimateur commentedI get an error when upgrading from 7.x-2.0-alpha8+56-dev to +65-dev on a site with multiple feeds importers because of the 7211 update.
The error I get is:
Call to a member function getMappings() on a non-object in /var/www/html/crires.ulaval.ca.dev/sites/all/modules/contrib/feeds/feeds.install on line 710Most importers use CSV files, some have XPath and another on imports from Zotero.
Anybody knows why $mappings = $importer->processor->getMappings(); would fail on some feeds importers?
Update It's a disabled ZoteroFeed that's causing the problem since feeds_importer_load returns false for disabled importers. There should be a check for this, something like:
Comment #12
twistor commentedWe're specifically loading all importers, so I switched to using feeds_importer(). I missed that from before. feeds_importer_load() is really only a menu callback.
Thanks for the bug report!
Comment #13
vinmassaro commentedThanks all!
Comment #14
vinmassaro commentedThanks all!
Comment #15
megachrizNew issue related to this change: #2392943: Call to undefined function feeds_importer_load_all().