MYVESTA_QUIET as export variable

This commit is contained in:
myvesta 2023-04-15 18:51:15 +02:00 committed by GitHub
parent 3fbb3dad78
commit 075c5e231b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -2,6 +2,8 @@
$myvesta_exit_on_error=true; $myvesta_exit_on_error=true;
$myvesta_quiet_mode=0; $myvesta_quiet_mode=0;
if (isset($_SERVER['MYVESTA_QUIET'])) $myvesta_quiet_mode=intval($_SERVER['MYVESTA_QUIET']);
define('MYVESTA_ERROR_PERMISSION_DENIED', 1); define('MYVESTA_ERROR_PERMISSION_DENIED', 1);
define('MYVESTA_ERROR_MISSING_ARGUMENTS', 2); define('MYVESTA_ERROR_MISSING_ARGUMENTS', 2);
define('MYVESTA_ERROR_FILE_DOES_NOT_EXISTS', 3); define('MYVESTA_ERROR_FILE_DOES_NOT_EXISTS', 3);

View file

@ -81,8 +81,8 @@ function myvesta_grep($find, $file_or_stdin, $count=0, $quiet=0) {
$myvesta_quiet_mode=$quiet; $myvesta_quiet_mode=$quiet;
//echo "find = " . $find."\n"; echo "file_or_stdin = " . $file_or_stdin."\n"; echo "count = " . $count."\n"; echo "quiet = " . $quiet."\n"; exit; //echo "find = " . $find."\n"; echo "file_or_stdin = " . $file_or_stdin."\n"; echo "count = " . $count."\n"; echo "quiet = " . $quiet."\n"; exit;
if ($myvesta_stdin_return_not_found==true) { if ($myvesta_stdin_return_not_found==true) {
if ($count==1) return myvesta_throw_error (MYVESTA_ERROR_STRING_NOT_FOUND, "0"); if ($count==1) return myvesta_throw_error (MYVESTA_ERROR_FILE_DOES_NOT_EXISTS, "0");
return myvesta_throw_error (MYVESTA_ERROR_STRING_NOT_FOUND, ""); return myvesta_throw_error (MYVESTA_ERROR_FILE_DOES_NOT_EXISTS, "");
} }
$arr=explode("\n", $file_or_stdin); $arr=explode("\n", $file_or_stdin);
@ -111,7 +111,7 @@ function myvesta_sed($find, $replace, $file_or_stdin) {
global $myvesta_stdin, $myvesta_stdin_return_not_found, $myvesta_stdin_from_file; global $myvesta_stdin, $myvesta_stdin_return_not_found, $myvesta_stdin_from_file;
//echo "find = " . $find."\n"; echo "replace = " . $replace."\n"; echo "file_or_stdin = " . $file_or_stdin."\n"; echo "stdin_from_file = " . $myvesta_stdin_from_file."\n"; exit; //echo "find = " . $find."\n"; echo "replace = " . $replace."\n"; echo "file_or_stdin = " . $file_or_stdin."\n"; echo "stdin_from_file = " . $myvesta_stdin_from_file."\n"; exit;
if ($myvesta_stdin_return_not_found==true) { if ($myvesta_stdin_return_not_found==true) {
return myvesta_throw_error (MYVESTA_ERROR_STRING_NOT_FOUND, "File not found"); return myvesta_throw_error (MYVESTA_ERROR_FILE_DOES_NOT_EXISTS, "File not found");
} }
if (strpos($file_or_stdin, $find)===false) return myvesta_throw_error (MYVESTA_ERROR_STRING_NOT_FOUND, "String '$find' not found"); if (strpos($file_or_stdin, $find)===false) return myvesta_throw_error (MYVESTA_ERROR_STRING_NOT_FOUND, "String '$find' not found");