[Fusionforge-commits] FusionForge branch master updated. dc0c92d6c9e35171c7710358a676e3e1da02374b

Franck Villaume nerville at fusionforge.org
Thu Aug 21 12:20:43 CEST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  dc0c92d6c9e35171c7710358a676e3e1da02374b (commit)
      from  b8dc5bc3d79e9358a7bfd50f7c2ee8495f7a6641 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit dc0c92d6c9e35171c7710358a676e3e1da02374b
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Thu Aug 21 12:18:39 2014 +0200

    drop old broken and incomplete feature: database per project

diff --git a/src/db/20140821-drop-project-database-broken-feature.sql b/src/db/20140821-drop-project-database-broken-feature.sql
new file mode 100644
index 0000000..2a596ce
--- /dev/null
+++ b/src/db/20140821-drop-project-database-broken-feature.sql
@@ -0,0 +1,5 @@
+-- drop the project database feature
+drop table prdb_dbs;
+drop table prdb_types;
+drop table prdb_states;
+drop sequence prdb_dbs_dbid_seq;
diff --git a/src/etc/config.ini.d/defaults.ini b/src/etc/config.ini.d/defaults.ini
index fa421a3..e418226 100644
--- a/src/etc/config.ini.d/defaults.ini
+++ b/src/etc/config.ini.d/defaults.ini
@@ -67,7 +67,6 @@ use_manual_uploads = yes
 use_news = yes
 use_people = yes
 use_pm = yes
-use_project_database = no
 use_project_multimedia = no
 use_project_vhost = yes
 use_ratings = yes
diff --git a/src/utils/migrate-to-ini-files.sh b/src/utils/migrate-to-ini-files.sh
index 4f35262..756cb71 100755
--- a/src/utils/migrate-to-ini-files.sh
+++ b/src/utils/migrate-to-ini-files.sh
@@ -99,7 +99,6 @@ add_config core use_manual_uploads >> $tmp
 add_config core use_news >> $tmp
 add_config core use_people >> $tmp
 add_config core use_pm >> $tmp
-add_config core use_project_database >> $tmp
 add_config core use_project_multimedia >> $tmp
 add_config core use_project_vhost >> $tmp
 add_config core use_ratings >> $tmp
diff --git a/src/www/admin/database.php b/src/www/admin/database.php
deleted file mode 100644
index 9db7356..0000000
--- a/src/www/admin/database.php
+++ /dev/null
@@ -1,170 +0,0 @@
-<?php
-/**
- * Site Admin page for maintaining groups'databases
- *
- * This page allows to:
- *   - browse aggregate numbers of databases of specific type (active,
- *	 deleted, etc.)
- *   - list all databases of given type
- *   - edit some database (by going to group's DB Admin page)
- *   - register existing database in system
- *
- * Copyright 1999-2001 (c) VA Linux Systems
- * Copyright 2010 (c) Franck Villaume - Capgemini
- * Copyright 2012, Franck Villaume - TrivialDev
- * http://fusionforge.org
- *
- * 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 Licence, 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.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-require_once '../env.inc.php';
-require_once $gfcommon.'include/pre.php';
-require_once $gfwww.'admin/admin_utils.php';
-
-if (!forge_get_config('use_project_database')) {
-	exit_disabled('home');
-}
-
-session_require_global_perm ('forge_admin');
-
-if (getStringFromRequest('submit')) {
-	$group_id = getIntFromRequest('group_id');
-	$groupname = getStringFromRequest('groupname');
-	$dbname = getStringFromRequest('dbname');
-
-	if ($groupname) {
-
-		$group = group_get_object_by_name($groupname);
-		if (!$group || !is_object($group)) {
-			exit_no_group();
-		} elseif ($group->isError()) {
-			exit_error($group->getErrorMessage(),'home');
-		}
-
-		$group_id = $group->getID();
-
-		$user =& session_get_user();
-		if (!$user || !is_object($user)) {
-			exit_error(_('Could Not Get User'),'home');
-		} elseif ($user->isError()) {
-			exit_error($u->getErrorMessage(),'home');
-		}
-
-		$res = db_query_params ('
-			INSERT INTO prdb_dbs(group_id, dbname, dbusername, dbuserpass, requestdate, dbtype, created_by, state)
-			VALUES ($group_id,$1,$2,$3,$4,1,$5,1)
-		',
-			array($dbname,
-				$dbname,
-				'xxx',
-				time(),
-				$user->getID()));
-
-		if (!$res || db_affected_rows($res) < 1) {
-			$error_msg .= _('Error Adding Database: ') .db_error();
-		} else {
-			$feedback .= _('Project'). " <em>".$group->getUnixName()."</em>" ._('added already active database');
-		}
-	} else {
-		$error_msg .= _('Unable to insert already active database.');
-	}
-}
-
-site_admin_header(array('title'=>_('Site Admin: Groups\' DB Maintenance')));
-
-$res_db = db_query_params ('
-	SELECT stateid,statename,COUNT(*) AS count
-	FROM prdb_dbs,prdb_states
-	WHERE stateid=state
-	GROUP BY statename,stateid
-',
-			array()) ;
-
-echo '<h3>' ._('Statistics for Project Databases').'</h3>';
-
-if (db_numrows($res_db) > 0) {
-
-	$title=array();
-	$title[]= _('Type');
-	$title[]= _('Count');
-	echo $GLOBALS['HTML']->listTableTop($title);
-
-	while ($row_db = db_fetch_array($res_db)) {
-
-		print '<tr><td class="align-center"><a href="'.getStringFromServer('PHP_SELF').'?displaydb=1&dbstate='.$row_db['stateid'].'">'.$row_db['statename'].'</a></td><td class="align-center">'.$row_db['count'].'</td></tr>';
-
-	}
-
-	echo $GLOBALS['HTML']->listTableBottom();
-
-} else {
-	echo '<p>' ._('No databases defined').'</p>';
-}
-
-if ($displaydb) {
-
-	$res_db = db_query_params ('
-		SELECT statename
-		FROM prdb_states
-		WHERE stateid=$1
-	',
-			array($dbstate));
-
-	$row_db = db_fetch_array($res_db);
-
-	print '<hr /><h3>' ._('Displaying Databases of Type:') .$row_db['statename'].' </h3><ul>';
-
-	$res_db = db_query_params ('
-		SELECT *
-		FROM prdb_dbs
-		WHERE state=$1
-		ORDER BY dbname
-	',
-			array($dbstate));
-
-	while ($row_db = db_fetch_array($res_db)) {
-		print '<li>'.util_make_link ('/project/admin/database.php?group_id='.$row_db['group_id'],$row_db['dbname']).'</li>';
-	}
-	print "</ul>";
-
-}
-
-?>
-<hr />
-
-<h3><?php echo _('Add an already active database'); ?></h3>
-
-<form name="madd" method="post" action="<?php  echo getStringFromServer('PHP_SELF'); ?>">
-
-<table>
-
-<tr>
-<td><?php echo _('Project Unix Name').utils_requiredField()._(': '); ?></td>
-<td><input type="text" required="required" name="groupname" /></td>
-</tr>
-
-<tr>
-<td><?php echo _('Database Name').utils_requiredField()._(': '); ?></td>
-<td><input type="text" required="required" name="dbname" /></td>
-</tr>
-
-</table>
-<input type="submit" name="submit" value="<?php echo _('Add'); ?>"/>
-</form>
-
-<?php
-
-site_admin_footer();
diff --git a/src/www/admin/index.php b/src/www/admin/index.php
index 3cd5517..f27383a 100644
--- a/src/www/admin/index.php
+++ b/src/www/admin/index.php
@@ -227,14 +227,10 @@ $abc_array = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','
 	<?php plugin_hook("site_admin_option_hook", array()); ?>
 </ul>
 
-<?php if(forge_get_config('use_project_database') || forge_get_config('use_project_vhost') || forge_get_config('use_people')) { ?>
+<?php if(forge_get_config('use_project_vhost') || forge_get_config('use_people')) { ?>
 <ul>
 	<?php if(forge_get_config('use_project_vhost')) { ?>
 		<li><?php echo util_make_link('/admin/vhost.php', _('Virtual Host Admin Tool')); ?></li>
-	<?php
-	}
-	if(forge_get_config('use_project_database')) { ?>
-		<li><?php echo util_make_link('/admin/database.php', _('Project Database Administration')); ?></li>
 	<?php }
 	if(forge_get_config('use_people')) { ?>
 		<li><?php echo util_make_link('/people/admin/', _('Job / Categories Administration')); ?></li>
diff --git a/src/www/project/admin/database.php b/src/www/project/admin/database.php
deleted file mode 100644
index 41ff3d4..0000000
--- a/src/www/project/admin/database.php
+++ /dev/null
@@ -1,255 +0,0 @@
-<?php
-/**
- *
- * Project Admin page to manage group's databases
- *
- * This page allows to request, change password of, and delete database.
- * Group may have single database of each type that provided (e.g., mysql,
- * pgsql, etc).
- *
- * Portions Copyright 1999-2001 (c) VA Linux Systems
- * The rest Copyright 2002-2004 (c) GForge Team
- * http://fusionforge.org/
- *
- * 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 Licence, 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.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-
-require_once '../../env.inc.php';
-require_once $gfcommon.'include/pre.php';
-require_once $gfwww.'project/admin/project_admin_utils.php';
-
-if (!forge_get_config('use_project_database')) {
-	exit_disabled();
-}
-
-$group_id = getIntFromRequest('group_id');
-session_require_perm ('project_admin', $group_id) ;
-
-$group = group_get_object($group_id);
-if (!$group || !is_object($group)) {
-	exit_no_group();
-} elseif ($group->isError()) {
-	exit_error($group->getErrorMessage(),'admin');
-}
-
-if (getStringFromRequest('createdb')) {
-	$newdbtypeid = getIntFromRequest('newdbtypeid');
-
-	//mysql takes issue with database names that have dashes in them - so strip the dashes, replace with ""
-	//e.g. free-mysql becomes freemysql (it's a workaround)
-	//if there is a dash in the groupname
-	$dbname = str_replace("-", "", $group->getUnixName());
-
-	//check there is no name double up - if there is - add an incrementing to the number to the end
-
-	$dbname = prdb_namespace_seek($dbname);
-	$randompw = random_pwgen();
-
-	$res = db_query_params("INSERT INTO prdb_dbs(group_id,dbname,dbusername,dbuserpass,requestdate,dbtype,created_by,state)
-			VALUES($1, $2, $2, $3, $4, $5, $6 ,2)", array($group_id, $dbname, $randompw, time(), $newdbtypeid, $LUSER->getID()));
-
-	if (!$res || db_affected_rows($res) < 1) {
-		$error_msg .= _('Cannot add database entry')._(': ').db_error();
-	} else {
-		$feedback .= _('Database scheduled for creation');
-		group_add_history('Created database '.$dbname.' type '.$row_db['dbsoftware'].' ','',$group_id);
-	}
-}
-
-if (getStringFromRequest('updatedbrec')) {
-	$dbid = getIntFromRequest('dbid');
-	$pw = getStringFromRequest('pw');
-	$pwconfirm = getStringFromRequest('pwconfirm');
-	$newdbtypeid = getIntFromRequest('newdbtypeid');
-
-	if ($pw == $pwconfirm) {
-
-		//sync new password, and flag it as 'pending (an) update'
-
-		$res = db_query_params ('
-			UPDATE prdb_dbs
-			SET dbuserpass = $1,
-				state = $2
-			WHERE dbid = $3
-			AND group_id = $4
-		',
-			array($pw,
-				'4',
-				$dbid,
-				$group_id));
-
-		if (!$res || db_affected_rows($res) < 1) {
-			$error_msg .= "Update failure - ".db_error()."";
-		} else {
-			$res = db_query_params ('
-				SELECT *
-				FROM prdb_types
-				WHERE dbtypeid=$1
-			',
-			array($newdbtypeid));
-			$row_db = db_fetch_array($res);
-			group_add_history('Updated database - (type: '.$row_db['dbsoftware'].')','',$group_id);
-		}
-	} else {
-		$error_msg .= _("Operation failed. Password and Password Confirm are not the same");
-	}
-
-}
-
-if (getStringFromRequest('deletedbconfirm')) {
-	$dbid = getIntFromRequest('dbid');
-
-	//schedule for deletion
-
-	$res = db_query_params ('
-		UPDATE prdb_dbs
-		SET state=3
-		WHERE dbid=$1
-		AND group_id=$2
-	',
-			array($dbid,
-				$group_id));
-
-	if (!$res || db_affected_rows($res) < 1) {
-		$error_msg .= 'Cannot delete database: '.db_error();
-	} else {
-		$feedback .= _('Database scheduled for deletion');
-	}
-
-}
-
-project_admin_header(array('title'=>_('Database Information').'','group'=>$group_id));
-
-// XXX ogi: where's deletedb defined?
-if ($deletedb == 1) {
-
-	print "<hr /><strong><div align=\"center\">"._('Click to confirm deletion')."[ <a href=\"".getStringFromServer('PHP_SELF')."?deletedbconfirm=1&group_id=".$group_id."&dbid=$dbid\">'._('CONFIRM DELETE').'</a> ] </div></strong> <hr />";
-
-}
-
-$res_db = db_query_params ('
-	SELECT *
-	FROM prdb_types
-	WHERE dbsoftware NOT IN (
-		SELECT dbsoftware
-		FROM prdb_dbs,prdb_types
-		WHERE dbtypeid=dbtype
-		AND group_id=$1
-		AND state IN (1,2,4)
-	)
-',
-			array($group_id));
-
-if (db_numrows($res_db) > 0) {
-
-	print '
-
-		<p><strong><span style="text-decoration:underline">'._('Add New Database').'</span></strong></p>
-		<p><em>'._('Clicking on “create” will schedule the creation of the database, and email the details to the project administrators').'</em></p>
-
-		<p><strong>'._('Database Type')._(':').'</strong></p>
-		<p><form action="'.getStringFromServer('PHP_SELF').'" method="post">
-		<input type="hidden" name="createdb" value="1" />
-		<input type="hidden" name="group_id" value="'.$group_id.'" />
-		<select name="newdbtypeid">
-
-	';
-
-	while ($res_row = db_fetch_array($res_db)) {
-
-		print "<option value=\"".$res_row['dbtypeid']."\">".$res_row['dbsoftware']."</option>";
-	}
-
-	print '
-
-		</select>
-		  <input type="submit" name="Create" value="'._('Create').'" />
-		</form></p>
-	';
-
-} else {
-?>
-<?php echo _('Maximum number of databases of all types have been allocated') ?>
- <p>
-
-<?php
-}
-
-$res_db = db_query_params("
-	SELECT *
-	FROM prdb_dbs,prdb_states,prdb_types
-	WHERE group_id=$1
-	AND stateid=state
-	AND dbtype=dbtypeid
-", array($group_id));
-
-if (db_numrows($res_db) > 0) {
-
-	$title=array();
-	$title[]=_('DB Type');
-	$title[]=_('State');
-	$title[]=_('New Password');
-	$title[]=_('Confirm New');
-	$title[]=_('Operations');
-
-	echo $GLOBALS['HTML']->listTableTop($title);
-
-	while ($row_db = db_fetch_array($res_db)) {
-
-		print '
-			<tr '.$GLOBALS['HTML']->boxGetAltRowStyle($i++).'>
-
-			<td>'.$row_db['dbsoftware'].'</td>
-			<td>'.$row_db['statename'].'</td>
-			';
-
-		//if database is active or pending update allow the record to be deleted or password changed
-
-		if (($row_db['state'] == 1) || ($row_db['state'] == 4) || ($row_db['state'] == 2)) {
-
-			print '<form name="dbupdate" method="post" action="'.getStringFromServer('PHP_SELF').'?group_id='.$group_id.'">
-				     <input type="hidden" name="dbid" value="'.$row_db['dbid'].'" />
-				     <input type="hidden" name="updatedbrec" value="1" />
-				     <td><input type="text" name="pw" size="8" maxlength="16" /></td>
-				     <td><input type="text" name="pwconfirm" size="8" maxlength="16" /></td>
-				     <td>
-				       <input type="submit" name="submit" value="'._('Update').'" />
-				     </td>
-				  </form>
-			';
-
-		} else {
-			print '
-				<td> </td>
-				<td> </td>
-				<td> </td>
-			';
-		}
-
-		print '</tr>';
-
-	}
-
-	echo $GLOBALS['HTML']->listTableBottom();
-
-} else {
-
-	print '<strong><span style="text-decoration:underline">'._('Current Databases').'</span></strong><p>'._('There are no databases currently allocated to this group').'</p>';
-
-}
-
-project_admin_footer();
diff --git a/src/www/project/admin/project_admin_utils.php b/src/www/project/admin/project_admin_utils.php
index b4c4c6c..9c249e2 100644
--- a/src/www/project/admin/project_admin_utils.php
+++ b/src/www/project/admin/project_admin_utils.php
@@ -83,12 +83,6 @@ function project_admin_header($params) {
 		$attr_r[] = array('title' => '');
 		$links[] = '/project/admin/vhost.php?group_id='.$group_id;
 	}
-	if(forge_get_config('use_project_database')) {
-		$labels[] = _('Database Admin');
-		//TODO: set the title.
-		$attr_r[] = array('title' => '');
-		$links[] = '/project/admin/database.php?group_id='.$group_id;
-	}
 	if ($project->usesStats()) {
 		$labels[] = _('Stats');
 		//TODO: set the title.
@@ -188,46 +182,6 @@ function show_grouphistory($group_id) {
 	}
 }
 
-/*
-	prdb_namespace_seek - check that a projects' potential db name hasn't
-	already been used.  If it has - add a 1..20 to the end of it.  If it
-	iterates through twenty times and still fails - namespace depletion -
-	throw an error.
-
- */
-function prdb_namespace_seek($namecheck) {
-
-	$query = 'SELECT * FROM prdb_dbs WHERE dbname=$1';
-
-	$res_dbl = db_query_params($query, array($namecheck));
-
-	if (db_numrows($res_dbl) > 0) {
-		//crap, we're going to have issues
-		$curr_num = 1;
-
-		while ((db_numrows($res_dbl) > 0) && ($curr_num < 20)) {
-
-			$curr_num++;
-			$namecheck .= $namecheck.$curr_num;
-
-			$res_dbl = db_query_params($query, array($namecheck));
-		}
-
-		// if we reached 20, then the namespace is depleted - eject eject
-		if ($curr_num == 20) {
-			exit_error(_('Failed to find namespace for database'),'home');
-		}
-
-	}
-	return $namecheck;
-
-} //end prdb_namespace_seek()
-
-function random_pwgen() {
-	return (substr(strtr(base64_encode(util_randbytes(9)), '+', '.'),
-		       0, 10));
-}
-
 function permissions_blurb() {
 	return _('<strong>NOTE:</strong><dl><dt><strong>Project Admins (bold)</strong></dt><dd>can access this page and other project administration pages</dd><dt><strong>Release Technicians</strong></dt><dd>can make the file releases (any project admin also a release technician)</dd><dt><strong>Tool Technicians (T)</strong></dt><dd>can be assigned Bugs/Tasks/Patches</dd><dt><strong>Tool Admins (A)</strong></dt><dd>can make changes to Bugs/Tasks/Patches as well as use the /toolname/admin/ pages</dd><dt><strong>Tool No Permission (N/A)</strong></dt><dd>Developer doesn\'t have specific permission (currently equivalent to \'-\')</dd><dt><strong>Moderators</strong> (forums)</dt><dd>can delete messages from the project forums</dd><dt><strong>Editors</strong> (doc. manager)</dt><dd>can update/edit/remove documentation from the project.</dd></dl>');
 }

-----------------------------------------------------------------------

Summary of changes:
 ...140821-drop-project-database-broken-feature.sql |    5 +
 src/etc/config.ini.d/defaults.ini                  |    1 -
 src/utils/migrate-to-ini-files.sh                  |    1 -
 src/www/admin/database.php                         |  170 -------------
 src/www/admin/index.php                            |    6 +-
 src/www/project/admin/database.php                 |  255 --------------------
 src/www/project/admin/project_admin_utils.php      |   46 ----
 7 files changed, 6 insertions(+), 478 deletions(-)
 create mode 100644 src/db/20140821-drop-project-database-broken-feature.sql
 delete mode 100644 src/www/admin/database.php
 delete mode 100644 src/www/project/admin/database.php


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list