2
0
forked from Wavyzz/dolibarr

Fix CLI tools must return a positive value on error for better cross

platform compatibility
This commit is contained in:
Laurent Destailleur
2024-03-04 19:41:21 +01:00
parent c181bbe2f2
commit 3bafcf5d00
27 changed files with 250 additions and 110 deletions

View File

@@ -35,7 +35,7 @@ $path = __DIR__.'/';
// Test if batch mode
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit(-1);
exit(1);
}
require_once $path."../../htdocs/master.inc.php";
@@ -91,7 +91,7 @@ $required_fields = array_unique(array_values(array_filter($required_fields, "dol
if (!isset($argv[1])) {
print "Usage: $script_file (nocommitiferror|commitiferror) [--server=ldapserverhost] [--excludeuser=user1,user2...] [-y]\n";
exit(-1);
exit(1);
}
foreach ($argv as $key => $val) {
@@ -142,7 +142,7 @@ if (!$confirmed) {
if (!getDolGlobalString('LDAP_USER_DN')) {
print $langs->trans("Error").': '.$langs->trans("LDAP setup for users not defined inside Dolibarr");
exit(-1);
exit(1);
}
// Load table of correspondence of countries
@@ -169,7 +169,7 @@ if ($resql) {
}
} else {
dol_print_error($db);
exit(-1);
exit(1);
}
$ldap = new Ldap();