Merge pull request #1000 from pradpnayak/CRM-12799
[civicrm-core.git] / CRM / Upgrade / Form.php
index d14e918b4bc9917b7efdc08b556cca59d06efc30..7ec91adfbe580c1678cfa8b308957841cab1f71d 100644 (file)
@@ -389,12 +389,12 @@ SET    version = '$version'
 
     $phpVersion = phpversion();
     $minPhpVersion = '5.3.3';
-    if (version_compare($phpVersion, $minPhpVersion) <= 0) {
+    if (version_compare($phpVersion, $minPhpVersion) < 0) {
       $error = ts('CiviCRM %3 requires PHP version %1 (or newer), but the current system uses %2 ',
                array(
                  1 => $minPhpVersion,
                  2 => $phpVersion,
-                 3 => $latestVer,
+                 3 => $latestVer
                ));
     }
 
@@ -407,7 +407,7 @@ SET    version = '$version'
     if (CRM_Core_DAO::getGlobalSetting('thread_stack', 0) < (1024*self::MINIMUM_THREAD_STACK)) {
       $error = ts('CiviCRM %1 requires MySQL thread stack >= %2k', array(
         1 => $latestVer,
-        2 => self::MINIMUM_THREAD_STACK,
+        2 => self::MINIMUM_THREAD_STACK
       ));
     }
 
@@ -601,7 +601,10 @@ SET    version = '$version'
     $upgrade = new CRM_Upgrade_Form();
     $upgrade->setVersion($rev);
     CRM_Utils_System::flushCache();
-    
+
+    $config = CRM_Core_Config::singleton();
+    $config->userSystem->flush();
+
     if (version_compare($currentVer, '4.1.alpha1') >= 0) {
       CRM_Core_BAO_Setting::updateSettingsFromMetaData();
     }
@@ -614,9 +617,15 @@ SET    version = '$version'
     // Seems extraneous in context, but we'll preserve old behavior
     $upgrade->setVersion($latestVer);
 
+    // lets rebuild the config array in case we've made a few changes in the
+    // code base
+    // this also helps us always store the latest version of civi in the DB
+    $params = array();
+    CRM_Core_BAO_ConfigSetting::add($params);
+
     // cleanup caches CRM-8739
     $config = CRM_Core_Config::singleton();
-    $config->cleanupCaches(1, FALSE);
+    $config->cleanupCaches(1);
 
     // Rebuild all triggers and re-enable logging if needed
     $logging = new CRM_Logging_Schema();