X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUpgrade%2FForm.php;h=9da28740a5abe5a65b50a24f09ff325282d26d38;hb=ee6fdeae05b7cc81fdf1abf3c8db64eb780a4c45;hp=5fb36b6475a885d4ec81aad298221ec6ea2a70f5;hpb=edc5f111a80d2c5f909b633f1675782e60b5dc16;p=civicrm-core.git diff --git a/CRM/Upgrade/Form.php b/CRM/Upgrade/Form.php index 5fb36b6475..9da28740a5 100644 --- a/CRM/Upgrade/Form.php +++ b/CRM/Upgrade/Form.php @@ -616,6 +616,7 @@ SET version = '$version' $messages = []; $manager = CRM_Extension_System::singleton()->getManager(); foreach ($manager->getStatuses() as $key => $status) { + $enableReplacement = CRM_Core_DAO::singleValueQuery('SELECT is_active FROM civicrm_extension WHERE full_name = %1', [1 => [$key, 'String']]); $obsolete = $manager->isIncompatible($key); if ($obsolete) { if (!empty($obsolete['disable']) && in_array($status, [$manager::STATUS_INSTALLED, $manager::STATUS_INSTALLED_MISSING])) { @@ -647,6 +648,15 @@ SET version = '$version' 1 => [$key, 'String'], ]); } + if (!empty($obsolete['replacement']) && $enableReplacement) { + try { + $manager->enable($manager->install($obsolete['replacement'])); + $messages[] = ts('A replacement extension %1 has been installed as you had the obsolete extension %2 installed', [1 => $obsolete['replacement'], 2 => $key]); + } + catch (CRM_Extension_Exception $e) { + $messages[] = ts('The replacement extension %1 could not be installed due to an error. It is recommended to enable this extension manually.', [1 => $obsolete['replacement']]); + } + } } } if ($messages) { @@ -755,8 +765,6 @@ SET version = '$version' $upgrade->setVersion($rev); CRM_Utils_System::flushCache(); - $config = CRM_Core_Config::singleton(); - $config->userSystem->flush(); return TRUE; } @@ -771,6 +779,9 @@ SET version = '$version' // Seems extraneous in context, but we'll preserve old behavior $upgrade->setVersion($latestVer); + $config = CRM_Core_Config::singleton(); + $config->userSystem->flush(); + CRM_Core_Invoke::rebuildMenuAndCaches(FALSE, TRUE); // NOTE: triggerRebuild is FALSE becaues it will run again in a moment (via fixSchemaDifferences).