} if ($argv[1] == '--maintenance') { $unix->events("Executing Maintenance"); maintenance(); die; } if ($argv[1] == "--fixmysqldbug") { fixmysqldbug(); die; } if ($argv[1] == "--multi-start") { multi_start($argv[2]); die; } if ($argv[1] == "--multi-stop") { multi_stop($argv[2]); die; } if ($argv[1] == "--multi-start-all") { multi_start_all(); die; } if ($argv[1] == "--multi-status") { multi_status(); die; } if ($argv[1] == '--dbstats') { databases_list_fill(); die; } if ($argv[1] == '--multi-dbstats') {
function multi_delete($ID) { $unix = new unix(); $rm = $unix->find_program("rm"); echo "Deleting......: zarafa-server instance id:{$ID}..\n"; echo "Deleting......: zarafa-server disable instance\n"; $q = new mysql(); $q->QUERY_SQL("UPDATE zarafamulti SET enabled=0 WHERE ID='{$ID}'", "artica_backup"); echo "Deleting......: zarafa-server stopping instance\n"; multi_stop($ID); $zarafa = new zarafamulti($ID); echo "Deleting......: zarafa-server removing directory {$zarafa->attachment_path}\n"; if (is_dir($zarafa->attachment_path)) { recursive_remove_directory($zarafa->attachment_path); } echo "Deleting......: zarafa-server removing directory /etc/zarafa-{$ID}\n"; if (is_dir("/etc/zarafa-{$ID}")) { recursive_remove_directory("/etc/zarafa-{$ID}"); } $database = "zarafa{$ID}"; echo "Deleting......: zarafa-server removing database {$database}\n"; if ($zarafa->mysql_instance_id > 0) { $q = new mysql_multi($zarafa->mysql_instance_id); $q->QUERY_SQL_NO_BASE("DROP DATABASE `{$database}`"); } else { $q = new mysql(); $q->DELETE_DATABASE($database); } echo "Deleting......: zarafa-server removing entry\n"; $q = new mysql(); $q->QUERY_SQL("DELETE FROM zarafamulti WHERE ID={$ID}", "artica_backup"); if ($zarafa->PostfixInstance != null) { echo "Deleting......: zarafa-server reconfigure {$zarafa->PostfixInstance} postfix instance \n"; $sock = new sockets(); $sock->getFrameWork("postfix.php?reconfigure-single-instance={$zarafa->PostfixInstance}"); } echo "Deleting......: zarafa-server done...\n"; }