CRM-21787: Keep up-to-date without running GenCode on all builds
[civicrm-core.git] / CRM / Utils / System.php
index b68356c0e587cb2bfc93d4decc6c25999080f91a..5d2e762622aea58e4684f28fa428def99fc12cde 100644 (file)
@@ -1074,25 +1074,12 @@ class CRM_Utils_System {
 
     if (!$version) {
       $verFile = implode(DIRECTORY_SEPARATOR,
-        array(dirname(__FILE__), '..', '..', 'civicrm-version.php')
+        array(dirname(__FILE__), '..', '..', 'xml', 'version.xml')
       );
       if (file_exists($verFile)) {
-        require_once $verFile;
-        if (function_exists('civicrmVersion')) {
-          $info = civicrmVersion();
-          $version = $info['version'];
-        }
-      }
-      else {
-        // svn installs don't have version.txt by default. In that case version.xml should help -
-        $verFile = implode(DIRECTORY_SEPARATOR,
-          array(dirname(__FILE__), '..', '..', 'xml', 'version.xml')
-        );
-        if (file_exists($verFile)) {
-          $str = file_get_contents($verFile);
-          $xmlObj = simplexml_load_string($str);
-          $version = (string) $xmlObj->version_no;
-        }
+        $str = file_get_contents($verFile);
+        $xmlObj = simplexml_load_string($str);
+        $version = (string) $xmlObj->version_no;
       }
 
       // pattern check
@@ -1404,6 +1391,14 @@ class CRM_Utils_System {
     // move things to CiviCRM cache as needed
     CRM_Core_Session::storeSessionObjects();
 
+    if (Civi\Core\Container::isContainerBooted()) {
+      Civi::dispatcher()->dispatch('civi.core.exit');
+    }
+
+    $userSystem = CRM_Core_Config::singleton()->userSystem;
+    if (is_callable(array($userSystem, 'onCiviExit'))) {
+      $userSystem->onCiviExit();
+    }
     exit($status);
   }