Glenn Henshaw | 3 Aug 2005 17:23
Picon

mantisbt/admin install.php,1.20,1.21

Update of /cvsroot/mantisbt/mantisbt/admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7682/admin

Modified Files:
	install.php 
Log Message:
add user database access test to the post install checks.

Index: install.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/admin/install.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- install.php	2 Aug 2005 02:26:06 -0000	1.20
+++ install.php	3 Aug 2005 15:23:20 -0000	1.21
 <at>  <at>  -210,7 +210,7  <at>  <at> 
 			if ( $t_support ) {
 				print_test_result( GOOD );
 			} else {
-				print_test_result( BAD, true, 'database is not supported by PHP' );
+				print_test_result( BAD, true, 'database is not supported by PHP. Check that it has been compiled
into your server.' );
 			}
 	?>
 </tr>
 <at>  <at>  -650,6 +650,86  <at>  <at> 
 <!-- Checking register_globals are off -->
 <?php print_test( 'Checking for register_globals are off for mantis', ! ini_get_bool(
'register_globals' ), false, 'change php.ini to disable register_globals setting' ) ?>

+<tr>
+	<td bgcolor="#ffffff">
+		Attempting to connect to database as user
+	</td>
+	<?php
+		$g_db = ADONewConnection($f_db_type);
+		$t_result =  <at> $g_db->Connect($f_hostname, $f_db_username, $f_db_password, $f_database_name);
+
+		if ( $t_result == true ) {
+			print_test_result( GOOD );
+		} else {
+			print_test_result( BAD, false, 'Database user doesn\'t have access to the database ( ' . 
db_error_msg() . ' )' );
+		}
+	?>
+</tr>
+<tr>
+	<td bgcolor="#ffffff">
+		checking ability to SELECT records
+	</td>
+	<?php
+		$t_mantis_config_table = config_get_global( 'mantis_config_table' );
+		$t_query = "SELECT COUNT(*) FROM $t_mantis_config_table";
+		$t_result =  <at> $g_db->Execute( $t_query );
+
+		if ( $t_result != false ) {
+			print_test_result( GOOD );
+			
+		} else {
+			print_test_result( BAD, true, 'Database user doesn\'t have SELECT access to the database ( ' . 
db_error_msg() . ' )' );
+		}
+	?>
+</tr>
+<tr>
+	<td bgcolor="#ffffff">
+		checking ability to INSERT records
+	</td>
+	<?php
+		$t_query = "INSERT INTO $t_mantis_config_table ( value, type, access_reqd, config_id, project_id,
user_id ) VALUES ('test', 1, 90, 'database_test', 20, 0 )";
+		$t_result =  <at> $g_db->Execute( $t_query );
+
+		if ( $t_result != false ) {
+			print_test_result( GOOD );
+			
+		} else {
+			print_test_result( BAD, true, 'Database user doesn\'t have INSERT access to the database ( ' . 
db_error_msg() . ' )' );
+		}
+	?>
+</tr>
+<tr>
+	<td bgcolor="#ffffff">
+		checking ability to UPDATE records
+	</td>
+	<?php
+		$t_query = "UPDATE $t_mantis_config_table SET value='test_update' WHERE config_id='database_test'";
+		$t_result =  <at> $g_db->Execute( $t_query );
+
+		if ( $t_result != false ) {
+			print_test_result( GOOD );
+			
+		} else {
+			print_test_result( BAD, true, 'Database user doesn\'t have UPDATE access to the database ( ' . 
db_error_msg() . ' )' );
+		}
+	?>
+</tr>
+<tr>
+	<td bgcolor="#ffffff">
+		checking ability to DELETE records
+	</td>
+	<?php
+		$t_query = "DELETE FROM $t_mantis_config_table WHERE config_id='database_test'";
+		$t_result =  <at> $g_db->Execute( $t_query );
+
+		if ( $t_result != false ) {
+			print_test_result( GOOD );
+			
+		} else {
+			print_test_result( BAD, true, 'Database user doesn\'t have DELETE access to the database ( ' . 
db_error_msg() . ' )' );
+		}
+	?>
+</tr>
 </table>
 <?php
 	if ( false == $g_failed ) {

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

Gmane