Do no retry ping after error the same month
This commit is contained in:
parent
8e18a08377
commit
b81d223ab3
@ -53,8 +53,8 @@ print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"])
|
|||||||
// If ok
|
// If ok
|
||||||
if ($action == 'firstpingok')
|
if ($action == 'firstpingok')
|
||||||
{
|
{
|
||||||
// Note: pings are by installation, done on entity 1.
|
// Note: pings are per installed instances / entity.
|
||||||
// Once this constant are set, no more ping will be tried (except if we add parameter &forceping=1 on URL). So we can say this are 'first' ping.
|
// Once this constants are set, no more ping will be tried (except if we add parameter &forceping=1 on URL). So we can say this are 'first' ping.
|
||||||
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_DATE', dol_print_date($now, 'dayhourlog', 'gmt'));
|
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_DATE', dol_print_date($now, 'dayhourlog', 'gmt'));
|
||||||
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_ID', $hash_unique_id);
|
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_ID', $hash_unique_id);
|
||||||
|
|
||||||
|
|||||||
@ -2553,22 +2553,30 @@ if (!function_exists("llxFooter"))
|
|||||||
|
|
||||||
// Add code for the asynchronous anonymous first ping (for telemetry)
|
// Add code for the asynchronous anonymous first ping (for telemetry)
|
||||||
// You can use &forceping=1 in parameters to force the ping if the ping was already sent.
|
// You can use &forceping=1 in parameters to force the ping if the ping was already sent.
|
||||||
if (($_SERVER["PHP_SELF"] == DOL_URL_ROOT.'/index.php') || GETPOST('forceping', 'alpha'))
|
$forceping = GETPOST('forceping', 'alpha');
|
||||||
|
if (($_SERVER["PHP_SELF"] == DOL_URL_ROOT.'/index.php') || $forceping)
|
||||||
{
|
{
|
||||||
//print '<!-- instance_unique_id='.$conf->file->instance_unique_id.' MAIN_FIRST_PING_OK_ID='.$conf->global->MAIN_FIRST_PING_OK_ID.' -->';
|
//print '<!-- instance_unique_id='.$conf->file->instance_unique_id.' MAIN_FIRST_PING_OK_ID='.$conf->global->MAIN_FIRST_PING_OK_ID.' -->';
|
||||||
$hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id);
|
$hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id);
|
||||||
if (empty($conf->global->MAIN_FIRST_PING_OK_DATE)
|
if (empty($conf->global->MAIN_FIRST_PING_OK_DATE)
|
||||||
|| (!empty($conf->file->instance_unique_id) && ($hash_unique_id != $conf->global->MAIN_FIRST_PING_OK_ID) && ($conf->global->MAIN_FIRST_PING_OK_ID != 'disabled'))
|
|| (!empty($conf->file->instance_unique_id) && ($hash_unique_id != $conf->global->MAIN_FIRST_PING_OK_ID) && ($conf->global->MAIN_FIRST_PING_OK_ID != 'disabled'))
|
||||||
|| GETPOST('forceping', 'alpha'))
|
|| $forceping)
|
||||||
{
|
{
|
||||||
if (strpos('alpha', DOL_VERSION) > 0) {
|
// No ping done if we are into an alpha version
|
||||||
|
if (strpos('alpha', DOL_VERSION) > 0 && ! $forceping) {
|
||||||
print "\n<!-- NO JS CODE TO ENABLE the anonymous Ping. It is an alpha version -->\n";
|
print "\n<!-- NO JS CODE TO ENABLE the anonymous Ping. It is an alpha version -->\n";
|
||||||
}
|
}
|
||||||
elseif (empty($_COOKIE['DOLINSTALLNOPING_'.$hash_unique_id])) // Cookie is set when we uncheck the checkbox in the installation wizard.
|
elseif (empty($_COOKIE['DOLINSTALLNOPING_'.$hash_unique_id]) || $forceping) // Cookie is set when we uncheck the checkbox in the installation wizard.
|
||||||
{
|
{
|
||||||
|
// MAIN_LAST_PING_KO_DATE
|
||||||
|
// TODO Disable ping if MAIN_LAST_PING_KO_DATE is set and is recent
|
||||||
|
if (! empty($conf->global->MAIN_LAST_PING_KO_DATE) && substr($conf->global->MAIN_LAST_PING_KO_DATE, 0, 6) == dol_print_date(dol_now(), '%Y%m') && ! $forceping) {
|
||||||
|
print "\n<!-- NO JS CODE TO ENABLE the anonymous Ping. An error already occured this month, we will try later. -->\n";
|
||||||
|
} else {
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
|
||||||
print "\n".'<!-- Includes JS for Ping of Dolibarr MAIN_FIRST_PING_OK_DATE = '.$conf->global->MAIN_FIRST_PING_OK_DATE.' MAIN_FIRST_PING_OK_ID = '.$conf->global->MAIN_FIRST_PING_OK_ID.' -->'."\n";
|
print "\n".'<!-- Includes JS for Ping of Dolibarr forceping='.$forceping.' MAIN_FIRST_PING_OK_DATE='.$conf->global->MAIN_FIRST_PING_OK_DATE.' MAIN_FIRST_PING_OK_ID='.$conf->global->MAIN_FIRST_PING_OK_ID.' MAIN_LAST_PING_KO_DATE='.$conf->global->MAIN_LAST_PING_KO_DATE.' -->'."\n";
|
||||||
print "\n<!-- JS CODE TO ENABLE the anonymous Ping -->\n";
|
print "\n<!-- JS CODE TO ENABLE the anonymous Ping -->\n";
|
||||||
$url_for_ping = (empty($conf->global->MAIN_URL_FOR_PING) ? "https://ping.dolibarr.org/" : $conf->global->MAIN_URL_FOR_PING);
|
$url_for_ping = (empty($conf->global->MAIN_URL_FOR_PING) ? "https://ping.dolibarr.org/" : $conf->global->MAIN_URL_FOR_PING);
|
||||||
// Try to guess the distrib used
|
// Try to guess the distrib used
|
||||||
@ -2620,6 +2628,7 @@ if (!function_exists("llxFooter"))
|
|||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user