Skip to content
Snippets Groups Projects
Commit d7a7ca69 authored by Laurent's avatar Laurent Committed by Patrick Barroca
Browse files

When cosmogramme index albums, does not delete records if only update is needed

parent 5fb650ba
Branches
Tags
4 merge requests!1132Hotline#29412 images des articles dans le resultat de recherche,!1120Master,!1071Dev #21694 stop delete notice,!1063Dev #21694 stop delete notice
...@@ -209,61 +209,51 @@ if ($phase == 0.5) ...@@ -209,61 +209,51 @@ if ($phase == 0.5)
// ---------------------------------------------------------------- // ----------------------------------------------------------------
if ($phase < 0.7) if ($phase < 0.7) {
{ unset($phase_data);
// init variables $phase_data["nombre"] = 0;
if ($phase == 0.6) $phase_data["timeStart"] = time();
{ $phase_data["pointeur_reprise"] = 0;
unset($phase_data); setVariable("traitement_phase", "Pseudo-notices : RESSOURCES NUMERIQUES :");
$phase_data["nombre"] = 0; $log->ecrire('<span class="violet">Notices RESSOURCES NUMERIQUES :</span>' . BR);
$phase_data["timeStart"] = time();
$phase_data["pointeur_reprise"] = 0;
setVariable("traitement_phase", "Pseudo-notices : RESSOURCES NUMERIQUES :");
$log->ecrire('<span class="violet">Notices RESSOURCES NUMERIQUES :</span>' . BR);
}
else print('<span class="violet">Notices RESSOURCES NUMERIQUES : suppressions</span>' . BR);
// suppression des notices et des exemplaires $phase = 0.7;
$phase = 0.61;
$items = fetchAll("select id_notice from notices where type_doc>99");
if ($items)
{
foreach ($items as $item)
{
if (!$mode_cron and $chrono->tempsPasse() > 10) sauveContexte();
$id_notice = $item["id_notice"];
deletePseudoNotice($id_notice);
}
}
$phase = 0.7;
} }
if ($phase == 0.7)
{ if ($phase == 0.7) {
if ($phase_data["nombre"] and !$mode_cron) if ($phase_data["nombre"] and !$mode_cron)
print('<span class="violet">Notices RESSOURCES NUMERIQUES : ajouts</span>' . BR); print('<span class="violet">Notices RESSOURCES NUMERIQUES : mise à jour</span>' . BR);
if (!$mode_cron and $chrono->tempsPasse() > 10) if (!$mode_cron and $chrono->tempsPasse() > 10)
sauveContexte(); sauveContexte();
$chrono->start(); $chrono->start();
$result = $sql->prepareListe("select * from album where id >" . $phase_data["pointeur_reprise"] . " and visible=true order by id");
if ($result)
{
while ($enreg = $sql->fetchNext($result))
{
if (!$mode_cron and $chrono->tempsPasse() > 10) sauveContexte();
$enreg["id_bib"] = $sql->fetchOne("select site_id from album_categorie where id=" . $enreg["cat_id"]);
$phase_data["nombre"]++;
if(!$enreg["type_doc_id"]) $enreg["type_doc_id"]=100;
$ret = $notice->traitePseudoNotice($enreg["type_doc_id"], $enreg);
tracePseudoNotice($ret, $enreg);
$phase_data["pointeur_reprise"] = $enreg["id"];
Class_Album::clearCache(); while ( $albums = Class_Album::findAllBy(['where' => 'id > ' . $phase_data["pointeur_reprise"],
Class_AlbumRessource::clearCache(); 'visible' => true,
Class_Notice::clearCache(); 'order' => 'id',
Class_Exemplaire::clearCache(); 'limit' => 100]) ) {
} foreach($albums as $album) {
} if (!$mode_cron and $chrono->tempsPasse() > 10) sauveContexte();
$phase_data["nombre"]++;
$album->index();
$notice = $album->getNotice();
$statut = $notice
? ['statut' => 0, 'id_notice' => 0]
: ['statut' => 1,
'id_notice' => $notice->getId(),
'unimarc' => $notice->getUnimarc(),
'code_barres' => $notice->getCodeBarres(),
'facettes' => $notice->getFacettes()];
tracePseudoNotice($ret, $statut);
$phase_data["pointeur_reprise"] = $album->getId();
}
}
traceRecapPseudoNotices($phase_data); traceRecapPseudoNotices($phase_data);
$phase = 1; $phase = 1;
} }
......
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