[Fusionforge-commits] r8667 - trunk/gforge/plugins/mediawiki/cronjobs

Julien HEYMAN jheyman at libremir.placard.fr.eu.org
Thu Jan 14 11:53:10 CET 2010


Author: jheyman
Date: 2010-01-14 11:53:09 +0100 (Thu, 14 Jan 2010)
New Revision: 8667

Modified:
   trunk/gforge/plugins/mediawiki/cronjobs/create-wikis.sh
Log:
Set public or private mediawiki for each project

Modified: trunk/gforge/plugins/mediawiki/cronjobs/create-wikis.sh
===================================================================
--- trunk/gforge/plugins/mediawiki/cronjobs/create-wikis.sh	2010-01-13 14:19:35 UTC (rev 8666)
+++ trunk/gforge/plugins/mediawiki/cronjobs/create-wikis.sh	2010-01-14 10:53:09 UTC (rev 8667)
@@ -90,4 +90,30 @@
 
 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 \
+    | tail -n +3 \
+    | grep '^ ')
+
+tmp4=$(mktemp)
+# 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 \
+			| tail -n +3 \
+			| grep '^ ')
+
+	# Purge anonymous read
+	cat $wdprefix/$project/LocalSettings.php | grep -vi "\$wgGroupPermissions\['Members'\]\['read'\]" > $tmp4
+	cat $tmp4 > $wdprefix/$project/LocalSettings.php
+	cat $wdprefix/$project/LocalSettings.php | grep -vi "\$wgGroupPermissions\['\*'\]\['read'\]" > $tmp4
+	cat $tmp4 > $wdprefix/$project/LocalSettings.php
+
+	if [ $ispublic == '0' ] ; then
+		echo "\$wgGroupPermissions['Members']['read']    = true;" >> $wdprefix/$project/LocalSettings.php
+		echo "\$wgGroupPermissions['*']['read']          = false;" >> $wdprefix/$project/LocalSettings.php
+	fi
+
+done
+rm -f $tmp4
 rm -f $tmp3




More information about the Fusionforge-commits mailing list