1
0

correction of some regressions

This commit is contained in:
Daniel Tartavel 2021-10-30 12:37:27 +02:00
parent 5cb0055bee
commit 952121b1d2
5 changed files with 58 additions and 14 deletions

View File

@ -16,7 +16,9 @@
peripeties(); peripeties();
print "Envoi des arrivées" . EOLH; print "Envoi des arrivées" . EOLH;
arrivee(); arrivee();
anonymisation();
################################### FONCTIONS #################################""
function peripetieDatee() function peripetieDatee()
{ {
global $db; global $db;
@ -130,7 +132,7 @@
$query = "SELECT * FROM avionpoeme WHERE atteri = 0 AND TIMEDIFF(CONCAT_WS(' ',CURDATE(),CURTIME()),deliveryTimeServer) > '00:00'"; $query = "SELECT * FROM avionpoeme WHERE atteri = 0 AND TIMEDIFF(CONCAT_WS(' ',CURDATE(),CURTIME()),deliveryTimeServer) > '00:00'";
$db->query($query); $db->query($query);
$avionArrive = $db->result->fetch_all(MYSQLI_ASSOC); $avionArrive = $db->result->fetch_all(MYSQLI_ASSOC);
var_dump($avionArrive); //var_dump($avionArrive);
foreach ($avionArrive as $avion) foreach ($avionArrive as $avion)
{ {
print "avion poème n° " . $avion['idAvion'] . "a atterri" . EOLH; print "avion poème n° " . $avion['idAvion'] . "a atterri" . EOLH;
@ -196,5 +198,19 @@
print json_last_error_msg() .EOLH; print json_last_error_msg() .EOLH;
} }
} }
function anonymisation()
{
global $db;
$query = "SELECT idAvion FROM avionpoeme WHERE atteri = 1 AND public = 0 AND DATEDIFF(CONCAT_WS(' ',CURDATE(),CURTIME()),deliveryTimeServer) > '7'";
$db->query($query);
$avionArrive = $db->result->fetch_all(MYSQLI_ASSOC);
//print_r($avionArrive);
foreach($avionArrive as $avion)
{
$query = "UPDATE avionpoeme SET message='', expeMail='', destMail='' WHERE idAvion='" . $avion['idAvion'] ."'";
$db->query($query);
}
}
$db->close(); $db->close();
?> ?>

View File

@ -67,15 +67,22 @@ function verifPeripetieAvion()
$db->query($query); $db->query($query);
$avions = $db->result->fetch_all(MYSQLI_ASSOC); $avions = $db->result->fetch_all(MYSQLI_ASSOC);
$avionsId = array_column($avions, 'expeMail', 'idAvion'); $avionsId = array_column($avions, 'expeMail', 'idAvion');
print_r($avionsId); //print_r($avionsId);
$flag = false;
foreach($peripeties as $peripetie) foreach($peripeties as $peripetie)
{ {
print "Péripétie " . $peripetie["idAP"] . EOLH; //print "Péripétie " . $peripetie["idAP"] . EOLH;
$idAvion = $peripetie["idAvion"]; $idAvion = $peripetie["idAvion"];
if ( empty($avionsId[$idAvion]) ) if ( empty($avionsId[$idAvion]) )
{ {
print "Péripétie " . $peripetie["idAP"] . " n'a pas d'avion poème idAvion=>" . $idAvion . EOLH; print "Péripétie " . $peripetie["idAP"] . " n'a pas d'avion poème idAvion=>" . $idAvion . EOLH;
$flag = true;
} }
}
if ( ! $flag )
{
print "Aucune erreur détectée";
} }
$db->close(); $db->close();
} }

View File

@ -30,6 +30,7 @@
</head> </head>
<body> <body>
<a href="stats.php">Statistiques</a><br>
<a href="lang.php">Générer les fichiers de langue</a><br> <a href="lang.php">Générer les fichiers de langue</a><br>
<a href="logs.php">Lire les logs</a><br> <a href="logs.php">Lire les logs</a><br>
<a href="gestionDB.php">Vérifier la base de données</a><br> <a href="gestionDB.php">Vérifier la base de données</a><br>

View File

@ -14,6 +14,7 @@
$result = $db->result->fetch_assoc(); $result = $db->result->fetch_assoc();
return $result['Auto_increment']-1; return $result['Auto_increment']-1;
} }
function total() //nombre d'avions poèmes présents dans la base function total() //nombre d'avions poèmes présents dans la base
{ {
global $db; global $db;
@ -27,26 +28,42 @@
function totalenvol() //nombre d'avions poèmes en vol function totalenvol() //nombre d'avions poèmes en vol
{ {
global $db; global $db;
$query = "SELECT COUNT(*) as n FROM avionpoeme WHERE public!=2"; $query = "SELECT COUNT(*) as n FROM avionpoeme WHERE atteri!=1";
$db->query($query); $db->query($query);
$result = $db->result->fetch_assoc(); $result = $db->result->fetch_assoc();
return $result["n"]; return $result["n"];
} }
function alea() function alea($nAvionEnvoye)
{ {
global $db; global $db;
$query = "SELECT COUNT(*) as nAvion FROM avionpoeme WHERE "; $query = "SELECT DISTINCT deliveryMethod FROM avionpoeme";
$db->query($query);
$result = $db->result->fetch_all(MYSQLI_ASSOC);
//var_dump($result);
foreach ( $result as $method )
{
$query = "SELECT COUNT(*) as nAvion FROM avionpoeme WHERE deliveryMethod='" . $method["deliveryMethod"] . "'";
$db->query($query); $db->query($query);
$result = $db->result->fetch_assoc(); $result = $db->result->fetch_assoc();
return $result["n"]; echo "Méthode => " . $method["deliveryMethod"] . " nombre d'avion poèmes => " . $result["nAvion"] . " => " . round($result["nAvion"]/$nAvionEnvoye*100,2) . "%" . EOLH;
}
} }
function anonymous() //nombre d'avions poèmes envoyés anonymement function anonymous() //nombre d'avions poèmes envoyés anonymement
{ {
global $db; global $db;
$query = "SELECT COUNT(*) as n FROM avionpoeme WHERE expemail=''"; $query = "SELECT COUNT(*) as n FROM avionpoeme WHERE expeknown='0'";
$db->query($query);
$result = $db->result->fetch_assoc();
return $result["n"];
}
function deleted()
{
global $db;
$query = "SELECT COUNT(*) as n FROM avionpoeme WHERE public='2'";
$db->query($query); $db->query($query);
$result = $db->result->fetch_assoc(); $result = $db->result->fetch_assoc();
return $result["n"]; return $result["n"];
@ -63,11 +80,14 @@
echo "Nombre total d'avions-poème : " . $nAvionEnvoye . EOLH; echo "Nombre total d'avions-poème : " . $nAvionEnvoye . EOLH;
$total = total(); $total = total();
$avionSupp = $nAvionEnvoye-$total; $avionSupp = $nAvionEnvoye-$total;
echo "Nombre d'avion supprimés : " . $avionSupp . " => " . round($avionSupp/$nAvionEnvoye*100,3) . "%" . EOLH; echo "Nombre d'avion supprimés : " . $avionSupp . " => " . round($avionSupp/$nAvionEnvoye*100,2) . "%" . EOLH;
$nAvionenvol = totalenvol(); $nAvionenvol = totalenvol();
echo "Nombre d'avions-poème en vol : " . $nAvionenvol . " => " . round($nAvionenvol/$nAvionEnvoye*100) . "%" . EOLH; echo "Nombre d'avions-poème en vol : " . $nAvionenvol . " => " . round($nAvionenvol/$nAvionEnvoye*100,2) . "%" . EOLH;
$anonymous = anonymous(); $anonymous = anonymous();
echo "Nombre d'envois anonymes : " . $anonymous . " => " . round($anonymous/$nAvionEnvoye*100) . "%" . EOLH; echo "Nombre d'envois anonymes : " . $anonymous . " => " . round($anonymous/$nAvionEnvoye*100,2) . "%" . EOLH;
$deleted = deleted();
echo "Nombre d'avions anonymisés(effacés) : " . $deleted . " => " . round($deleted/$nAvionEnvoye*100,2) . "%" . EOLH;
alea($nAvionEnvoye);
} }

View File

@ -20,7 +20,7 @@ $site = "Avion Poème";
$dossier = "/www"; $dossier = "/www";
$basedir = dirname( $_SERVER['DOCUMENT_ROOT'] ) . $dossier; $basedir = dirname( $_SERVER['DOCUMENT_ROOT'] ) . $dossier;
$base_url = "http://avion-poe.me"; $base_url = "https://avion-poe.me";
$base_path = "/flex/storage/avion-poe.me/site/www/"; $base_path = "/flex/storage/avion-poe.me/site/www/";
$url_admin = $base_url . "/gestion"; $url_admin = $base_url . "/gestion";
$accueil = $base_url . "/index.html"; $accueil = $base_url . "/index.html";