Compare commits

...

2 Commits

Author SHA1 Message Date
cam.lafit f490d9a167 La mise à la poubelle ne doit fonctionner que si le mode orphelin est inactif 2 years ago
cam.lafit 3f037b84ed Branch '/branches/evenements-orphelins' created from /trunk:113126 2 years ago
  1. 21
      agenda_pipelines.php

21
agenda_pipelines.php

@ -103,15 +103,18 @@ function agenda_optimiser_base_disparus($flux) {
# passer a la poubelle
# les evenements lies a un article inexistant (et orphelin interdit)
$where = lire_config('agenda/autoriser_orphelins') ? '' : 'articles.id_article IS NULL';
$res = sql_select(
'DISTINCT evenements.id_article',
'spip_evenements AS evenements LEFT JOIN spip_articles AS articles ON evenements.id_article=articles.id_article',
$where
);
while ($row = sql_fetch($res)) {
sql_updateq('spip_evenements', array('statut'=>'poubelle'), 'id_article='.$row['id_article']);
}
if (lire_config('agenda/autoriser_orphelins')) {
$where = 'articles.id_article IS NULL';
$res = sql_select(
'DISTINCT evenements.id_article',
'spip_evenements AS evenements LEFT JOIN spip_articles AS articles ON evenements.id_article=articles.id_article',
$where
);
while ($row = sql_fetch($res)) {
sql_updateq('spip_evenements', array('statut'=>'poubelle'), 'id_article='.$row['id_article']);
}
}
// Evenements a la poubelle
sql_delete('spip_evenements', "statut='poubelle' AND maj < ".$flux['args']['date']);

Loading…
Cancel
Save