Sfoglia il codice sorgente

moved assumed path management to detect_switch as *_vdir

Matthew Vale 9 anni fa
parent
commit
e02ad0e884

+ 11 - 0
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";

+ 32 - 9
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;

+ 11 - 5
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';

+ 19 - 4
core/install/resources/page_parts/install_event_socket.php

@@ -91,10 +91,10 @@
 		echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
 	
 		echo "<tr>\n";
-		echo "<td colspan='4' align='left' nowrap><b>".$text['title-detected_configuration']."</b><br><br></td>\n";
+		echo "<td colspan='4' align='left' nowrap><b>".$text['title-detected_configuration']."</b></td>\n";
 		echo "</tr>\n";
 
-		$id = 0;
+		$id = 1;
 		echo "<tr>\n";
 		echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap' width='15%'>\n";
 		echo "Switch version\n";
@@ -102,9 +102,8 @@
 		echo "<td class='vtable' width='35%' align='left'>\n";
 		echo "    ".$switch_detect->version()."\n";
 		echo "</td>\n";
-		echo "</tr>\n";
 		
-		foreach ($switch_detect->get_folders() as $folder)
+		foreach ($switch_detect->get_dirs() as $folder)
 		{
 			if($id % 2 == 0){ echo "<tr>\n"; }
 			echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap' width='15%'>\n";
@@ -117,6 +116,22 @@
 			$id++;
 		}
 		if($id % 2 == 1){ echo "</tr>\n"; }
+		echo "<tr>\n";
+		echo "<td colspan='4' align='left' nowrap><br/><b>".$text['title-assumed_configuration']."</b></td>\n";
+		echo "</tr>\n";
+		$id=0;
+		foreach ($switch_detect->get_vdirs() as $folder)
+		{
+			if($id % 2 == 0){ echo "<tr>\n"; }
+			echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap' width='15%'>\n";
+			echo $folder."\n";
+			echo "</td>\n";
+			echo "<td class='vtable' width='35%' align='left'>\n";
+			echo "    ".$switch_detect->$folder()."\n";
+			echo "</td>\n";
+			if($id % 2 == 1){ echo "</tr>\n"; }
+			$id++;
+		}
 			
 		echo "</table>";
 	}