Add log into curl method for oauth

This commit is contained in:
Laurent Destailleur 2024-08-13 17:04:32 +02:00
parent 14dfe8a073
commit 8936b6ef8a
2 changed files with 10 additions and 1 deletions

View File

@ -139,7 +139,7 @@ if ($action == 'update') {
$error++;
}
// Update const where the token was used, might not be exhaustive
// Update other const that was using the renamed key as token (might not be exhaustive)
if (getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE') == $oldname) {
if (!dolibarr_set_const($db, 'MAIN_MAIL_SMTPS_OAUTH_SERVICE', strtoupper($oldprovider).'-'.$newlabel, 'chaine', 0, '', $conf->entity)) {
$error++;

View File

@ -122,6 +122,15 @@ class CurlClient extends AbstractClient
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
}
// @CHANGE DOL_LDR Add log
if (function_exists('getDolGlobalString') && getDolGlobalString('OAUTH_DEBUG')) {
file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $endpoint->getAbsoluteUri()."\n", FILE_APPEND);
file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $requestBody."\n", FILE_APPEND);
file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $method."\n", FILE_APPEND);
file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", var_export($extraHeaders, true)."\n", FILE_APPEND);
@chmod(DOL_DATA_ROOT . "/dolibarr_oauth.log", octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK));
}
$response = curl_exec($ch);
$responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);