[#15] Convert serialized settings from objects to arrays.
This commit is contained in:
parent
edebdd234d
commit
f2b94b72e7
2 changed files with 21 additions and 1 deletions
|
@ -363,6 +363,6 @@ class CRM_Twingle_Profile {
|
|||
foreach (self::$_profiles as $profile_name => $profile) {
|
||||
$profile_data[$profile_name] = $profile->data;
|
||||
}
|
||||
CRM_Core_BAO_Setting::setItem((object) $profile_data, 'de.systopia.twingle', 'twingle_profiles');
|
||||
CRM_Core_BAO_Setting::setItem($profile_data, 'de.systopia.twingle', 'twingle_profiles');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,4 +143,24 @@ class CRM_Twingle_Upgrader extends CRM_Twingle_Upgrader_Base {
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert serialized settings from objects to arrays.
|
||||
*
|
||||
* @link https://civicrm.org/advisory/civi-sa-2019-21-poi-saved-search-and-report-instance-apis
|
||||
*/
|
||||
public function upgrade_5011() {
|
||||
// Do not use CRM_Core_BAO::getItem() or Civi::settings()->get().
|
||||
// Extract and unserialize directly from the database.
|
||||
$twingle_profiles_query = CRM_Core_DAO::executeQuery("
|
||||
SELECT `value`
|
||||
FROM `civicrm_setting`
|
||||
WHERE `name` = 'twingle_profiles';");
|
||||
if ($twingle_profiles_query->fetch()) {
|
||||
$profiles = unserialize($twingle_profiles_query->value);
|
||||
Civi::settings()->set('twingle_profiles', (array) $profiles);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue