Fix error message

This commit is contained in:
Laurent Destailleur 2022-10-03 17:30:47 +02:00
parent 2e8734a950
commit 5ccc5c9e1a

View File

@ -120,7 +120,7 @@ if (empty($conf->global->MAIN_MODULE_API)) {
// Test if explorer is not disabled
if (preg_match('/api\/index\.php\/explorer/', $url) && !empty($conf->global->API_EXPLORER_DISABLED)) {
$langs->load("admin");
dol_syslog("Call Dolibarr API interfaces with module REST disabled");
dol_syslog("Call Dolibarr API interfaces with module API REST disabled");
print $langs->trans("WarningAPIExplorerDisabled").'.<br><br>';
//session_destroy();
exit(0);
@ -153,6 +153,10 @@ preg_match('/index\.php\/([^\/]+)(.*)$/', $url, $reg);
$refreshcache = (empty($conf->global->API_PRODUCTION_DO_NOT_ALWAYS_REFRESH_CACHE) ? true : false);
if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root')) {
$refreshcache = true;
if (!is_writable($conf->api->dir_temp)) {
print 'Erreur temp dir api/temp not writable';
exit(0);
}
}
$api = new DolibarrApi($db, '', $refreshcache);