diff --git a/scripts/mailbox/destroy.php b/scripts/mailbox/destroy.php index cdd87c8..162bc9b 100755 --- a/scripts/mailbox/destroy.php +++ b/scripts/mailbox/destroy.php @@ -1,94 +1,94 @@ #!/usr/bin/php . /** * destroy-mailbox * * This is a command-line interface to destroy a mailbox. * * This script is designed to be run by a SYSTEM ADMINISTRATOR * with enough brain and with enough privileges to delete contents from * your MDA. * * YES, This script PERMANENTLY REMOVE ALL THE F*****G E-MAILS * of the specified mailbox and PERMANENTLY REMOVE the mailbox from * your database and YOU SHOULD HAVE A F*****G BACKUP. */ // require the framework require dirname( __FILE__ ) . '/../../load.php'; // no arguments no party if( !isset( $argv ) ) { exit( 1 ); } // check the mailbox name $mailbox_raw = $argv[1] ?? null; // no mailbox no party if( !$mailbox_raw ) { destroy_mailbox_help( "Please specify a mailbox" ); exit( 2 ); } // request the mailbox $mailbox = ( new MailboxAPI() ) ->joinDomain() ->whereCompleteMailboxAddress( $mailbox_raw ) ->queryRow(); // no mailbox no party if( !$mailbox ) { - echo "Cannot destroy an unexisting mailbox.\n"; + echo "Cannot destroy a not existing mailbox.\n"; exit( 4 ); } // mandatory question printf( "Are you F*****G sure to DESTROY the mailbox '%s' FOREVER? [y/n]\n", $mailbox->getMailboxAddress() ); $yes = readline(); // aborted if( $yes !== 'y' ) { echo "Aborted\n"; exit( 0 ); } // destroy this F*****G mailbox NOW MailboxDestroyer::destroy( $mailbox ); echo "Destroyed.\n"; /** * Show an help message, eventually with a custom message * * @param $message string */ function destroy_mailbox_help( $message = null ) { printf( "Usage:\n %s foo@example.com\n", $GLOBALS['argv'][0] ); // eventually spawn an error message if( $message ) { echo "\n"; printf( "Error:\n %s\n", $message ); } }