Skip to content

Commit

Permalink
Merge pull request #11700 from JMAConsulting/CRM-21787
Browse files Browse the repository at this point in the history
CRM-21787 : Simplify CRM_Utils_System::version() to fetch version directly from xml/version.xml
  • Loading branch information
totten authored Feb 21, 2018
2 parents 59a83d2 + e48985c commit 5ad79e0
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions CRM/Utils/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -1074,25 +1074,12 @@ public static function version() {

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
Expand Down

0 comments on commit 5ad79e0

Please sign in to comment.