From 45d9c2039d32d680af48095124555acafeb07754 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 10 Dec 2015 10:51:38 +0000 Subject: [PATCH] updated switch version detection will now work with both git and packaged version numbers added bits to detect_switch --- app/system/system.php | 2 +- core/install/resources/classes/detect_switch.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/system/system.php b/app/system/system.php index 9129f39707..60cea81bb0 100644 --- a/app/system/system.php +++ b/app/system/system.php @@ -108,7 +108,7 @@ $document['title'] = $text['title-sys-status']; $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); if ($fp) { $switch_version = event_socket_request($fp, 'api version'); - preg_match("/FreeSWITCH Version (\d+\.\d+\.\d+(?:\.\d+)?).*\(\s*(\d+\w+)\s*\)/", $switch_version, $matches); + preg_match("/FreeSWITCH Version (\d+\.\d+\.\d+(?:\.\d+)?).*\(.*?(\d+\w+)\s*\)/", $switch_version, $matches); $switch_version = $matches[1]; $switch_bits = $matches[2]; echo "\n"; diff --git a/core/install/resources/classes/detect_switch.php b/core/install/resources/classes/detect_switch.php index 4245d5bc61..92ab726465 100644 --- a/core/install/resources/classes/detect_switch.php +++ b/core/install/resources/classes/detect_switch.php @@ -40,10 +40,12 @@ require_once "resources/classes/EventSocket.php"; protected $_major; protected $_minor; protected $_build; + protected $_bits; public function major() { return $this->_major; } public function minor() { return $this->_minor; } public function build() { return $this->_build; } - public function version() { return $this->_major.".".$this->_minor.".".$this->_build; } + public function bits() { return $this->_bits; } + public function version() { return $this->_major.".".$this->_minor.".".$this->_build." (".$this->_bits.")"; } // dirs - detected by from the switch protected $_base_dir = ''; @@ -126,7 +128,7 @@ require_once "resources/classes/EventSocket.php"; throw new Exception('Failed to use event socket'); } $FS_Version = $this->event_socket_request('api version'); - preg_match("/FreeSWITCH Version (\d+)\.(\d+)\.(\d+(?:\.\d+)?)/", $FS_Version, $matches); + preg_match("/FreeSWITCH Version (\d+\.\d+\.\d+(?:\.\d+)?).*\(.*?(\d+\w+)\s*\)/", $FS_Version, $matches); $this->_major = $matches[1]; $this->_minor = $matches[2]; $this->_build = $matches[3];