Skip to content

Commit

Permalink
Fix caching on managed entities singleton
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Sep 12, 2021
1 parent d3a40cf commit 7e1f8a2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions CRM/Core/ManagedEntities.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,10 @@ public static function getCleanupOptions() {
* @return \CRM_Core_ManagedEntities
*/
public static function singleton($fresh = FALSE) {
static $singleton;
if ($fresh || !$singleton) {
$singleton = new CRM_Core_ManagedEntities(CRM_Core_Module::getAll());
if ($fresh || !isset(Civi::$statics[__CLASS__ . 'singleton'])) {
Civi::$statics[__CLASS__ . 'singleton'] = new CRM_Core_ManagedEntities(CRM_Core_Module::getAll());
}
return $singleton;
return Civi::$statics[__CLASS__ . 'singleton'];
}

/**
Expand Down

0 comments on commit 7e1f8a2

Please sign in to comment.