From 255a86c376f21965d3dc623d83aa27078fd51a0a Mon Sep 17 00:00:00 2001
From: Antoine Pitrou <pitrou@free.fr>
Date: Sat, 13 Apr 2002 16:47:17 +0000
Subject: [PATCH] Correction du bug upgrade document (1.3->1.4).

---
 ecrire/inc_base.php3 | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/ecrire/inc_base.php3 b/ecrire/inc_base.php3
index 177d9310df..81f7bf2ec0 100644
--- a/ecrire/inc_base.php3
+++ b/ecrire/inc_base.php3
@@ -724,7 +724,7 @@ function maj_base() {
 			$images = $row['images'];
 			$images = explode(",", $images);
 			reset($images);
-			$replace = 'texte';
+			$replace = '_orig_';
 			while (list (, $val) = each($images)) {
 				$image = explode("|", $val);
 				$fichier = $image[0];
@@ -741,7 +741,14 @@ function maj_base() {
 				mysql_query("INSERT spip_documents_articles (id_document, id_article) VALUES ($id_document, $id_article)");
 				$replace = "REPLACE($replace, '<IMG$num_img|', '<IM_$id_document|')";
 			}
-			$query = "UPDATE spip_articles SET texte=REPLACE($replace, '<IM_', '<IMG') WHERE id_article=$id_article";
+			$replace = "REPLACE($replace, '<IM_', '<IMG')";
+			$replace_chapo = ereg_replace('_orig_', 'chapo', $replace);
+			$replace_descriptif = ereg_replace('_orig_', 'descriptif', $replace);
+			$replace_texte = ereg_replace('_orig_', 'texte', $replace);
+			$replace_ps = ereg_replace('_orig_', 'ps', $replace);
+			$query = "UPDATE spip_articles ".
+				"SET chapo=$replace_chapo, descriptif=$replace_descriptif, texte=$replace_texte, ps=$replace_ps ".
+				"WHERE id_article=$id_article";
 			mysql_query($query);
 		}
 		mysql_query("ALTER TABLE spip_articles DROP images");
-- 
GitLab