Add proper exit() code to bin/ commands

This commit is contained in:
slawkens
2020-01-21 18:18:29 +01:00
parent dd1e604155
commit 75d1ed6eea
3 changed files with 31 additions and 21 deletions

View File

@@ -1,7 +1,8 @@
<?php
if(PHP_SAPI !== 'cli') {
die('This script can be run only in command line mode.');
echo 'This script can be run only in command line mode.';
exit(1);
}
require_once __DIR__ . '/../../common.php';
@@ -9,10 +10,9 @@ require_once SYSTEM . 'functions.php';
require_once SYSTEM . 'init.php';
if(clearCache()) {
echo 'Cache cleared.';
echo 'Cache cleared.' . PHP_EOL;
}
else {
echo 'Unexpected error.';
echo 'Unexpected error.' . PHP_EOL;
exit(2);
}
echo PHP_EOL;