From 75d1ed6eea118befefeb51da6e91f6dbd6c68cd0 Mon Sep 17 00:00:00 2001 From: slawkens Date: Tue, 21 Jan 2020 18:18:29 +0100 Subject: [PATCH] Add proper exit() code to bin/ commands --- system/bin/clear_cache.php | 10 +++++----- system/bin/install_plugin.php | 22 +++++++++++++--------- system/bin/send_email.php | 20 +++++++++++++------- 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/system/bin/clear_cache.php b/system/bin/clear_cache.php index 60ddbdb5..9c10b793 100644 --- a/system/bin/clear_cache.php +++ b/system/bin/clear_cache.php @@ -1,7 +1,8 @@ getAccount()->getEMail(); } else { - exit('Cannot find player or account with name: ' . $email_account_name . '.' . PHP_EOL); + echo 'Cannot find player or account with name: ' . $email_account_name . '.' . PHP_EOL; + exit(3); } } } if(!Validator::email($email_account_name)) { - exit('Invalid E-Mail format.' . PHP_EOL); + echo 'Invalid E-Mail format.' . PHP_EOL; + exit(4); } if(strlen($subject) > 255) { - exit('Subject max length is 255 characters.' . PHP_EOL); + echo 'Subject max length is 255 characters.' . PHP_EOL; + exit(5); } if(!_mail($email_account_name, $subject, $message)) { - exit('Error while sending mail: ' . $mailer->ErrorInfo . PHP_EOL); + echo 'Error while sending mail: ' . $mailer->ErrorInfo . PHP_EOL; + exit(6); } -echo 'Mail sent to ' . $email_account_name . '.' . PHP_EOL; \ No newline at end of file +echo 'Mail sent to ' . $email_account_name . '.' . PHP_EOL;