diff --git a/ecrire/inc_sites.php3 b/ecrire/inc_sites.php3 index 375ad9a9d605dd67d38cc198e18cd51bae1b3261..4de0b01fc8af80cc5013d3efa87be795abcb4059 100644 --- a/ecrire/inc_sites.php3 +++ b/ecrire/inc_sites.php3 @@ -656,7 +656,10 @@ function syndic_a_jour($now_id_syndic, $statut = 'off') { // Section critique : n'autoriser qu'une seule syndication // simultanee pour un site donne - if (!spip_get_lock("syndication $url_syndic")) return; + if (!spip_get_lock("syndication $url_syndic")) { + spip_log("lock pour $url_syndic"); + return; + } spip_query("UPDATE spip_syndic SET syndication='$statut', date_syndic=NOW() WHERE id_syndic='$now_id_syndic'"); @@ -788,7 +791,7 @@ function afficher_sites($titre_table, $requete) { $title = _T('info_site_refuse'); break; } - if ($syndication == "off") { + if ($syndication == 'off' OR $syndication == 'sus') { $puce = 'puce-orange-anim.gif'; $title = _T('info_panne_site_syndique'); } @@ -817,17 +820,17 @@ function afficher_sites($titre_table, $requete) { $s = ""; //echo "<td class='arial1' align='right'> "; - if ($syndication == "off") { + if ($syndication == 'off' OR $syndication == 'sus') { $s .= "<font color='red'>"._T('info_probleme_grave')." </font>"; } - if ($syndication == "oui" or $syndication == "off"){ + if ($syndication == "oui" or $syndication == "off" OR $syndication == 'sus'){ $s .= "<font color='red'>"._T('info_syndication')."</font>"; } $vals[] = $s; //echo "</td>"; //echo "<td class='arial1'>"; $s = ""; - if ($syndication == "oui" OR $syndication == "off") { + if ($syndication == "oui" OR $syndication == "off" OR $syndication == "sus") { $result_art = spip_query("SELECT COUNT(*) FROM spip_syndic_articles WHERE id_syndic='$id_syndic'"); list($total_art) = spip_fetch_array($result_art); $s .= " $total_art "._T('info_syndication_articles'); @@ -1019,11 +1022,15 @@ function afficher_syndic_articles($titre_table, $requete, $afficher_site = false function executer_une_syndication() { $id_syndic = 0; - if ($row = spip_fetch_array(spip_query("SELECT * FROM spip_syndic WHERE syndication='sus' AND statut='publie' AND date_syndic < DATE_SUB(NOW(), INTERVAL 24 HOUR) ORDER BY date_syndic LIMIT 0,1"))) { + + // On va tenter un site 'sus' ou 'off' de plus de 24h, et le passer en 'off' + // s'il echoue + if ($row = spip_fetch_array(spip_query("SELECT * FROM spip_syndic WHERE syndication IN ('sus','off') AND statut='publie' AND date_syndic < DATE_SUB(NOW(), INTERVAL 24 HOUR) ORDER BY date_syndic LIMIT 0,1"))) { $id_syndic = $row["id_syndic"]; - syndic_a_jour($id_syndic); + syndic_a_jour($id_syndic, 'off'); } + // Et un site 'oui' de plus de 2 heures, qui passe en 'sus' s'il echoue if ($row = spip_fetch_array(spip_query("SELECT * FROM spip_syndic WHERE syndication='oui' AND statut='publie' AND date_syndic < DATE_SUB(NOW(), INTERVAL 2 HOUR) ORDER BY date_syndic LIMIT 0,1"))) { $id_syndic = $row["id_syndic"]; syndic_a_jour($id_syndic, 'sus'); diff --git a/ecrire/index.php3 b/ecrire/index.php3 index b1937272a8fb30474f30a9a0c0d289d21a953c87..5765201b482bfd01a4aa60d8a474f9fc8e94c3f2 100644 --- a/ecrire/index.php3 +++ b/ecrire/index.php3 @@ -375,7 +375,7 @@ else // if (lire_meta('activer_syndic') != 'non' AND $connect_statut == '0minirezo' AND $connect_toutes_rubriques) { include_ecrire("inc_sites.php3"); - afficher_sites(afficher_plus('sites_tous.php3')._T('avis_sites_syndiques_probleme'), "SELECT * FROM spip_syndic WHERE syndication='off' AND statut='publie' ORDER BY nom_site"); + afficher_sites(afficher_plus('sites_tous.php3')._T('avis_sites_syndiques_probleme'), "SELECT * FROM spip_syndic WHERE (syndication='off' OR syndication='sus') AND statut='publie' ORDER BY nom_site"); } // Les articles syndiques en attente de validation diff --git a/ecrire/naviguer.php3 b/ecrire/naviguer.php3 index e2e74086a0059f4bc418502c44e24e486537e57a..a07c156802ffa37fd9eabc6f1aa912f633a7650e 100644 --- a/ecrire/naviguer.php3 +++ b/ecrire/naviguer.php3 @@ -332,7 +332,7 @@ if (!$relief AND lire_meta('activer_syndic') != 'non') { } if (!$relief AND lire_meta('activer_syndic') != 'non' AND $connect_statut == '0minirezo' AND $connect_toutes_rubriques) { - $query = "SELECT id_syndic FROM spip_syndic WHERE id_rubrique='$id_rubrique' AND syndication='off' LIMIT 0,1"; + $query = "SELECT id_syndic FROM spip_syndic WHERE id_rubrique='$id_rubrique' AND (syndication='off' OR syndication='sus') LIMIT 0,1"; $result = spip_query($query); $relief = (spip_num_rows($result) > 0); } @@ -369,7 +369,7 @@ if ($relief) { if (lire_meta('activer_syndic') != 'non' AND $connect_statut == '0minirezo' AND $connect_toutes_rubriques) { include_ecrire("inc_sites.php3"); afficher_sites(_T('avis_sites_syndiques_probleme'), - "SELECT * FROM spip_syndic WHERE id_rubrique='$id_rubrique' AND syndication='off' AND statut='publie' ORDER BY nom_site"); + "SELECT * FROM spip_syndic WHERE id_rubrique='$id_rubrique' AND (syndication='off' OR syndication='sus') AND statut='publie' ORDER BY nom_site"); } // Les articles syndiques en attente de validation @@ -424,7 +424,7 @@ if ($id_parent == "0" AND $id_rubrique != "0" AND $activer_breves!="non"){ if (lire_meta("activer_sites") == 'oui') { include_ecrire("inc_sites.php3"); - afficher_sites(_T('titre_sites_references_rubrique'), "SELECT * FROM spip_syndic WHERE id_rubrique='$id_rubrique' AND statut!='refuse' AND statut != 'prop' AND syndication != 'off' ORDER BY nom_site"); + afficher_sites(_T('titre_sites_references_rubrique'), "SELECT * FROM spip_syndic WHERE id_rubrique='$id_rubrique' AND statut!='refuse' AND statut != 'prop' AND syndication NOT IN ('off','sus') ORDER BY nom_site"); $proposer_sites=lire_meta("proposer_sites"); if ($id_rubrique > 0 AND ($flag_editable OR $proposer_sites > 0)) { diff --git a/ecrire/sites.php3 b/ecrire/sites.php3 index af3f99f83f3070f04cee5f51ceb67d88e44434d0..57592f962740d9e1115f1613f3a169cae11e4048 100644 --- a/ecrire/sites.php3 +++ b/ecrire/sites.php3 @@ -269,7 +269,7 @@ debut_droite(); debut_cadre_relief("site-24.gif"); echo "<center>"; -if ($syndication == 'off') { +if ($syndication == 'off' OR $syndication == 'sus') { $logo_statut = "puce-orange-anim.gif"; } else if ($statut == 'publie') { @@ -367,7 +367,7 @@ if ($syndication == "oui" OR $syndication == "off" OR $syndication == "sus") { if ($erreur_syndic) echo "<p><font color=red><b>$erreur_syndic</b></font>"; - if ($syndication == "off") { + if ($syndication == "off" OR $syndication=="sus") { debut_boite_info(); echo _T('avis_site_syndique_probleme', array('url_syndic' => $url_syndic)); echo "<center><b>";