Added flush for cid_channels_recent table
git-svn-id: svn://192.168.202.10@2890 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
# !!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!
|
||||
# THIS SCRIPT SHOULD ONLY BE RUN ON ONE SERVER ON YOUR CLUSTER
|
||||
#
|
||||
# Copyright (C) 2016 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2018 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGES
|
||||
# 60717-1214 - changed to DBI by Marin Blu
|
||||
@@ -22,6 +22,7 @@
|
||||
# 150710-0907 - Added flush of vicidial_dtmf_log table
|
||||
# 160101-1124 - Added flush of routing_initiated_recordings table
|
||||
# 161214-1039 - Added flush of parked_channels_recent table
|
||||
# 180112-0915 - Added flush for cid_channels_recent table
|
||||
#
|
||||
|
||||
### begin parsing run-time options ###
|
||||
@@ -101,6 +102,17 @@ if ($min < 10) {$min = "0$min";}
|
||||
if ($sec < 10) {$sec = "0$sec";}
|
||||
$SQLdate_NOW="$year-$mon-$mday $hour:$min:$sec";
|
||||
|
||||
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time() - 121);
|
||||
$year = ($year + 1900);
|
||||
$yy = $year; $yy =~ s/^..//gi;
|
||||
$mon++;
|
||||
if ($mon < 10) {$mon = "0$mon";}
|
||||
if ($mday < 10) {$mday = "0$mday";}
|
||||
if ($hour < 10) {$hour = "0$hour";}
|
||||
if ($min < 10) {$min = "0$min";}
|
||||
if ($sec < 10) {$sec = "0$sec";}
|
||||
$SQLdate_NEG_2min="$year-$mon-$mday $hour:$min:$sec";
|
||||
|
||||
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time() - $purge_seconds);
|
||||
$year = ($year + 1900);
|
||||
$yy = $year; $yy =~ s/^..//gi;
|
||||
@@ -215,6 +227,11 @@ if($DB){print STDERR "\n|$stmtA|\n";}
|
||||
if (!$T) { $affected_rows = $dbhA->do($stmtA);}
|
||||
if (!$Q) {print " - parked_channels_recent flush: $affected_rows rows\n";}
|
||||
|
||||
$stmtA = "DELETE from cid_channels_recent where call_date < '$SQLdate_NEG_2min';";
|
||||
if($DB){print STDERR "\n|$stmtA|\n";}
|
||||
if (!$T) { $affected_rows = $dbhA->do($stmtA);}
|
||||
if (!$Q) {print " - cid_channels_recent flush: $affected_rows rows\n";}
|
||||
|
||||
$stmtA = "OPTIMIZE table vicidial_manager;";
|
||||
if($DB){print STDERR "\n|$stmtA|\n";}
|
||||
if (!$T)
|
||||
@@ -271,6 +288,20 @@ if (!$T)
|
||||
if (!$Q) {print " - OPTIMIZE parked_channels_recent \n";}
|
||||
|
||||
|
||||
$stmtA = "OPTIMIZE table cid_channels_recent;";
|
||||
if($DB){print STDERR "\n|$stmtA|\n";}
|
||||
if (!$T)
|
||||
{
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";}
|
||||
$sthA->finish();
|
||||
}
|
||||
if (!$Q) {print " - OPTIMIZE cid_channels_recent \n";}
|
||||
|
||||
|
||||
$stmtA = "OPTIMIZE table vicidial_live_agents;";
|
||||
if($DB){print STDERR "\n|$stmtA|\n";}
|
||||
if (!$T)
|
||||
@@ -332,4 +363,3 @@ $dbhA->disconnect();
|
||||
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
@@ -3837,6 +3837,18 @@ index(phone_number),
|
||||
index(scrub_date)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
CREATE TABLE vicidial_process_log (
|
||||
serial_id VARCHAR(20) NOT NULL,
|
||||
run_time DATETIME,
|
||||
run_sec INT,
|
||||
server_ip VARCHAR(15) NOT NULL,
|
||||
script VARCHAR(100),
|
||||
process VARCHAR(100),
|
||||
output_lines MEDIUMTEXT,
|
||||
index (serial_id),
|
||||
index (run_time)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
|
||||
ALTER TABLE vicidial_email_list MODIFY message text character set utf8;
|
||||
|
||||
@@ -4118,4 +4130,4 @@ INSERT INTO vicidial_settings_containers(container_id,container_notes,container_
|
||||
|
||||
UPDATE system_settings set vdc_agent_api_active='1';
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1531',db_schema_update_date=NOW(),reload_timestamp=NOW();
|
||||
UPDATE system_settings SET db_schema_version='1532',db_schema_update_date=NOW(),reload_timestamp=NOW();
|
||||
|
||||
@@ -476,3 +476,19 @@ UPDATE system_settings SET db_schema_version='1530',db_schema_update_date=NOW()
|
||||
ALTER TABLE system_settings ADD anyone_callback_inactive_lists ENUM('default','NO_ADD_TO_HOPPER','KEEP_IN_HOPPER') default 'default';
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1531',db_schema_update_date=NOW() where db_schema_version < 1531;
|
||||
|
||||
CREATE TABLE vicidial_process_log (
|
||||
serial_id VARCHAR(20) NOT NULL,
|
||||
run_time DATETIME,
|
||||
run_sec INT,
|
||||
server_ip VARCHAR(15) NOT NULL,
|
||||
script VARCHAR(100),
|
||||
process VARCHAR(100),
|
||||
output_lines MEDIUMTEXT,
|
||||
index (serial_id),
|
||||
index (run_time)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
DELETE from cid_channels_recent;
|
||||
|
||||
UPDATE system_settings SET db_schema_version='1532',db_schema_update_date=NOW() where db_schema_version < 1532;
|
||||
|
||||
Reference in New Issue
Block a user