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

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

parent d7a7ca69
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
...@@ -37,11 +37,7 @@ function deletePseudoNotice($id_notice) { ...@@ -37,11 +37,7 @@ function deletePseudoNotice($id_notice) {
// ---------------------------------------------------------------- // ----------------------------------------------------------------
// CMS // CMS
// ---------------------------------------------------------------- // ----------------------------------------------------------------
if ($phase > 0.1 and $phase < 0.202) if ($phase > 0.1 and $phase < 0.202) {
{
// init variables
if ($phase == 0.2)
{
unset($phase_data); unset($phase_data);
$phase_data["nombre"] = 0; $phase_data["nombre"] = 0;
$phase_data["timeStart"] = time(); $phase_data["timeStart"] = time();
...@@ -49,22 +45,8 @@ if ($phase > 0.1 and $phase < 0.202) ...@@ -49,22 +45,8 @@ if ($phase > 0.1 and $phase < 0.202)
setVariable("traitement_phase", "Pseudo-notices : CMS"); setVariable("traitement_phase", "Pseudo-notices : CMS");
$log->ecrire("<h4>Traitement des pseudo-notices</h4>"); $log->ecrire("<h4>Traitement des pseudo-notices</h4>");
$log->ecrire(BR . BR . '<span class="violet">Notices CMS :</span>' . BR); $log->ecrire(BR . BR . '<span class="violet">Notices CMS :</span>' . BR);
}
else print('<span class="violet">Notices CMS :</span>' . BR);
// suppression des notices et des exemplaires $phase = 0.2002;
$phase = 0.2001;
$items = fetchAll("select id_notice from notices where type_doc=8");
if ($items)
{
foreach ($items as $item)
{
if (!$mode_cron and $chrono->tempsPasse() > 10) sauveContexte();
$id_notice = $item["id_notice"];
deletePseudoNotice($id_notice);
}
}
$phase = 0.2002;
} }
...@@ -72,22 +54,37 @@ if ($phase > 0.1 and $phase < 0.202) ...@@ -72,22 +54,37 @@ if ($phase > 0.1 and $phase < 0.202)
// ---------------------------------------------------------------- // ----------------------------------------------------------------
// Articles CMS // Articles CMS
// ---------------------------------------------------------------- // ----------------------------------------------------------------
if ($phase == 0.2002) if ($phase == 0.2002) {
{ if ($phase_data["nombre"] and !$mode_cron)
if ($phase_data["nombre"] and !$mode_cron) print('<span class="violet">Notices CMS :</span>' . BR); print('<span class="violet">Notices CMS :</span>' . BR);
if (!$mode_cron and $chrono->tempsPasse() > 10) sauveContexte();
if (!$mode_cron and $chrono->tempsPasse() > 10)
sauveContexte();
$chrono->start(); $chrono->start();
$result = $sql->prepareListe("select * from cms_article where ID_ARTICLE >" . $phase_data["pointeur_reprise"] . " and INDEXATION=1 and STATUS NOT IN(1, 2, 4) order by ID_ARTICLE");
if ($result) while($articles = Class_Article::findAllBy(['where' => 'id_article >' . $phase_data["pointeur_reprise"],
{ 'order' => 'id_article',
while ($enreg = $sql->fetchNext($result)) 'limit' => 100
{ ])) {
if (!$mode_cron and $chrono->tempsPasse() > 10) sauveContexte(); foreach($articles as $article) {
$enreg["id_bib"] = $sql->fetchOne("select ID_SITE from cms_categorie where ID_CAT=" . $enreg["ID_CAT"]); if (!$mode_cron and $chrono->tempsPasse() > 10)
sauveContexte();
$phase_data["nombre"]++; $phase_data["nombre"]++;
$ret = $notice->traitePseudoNotice(8, $enreg);
tracePseudoNotice($ret, $enreg); $article->index();
$phase_data["pointeur_reprise"] = $enreg["ID_ARTICLE"]; $record = $article->getNotice();
$statut = $record
? ['statut' => 1,
'id_notice' => $record->getId(),
'unimarc' => $record->getUnimarc(),
'code_barres' => '',
'facettes' => $record->getFacettes()]
: ['statut' => 0, 'id_notice' => 0];
tracePseudoNotice($ret, $statut);
$phase_data["pointeur_reprise"] = $article->getId();
} }
} }
traceRecapPseudoNotices($phase_data); traceRecapPseudoNotices($phase_data);
...@@ -231,7 +228,6 @@ if ($phase == 0.7) { ...@@ -231,7 +228,6 @@ if ($phase == 0.7) {
$chrono->start(); $chrono->start();
while ( $albums = Class_Album::findAllBy(['where' => 'id > ' . $phase_data["pointeur_reprise"], while ( $albums = Class_Album::findAllBy(['where' => 'id > ' . $phase_data["pointeur_reprise"],
'visible' => true,
'order' => 'id', 'order' => 'id',
'limit' => 100]) ) { 'limit' => 100]) ) {
foreach($albums as $album) { foreach($albums as $album) {
...@@ -240,17 +236,17 @@ if ($phase == 0.7) { ...@@ -240,17 +236,17 @@ if ($phase == 0.7) {
$phase_data["nombre"]++; $phase_data["nombre"]++;
$album->index(); $album->index();
$notice = $album->getNotice(); $record = $album->getNotice();
$statut = $notice $statut = $record
? ['statut' => 0, 'id_notice' => 0] ? ['statut' => 1,
: ['statut' => 1, 'id_notice' => $record->getId(),
'id_notice' => $notice->getId(), 'unimarc' => $record->getUnimarc(),
'unimarc' => $notice->getUnimarc(), 'code_barres' => '',
'code_barres' => $notice->getCodeBarres(), 'facettes' => $record->getFacettes()]
'facettes' => $notice->getFacettes()]; : ['statut' => 0, 'id_notice' => 0];
tracePseudoNotice($ret, $statut); tracePseudoNotice($ret, $statut);
$phase_data["pointeur_reprise"] = $album->getId(); $phase_data["pointeur_reprise"] = $album->getId();
} }
} }
......
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