Update of /home/spip-cvs/spip/ecrire
In directory alan:/tmp/cvs-serv8812
Modified Files:
articles.php3 inc_mots.php3
Log Message:
reindexer les articles, breves, sites etc. quand on leur ajoute/supprime un mot-clé ou un auteur
Index: articles.php3
RCS file: /home/spip-cvs/spip/ecrire/articles.php3,v
retrieving revision 1.179
retrieving revision 1.180
diff -u -d -r1.179 -r1.180
--- articles.php3 6 Jul 2004 05:47:12 -0000 1.179
+++ articles.php3 9 Jul 2004 20:14:13 -0000 1.180
@@ -89,31 +89,9 @@
//
$suivi_edito = lire_meta("suivi_edito");
-$reindexer = false;
$ok_nouveau_statut = false;
-function terminer_changement_statut() {
- global $ok_nouveau_statut, $statut_nouv, $statut_ancien, $id_article, $reindexer;
-
- if ($ok_nouveau_statut) {
- calculer_rubriques();
- if ($statut_nouv == 'publie' AND $statut_ancien != $statut_nouv) {
- include_ecrire("inc_mail.php3");
- envoyer_mail_publication($id_article);
- }
- if ($statut_nouv == "prop" AND $statut_ancien != $statut_nouv AND $statut_ancien != 'publie') {
- include_ecrire("inc_mail.php3");
- envoyer_mail_proposition($id_article);
- }
- if ($statut_nouv == 'publie' AND $statut_nouv != $statut_ancien) $reindexer = true;
- }
-
- if ($reindexer AND (lire_meta('activer_moteur') == 'oui')) {
- include_ecrire ("inc_index.php3");
- indexer_article($id_article);
- }
-}
if ($statut_nouv) {
if (acces_rubrique($rubrique_article)) $ok_nouveau_statut = true;
@@ -134,17 +112,15 @@
$statut_article = $statut_nouv;
$flag_editable = (acces_rubrique($rubrique_article)
OR ($flag_auteur AND ($statut_article == 'prepa' OR $statut_article == 'prop')));
-
- if ($methode == 'image') {
- spip_log ("statut article $id_article : $statut_article");
- header ("Content-Type: image/gif");
- readfile ("img_pack/puce-".puce_statut($statut_article).".gif");
- terminer_changement_statut();
- exit;
- }
}
}
+// reindexer
+if ($ok_nouveau_statut AND $statut_nouv == 'publie' AND $statut_nouv != $statut_ancien AND (lire_meta('activer_moteur') == 'oui')) {
+ include_ecrire ("inc_index.php3");
+ indexer_article($id_article);
+}
+
if ($jour && $flag_editable) {
if ($annee == "0000") $mois = "00";
if ($mois == "00") $jour = "00";
@@ -256,8 +232,11 @@
$query = "UPDATE spip_articles SET surtitre=\"$surtitre\", titre=\"$titre\", soustitre=\"$soustitre\", $change_rubrique descriptif=\"$descriptif\", chapo=\"$chapo\", texte=\"$texte\", ps=\"$ps\", url_site=\"$url_site\", nom_site=\"$nom_site\" $add_extra WHERE id_article=$id_article";
$result = spip_query($query);
calculer_rubriques();
- if ($statut_article == 'publie') $reindexer = true;
-
+ if ($statut_article == 'publie' AND lire_meta('activer_moteur') == 'oui') {
+ include_ecrire ("inc_index.php3");
+ indexer_article($id_article);
+ }
+
// -- Experimental --
// Stockage des versions
if ($articles_versions) {
@@ -1047,12 +1026,20 @@
$query="INSERT INTO spip_auteurs_articles (id_auteur,id_article) VALUES ('$nouv_auteur','$id_article')";
$result=spip_query($query);
}
+
+ if (lire_meta('activer_moteur') == 'oui') {
+ include_ecrire ("inc_index.php3");
+ indexer_article($id_article);
+ }
}
if ($supp_auteur && $flag_editable) {
$query="DELETE FROM spip_auteurs_articles WHERE id_auteur='$supp_auteur' AND id_article='$id_article'";
$result=spip_query($query);
-
+ if (lire_meta('activer_moteur') == 'oui') {
+ include_ecrire ("inc_index.php3");
+ indexer_article($id_article);
+ }
}
@@ -1660,10 +1647,18 @@
fin_page();
-
-if ($ok_nouveau_statut || $reindexer) {
+// Taches lentes
+if ($ok_nouveau_statut) {
@flush();
- terminer_changement_statut();
+ calculer_rubriques();
+ if ($statut_nouv == 'publie' AND $statut_ancien != $statut_nouv) {
+ include_ecrire("inc_mail.php3");
+ envoyer_mail_publication($id_article);
+ }
+ if ($statut_nouv == "prop" AND $statut_ancien != $statut_nouv AND $statut_ancien != 'publie') {
+ include_ecrire("inc_mail.php3");
+ envoyer_mail_proposition($id_article);
+ }
}
?>
Index: inc_mots.php3
RCS file: /home/spip-cvs/spip/ecrire/inc_mots.php3,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- inc_mots.php3 6 Jul 2004 05:24:21 -0000 1.33
+++ inc_mots.php3 9 Jul 2004 20:14:13 -0000 1.34
@@ -77,23 +77,28 @@
global $flag_mots_ressemblants;
global $connect_statut, $options;
global $spip_lang_rtl, $spip_lang_right;
+
$select_groupe = $GLOBALS['select_groupe'];
if ($table == 'articles') {
$id_table = 'id_article';
+ $objet = 'article';
$url_base = "articles.php3?id_article=$id_objet";
}
else if ($table == 'breves') {
$id_table = 'id_breve';
+ $objet = 'breve';
$url_base = "breves_voir.php3?id_breve=$id_objet";
}
else if ($table == 'rubriques') {
$id_table = 'id_rubrique';
+ $objet = 'rubrique';
$url_base = "naviguer.php3?coll=$id_objet";
}
else if ($table == 'syndic') {
$id_table = 'id_syndic';
+ $objet = 'syndic';
$url_base = "sites.php3?id_syndic=$id_objet";
}
@@ -151,7 +156,7 @@
while ($row = spip_fetch_array($result)) {
$id_mot = $row['id_mot'];
$titre_mot = $row['titre'];
- $type_mot = $row['type'];
+ $type_mot = typo($row['type']);
$descriptif_mot = $row['descriptif'];
echo "<LI><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=2><B><FONT SIZE=3>".typo($titre_mot)."</FONT></B>";
@@ -172,7 +177,7 @@
while ($row = spip_fetch_array($result)) {
$id_mot = $row['id_mot'];
$titre_mot = $row['titre'];
- $type_mot = $row['type'];
+ $type_mot = typo($row['type']);
$descriptif_mot = $row['descriptif'];
echo "<LI><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=2><B><FONT SIZE=3>".typo($titre_mot)."</FONT></B>";
@@ -210,6 +215,7 @@
$result = spip_query($query);
}
}
+ $reindexer = true;
}
if ($supp_mot && $flag_editable) {
@@ -219,9 +225,15 @@
$mots_supp = " AND id_mot=$supp_mot";
$query = "DELETE FROM spip_mots_$table WHERE $id_table=$id_objet $mots_supp";
$result = spip_query($query);
+ $reindexer = true;
}
+ if ($reindexer AND lire_meta('activer_moteur') == 'oui') {
+ include_ecrire ("inc_index.php3");
+ marquer_indexer($objet, $id_objet);
+ }
+
//
// Afficher les mots-cles
//
@@ -247,7 +259,7 @@
$id_mot = $row['id_mot'];
$titre_mot = $row['titre'];
- $type_mot = $row['type'];
+ $type_mot = typo($row['type']);
$descriptif_mot = $row['descriptif'];
$id_groupe = $row['id_groupe'];