When exporting the salesforce mapping entities using features, we see plenty of Salesforce properties exported that do not seem to be used anywhere by the module.
These data are also stored in the entity table and take a significant amount of space (especially the picklistValues when used).

Comments

sdelbosc created an issue. See original summary.

sdelbosc’s picture

aaronbauman’s picture

Status: Active » Needs work

To make this viable for review, please make sure it doesn't change existing behavior.
ie. what is useless to you may be in use by someone else.
You can't just throw out a huge chunk of data, since we have a stable release and many installs which might break.

Next, please change the variables named like "useful_sf_properties" to something more descriptive.

sdelbosc’s picture

On my current installation, getting rid of these had no impact.
Guaranteeing that it will not impact any site is another story and I think the maintainers of this module are better placed than me to evaluate the risk.

Regarding variable name, would 'salesforce_mapping_stored_sf_properties' be ok?

aaronbauman’s picture

Right, so I think by default the entire, mostly useless mapping should be stored - same as the current behavior.
Your patch should allow it to be overridden by some means.

For example, make the variable_get() return FALSE by default, and only apply the array intersection if the default has been overridden.

'salesforce_mapping_stored_sf_properties' seems more appropriate

Finally, I would suggest that you should apply some bare-minimum to any default, so that overrides do not break mappings altogether.
In other words, make sure that at least "name" is saved for all sf field properties.

sdelbosc’s picture

Thank you. I am fine with the suggested approach.
I will submit another patch later on.

sdelbosc’s picture

aaronbauman’s picture

Version: 7.x-3.1 » 7.x-3.x-dev
Status: Needs work » Needs review

This makes more sense to me.

bob.hinrichs’s picture

In case this is related: when put into a feature that is enabled on multiple sites, the 'created' date attribute of the mapping is stored in the feature, and ends up showing as an overridden value, putting the feature into an overridden state that cannot be fixed without hand-editing the feature.

However that date is different on every environment. Therefore that value should be removed from the exported attributes.

gcb’s picture

I've updated with a different approach. This adds a hook that allows anyone to restrict the list of properties if they desire, and otherwise leaves everything as normal.

gcb’s picture

Status: Needs review » Needs work
StatusFileSize
new3.74 KB

Should probably include properties the module uses by default. This could use some work: repetition of the force inclusions is sloppy, probably should do a true/false return on the hook about whether to override and just implement the hook without a return value from within the SF modules to dictate which properties they want to assert.

aaronbauman’s picture

Status: Needs work » Closed (won't fix)

7.x is no longer supported

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.