Update main.php

This commit is contained in:
myvesta 2020-08-30 03:30:14 +02:00 committed by GitHub
commit eaafe8dea3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,7 +7,7 @@ define('myvesta_exit_on_error', true);
function myvesta_throw_error($code, $message) { function myvesta_throw_error($code, $message) {
echo "ERROR: ".$message."\n"; echo "ERROR: ".$message."\n";
if (defined('myvesta_exit_on_error')) exit($code); if (defined('myvesta_exit_on_error')) myvesta_exit($code);
return $code; return $code;
} }
@ -22,9 +22,9 @@ function myvesta_check_args ($requried_arguments, $arguments) {
global $argv; global $argv;
$argument_counter=count($argv); $argument_counter=count($argv);
$argument_counter--; $argument_counter--;
$argv[0]=str_replace('/usr/local/vesta/bin/', '', $argv[0]);
echo "-------------------- ".$argv[0]." --------------------\n";
if ($argument_counter<$requried_arguments) { if ($argument_counter<$requried_arguments) {
$command=$argv[0];
$command=str_replace('/usr/local/vesta/bin/', '', $command);
$arguments=str_replace(" ", "' '", $arguments); $arguments=str_replace(" ", "' '", $arguments);
$arguments="'".$arguments."'"; $arguments="'".$arguments."'";
return myvesta_throw_error(1, "Usage: $command $arguments"); return myvesta_throw_error(1, "Usage: $command $arguments");
@ -36,3 +36,9 @@ function myvesta_check_args ($requried_arguments, $arguments) {
$i++; $i++;
} }
} }
function myvesta_exit($code) {
global $argv;
echo "==================== ".$argv[0].": ".$code." ====================\n";
exit($code);
}