43 lines
1.9 KiB
PHP
43 lines
1.9 KiB
PHP
<?php
|
||
/**
|
||
* Created by PhpStorm.
|
||
* User: jesse94
|
||
* Date: 14-07-04
|
||
* Time: 15:43
|
||
*/
|
||
|
||
// cron job sur baloo PROD php
|
||
// 8-03-2021
|
||
// /usr/bin/wget --delete-after --no-check-certificate "https://ms1inscription.com/php/clear_cart.php"
|
||
// a tout les 15 minutes
|
||
require_once "inc_fonctions.php";
|
||
require_once "inc_fx_panier.php";
|
||
|
||
global $objDatabase;
|
||
|
||
// trouver les paniers incomplets depuis plus de 6h
|
||
/* PR<50> MSIN-194
|
||
$sqlPaniers = "SELECT no_panier FROM inscriptions_panier_acheteurs WHERE sta_id = 1 AND receipt_text NOT IN('Erreur', 'Error') AND ach_maj <= DATE_SUB('" . fxGetDateTime() . "', INTERVAL 6 HOUR) ORDER BY ach_maj DESC";
|
||
$tabPaniers = $objDatabase->fxGetResults($sqlPaniers);
|
||
|
||
if ($tabPaniers != null) {
|
||
for ($intCtr = 1; $intCtr <= count($tabPaniers); $intCtr++) {
|
||
fxViderPanier($tabPaniers[$intCtr]['no_panier'], 1);
|
||
}
|
||
} */
|
||
// POST MSIN-194
|
||
$sqlPaniers = "UPDATE inscriptions_panier_acheteurs SET sta_id = 2 WHERE sta_id = 1 AND ach_maj <= DATE_SUB('" . fxGetDateTime() . "', INTERVAL 6 HOUR)";
|
||
$tabPaniers = $objDatabase->fxQuery($sqlPaniers);
|
||
|
||
// trouver les campings des paniers incomplets ajout<75>s depuis plus de 30 min
|
||
$sqlPaniers = "SELECT p.ppn_id, a.no_panier FROM inscriptions_panier_acheteurs a, inscriptions_panier_produits_new p WHERE a.no_panier = p.no_panier AND a.sta_id = 1 AND p.pt_id = 1 AND a.ach_maj <= DATE_SUB('" . fxGetDateTime() . "', INTERVAL 30 MINUTE) AND p.pro_maj <= DATE_SUB('" . fxGetDateTime() . "', INTERVAL 30 MINUTE) ORDER BY a.ach_maj DESC";
|
||
$tabPaniers = $objDatabase->fxGetResults($sqlPaniers);
|
||
|
||
if ($tabPaniers != null) {
|
||
for ($intCtr = 1; $intCtr <= count($tabPaniers); $intCtr++) {
|
||
$sqlDelete = "DELETE FROM inscriptions_panier_produits_new WHERE ppn_id = " . intval($tabPaniers[$intCtr]['ppn_id']) . " AND no_panier = '" . $tabPaniers[$intCtr]['no_panier'] . "'";
|
||
$qryDelete = $objDatabase->fxQuery($sqlDelete);
|
||
}
|
||
}
|
||
|
||
fxcreer_log('Cron job pour vider les paniers'); |