diff --git a/htdocs/core/ajax/pingresult.php b/htdocs/core/ajax/pingresult.php
index 0dbb5167f9e..7e9fad309d4 100644
--- a/htdocs/core/ajax/pingresult.php
+++ b/htdocs/core/ajax/pingresult.php
@@ -53,8 +53,8 @@ print '';
$hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id);
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'))
- || 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\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.
{
- include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+ // 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\n";
+ } else {
- print "\n".''."\n";
- print "\n\n";
- $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
- $distrib = 'standard';
- if ($_SERVER["SERVER_ADMIN"] == 'doliwamp@localhost') $distrib = 'doliwamp';
- if (! empty($dolibarr_distrib)) $distrib = $dolibarr_distrib;
- ?>
-
- 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\n";
+ $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
+ $distrib = 'standard';
+ if ($_SERVER["SERVER_ADMIN"] == 'doliwamp@localhost') $distrib = 'doliwamp';
+ if (! empty($dolibarr_distrib)) $distrib = $dolibarr_distrib;
+ ?>
+
+