Skip to content
Snippets Groups Projects
Tim Otten's avatar
extensions/dataprocessor#101 - Do not activate custom-search classes on all page-views
totten authored
_Overview_: Civi 5.41 began migrating the "custom search" layer to an extension
(`legacycustomsearches`).  `dataprocessor` uses the "custom search" layer in a way that
provokes a hard/ubiquitous error during upgrade.  This revision makes it more robust
against upgrade errors.

_Before_: `hook_config` unconditionally (*on all page-views*) loads
`CRM_DataprocessorSearch_Form_Search_Custom_DataprocessorSmartGroupIntegration` and calls
`redirectCustomSearchToDataProcessorSearch()`.

_After_: `hook_config` only calls `CRM_DataprocessorSearch_Form_Search_Custom_DataprocessorSmartGroupIntegration`
if it's needed.

_Comments_:

* The error arises from when autoloading the base-class `CRM_Contact_Form_Search_Custom_Base`. This class
  exists, but it won't be available until the upgrade is complete.
* Strictly speaking, the two conditionals (on `$currentUrl` and `ssID`) are sufficient. I threw in a
  third conditional (`class_exists()`) as an extra bit of paranoia.
* I did a light `r-run` to ensure that the upgrade process works with the patch. However, I did not
  test the redirect.
* We're planning to include a short-term work-around in 5.41.1. However, this work-around will go away
  soon (eg 5.42 or 5.43).
0736926a
History