From 93e39772ed2e68f724920638615ae93f35e150fe Mon Sep 17 00:00:00 2001 From: mattf Date: Thu, 12 Mar 2015 16:06:38 +0000 Subject: [PATCH] Added ExpectedDBSchema line to astguiclient.conf git-svn-id: svn://192.168.202.10@2299 3d104415-ff17-0410-8863-d5cf3c621b8a --- bin/ADMIN_update_server_ip.pl | 15 ++++++++------- install.pl | 29 ++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/bin/ADMIN_update_server_ip.pl b/bin/ADMIN_update_server_ip.pl index 893b38cb..69865e80 100644 --- a/bin/ADMIN_update_server_ip.pl +++ b/bin/ADMIN_update_server_ip.pl @@ -6,7 +6,7 @@ # astguiclient.conf file to reflect a change in IP address. The script will # automatically default to the first eth address in the ifconfig output. # -# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2015 Matt Florell LICENSE: AGPLv2 # # CHANGELOG # 71205-2144 - Added display of extensions.conf example for call routing @@ -14,7 +14,9 @@ # 90211-1247 - Added asterisk version # 90630-2256 - vicidial_process_triggers # 100428-0943 - Added DB custom user/pass fields +# 150312-1000 - Added ExpectedDBSchema # + # default path to astguiclient configuration file: $PATHconf = '/etc/astguiclient.conf'; @@ -202,6 +204,8 @@ if (-e "$PATHconf") {$VARfastagi_log_checkfordead = $line; $VARfastagi_log_checkfordead =~ s/.*=//gi;} if ( ($line =~ /^VARfastagi_log_checkforwait/) && ($CLIVARfastagi_log_checkforwait < 1) ) {$VARfastagi_log_checkforwait = $line; $VARfastagi_log_checkforwait =~ s/.*=//gi;} + if ($line =~ /^ExpectedDBSchema/) + {$ExpectedDBSchema = $line; $ExpectedDBSchema =~ s/.*=//gi;} $i++; } } @@ -378,6 +382,9 @@ print conf "VARfastagi_log_max_spare_servers => $VARfastagi_log_max_spare_server print conf "VARfastagi_log_max_requests => $VARfastagi_log_max_requests\n"; print conf "VARfastagi_log_checkfordead => $VARfastagi_log_checkfordead\n"; print conf "VARfastagi_log_checkforwait => $VARfastagi_log_checkforwait\n"; +print conf "\n"; +print conf "# Expected DB Schema version for this install\n"; +print conf "ExpectedDBSchema => $ExpectedDBSchema\n"; close(conf); @@ -476,11 +483,6 @@ if( $VARserver_ip =~ m/(\S+)\.(\S+)\.(\S+)\.(\S+)/ ) print "\n"; print "SERVER IP ADDRESS CHANGE FOR VICIDIAL FINISHED!\n"; print "\n"; -#print "If you are not having VICIDIAL auto-generate your conf files, please\n"; -#print "remember to change your extensions.conf entries for the new IP address:\n"; -#print "exten => _$VARremDIALstr*.,1,Goto(default,\${EXTEN:16},1)\n"; -#print "exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi)\n"; -#print "exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi)\n"; $secy = time(); $secz = ($secy - $secX); $minz = ($secz/60); # calculate script runtime so far @@ -497,4 +499,3 @@ sub leading_zero($) s/^(\d\d)$/0$1/; return $_; } # End of the leading_zero() routine. - diff --git a/install.pl b/install.pl index 2e5ee7a6..3b5148ee 100644 --- a/install.pl +++ b/install.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -# install.pl version 2.10 +# install.pl version 2.12 # # Copyright (C) 2015 Matt Florell LICENSE: AGPLv2 # @@ -37,6 +37,7 @@ # 140619-0958 - Added instructions for new ASTplay IAX loop trunk # 150115-0657 - Changes to save custom.css customizations, issue #816 # 150302-0706 - Removed path changes for non-English languages +# 150312-0942 - Added ExpectedDBSchema value in astguiclient.conf # ############################################ @@ -2353,6 +2354,29 @@ else } } +$ExpectedDBSchema='?'; +if (-e "./extras/MySQL_AST_CREATE_tables.sql") + { + print "Gathering expected DB Schema version...\n"; + open(DBcreate, "./extras/MySQL_AST_CREATE_tables.sql") || die "can't open ./extras/MySQL_AST_CREATE_tables.sql: $!\n"; + @DBcreate = ; + close(DBcreate); + $i=0; + foreach(@DBcreate) + { + $line = $DBcreate[$i]; + $line =~ s/>|\n|\r|\t|\#.*|;.*//gi; + if ($line =~ /^UPDATE system_settings SET db_schema_version/) + { + $ExpectedDBSchema = $line; + $ExpectedDBSchema =~ s/UPDATE system_settings SET db_schema_version\=\'//gi; + $ExpectedDBSchema =~ s/\'.*//gi; + print " Gathering expected DB Schema version found: |$ExpectedDBSchema|\n"; + } + $i++; + } + } + print "Writing to configuration file: $PATHconf\n"; open(conf, ">$PATHconf") || die "can't open $PATHconf: $!\n"; @@ -2422,6 +2446,9 @@ print conf "VARfastagi_log_max_spare_servers => $VARfastagi_log_max_spare_server print conf "VARfastagi_log_max_requests => $VARfastagi_log_max_requests\n"; print conf "VARfastagi_log_checkfordead => $VARfastagi_log_checkfordead\n"; print conf "VARfastagi_log_checkforwait => $VARfastagi_log_checkforwait\n"; +print conf "\n"; +print conf "# Expected DB Schema version for this install\n"; +print conf "ExpectedDBSchema => $ExpectedDBSchema\n"; close(conf);