Add upgrade function for message templates that does not involve copying the whole...
[civicrm-core.git] / CRM / Upgrade / Form.php
index e2246c0e04e2fbe76d47e56ae0ab8061f5fd63c1..7a6ad203c86f2612406d8de654b4f2a440b3ee4a 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                                |
+ | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
@@ -45,7 +45,7 @@ class CRM_Upgrade_Form extends CRM_Core_Form {
   /**
    * Minimum previous CiviCRM version we can directly upgrade from
    */
-  const MINIMUM_UPGRADABLE_VERSION = '4.0.8';
+  const MINIMUM_UPGRADABLE_VERSION = '4.1.3';
 
   /**
    * Minimum php version required to run (equal to or lower than the minimum install version)
@@ -336,9 +336,6 @@ SET    version = '$version'
     $sqlFilePattern = '/^((\d{1,2}\.\d{1,2})\.(\d{1,2}\.)?(\d{1,2}|\w{4,7}))\.(my)?sql(\.tpl)?$/i';
     foreach ($sqlFiles as $file) {
       if (preg_match($sqlFilePattern, $file, $matches)) {
-        if ($matches[2] == '4.0') {
-          CRM_Core_Error::fatal("4.0.x upgrade files shouldn't exist. Contact Lobo to discuss this. This is related to the issue CRM-7731.");
-        }
         if (!in_array($matches[1], $revList)) {
           $revList[] = $matches[1];
         }
@@ -533,12 +530,6 @@ SET    version = '$version'
   public static function buildQueue($currentVer, $latestVer, $postUpgradeMessageFile) {
     $upgrade = new CRM_Upgrade_Form();
 
-    // hack to make 4.0.x (D7,J1.6) codebase go through 3.4.x (d6, J1.5) upgrade files,
-    // since schema wise they are same
-    if (CRM_Upgrade_Form::getRevisionPart($currentVer) == '4.0') {
-      $currentVer = str_replace('4.0.', '3.4.', $currentVer);
-    }
-
     // Ensure that queue can be created
     if (!CRM_Queue_BAO_QueueItem::findCreateTable()) {
       CRM_Core_Error::fatal(ts('Failed to find or create queueing table'));
@@ -747,6 +738,9 @@ SET    version = '$version'
     $config = CRM_Core_Config::singleton();
     $config->cleanupCaches(1);
 
+    $versionCheck = new CRM_Utils_VersionCheck();
+    $versionCheck->flushCache();
+
     // Rebuild all triggers and re-enable logging if needed
     $logging = new CRM_Logging_Schema();
     $logging->fixSchemaDifferences();
@@ -775,6 +769,7 @@ SET    version = '$version'
     foreach ($revisions as $rev) {
       if (version_compare($currentVer, $rev) < 0) {
         $versionObject = $this->incrementalPhpObject($rev);
+        CRM_Upgrade_Incremental_General::updateMessageTemplate($preUpgradeMessage, $rev);
         if (is_callable(array($versionObject, 'setPreUpgradeMessage'))) {
           $versionObject->setPreUpgradeMessage($preUpgradeMessage, $rev, $currentVer);
         }