correction of some regressions
This commit is contained in:
parent
5cb0055bee
commit
952121b1d2
18
cron.php
18
cron.php
@ -16,7 +16,9 @@
|
||||
peripeties();
|
||||
print "Envoi des arrivées" . EOLH;
|
||||
arrivee();
|
||||
anonymisation();
|
||||
|
||||
################################### FONCTIONS #################################""
|
||||
function peripetieDatee()
|
||||
{
|
||||
global $db;
|
||||
@ -130,7 +132,7 @@
|
||||
$query = "SELECT * FROM avionpoeme WHERE atteri = 0 AND TIMEDIFF(CONCAT_WS(' ',CURDATE(),CURTIME()),deliveryTimeServer) > '00:00'";
|
||||
$db->query($query);
|
||||
$avionArrive = $db->result->fetch_all(MYSQLI_ASSOC);
|
||||
var_dump($avionArrive);
|
||||
//var_dump($avionArrive);
|
||||
foreach ($avionArrive as $avion)
|
||||
{
|
||||
print "avion poème n° " . $avion['idAvion'] . "a atterri" . EOLH;
|
||||
@ -196,5 +198,19 @@
|
||||
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();
|
||||
?>
|
||||
|
@ -67,15 +67,22 @@ function verifPeripetieAvion()
|
||||
$db->query($query);
|
||||
$avions = $db->result->fetch_all(MYSQLI_ASSOC);
|
||||
$avionsId = array_column($avions, 'expeMail', 'idAvion');
|
||||
print_r($avionsId);
|
||||
//print_r($avionsId);
|
||||
$flag = false;
|
||||
foreach($peripeties as $peripetie)
|
||||
{
|
||||
print "Péripétie " . $peripetie["idAP"] . EOLH;
|
||||
//print "Péripétie " . $peripetie["idAP"] . EOLH;
|
||||
$idAvion = $peripetie["idAvion"];
|
||||
if ( empty($avionsId[$idAvion]) )
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a href="stats.php">Statistiques</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="gestionDB.php">Vérifier la base de données</a><br>
|
||||
|
@ -14,6 +14,7 @@
|
||||
$result = $db->result->fetch_assoc();
|
||||
return $result['Auto_increment']-1;
|
||||
}
|
||||
|
||||
function total() //nombre d'avions poèmes présents dans la base
|
||||
{
|
||||
global $db;
|
||||
@ -27,26 +28,42 @@
|
||||
function totalenvol() //nombre d'avions poèmes en vol
|
||||
{
|
||||
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);
|
||||
$result = $db->result->fetch_assoc();
|
||||
return $result["n"];
|
||||
}
|
||||
|
||||
function alea()
|
||||
function alea($nAvionEnvoye)
|
||||
{
|
||||
global $db;
|
||||
$query = "SELECT COUNT(*) as nAvion FROM avionpoeme WHERE ";
|
||||
$query = "SELECT DISTINCT deliveryMethod FROM avionpoeme";
|
||||
$db->query($query);
|
||||
$result = $db->result->fetch_assoc();
|
||||
return $result["n"];
|
||||
|
||||
$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);
|
||||
$result = $db->result->fetch_assoc();
|
||||
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
|
||||
{
|
||||
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);
|
||||
$result = $db->result->fetch_assoc();
|
||||
return $result["n"];
|
||||
@ -63,11 +80,14 @@
|
||||
echo "Nombre total d'avions-poème : " . $nAvionEnvoye . EOLH;
|
||||
$total = 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();
|
||||
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();
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,7 +20,7 @@ $site = "Avion Poème";
|
||||
$dossier = "/www";
|
||||
$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/";
|
||||
$url_admin = $base_url . "/gestion";
|
||||
$accueil = $base_url . "/index.html";
|
||||
|
Reference in New Issue
Block a user