Add type of db driver in stats

This commit is contained in:
Laurent Destailleur 2019-11-09 12:24:18 +01:00
parent dcdcd7c67e
commit 917c8df225
3 changed files with 21 additions and 10 deletions

View File

@ -54,6 +54,7 @@ print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"])
if ($action == 'firstpingok') if ($action == 'firstpingok')
{ {
// Note: pings are by installation, done on entity 1. // Note: pings are by installation, done on entity 1.
// 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.
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);
@ -63,7 +64,7 @@ if ($action == 'firstpingok')
elseif ($action == 'firstpingko') elseif ($action == 'firstpingko')
{ {
// Note: pings are by installation, done on entity 1. // Note: pings are by installation, done on entity 1.
dolibarr_set_const($db, 'MAIN_LAST_PING_KO_DATE', dol_print_date($now, 'dayhourlog'), 'gmt'); dolibarr_set_const($db, 'MAIN_LAST_PING_KO_DATE', dol_print_date($now, 'dayhourlog'), 'gmt'); // erase last value
print 'First ping KO saved for entity '.$conf->entity; print 'First ping KO saved for entity '.$conf->entity;
} }
else { else {

View File

@ -2567,7 +2567,7 @@ if (! function_exists("llxFooter"))
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 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<!-- JS CODE TO ENABLE the anonymous Ontime Ping -->\n"; print "\n<!-- JS CODE TO ENABLE the anonymous Ontime Ping -->\n";
$hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id); $hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id);
$url_for_ping = "https://ping.dolibarr.org/"; $url_for_ping = (empty($conf->global->MAIN_URL_FOR_PING) ? "https://ping.dolibarr.org/" : $conf->global->MAIN_URL_FOR_PING);
?> ?>
<script> <script>
jQuery(document).ready(function (tmp) { jQuery(document).ready(function (tmp) {
@ -2576,7 +2576,14 @@ if (! function_exists("llxFooter"))
url: "<?php echo $url_for_ping ?>", url: "<?php echo $url_for_ping ?>",
timeout: 500, // timeout milliseconds timeout: 500, // timeout milliseconds
cache: false, cache: false,
data: { hash_algo: "md5", hash_unique_id: "<?php echo $hash_unique_id; ?>", action: "dolibarrping", version: "<?php echo (float) DOL_VERSION; ?>", entity: <?php echo (int) $conf->entity; ?> }, data: {
hash_algo: "md5",
hash_unique_id: "<?php echo dol_escape_js($hash_unique_id); ?>",
action: "dolibarrping",
version: "<?php echo (float) DOL_VERSION; ?>",
entity: "<?php echo (int) $conf->entity; ?>",
dbtype: "<?php echo dol_escape_js($db->type); ?>"
},
success: function (data, status, xhr) { // success callback function (data contains body of response) success: function (data, status, xhr) { // success callback function (data contains body of response)
console.log("Ping ok"); console.log("Ping ok");
$.ajax({ $.ajax({
@ -2584,17 +2591,17 @@ if (! function_exists("llxFooter"))
url: "<?php echo DOL_URL_ROOT.'/core/ajax/pingresult.php'; ?>", url: "<?php echo DOL_URL_ROOT.'/core/ajax/pingresult.php'; ?>",
timeout: 500, // timeout milliseconds timeout: 500, // timeout milliseconds
cache: false, cache: false,
data: { hash_algo: "md5", hash_unique_id: "<?php echo $hash_unique_id; ?>", action: "firstpingok" }, data: { hash_algo: "md5", hash_unique_id: "<?php echo dol_escape_js($hash_unique_id); ?>", action: "firstpingok" }, // to update
}); });
}, },
error: function (data,status,xhr) { // success callback function error: function (data,status,xhr) { // error callback function
console.log("Ping ko: " + data); console.log("Ping ko: " + data);
$.ajax({ $.ajax({
method: "GET", method: "GET",
url: "<?php echo DOL_URL_ROOT.'/core/ajax/pingresult.php'; ?>", url: "<?php echo DOL_URL_ROOT.'/core/ajax/pingresult.php'; ?>",
timeout: 500, // timeout milliseconds timeout: 500, // timeout milliseconds
cache: false, cache: false,
data: { hash_algo: "md5", hash_unique_id: "<?php echo $hash_unique_id; ?>", action: "firstpingko", version: "<?php echo (float) DOL_VERSION; ?>" }, data: { hash_algo: "md5", hash_unique_id: "<?php echo dol_escape_js($hash_unique_id); ?>", action: "firstpingko" },
}); });
} }
}); });

View File

@ -227,6 +227,8 @@ class MyObject extends CommonObject
} }
// Translate some data of arrayofkeyval // Translate some data of arrayofkeyval
if (is_object($langs))
{
foreach($this->fields as $key => $val) foreach($this->fields as $key => $val)
{ {
if (is_array($val['arrayofkeyval'])) if (is_array($val['arrayofkeyval']))
@ -238,6 +240,7 @@ class MyObject extends CommonObject
} }
} }
} }
}
/** /**
* Create object into database * Create object into database