CRM/Utils/System.php - Don't go through civicrm-version.php
authorTim Otten <totten@civicrm.org>
Fri, 11 May 2018 01:59:08 +0000 (18:59 -0700)
committerTim Otten <totten@civicrm.org>
Fri, 11 May 2018 02:01:27 +0000 (19:01 -0700)
In a typical environment, this is just an unnecessary file-load, and it
makes it harder to (someday) remove/deprecate `civicrm-version.php`.

CRM/Utils/System.php

index 394dde66392b3f2ca956fb60eb1f092e8abe017d..e2d72f5303244d9eb8c031c82696994bedd3f47f 100644 (file)
@@ -1081,9 +1081,14 @@ class CRM_Utils_System {
     static $version;
 
     if (!$version) {
-      $verFile = implode(DIRECTORY_SEPARATOR, [dirname(__FILE__), '..', '..', 'civicrm-version.php']);
-      require_once $verFile;
-      $version = \Civi\Version::findVersion();
+      $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;
+      }
 
       // pattern check
       if (!CRM_Utils_System::isVersionFormatValid($version)) {