[Phpslash-commit] CVS: phpslash-dev/public_html config_setup.php,1.9,1.10
Brought to you by:
joestewart,
nhruby
From: Joe S. <joe...@us...> - 2004-09-09 18:59:45
|
Update of /cvsroot/phpslash/phpslash-dev/public_html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13433/phpslash-dev/public_html Modified Files: config_setup.php Log Message: setup wizard can populate existing database Index: config_setup.php =================================================================== RCS file: /cvsroot/phpslash/phpslash-dev/public_html/config_setup.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** config_setup.php 1 Sep 2004 20:21:49 -0000 1.9 --- config_setup.php 9 Sep 2004 18:59:36 -0000 1.10 *************** *** 685,697 **** $tableAlreadyExists = true; } if (!$tableAlreadyExists) { ?> <tr> <td colspan=2> ! <?php print PRODUCT;?> needs to have the database configured before it can run. It will create a database named <tt><?php print $vars['DB_Database']?></tt>. Fill in the following information to allow <?php print PRODUCT;?> to create that database and the necessary tables inside of it. </td> </td> --- 685,734 ---- $tableAlreadyExists = true; } + $result = true; + if($tableAlreadyExists) { + /* Use the database */ + $result = mysql_query( + "USE " . mysql_escape_string($vars['DB_Database']) + ); + if (mysql_errno() != 0) { + _setError( + "Could use database " . $vars['DB_Database'] . " as " + . $user['name'] . ' (pass: "' . $user['pass'] .'") -- Server said ' + . mysql_error(), + __LINE__ + ); + return STEP_ERROR; + } + + + $result = mysql_query( + "SELECT id FROM psl_block_type where name = 'page' " + ); + + if (!$result) { + $tableAlreadyExists = false; + } + + } if (!$tableAlreadyExists) { ?> <tr> <td colspan=2> ! <?php ! if($result) { ! print PRODUCT;?> needs to have the database configured before it can run. It will create a database named <tt><?php print $vars['DB_Database']?></tt>. Fill in the following information to allow <?php print PRODUCT;?> to create that database and the necessary tables inside of it. + <?php + } else { + print PRODUCT;?> needs to have the database configured before it can run. It + will use the database named <tt><?php print $vars['DB_Database']?></tt>. Fill + in the + following information to allow <?php print PRODUCT;?> to use that database and create + the necessary tables inside of it. + <?php + } ?> </td> </td> *************** *** 703,717 **** <tr> <td colspan=2> Enter the name and password of a database user that has a sufficient access level to create a database, and then create tables inside of it. ! ! <P> ! If you already have a database set up and ! do not need to create a new one leave this blank. ! <p> ! This information will <i>not</i> be stored after the database has ! been created. <table align="center"> <tr class="setVal" valign="top"> --- 740,754 ---- <tr> <td colspan=2> + <?php if($result) { ?> Enter the name and password of a database user that has a sufficient access level to create a database, and then create tables inside of it. ! <?php } else { ?> ! Enter the name and password of a database user that has a ! sufficient access level to use the database, and then create ! tables inside of it. ! <?php } ?> <p> ! This information will <i>not</i> be stored after this program has completed. <table align="center"> <tr class="setVal" valign="top"> *************** *** 737,740 **** --- 774,780 ---- </td> </table> + <? if(!$result) { + echo "<input type=\"hidden\" name=\"do_not_create\" value=\"alreadyExists\">"; + } ?> <input type="submit" value="Set values"> </form> |