Merge pull request #1316 from mafoo/Bugfix-app/system

Updated switch version detection
This commit is contained in:
FusionPBX
2015-12-10 17:21:25 -08:00
3 changed files with 25 additions and 13 deletions

View File

@@ -100,15 +100,15 @@ $text['label-git_info']['sv-se'] = "";
$text['label-git_info']['uk'] = "";
$text['label-git_info']['de-at'] = "";
$text['label-switch_version']['en-us'] = "Switch Version";
$text['label-switch_version']['es-cl'] = "";
$text['label-switch_version']['pt-pt'] = "";
$text['label-switch_version']['fr-fr'] = "";
$text['label-switch_version']['pt-br'] = "";
$text['label-switch_version']['pl'] = "";
$text['label-switch_version']['sv-se'] = "";
$text['label-switch_version']['uk'] = "";
$text['label-switch_version']['de-at'] = "";
$text['label-switch']['en-us'] = "Switch";
$text['label-switch']['es-cl'] = "";
$text['label-switch']['pt-pt'] = "";
$text['label-switch']['fr-fr'] = "";
$text['label-switch']['pt-br'] = "";
$text['label-switch']['pl'] = "";
$text['label-switch']['sv-se'] = "";
$text['label-switch']['uk'] = "";
$text['label-switch']['de-at'] = "";
$text['label-git_branch']['en-us'] = "Branch:";
$text['label-git_branch']['es-cl'] = "";

View File

@@ -108,15 +108,25 @@ $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 "<tr>\n";
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
echo " ".$text['label-switch_version']."\n";
echo " ".$text['label-switch']." ".$text['label-version']."\n";
echo " </td>\n";
echo " <td class=\"row_style1\">$switch_version ($switch_bits)</td>\n";
echo "</tr>\n";
preg_match("/\(git\s*(.*?)\s*\d+\w+\s*\)/", $switch_version, $matches);
$switch_git_info = $matches[1];
if(strlen($switch_git_info) > 0){
echo "<tr>\n";
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
echo " ".$text['label-switch']." ".$text['label-git_info']."\n";
echo " </td>\n";
echo " <td class=\"row_style1\">$switch_git_info</td>\n";
echo "</tr>\n";
}
}
echo "<!--\n";

View File

@@ -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];