diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index 63f30b72..0554488f 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -125,9 +125,9 @@ $PHP_SELF = preg_replace('/\.php.*/i','.php',$PHP_SELF); $QUERY_STRING = getenv("QUERY_STRING"); $groups=array(); -$Vreports = 'NONE, Real-Time Main Report, Real-Time Campaign Summary, Real-Time Whiteboard Report, VERM Reports, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound DID Detail Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Callmenu Survey Report, Outbound Lead Source Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Inbound Status Summary, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Carrier Log Report, Campaign Debug, Shared Debug, Asterisk Debug, Hangup Cause Report, Lists Pass Report, Called Counts List IDs Report, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report, AMD Log Report, 3-Way Press Log Report, SIP Event Report, Caller ID Log Report, Quality Control Report, Settings Compare, Phone Stats, Hopper List Report, In-Group User List, Webserver-URL Report, VDAD Debug Log Report, URL Log Report, Medialog Inventory Report, Asterisk Debug, SPH Report, Shared Debug, Process Report, Group Alias Report, Hangup Cause Report, IVR Filter Report, LAGGED Agent Log Report, LAGGED Agent Log Summary Report, Agent Latency Report, Latency Gaps Report, Agent Disposition Report, Agent Performance Report, Carrier Log Report, Dial Log Report, Inbound Extension Stats, Agents Time On Calls, Callbacks Export, User Logins Report, Demographic Quotas Report'; +$Vreports = 'NONE, Real-Time Main Report, Real-Time Campaign Summary, Real-Time Whiteboard Report, VERM Reports, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound DID Detail Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Callmenu Survey Report, Outbound Lead Source Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Inbound Status Summary, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Carrier Log Report, Campaign Debug, Shared Debug, Asterisk Debug, Hangup Cause Report, Lists Pass Report, Called Counts List IDs Report, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report, AMD Log Report, 3-Way Press Log Report, SIP Event Report, Caller ID Log Report, Quality Control Report, Settings Compare, Phone Stats, Hopper List Report, In-Group User List, Webserver-URL Report, VDAD Debug Log Report, URL Log Report, Medialog Inventory Report, Asterisk Debug, SPH Report, Shared Debug, Process Report, Group Alias Report, Hangup Cause Report, IVR Filter Report, LAGGED Agent Log Report, LAGGED Agent Log Summary Report, Agent Latency Report, Latency Gaps Report, Agent Disposition Report, Agent Performance Report, Carrier Log Report, Dial Log Report, Inbound Extension Stats, Agents Time On Calls, Callbacks Export, User Logins Report, Demographic Quotas Report, DB Schema Compare Utility'; -$UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summary, Real-Time Whiteboard Report, VERM Reports, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound DID Detail Report, Inbound Email Report, Inbound Chat Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Callmenu Survey Report, Outbound Lead Source Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Inbound Status Summary, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Custom Reports Links, CallCard Search, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Lists Pass Report, Called Counts List IDs Report, Front Page System Summary, Report Page Servers Summary, Admin Utilities Page, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report, AMD Log Report, 3-Way Press Log Report, SIP Event Report, Caller ID Log Report, Quality Control Report, Settings Compare, Phone Stats, Hopper List Report, In-Group User List, Webserver-URL Report, VDAD Debug Log Report, URL Log Report, Medialog Inventory Report, Asterisk Debug, SPH Report, Shared Debug, Process Report, Group Alias Report, Hangup Cause Report, IVR Filter Report, LAGGED Agent Log Report, LAGGED Agent Log Summary Report, Agent Latency Report, Latency Gaps Report, Agent Disposition Report, Agent Performance Report, Carrier Log Report, Dial Log Report, Inbound Extension Stats, Agents Time On Calls, Callbacks Export, User Logins Report, Demographic Quotas Report, VERM QA Links'; +$UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summary, Real-Time Whiteboard Report, VERM Reports, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound DID Detail Report, Inbound Email Report, Inbound Chat Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Callmenu Survey Report, Outbound Lead Source Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Inbound Status Summary, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Custom Reports Links, CallCard Search, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Lists Pass Report, Called Counts List IDs Report, Front Page System Summary, Report Page Servers Summary, Admin Utilities Page, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report, AMD Log Report, 3-Way Press Log Report, SIP Event Report, Caller ID Log Report, Quality Control Report, Settings Compare, Phone Stats, Hopper List Report, In-Group User List, Webserver-URL Report, VDAD Debug Log Report, URL Log Report, Medialog Inventory Report, Asterisk Debug, SPH Report, Shared Debug, Process Report, Group Alias Report, Hangup Cause Report, IVR Filter Report, LAGGED Agent Log Report, LAGGED Agent Log Summary Report, Agent Latency Report, Latency Gaps Report, Agent Disposition Report, Agent Performance Report, Carrier Log Report, Dial Log Report, Inbound Extension Stats, Agents Time On Calls, Callbacks Export, User Logins Report, Demographic Quotas Report, VERM QA Links, DB Schema Compare Utility'; $Vtables = 'NONE,log_noanswer,did_agent_log,contact_information'; @@ -6182,12 +6182,13 @@ if ($SSscript_remove_js > 0) # 240627-1950 - Added leave_3way_stop_recording campaign setting # 240703-1758 - Added update_remote_agent Non-Agent API function # 240704-0944 - Added coldstorage database connection fields to system_settings +# 240706-2332 - Added DB Schema Compare Utility # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 9 to access this page the first time -$admin_version = '2.14-922a'; -$build = '240704-0944'; +$admin_version = '2.14-923a'; +$build = '240706-2332'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -50858,7 +50859,7 @@ if ($ADD==999994) if ( (preg_match("/VERM Reports/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) {echo "
| ";
+ echo "\n";
+ echo _QXZ("DB Schema Compare Utility").$NWB."db_schema_compare".$NWE." \n"; + echo "\n\n"; + echo " |
| ";
+ echo "\n";
+ echo _QXZ("DB Schema Compare Utility").$NWB."db_schema_compare".$NWE." $stage "._QXZ("RESET")." \n"; + + $first_id_menu=''; + $second_id_menu=''; + $stmt=''; + if ($stage == 'SECONDARY') + { + if (strlen($SSslave_db_server)>4) + { + if (preg_match("/\:/", $SSslave_db_server)) + { + $temp_slave_db = explode(':',$SSslave_db_server); + $CSserver_string = $temp_slave_db[0]; + $VARDB_port = $temp_slave_db[1]; + } + else + { + $CSserver_string = $SSslave_db_server; + } + $linkCS=mysqli_connect($CSserver_string, "$VARDB_user", "$VARDB_pass", "$VARDB_database", $VARDB_port); + } + else + { + echo "Error: no secondary server: $SSslave_db_server\n"; + exit; + } + } + if ($stage == 'COLDSTORAGE') + { + if ( (strlen($SScoldstorage_server_ip) > 1) and (strlen($SScoldstorage_login) > 0) and (strlen($SScoldstorage_pass) > 0) ) + { + $CSserver_string = $SScoldstorage_server_ip; + $linkCS = mysqli_connect("$SScoldstorage_server_ip", "$SScoldstorage_login", "$SScoldstorage_pass", "$SScoldstorage_dbname", $SScoldstorage_port); + if (!$linkCS) {echo "MySQL Cold-Storage connect ERROR: " . mysqli_connect_error();} + } + else + { + echo "Error: no secondary server: $SSslave_db_server\n"; + exit; + } + } + + if (!$linkCS) + { + echo "Error: no DB compare server connection: |$stage|\n" . mysqli_connect_error();; + exit; + } + + + + echo " SCHEMA DETAILS:\n "; + $first_tables='|'; + $second_tables='|'; + + # get primary server list of DB tables + $stmtA="SELECT db_schema_version from system_settings;"; + $rslt=mysql_to_mysqli($stmtA, $link); + if ($DB) {echo "$stmtA\n";} + $rows_to_printA = mysqli_num_rows($rslt); + $first_text = "DB Server: $VARDB_server\nSchema version: "; + if ($rows_to_printA > 0) + { + $row = mysqli_fetch_array($rslt); + $first_text .= $row[0] . "\n"; + } + + # get secondary server list of DB tables + $rsltB=mysql_to_mysqli($stmtA, $linkCS); + if ($DB) {echo "$stmtA\n";} + $rows_to_printB = mysqli_num_rows($rsltB); + $second_text = "DB Server: $CSserver_string\nSchema version: "; + if ($rows_to_printB > 0) + { + $row = mysqli_fetch_array($rsltB); + $second_text .= $row[0] . "\n"; + } + + // include the Diff class + require_once './class.Diff.php'; + + echo Diff::toTable(Diff::compare($first_text, $second_text)); + + + $tables = array(); + $first_tables='|'; + $second_tables='|'; + echo " TABLES LIST:\n "; + + # get primary server list of DB tables + $stmtA="SHOW TABLES;"; + $rslt=mysql_to_mysqli($stmtA, $link); + if ($DB) {echo "$stmtA\n";} + $tables_to_printA = mysqli_num_rows($rslt); + $first_text = "DB Server: $VARDB_server\nTABLES: $tables_to_printA\n"; + $i=0; + while ($tables_to_printA > $i) + { + $row = mysqli_fetch_array($rslt); + $first_text .= $row[0] . "\n"; + $tables[$i] = $row[0]; + $first_tables .= "$tables[$i]|"; + $i++; + } + + # get secondary server list of DB tables + $stmtB="SHOW TABLES;"; + $rsltB=mysql_to_mysqli($stmtB, $linkCS); + if ($DB) {echo "$stmtB\n";} + $tables_to_printB = mysqli_num_rows($rsltB); + $second_text = "DB Server: $CSserver_string\nTABLES: $tables_to_printB\n"; + $i=0; + while ($tables_to_printB > $i) + { + $row = mysqli_fetch_array($rsltB); + $second_text .= $row[0] . "\n"; + $second_tables .= "$row[0]|"; + $i++; + } + + // include the Diff class + require_once './class.Diff.php'; + + echo Diff::toTable(Diff::compare($first_text, $second_text)); + + + + + + $first_text=''; + $second_text=''; + echo " TABLE ROW COUNTS:\n "; + + $i=0; + while ($tables_to_printA > $i) + { + # get primary server list of DB tables + $stmtA="SELECT count(*) from $tables[$i];"; + $rslt=mysql_to_mysqli($stmtA, $link); + if ($DB) {echo "$stmtA\n";} + $rows_to_print = mysqli_num_rows($rslt); + if ($rows_to_print > 0) + { + $row = mysqli_fetch_array($rslt); + $first_text .= $tables[$i] . ': ' . $row[0] . "\n"; + } + + if (preg_match("/\|$tables[$i]\|/",$second_tables)) + { + $rsltB=mysql_to_mysqli($stmtA, $linkCS); + if ($DB) {echo "$stmtA\n";} + $rows_to_printB = mysqli_num_rows($rsltB); + if ($rows_to_printB > 0) + { + $row = mysqli_fetch_array($rsltB); + $second_text .= $tables[$i] . ': ' . $row[0] . "\n"; + } + } + else + { + $second_text .= "na\n"; + } + + $i++; + } + + echo Diff::toTable(Diff::compare($first_text, $second_text)); + + + + + + $first_text=''; + $second_text=''; + echo " TABLE FIELD COUNTS:\n "; + + $i=0; + while ($tables_to_printA > $i) + { + # get primary server list of DB tables + $stmtA="SELECT * from $tables[$i] limit 1;"; + $rslt=mysql_to_mysqli($stmtA, $link); + if ($DB) {echo "$stmtA\n";} + $rows_to_print = mysqli_num_rows($rslt); + if ($rows_to_print > 0) + { + $fieldsA = mysqli_num_fields($rslt); + $row = mysqli_fetch_array($rslt); + $first_text .= $tables[$i] . ': ' . $fieldsA . "\n"; + } + else + { + $first_text .= $tables[$i] . ": empty\n"; + } + + if (preg_match("/\|$tables[$i]\|/",$second_tables)) + { + $rsltB=mysql_to_mysqli($stmtA, $linkCS); + if ($DB) {echo "$stmtA\n";} + $rows_to_printB = mysqli_num_rows($rsltB); + if ($rows_to_printB > 0) + { + $fieldsB = mysqli_num_fields($rsltB); + $row = mysqli_fetch_array($rsltB); + $second_text .= $tables[$i] . ': ' . $fieldsB . "\n"; + } + else + { + $second_text .= $tables[$i] . ": empty\n"; + } + } + else + { + $second_text .= "na\n"; + } + + $i++; + } + + echo Diff::toTable(Diff::compare($first_text, $second_text)); + + echo " |