Closed (duplicate)
Project:
Apache Solr Search
Version:
7.x-1.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
3 Jul 2012 at 19:58 UTC
Updated:
18 Jun 2014 at 15:26 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
ruedu commentedI also get this error in the web admin when trying to revert the feature
Notice: Trying to get property of non-object in ctools_component_features_revert() (line 211 of /Users//Sites//public_html/sites/all/modules/contrib/features/includes/features.ctools.inc).
Comment #2
alanmackenzie commentedctools_export_crud_load() called by ctools_component_features_revert() expects the callback supplied by the apachesolr module (apachesolr_environment_load(), see apachesolr.install line 110) to return a ctools object, instead it currently returns an array.
However tools_export_crud_load() will default to fetching a ctools object itself if no callback exists, so the fix is to remove the callback to apachesolr's broken function.
Attached (2 line :)) patch does this, you'll need to clear your cache after applying the patch before it will take effect.
The reader should note that the option of which solr environment configuration is the default is controlled by the persistent variable 'apachesolr_default_environment' and isn't included in the ctools export, though it could be with a little more work. I'll leave the decision of whether this is a bug or not up to the committers but if it is then I'm happy to fix it.
For clarity:
Comment #3
pwolanin commentedIs that going to work? It might be missing the 'conf' information that is joined in from a separate table.
Comment #4
scor commentedhaven't had enough time to dive into the code causing this issue, but just want to report at least that this patch solved the issue for me: as soon as I applied it and cleared the caches, I was finally able to revert the apachesolr_environment component, which would not revert before.
Comment #5
nick_vhI think we can assume the issue reporter is correct. Since we don't support the load all and load multiple callback, we should probably also not code our own load single callback if it does not return the proper respons.
The normal export function is defined correctly as "function apachesolr_ctools_environment_export($environment, $indent) {"
I'm going ahead and commit this patch and let this bake a bit. If this is problematic, we can easily add it back
Comment #6
nick_vhcommitted to D7
Comment #7
killua99 commentedPorted
Comment #8
nick_vhyou have a newline problem in the patch :)
Comment #9
killua99 commentedThe original file don't have a empty line. My IDE add this new line at EOF can this be the problem?
Comment #10
scor commented@Nick_vh his patch is actually fixing a problem in the current version of apachesolr.install! The red newline would be at the very bottom of the patch if it was a problem with the patch.
Comment #11
nick_vhah, good to know :)
I'll do another commit spree for 6.x-3.x very soonish
Comment #12
killua99 commentedGood to ear that :)
Comment #13
nick_vhCommitted! Thanks all that helped!
Comment #14
nick_vhComment #16
Nick Robillard commentedI'm honestly a bit confused by this thread. In 7.x-1.6 (as well as 7.x-1.6+3-dev), I've observed feature reverting/importing NOT restoring any settings inside $environment->conf. (apachesolr_search_sticky_boost, apachesolr_search_promote_boost, apachesolr_search_date_boost, apachesolr_search_comment_boost, apachesolr_search_changed_boost, apachesolr_search_type_boosts, field_bias)I've found that adding a "load callback" to the ctools export block and doing an apachesolr_environment_variable_set() on each of the $environment->conf values fixes this. I've attached a patch against 7.x-1.6+3-dev. This patch makes feature reverting work as expected.Ok scratch that. Ignore this patch. Using the "load callback" still didn't address the problem of feature reverting never reverting settings inside "conf". And I found that the variable sets were not needed there at all.
I've simplified my approach by adding back hook_features_revert() and inside that, deleting the environment manually, so that "conf" gets reverted. Patch below.
Comment #17
Nick Robillard commentedThis patch solves the problem where conf settings are never reverted via Features revert. I've added back hook_features_revert (same one that was there before) that deletes the environment. This may be a bit brute force and I suspect there is be a better way to handle this. But this seems to do the job.
Comment #18
nick_vhForgive me if I'm wrong but I think #1439564: Index bundles Export/Import and #1984502: Don't include time dependent configuration and state in ctools exports already tackle this. I'm closing this until you can show me why this is needed on top of those two patches.
Thanks for your contribution. It's very much appreciated and I hope you continue to contribute to our issue queue. We can use all the help we can get.