[Fusionforge-commits] r11058 - in branches/Branch_5_0/gforge: debian plugins/mediawiki/bin plugins/mediawiki/cronjobs

Roland Mas lolando at libremir.placard.fr.eu.org
Tue Oct 19 20:14:41 CEST 2010


Author: lolando
Date: 2010-10-19 20:14:40 +0200 (Tue, 19 Oct 2010)
New Revision: 11058

Modified:
   branches/Branch_5_0/gforge/debian/changelog
   branches/Branch_5_0/gforge/plugins/mediawiki/bin/drop-wiki.sh
   branches/Branch_5_0/gforge/plugins/mediawiki/cronjobs/create-wikis.sh
Log:
Fixed Mediawiki creation script so it uses the appropriate database and user

Modified: branches/Branch_5_0/gforge/debian/changelog
===================================================================
--- branches/Branch_5_0/gforge/debian/changelog	2010-10-19 16:33:19 UTC (rev 11057)
+++ branches/Branch_5_0/gforge/debian/changelog	2010-10-19 18:14:40 UTC (rev 11058)
@@ -1,3 +1,10 @@
+fusionforge (5.0.2-2+) unstable; urgency=low
+
+  * Fixed Mediawiki creation script so it uses the appropriate database
+    and user (closes: #600605).
+
+ -- Roland Mas <lolando at debian.org>  Tue, 19 Oct 2010 20:13:36 +0200
+
 fusionforge (5.0.2-2) unstable; urgency=low
 
   * Ship a /usr/share/gforge/plugins/ directory in gforge-web-apache2

Modified: branches/Branch_5_0/gforge/plugins/mediawiki/bin/drop-wiki.sh
===================================================================
--- branches/Branch_5_0/gforge/plugins/mediawiki/bin/drop-wiki.sh	2010-10-19 16:33:19 UTC (rev 11057)
+++ branches/Branch_5_0/gforge/plugins/mediawiki/bin/drop-wiki.sh	2010-10-19 18:14:40 UTC (rev 11058)
@@ -13,6 +13,7 @@
 fi
 
 schema=$(echo plugin_mediawiki_$project | sed s/-/_/g)
-su -s /bin/sh postgres -c "/usr/bin/psql gforge" <<-EOF
+dbname=$(perl -e'require "/etc/gforge/local.pl"; print "$sys_dbname\n"')
+su -s /bin/sh postgres -c "/usr/bin/psql $dbname" <<-EOF
 DROP SCHEMA $schema CASCADE;
 EOF

Modified: branches/Branch_5_0/gforge/plugins/mediawiki/cronjobs/create-wikis.sh
===================================================================
--- branches/Branch_5_0/gforge/plugins/mediawiki/cronjobs/create-wikis.sh	2010-10-19 16:33:19 UTC (rev 11057)
+++ branches/Branch_5_0/gforge/plugins/mediawiki/cronjobs/create-wikis.sh	2010-10-19 18:14:40 UTC (rev 11058)
@@ -2,9 +2,11 @@
 
 tmp3=$(mktemp)
 perl -e'require "/etc/gforge/local.pl"; print "*:*:$sys_dbname:$sys_dbuser:$sys_dbpasswd\n"' > $tmp3
+dbuser=$(perl -e'require "/etc/gforge/local.pl"; print "$sys_dbuser\n"')
+dbname=$(perl -e'require "/etc/gforge/local.pl"; print "$sys_dbname\n"')
 
 projects=$(echo "SELECT g.unix_group_name from groups g, group_plugin gp, plugins p where g.group_id = gp.group_id and gp.plugin_id = p.plugin_id and p.plugin_name = 'mediawiki' ;" \
-    | PGPASSFILE=$tmp3 /usr/bin/psql -U gforge gforge \
+    | PGPASSFILE=$tmp3 /usr/bin/psql -U $dbuser $dbname \
     | tail -n +3 \
     | grep '^ ')
 
@@ -53,11 +55,11 @@
     tmp1=$(mktemp)
     tmp2=$(mktemp)
 
-    if su -s /bin/sh postgres -c "/usr/bin/psql gforge" 1> $tmp1 2> $tmp2 <<-EOF \
+    if su -s /bin/sh postgres -c "/usr/bin/psql $dbname" 1> $tmp1 2> $tmp2 <<-EOF \
         && [ "$(tail -n +2 $tmp1 | head -1)" = 'CREATE SCHEMA' ] ;
 SET LC_MESSAGES = 'C' ;
 CREATE SCHEMA $schema ;
-ALTER SCHEMA $schema OWNER TO gforge;
+ALTER SCHEMA $schema OWNER TO $dbuser;
 EOF
     then
         rm -f $tmp1 $tmp2
@@ -73,7 +75,7 @@
     tmp1=$(mktemp)
     tmp2=$(mktemp)
 
-    if PGPASSFILE=$tmp3 /usr/bin/psql -U gforge gforge 1> $tmp1 2> $tmp2 <<-EOF \
+    if PGPASSFILE=$tmp3 /usr/bin/psql -U $dbuser $dbname 1> $tmp1 2> $tmp2 <<-EOF \
         && true || [ "$(tail -1 $tmp1)" = 'COMMIT' ] ;
 SET search_path = "$schema" ;
 \i /usr/share/mediawiki/maintenance/postgres/tables.sql
@@ -94,7 +96,7 @@
 done
 
 projects=$(echo "SELECT g.unix_group_name from groups g, group_plugin gp, plugins p where g.group_id = gp.group_id and gp.plugin_id = p.plugin_id and p.plugin_name = 'mediawiki' ;" \
-    | PGPASSFILE=$tmp3 /usr/bin/psql -U gforge gforge \
+    | PGPASSFILE=$tmp3 /usr/bin/psql -U $dbuser $dbname \
     | tail -n +3 \
     | grep '^ ')
 
@@ -102,7 +104,7 @@
 # Disable read anonymous if project is private
 for project in $projects ; do
 	ispublic=$(echo "SELECT is_public from groups where unix_group_name = '${project}' ;" \
-	    | PGPASSFILE=$tmp3 /usr/bin/psql -U gforge gforge \
+	    | PGPASSFILE=$tmp3 /usr/bin/psql -U $dbuser $dbname \
 			| tail -n +3 \
 			| grep '^ ')
 




More information about the Fusionforge-commits mailing list