From ebf8ee8558c6c36f0605b932a07cbc962097e140 Mon Sep 17 00:00:00 2001 From: mattf Date: Tue, 8 Mar 2011 18:09:44 +0000 Subject: [PATCH] Small fix for auto-list-resets on multi-server systems. git-svn-id: svn://192.168.202.10@1617 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl | 53 +++++++++++++----------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl b/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl index eedd9ee6..34e44143 100644 --- a/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl +++ b/agc_2-X/trunk/bin/ADMIN_keepalive_ALL.pl @@ -2510,38 +2510,41 @@ if ($sthBrows > 0) ################################################################################ ##### BEGIN reset lists ################################################################################ -$stmtA = "SELECT list_id FROM vicidial_lists where reset_time LIKE \"%$reset_test%\";"; -$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; -$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; -$sthBrows=$sthA->rows; -$i=0; -while ($sthBrows > $i) +if ($AST_VDadapt > 0) { - @aryA = $sthA->fetchrow_array; - $list_id[$i] = "$aryA[0]"; - $i++; - } -$sthA->finish(); + $stmtA = "SELECT list_id FROM vicidial_lists where reset_time LIKE \"%$reset_test%\";"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthBrows=$sthA->rows; + $i=0; + while ($sthBrows > $i) + { + @aryA = $sthA->fetchrow_array; + $list_id[$i] = "$aryA[0]"; + $i++; + } + $sthA->finish(); -if ($DBX) {print "RESET LIST: $i|$reset_test";} + if ($DBX) {print "RESET LIST: $i|$reset_test";} -$i=0; -while ($sthBrows > $i) - { - $stmtA="UPDATE vicidial_list set called_since_last_reset='N' where list_id='$list_id[$i]';"; - $affected_rows = $dbhA->do($stmtA); + $i=0; + while ($sthBrows > $i) + { + $stmtA="UPDATE vicidial_list set called_since_last_reset='N' where list_id='$list_id[$i]';"; + $affected_rows = $dbhA->do($stmtA); - $SQL_log = "$stmtA|"; - $SQL_log =~ s/;|\\|\'|\"//gi; + $SQL_log = "$stmtA|"; + $SQL_log =~ s/;|\\|\'|\"//gi; - if ($DB) {print "DONE\n";} - if ($DB) {print "$trigger_results\n";} + if ($DB) {print "DONE\n";} + if ($DB) {print "$trigger_results\n";} - $stmtA="INSERT INTO vicidial_admin_log set event_date='$now_date', user='VDAD', ip_address='1.1.1.1', event_section='LISTS', event_type='RESET', record_id='$list_id[$i]', event_code='ADMIN RESET LIST', event_sql=\"$SQL_log\", event_notes='$affected_rows leads reset';"; - $Iaffected_rows = $dbhA->do($stmtA); - if ($DB) {print "FINISHED: $affected_rows|$Iaffected_rows|$stmtA";} + $stmtA="INSERT INTO vicidial_admin_log set event_date='$now_date', user='VDAD', ip_address='1.1.1.1', event_section='LISTS', event_type='RESET', record_id='$list_id[$i]', event_code='ADMIN RESET LIST', event_sql=\"$SQL_log\", event_notes='$affected_rows leads reset';"; + $Iaffected_rows = $dbhA->do($stmtA); + if ($DB) {print "FINISHED: $affected_rows|$Iaffected_rows|$stmtA";} - $i++; + $i++; + } } ################################################################################ ##### END reset lists