Skip to content
Snippets Groups Projects
Commit 6727769e authored by jgaimard's avatar jgaimard
Browse files

integration selective

parent 1c89b8f3
Branches
Tags
No related merge requests found
......@@ -26,10 +26,12 @@
error_reporting(E_ERROR | E_PARSE);
// Arguments de la commande en mode cron
if ($argc == 3)
if ($argc == 3 or $argc==4)
{
$user = $argv[1];
$passe = $argv[2];
$cron_a_traiter=$argv[3];
if(!$cron_a_traiter) $cron_a_traiter="all";
$mode_cron = true;
}
include("_init_frame.php");
......@@ -92,6 +94,11 @@ else
$log->ecrire("Date : " . date("d-m-Y") . BR);
$log->ecrire("Heure : " . date("G:i:s") . BR);
if ($mode_cron == true) $log->ecrire("Mode : automatique (cron)" . BR); else $log->ecrire("Mode : manuel" . BR);
if($cron_a_traiter > '')
{
$txt=array("all"=>"tous types d'imports","tot"=>"imports totaux uniquement","inc"=>"imports incrementiels uniquement");
$log->ecrire("Type d'import : ".$txt[$cron_a_traiter] . BR);
}
// controle du trigger de maj des notices
@sqlExecute('DROP TRIGGER datemaj_notices_update');
......@@ -117,6 +124,30 @@ else
}
setVariable("integration_date", $date);
$transfert->supprimerEntetesPergame();
// ----------------------------------------------------------------
// controle si on doit sortir en cas d'import total
// ----------------------------------------------------------------
if($cron_a_traiter > '' and $cron_a_traiter!="all")
{
$controle=fetchOne("select count(*) from integrations,profil_donnees
Where integrations.profil=profil_donnees.id_profil
and traite='non'
and type_operation=2
and type_fichier=0");
if($cron_a_traiter=="inc" and $controle>0)
{
$erreur="Il y a un import total à traiter et le cron demande de ne traiter que les imports incrementiels";
$log->ecrire(BR . BR . '<span class="rouge">' . $erreur . ' : Abandon du traitement !</span><br>');
exit;
}
if($cron_a_traiter=="tot" and $controle==0)
{
$erreur="Il n'y aucun import total à traiter et le cron demande de ne traiter que les imports totaux";
$log->ecrire(BR . BR . '<span class="rouge">' . $erreur . ' : Abandon du traitement !</span><br>');
exit;
}
}
// ----------------------------------------------------------------
// Test blocage de la base
......@@ -865,19 +896,21 @@ function traceSuccinte($ret)
// ----------------------------------------------------------------
function sauveContexte()
{
global $cron_a_traiter;
global $timeStart, $chrono_fichier, $chrono100notices;
global $nb_notices, $compteur;
global $phase, $phase_data;
$timeStart_fichier = $chrono_fichier->timeStart;
$timeStart_100notices = $chrono100notices->timeStart;
$data = compact("nb_notices", "compteur", "timeStart", "timeStart_fichier", "timeStart_100notices", "phase", "phase_data");
$data = compact("cron_a_traiter","nb_notices", "compteur", "timeStart", "timeStart_fichier", "timeStart_100notices", "phase", "phase_data");
$_SESSION["reprise"] = $data;
redirection("integre_traite_main.php?reprise=oui");
}
function restaureContext()
{
global $cron_a_traiter;
global $timeStart, $chrono_fichier, $chrono100notices;
global $nb_notices, $compteur;
global $phase, $phase_data;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment