Actually I found a quick workaround. Civicrm includes the standard PEAR library DB which creates this conflict. See http://pear.php.net/package/DB. The Shopp code creates a DB class but it is noted as deprecated and simply extends the sDB class. From what I can tell, DB is not needed anywhere in the core code. Maybe it is needed in some of the add on modules? Anyway for the moment I commented out lines 715-728 in shopp/core/library/DB.php and it works. If the author could suggest a better fix I would be grateful. Thanks.
Plugin Author
chaoix
(@chaoix)
The DB class is defined to provide compatibility with older Shopp plugins, addons, and themes that haven’t been updated with sDB calls.
I haven’t found a civicrm WordPress plugin that meets your description in the plugins repo. Could you provide us with a link to the plugin page to download it?
We are already checking for a DB class before Shopp declares its DB class however, so I am not sure what more we could do to resolve the conflict.
See this page.
I agree with you. Sounds like Civicrm is being loaded last, and doesn’t check. But if Civicrm did check, it would just fail because it can’t run without the Pear library. I guess that this is what php namespaces are for.
Plugin Contributor
Barry
(@barryhughes-1)
Perhaps Shopp’s definition of the DB class could be moved into core/library/Deprecated.php, allowing this sort of problem to be resolved by turning off the backwards compatibility layer, ie:
define( 'SHOPP_DEPRECATED_CLASSES', false );
Right now of course DB is defined outside of that file so this approach won’t work (and perhaps there’s a reason for that I’m forgetting/missing)? In any case, might be worth posting on the issue tracker so this can be considered.
Plugin Author
chaoix
(@chaoix)
@twowheeler: The actual Database class was renamespaced to sDB to avoid these types of issues in 1.3. The DB class your are having issues with is the depreciated class bridge for older Shopp addons that haven’t been updated with sDB references.
For Shopp 1.3 compatibility with CivicCRM, you have two choices.
1. Ensure CivicCRM is loaded first. WordPress plugins are loaded in order by folder name. You could change the name of the CivicCRM plugin folder to start with an A or something and see if this resolves your issue.
2. Remove the “class DB” stuff from shopp/core/library/DB.php to ensure the DB class is never defined. The only downside of this solution is you’ll need to do testing of any Shopp addons you are using to ensure they still work.
For Shopp 1.4, I put a feature request into our Github issue tracker to add a ‘SHOPP_DEPRECATED_CLASSES’ directive.
https://github.com/ingenesis/shopp/issues/3317