[gcompris] improved web site generation to avoid article id overwrites.



commit 1cd2a5d4b5bb9f2498cc0402b763425f3dedf692
Author: Bruno Coudoin <bruno coudoin free fr>
Date:   Tue Nov 20 01:15:53 2012 +0100

    improved web site generation to avoid article id overwrites.

 docs/README                 |    2 +-
 docs/gcompris2spip.pl       |   10 ++++++++--
 docs/get_last_article_id.sh |    4 ++++
 3 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/docs/README b/docs/README
index 0705324..666f965 100644
--- a/docs/README
+++ b/docs/README
@@ -6,7 +6,7 @@
 # Create the board menus
 ./create_boards_menu.sh
 # Create the screenshots articles all_article.spip
-./gcompris2spip.pl
+./gcompris2spip.pl `get_last_article_id.sh dump2.xml`
 # Include all_article.spip in dump2.xml
 sed -i "s:</SPIP>::" dump2.xml
 cat all_article.spip >> dump2.xml
diff --git a/docs/gcompris2spip.pl b/docs/gcompris2spip.pl
index e86bc12..062b7fe 100755
--- a/docs/gcompris2spip.pl
+++ b/docs/gcompris2spip.pl
@@ -290,6 +290,13 @@ sub spip_cleanup {
   return $output;
 }
 
+# Read the last article id from the command line
+my $num_args = $#ARGV + 1;
+if ($num_args != 1) {
+  print "\nUsage: gcompris2spip.pl last_article_id\n";
+  exit;
+}
+my $first_article = $ARGV[0] + 1;
 
 #-------------------------------------------------------------------------------
 # Initialisation
@@ -328,8 +335,7 @@ my $output_file = "all_article.spip";
 unlink $tmp_file;
 unlink $output_file;
 
-my $first_article = 999;
-my $article_id    = $first_article;
+my $article_id    = $first_article + 1;
 
 
 
diff --git a/docs/get_last_article_id.sh b/docs/get_last_article_id.sh
new file mode 100755
index 0000000..a006db8
--- /dev/null
+++ b/docs/get_last_article_id.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+file=$1
+grep "<id_article>" $file | cut -c13- | sort -un | tail -1 | sed "s:</id_article>::"
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]