[Fusionforge-commits] r13127 - in branches/Branch_5_1/src: . db deb-specific debian/dsf-in packaging/install utils utils/fixscripts

Roland Mas lolando at fusionforge.org
Thu Apr 14 16:20:33 CEST 2011


Author: lolando
Date: 2011-04-14 16:20:32 +0200 (Thu, 14 Apr 2011)
New Revision: 13127

Added:
   branches/Branch_5_1/src/db/20110414-move-news-forums-to-own-project.sql
   branches/Branch_5_1/src/utils/normalize_roles.php
Removed:
   branches/Branch_5_1/src/utils/fixscripts/normalize_roles.php
Modified:
   branches/Branch_5_1/src/deb-specific/db-upgrade.pl
   branches/Branch_5_1/src/debian/dsf-in/db-postgresql.postinst.dsfh-in
   branches/Branch_5_1/src/fusionforge.spec
   branches/Branch_5_1/src/install.sh
   branches/Branch_5_1/src/packaging/install/db-postgresql
Log:
Added upgrade path to move news-forums to their own groups and fix permissions afterwards

Added: branches/Branch_5_1/src/db/20110414-move-news-forums-to-own-project.sql
===================================================================
--- branches/Branch_5_1/src/db/20110414-move-news-forums-to-own-project.sql	                        (rev 0)
+++ branches/Branch_5_1/src/db/20110414-move-news-forums-to-own-project.sql	2011-04-14 14:20:32 UTC (rev 13127)
@@ -0,0 +1 @@
+UPDATE forum_group_list SET group_id=(SELECT MIN(nb.group_id) FROM news_bytes nb WHERE forum_group_list.group_forum_id=nb.forum_id) WHERE group_forum_id IN (SELECT forum_id FROM news_bytes);

Modified: branches/Branch_5_1/src/deb-specific/db-upgrade.pl
===================================================================
--- branches/Branch_5_1/src/deb-specific/db-upgrade.pl	2011-04-14 13:56:12 UTC (rev 13126)
+++ branches/Branch_5_1/src/deb-specific/db-upgrade.pl	2011-04-14 14:20:32 UTC (rev 13127)
@@ -1945,6 +1945,7 @@
     &update_with_sql("20110110-pw-size","5.0.51-11");
     &update_with_sql("20110405-forum_attachment_fix-bug284","5.0.51-12");
     &update_with_sql("20110408-anonymous-read-news","5.0.51-13");
+    &update_with_sql("20110411-move-news-forums-to-own-project","5.0.51-14");
 
     ########################### INSERT HERE #################################
 

Modified: branches/Branch_5_1/src/debian/dsf-in/db-postgresql.postinst.dsfh-in
===================================================================
--- branches/Branch_5_1/src/debian/dsf-in/db-postgresql.postinst.dsfh-in	2011-04-14 13:56:12 UTC (rev 13126)
+++ branches/Branch_5_1/src/debian/dsf-in/db-postgresql.postinst.dsfh-in	2011-04-14 14:20:32 UTC (rev 13127)
@@ -87,6 +87,11 @@
 	    exit $v
 	fi
 
+	if dpkg --compare-versions $2 lt 5.1-1 ; then
+            echo "Normalizing all roles and permissions"
+            PATH=$PATH:/usr/share/gforge/bin normalize_roles.php
+        fi
+
     ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)

Modified: branches/Branch_5_1/src/fusionforge.spec
===================================================================
--- branches/Branch_5_1/src/fusionforge.spec	2011-04-14 13:56:12 UTC (rev 13126)
+++ branches/Branch_5_1/src/fusionforge.spec	2011-04-14 14:20:32 UTC (rev 13127)
@@ -578,6 +578,7 @@
 	fi
 
 	/usr/bin/php %{FORGE_DIR}/db/upgrade-db.php >>/var/log/%{name}-install.log 2>&1
+	/usr/bin/php %{FORGE_DIR}/utils/normalize_roles.php >>/var/log/%{name}-install.log 2>&1
 
 	HOSTNAME=`hostname -f`
 	%{__sed} -i -e "s!gforge.company.com!$HOSTNAME!g" %{FORGE_CONF_DIR}/local.inc

Modified: branches/Branch_5_1/src/install.sh
===================================================================
--- branches/Branch_5_1/src/install.sh	2011-04-14 13:56:12 UTC (rev 13126)
+++ branches/Branch_5_1/src/install.sh	2011-04-14 14:20:32 UTC (rev 13127)
@@ -94,6 +94,7 @@
 		service crond reload
 	else
 		php db/upgrade-db.php
+		php utils/normalize_roles.php
 	fi
 elif [ "$type" = "suse" ]
 then

Modified: branches/Branch_5_1/src/packaging/install/db-postgresql
===================================================================
--- branches/Branch_5_1/src/packaging/install/db-postgresql	2011-04-14 13:56:12 UTC (rev 13126)
+++ branches/Branch_5_1/src/packaging/install/db-postgresql	2011-04-14 14:20:32 UTC (rev 13127)
@@ -66,6 +66,6 @@
 utils/inject-groups.php usr/share/@OLDPACKAGE@/bin/
 utils/inject-files.php usr/share/@OLDPACKAGE@/bin/
 #
-utils/fixscripts/normalize_roles.php	usr/share/@OLDPACKAGE@/bin/
+utils/normalize_roles.php	usr/share/@OLDPACKAGE@/bin/
 utils/fixscripts/populate_template_project.php	usr/share/@OLDPACKAGE@/bin/
 utils/forge_set_password                usr/share/@OLDPACKAGE@/bin/

Deleted: branches/Branch_5_1/src/utils/fixscripts/normalize_roles.php
===================================================================
--- branches/Branch_5_1/src/utils/fixscripts/normalize_roles.php	2011-04-14 13:56:12 UTC (rev 13126)
+++ branches/Branch_5_1/src/utils/fixscripts/normalize_roles.php	2011-04-14 14:20:32 UTC (rev 13127)
@@ -1,47 +0,0 @@
-#! /usr/bin/php
-<?php
-/**
- * Copyright 2010 Roland Mas
- *
- * This file is part of FusionForge.
- *
- * FusionForge is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * FusionForge is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with FusionForge; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  US
- */
-
-require (dirname(__FILE__).'/../www/env.inc.php');
-require_once $gfcommon.'include/pre.php';
-			 
-$err='';
-
-// Plugins subsystem
-require_once('common/include/Plugin.class.php') ;
-require_once('common/include/PluginManager.class.php') ;
-
-setup_plugin_manager () ;
-session_set_admin () ;
-
-$res = db_query_params ('SELECT role_id FROM pfo_role ORDER BY role_id',
-			array ());
-
-$rows=db_numrows($res);
-
-for ($i=0; $i<$rows; $i++) {
-	$role = RBACEngine::getInstance()->getRoleById (db_result($res,$i,'role_id')) ;
-	echo "Normalizing role ".$role->getDisplayableName()."\n" ;
-	
-	$role->normalizeData() ;
-}
-
-?>

Copied: branches/Branch_5_1/src/utils/normalize_roles.php (from rev 13125, branches/Branch_5_1/src/utils/fixscripts/normalize_roles.php)
===================================================================
--- branches/Branch_5_1/src/utils/normalize_roles.php	                        (rev 0)
+++ branches/Branch_5_1/src/utils/normalize_roles.php	2011-04-14 14:20:32 UTC (rev 13127)
@@ -0,0 +1,47 @@
+#! /usr/bin/php
+<?php
+/**
+ * Copyright 2010 Roland Mas
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  US
+ */
+
+require (dirname(__FILE__).'/../www/env.inc.php');
+require_once $gfcommon.'include/pre.php';
+			 
+$err='';
+
+// Plugins subsystem
+require_once('common/include/Plugin.class.php') ;
+require_once('common/include/PluginManager.class.php') ;
+
+setup_plugin_manager () ;
+session_set_admin () ;
+
+$res = db_query_params ('SELECT role_id FROM pfo_role ORDER BY role_id',
+			array ());
+
+$rows=db_numrows($res);
+
+for ($i=0; $i<$rows; $i++) {
+	$role = RBACEngine::getInstance()->getRoleById (db_result($res,$i,'role_id')) ;
+	echo "Normalizing role ".$role->getDisplayableName()."\n" ;
+	
+	$role->normalizeData() ;
+}
+
+?>




More information about the Fusionforge-commits mailing list