From 21d7b28a9a4ba14abf2daa71e424da39f28766e8 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Mon, 30 Nov 2015 15:23:42 +0000 Subject: [PATCH] moved assumed path management to detect_switch as *_vdir --- core/install/app_languages.php | 11 +++++ .../resources/classes/detect_switch.php | 41 +++++++++++++++---- .../resources/classes/install_fusionpbx.php | 16 +++++--- .../page_parts/install_event_socket.php | 23 +++++++++-- 4 files changed, 73 insertions(+), 18 deletions(-) diff --git a/core/install/app_languages.php b/core/install/app_languages.php index 7dcfb2145f..22ead46f1e 100644 --- a/core/install/app_languages.php +++ b/core/install/app_languages.php @@ -22,6 +22,17 @@ $text['title-detected_configuration']['uk'] = ""; $text['title-detected_configuration']['de-at'] = ""; $text['title-detected_configuration']['ar-eg'] = ""; +$text['title-assumed_configuration']['en-us'] = "Assumed Configuration"; +$text['title-assumed_configuration']['es-cl'] = ""; +$text['title-assumed_configuration']['pt-pt'] = ""; +$text['title-assumed_configuration']['fr-fr'] = ""; +$text['title-assumed_configuration']['pt-br'] = ""; +$text['title-assumed_configuration']['pl'] = ""; +$text['title-assumed_configuration']['sv-se'] = ""; +$text['title-assumed_configuration']['uk'] = ""; +$text['title-assumed_configuration']['de-at'] = ""; +$text['title-assumed_configuration']['ar-eg'] = ""; + $text['message-update']['en-us'] = "Update Completed"; $text['message-update']['es-cl'] = "Actualización Completada"; $text['message-update']['pt-pt'] = "Actualização Efectuada"; diff --git a/core/install/resources/classes/detect_switch.php b/core/install/resources/classes/detect_switch.php index 77a552aab9..a0c26c4d3c 100644 --- a/core/install/resources/classes/detect_switch.php +++ b/core/install/resources/classes/detect_switch.php @@ -36,7 +36,7 @@ require_once "resources/classes/EventSocket.php"; protected $_major; protected $_minor; - // folders + // dirs - detected by from the switch protected $_base_dir = ''; protected $_cache_dir = ''; protected $_certs_dir = ''; @@ -54,7 +54,7 @@ require_once "resources/classes/EventSocket.php"; protected $_sounds_dir = ''; protected $_storage_dir = ''; protected $_temp_dir = ''; - + public function major() { return $this->_major; } public function minor() { return $this->_minor; } public function version() { return $this->_major.".".$this->_minor; } @@ -75,7 +75,23 @@ require_once "resources/classes/EventSocket.php"; public function sounds_dir() { return $this->_sounds_dir; } public function storage_dir() { return $this->_storage_dir; } public function temp_dir() { return $this->_temp_dir; } - public function get_folders() { return $this->_folders; } + public function get_dirs() { return $this->_dirs; } + public function get_vdirs() { return $this->_vdirs; } + + // virtual dirs - assumed based on the detected dirs + protected $_voicemail_vdir = ''; + protected $_phrases_vdir = ''; + protected $_extensions_vdir = ''; + protected $_sip_profiles_vdir = ''; + protected $_dialplan_vdir = ''; + protected $_backup_vdir = ''; + + public function voicemail_vdir() { return $this->_voicemail_vdir; } + public function phrases_vdir() { return $this->_phrases_vdir; } + public function extensions_vdir() { return $this->_extensions_vdir; } + public function sip_profiles_vdir() { return $this->_sip_profiles_vdir; } + public function dialplan_vdir() { return $this->_dialplan_vdir; } + public function backup_vdir() { return $this->_backup_vdir; } // event socket public $event_host = 'localhost'; @@ -91,14 +107,16 @@ require_once "resources/classes/EventSocket.php"; if(!$this->event_socket){ $this->detect_event_socket(); } - $this->_folders = preg_grep ('/.*_dir$/', get_class_methods('detect_switch') ); - sort( $this->_folders ); + $this->_dirs = preg_grep ('/.*_dir$/', get_class_methods('detect_switch') ); + sort( $this->_dirs ); + $this->_vdirs = preg_grep ('/.*_vdir$/', get_class_methods('detect_switch') ); + sort( $this->_vdirs ); } - + protected function detect_event_socket() { //perform searches for user's config here } - + public function detect() { $this->connect_event_socket(); if(!$this->event_socket){ @@ -116,8 +134,13 @@ require_once "resources/classes/EventSocket.php"; $this->$field = $matches[2]; } } - } - + $this->_voicemail_vdir = join( DIRECTORY_SEPARATOR, array($this->_storage_dir, "voicemail")); + $this->_phrases_vdir = join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "lang")); + $this->_extensions_vdir = join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "directory")); + $this->_sip_profiles_vdir = join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "sip_profiles")); + $this->_dialplan_vdir = join( DIRECTORY_SEPARATOR, array($this->_conf_dir, "dialplan")); + $this->_backup_vdir = sys_get_temp_dir(); + } protected function connect_event_socket(){ $esl = new EventSocket; diff --git a/core/install/resources/classes/install_fusionpbx.php b/core/install/resources/classes/install_fusionpbx.php index 6d62060939..b7482fe592 100644 --- a/core/install/resources/classes/install_fusionpbx.php +++ b/core/install/resources/classes/install_fusionpbx.php @@ -637,7 +637,7 @@ include "root.php"; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = join( DIRECTORY_SEPARATOR, $this->detect_switch->storage_dir(), 'voicemail'); + $tmp[$x]['value'] = $this->detect_switch->voicemail_vdir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'voicemail'; $tmp[$x]['enabled'] = 'true'; @@ -655,25 +655,31 @@ include "root.php"; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; + $tmp[$x]['value'] = $this->detect_switch->phrases_vdir(); + $tmp[$x]['category'] = 'switch'; + $tmp[$x]['subcategory'] = 'phrases'; + $tmp[$x]['enabled'] = 'true'; + $x++; + $tmp[$x]['name'] = 'dir'; $tmp[$x]['value'] = ''; $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'provision'; $tmp[$x]['enabled'] = 'false'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = join( DIRECTORY_SEPARATOR, $this->detect_switch->conf_dir(), "/directory"); + $tmp[$x]['value'] = $this->detect_switch->extensions_vdir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'extensions'; $tmp[$x]['enabled'] = 'false'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = join( DIRECTORY_SEPARATOR, $this->detect_switch->conf_dir(), "/sip_profiles"); + $tmp[$x]['value'] = $this->detect_switch->sip_profiles_vdir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'sip_profiles'; $tmp[$x]['enabled'] = 'false'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = join( DIRECTORY_SEPARATOR, $this->detect_switch->conf_dir(), "/dialplan"); + $tmp[$x]['value'] = $this->detect_switch->dialplan_vdir(); $tmp[$x]['category'] = 'switch'; $tmp[$x]['subcategory'] = 'dialplan'; $tmp[$x]['enabled'] = 'false'; @@ -694,7 +700,7 @@ include "root.php"; $tmp[$x]['enabled'] = 'true'; $x++; $tmp[$x]['name'] = 'dir'; - $tmp[$x]['value'] = sys_get_temp_dir(); + $tmp[$x]['value'] = $this->detect_switch->backup_vdir(); $tmp[$x]['category'] = 'server'; $tmp[$x]['subcategory'] = 'backup'; $tmp[$x]['enabled'] = 'true'; diff --git a/core/install/resources/page_parts/install_event_socket.php b/core/install/resources/page_parts/install_event_socket.php index 7122925b4d..928c6e5424 100644 --- a/core/install/resources/page_parts/install_event_socket.php +++ b/core/install/resources/page_parts/install_event_socket.php @@ -91,10 +91,10 @@ echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; - $id = 0; + $id = 1; echo "\n"; echo "\n"; - echo "\n"; - foreach ($switch_detect->get_folders() as $folder) + foreach ($switch_detect->get_dirs() as $folder) { if($id % 2 == 0){ echo "\n"; } echo "\n"; } + echo "\n"; + echo "\n"; + echo "\n"; + $id=0; + foreach ($switch_detect->get_vdirs() as $folder) + { + if($id % 2 == 0){ echo "\n"; } + echo "\n"; + echo "\n"; + if($id % 2 == 1){ echo "\n"; } + $id++; + } echo "
".$text['title-detected_configuration']."

".$text['title-detected_configuration']."
\n"; echo "Switch version\n"; @@ -102,9 +102,8 @@ echo "\n"; echo " ".$switch_detect->version()."\n"; echo "
\n"; @@ -117,6 +116,22 @@ $id++; } if($id % 2 == 1){ echo "

".$text['title-assumed_configuration']."
\n"; + echo $folder."\n"; + echo "\n"; + echo " ".$switch_detect->$folder()."\n"; + echo "
"; }