[evolvis-commits] r15275: Fix permission problems for wiki creation

mirabilos at evolvis.org mirabilos at evolvis.org
Mon Feb 28 23:52:46 CET 2011


Author: mirabilos
Date: 2011-02-28 23:52:46 +0100 (Mon, 28 Feb 2011)
New Revision: 15275

Modified:
   trunk/gforge_base/evolvisforge-5.1/gforge/deb-specific/install-db.sh
   trunk/gforge_base/evolvisforge-5.1/gforge/plugins/mediawiki/packaging/cron.d/plugin-mediawiki
Log:
Fix permission problems for wiki creation

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/deb-specific/install-db.sh
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/deb-specific/install-db.sh	2011-02-28 22:52:43 UTC (rev 15274)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/deb-specific/install-db.sh	2011-02-28 22:52:46 UTC (rev 15275)
@@ -210,6 +210,31 @@
 		fi
 	fi
 	
+        # Grant appropriate permissions to the database (for schema creation)
+	tmp1=$(mktemp /tmp/$pattern)
+	tmp2=$(mktemp /tmp/$pattern)
+	if su -s /bin/sh postgres -c "/usr/bin/psql template1" 1> $tmp1 2> $tmp2 <<EOF \
+	    && [ "$(tail -n +2 $tmp1 | head -1)" = 'GRANT' ] ; 
+SET LC_MESSAGES = 'C' ;
+GRANT CREATE ON DATABASE $db_name TO $db_user ;
+EOF
+	then
+  	    # Grant OK 
+	    echo -n ""
+	    rm -f $tmp1 $tmp2
+	else
+	    echo "Cannot grant permissions to PostgreSQL database...  This shouldn't have happened."
+	    echo "Maybe a problem in your PostgreSQL configuration?"
+	    echo "Please report a bug to the Debian bug tracking system"
+	    echo "Please include the following output:"
+	    echo "GRANT CREATE's STDOUT:"
+	    cat $tmp1
+	    echo "GRANT CREATE's STDERR:"
+	    cat $tmp2
+	    rm -f $tmp1 $tmp2
+	    exit 1
+	fi
+	
 	# Enable plpgsql language
 	if [ -f /usr/bin/createlang ]
 	then 

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/plugins/mediawiki/packaging/cron.d/plugin-mediawiki
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/plugins/mediawiki/packaging/cron.d/plugin-mediawiki	2011-02-28 22:52:43 UTC (rev 15274)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/plugins/mediawiki/packaging/cron.d/plugin-mediawiki	2011-02-28 22:52:46 UTC (rev 15275)
@@ -13,5 +13,5 @@
 #
 
 # Create new mediawikis four times an hour
-0,15,30,45 * * * * $FFUSER [ -x $MWCRON/create-wikis.php ] && $PHP $MWCRON/create-wikis.php
+0,15,30,45 * * * * root [ -x $MWCRON/create-wikis.php ] && $PHP $MWCRON/create-wikis.php
 1,16,31,46 * * * * root [ -x $MWCRON/create-imgdirs.php ] && $PHP $MWCRON/create-imagedirs.php



More information about the evolvis-commits mailing list