Unverified Commit 6a0b4a58 authored by eileen's avatar eileen 🎱 Committed by GitHub

Merge pull request #11423 from totten/master-onchange

CRM-21568 - Move emptiness judgments from SettingsBag::setDb to InnoDBIndexer
parents d94349dc 38e5457e
......@@ -91,6 +91,10 @@ class CRM_Core_InnoDBIndexer {
* Specification of the setting (per *.settings.php).
*/
public static function onToggleFts($oldValue, $newValue, $metadata) {
if (empty($oldValue) && empty($newValue)) {
return;
}
$indexer = CRM_Core_InnoDBIndexer::singleton();
$indexer->setActive($newValue);
$indexer->fixSchemaDifferences();
......
......@@ -352,9 +352,11 @@ class SettingsBag {
}
$dao->find(TRUE);
// string comparison with 0 always return true, so to be ensure the type use ===
// ref - https://stackoverflow.com/questions/8671942/php-string-comparasion-to-0-integer-returns-true
if (isset($metadata['on_change']) && !($value === 0 && ($dao->value === NULL || unserialize($dao->value) == 0))) {
// Call 'on_change' listeners. It would be nice to only fire when there's
// a genuine change in the data. However, PHP developers have mixed
// expectations about whether 0, '0', '', NULL, and FALSE represent the same
// value, so there's no universal way to determine if a change is genuine.
if (isset($metadata['on_change'])) {
foreach ($metadata['on_change'] as $callback) {
call_user_func(
\Civi\Core\Resolver::singleton()->get($callback),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment