As seen in #2537290: Call to undefined function feeds_importer_load_all() trying to run an upgrade for change source and target definitions is crazy. Let's not do it.

We can maintain compatibility by allowing targets and sources to be hidden, that way things can change, but existing installs still work.

Comments

twistor’s picture

Also, even force enabling and loading modules to try and run the upgrade won't fix importers that are in disabled features and such.

twistor’s picture

Status: Active » Needs review
StatusFileSize
new3.9 KB

Status: Needs review » Needs work

The last submitted patch, 2: feeds-allow-hidden-targets-2542416-2.patch, failed testing.

twistor’s picture

Status: Needs work » Needs review
StatusFileSize
new3.91 KB
twistor’s picture

StatusFileSize
new6.19 KB
twistor’s picture

Title: All sources and targets to be defined but hidden. » Allow sources and targets to be defined but hidden.
twistor’s picture

This should delete the whole update hook, just make it a no-op.

megachriz’s picture

Nice work. I tested this patch by defining a mapper to "field_image" and by setting one source from FeedsSyndicationParser to be hidden. Both show up as "DEPRECATED" when the importer uses them, so I guess this is good.

My review:

  1. +++ b/feeds_ui/feeds_ui.admin.inc
    @@ -830,11 +836,14 @@ function feeds_ui_mapping_form_submit($form, &$form_state) {
    +      $result[$k] = $v['name'] . ' (' . (!empty($v['hidden']) ? t('DEPRECATED') : $k) . ')';
    

    It would be nice if the key of the target is shown even if the target is "hidden".

  2. +++ b/feeds_ui/feeds_ui.admin.inc
    @@ -1028,9 +1044,8 @@ function theme_feeds_ui_mapping_form($variables) {
    +      $source = isset($sources[$mapping['source']]) ? check_plain($sources[$mapping['source']]) : check_plain($mapping['source']);
    

    Further in the code $source gets a second time through check_plain(). This causes text to be double escaped.

  3. If a hidden target is used, in the UI it will show up as "DEPRECATED". Wouldn't it be better then to call this property "deprecated" instead of "hidden"?
  4. The property should be documented in feeds.api.php.

In the attached patch I addressed points 1, 2 and 4 from above. If a hidden target is used, it will show up like this:

Image: URI (field_image) - DEPRECATED

We could debate about what to call the property ("hidden" or "deprecated"). Now it seems not to be consistent to have a target that is marked as hidden and when it used it is marked as deprecated.

twistor’s picture

StatusFileSize
new3.79 KB
new7.36 KB

My comment in #7 was supposed to say, "This should not delete the whole update hook, just make it a no-op."

I agree, deprecated makes more sense than hidden. I was just going off of other keys in other parts of the API.

  • MegaChriz committed 12bd52b on 7.x-2.x authored by twistor
    Issue #2542416 by twistor, MegaChriz: Allow sources and targets to be...
megachriz’s picture

Status: Needs review » Fixed

All looks good. Committed #9.

Status: Fixed » Closed (fixed)

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