diff --git a/bin/AST_update.pl b/bin/AST_update.pl index b7ea88cc..ef82fb89 100644 --- a/bin/AST_update.pl +++ b/bin/AST_update.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# AST_update.pl version 14 *DBI-version* +# AST_update.pl version 2.0.5 *DBI-version* # # DESCRIPTION: # uses the Asterisk Manager interface and Net::MySQL to update the live_channels @@ -30,7 +30,7 @@ # # It is recommended that you run this program on the local Asterisk machine # -# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# Copyright (C) 2008 Matt Florell LICENSE: GPLv2 # # version changes: # 41228-1659 - modified to compensate for manager output response hiccups @@ -55,9 +55,10 @@ # 60926-1601 - validate proper binutil locations for performance gathering # 61130-1008 - defaults show_channels_format to 1 for non 1.0 version Asterisk # 61227-1659 - added "core show channels concise" for Asterisk 1.4 compatibility +# 80111-1850 - fixed server_updater record missing bug # -$build = '61227-1659'; +$build = '80111-1850'; # constants $SYSPERF=0; # system performance logging to MySQL server_performance table every 5 seconds @@ -146,6 +147,7 @@ if (length($ARGV[0])>1) } if ($args =~ /--debugX/i) { + $DB=1; $DBX=1; print "\n----- SUPER-DUPER DEBUGGING -----\nBUILD: $build\n"; } @@ -269,6 +271,27 @@ $sthA->finish(); if ($AST_ver =~ /^1\.4/i) {$show_channels_format = 2;} print STDERR "SHOW CHANNELS format: $show_channels_format\n"; + +##### Check for a server_updater record, and if not present, insert one +$SUrec=0; +$stmtA = "SELECT count(*) FROM $server_updater where server_ip = '$server_ip';"; +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +@aryA = $sthA->fetchrow_array; +$SUrec = $aryA[0]; +$sthA->finish(); + if($DB){print STDERR "\n|$SUrec|$stmtA|\n";} + +if ($SUrec < 1) + { + &get_time_now; + + $stmtU = "INSERT INTO $server_updater set server_ip='$server_ip', last_update='$now_date';"; + if($DB){print STDERR "\n|$stmtU|\n";} + $affected_rows = $dbhA->do($stmtU); + } + + ##### LOOK FOR ZAP CLIENTS AS DEFINED IN THE phones TABLE SO THEY ARE NOT MISLABELED AS TRUNKS print STDERR "LOOKING FOR Zap clients assigned to this server:\n"; $Zap_client_count=0; diff --git a/extras/upgrade_2.0.5.sql b/extras/upgrade_2.0.5.sql index d7da4118..8ac9ba15 100644 --- a/extras/upgrade_2.0.5.sql +++ b/extras/upgrade_2.0.5.sql @@ -31,9 +31,6 @@ index (user), index (event_date) ); - - - ALTER TABLE vicidial_users ADD qc_enabled ENUM('1','0') default '0'; ALTER TABLE vicidial_users ADD qc_user_level INT(2) default '1'; ALTER TABLE vicidial_users ADD qc_pass ENUM('1','0') default '0'; @@ -42,3 +39,12 @@ ALTER TABLE vicidial_users ADD qc_commit ENUM('1','0') default '0'; ALTER TABLE vicidial_user_groups ADD qc_allowed_campaigns TEXT; ALTER TABLE vicidial_user_groups ADD qc_allowed_inbound_groups TEXT; + + + + + +ALTER TABLE system_settings ADD db_schema_version INT(8) UNSIGNED default '0'; + +UPDATE system_settings SET db_schema_version='1074', version='2.0.5b0.5'; + diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index 5b65df19..6f546376 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -1162,12 +1162,13 @@ $list_mix_container = ereg_replace(";","",$list_mix_container); # 71125-1751 - Added allowable transfer groups to campaign detail screen # 80107-1204 - Started framework for new QC section # 80112-0242 - Added more options for lead order +# 80211-1901 - Added DB Schema Version to system settings display # # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time $admin_version = '2.0.5-121'; -$build = '80112-0242'; +$build = '80211-1901'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -12194,7 +12195,7 @@ if ($ADD==311111111111111) echo "
\n"; echo ""; - $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log from system_settings;"; + $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version from system_settings;"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $version = $row[0]; @@ -12213,11 +12214,13 @@ if ($ADD==311111111111111) $allow_sipsak_messages = $row[13]; $admin_home_url = $row[14]; $enable_agc_xfer_log = $row[15]; + $db_schema_version = $row[16]; echo "
MODIFY VICIDIAL SYSTEM SETTINGS
\n"; echo "\n"; echo "
\n"; echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n";
Version: $version
DB Schema Version: $db_schema_version
Install Date: $install_date
Use Non-Latin: $NWB#settings-use_non_latin$NWE
Webroot Writable: $NWB#settings-webroot_writable$NWE