[PHPPlanner-cvs] phpplanner install.php,1.12,1.13
Status: Beta
Brought to you by:
tomsommer
From: Jeppe A. <no...@us...> - 2004-04-27 16:27:24
|
Update of /cvsroot/phpplanner/phpplanner In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5611 Modified Files: install.php Log Message: * Warning appears if the config file exists to make the owner delete or rename install file for safety reasons. * Added reinstall function which drops all existing SQL data and then does a reinstall. Index: install.php =================================================================== RCS file: /cvsroot/phpplanner/phpplanner/install.php,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- install.php 25 Apr 2004 19:21:16 -0000 1.12 +++ install.php 27 Apr 2004 16:27:13 -0000 1.13 @@ -1,10 +1,13 @@ <?php - + if ( is_file("config.php") ) { + echo( "It seems like phpplanner is already installed! Please remove this file for safety reasons or rename it in case you want to reinstall later.<br>Reinstalling will erase all existing database data created by phpplanner!" ); + } + if ( isset($_POST['submit']) ) { $config_file = 'config.php'; - if ( $_POST['install_type'] == 'install') + if ( $_POST['install_type'] == 'install' || $_POST['install_type'] == 'reinstall') { $configvars_more = array('path_to_calendar' => '"'. $_POST['path_to_calendar'] .'"', 'http_to_calendar' => '"'. $_POST['http_to_calendar'] .'"', @@ -21,7 +24,7 @@ 'language' => '"english"', 'debug' => 'false'); } - + // Add all config vars that needs to be added from a previous version if ( $_POST['install_type'] == 'upgrade' || $_POST['install_type'] == 'upgrade_conf' ) { @@ -44,8 +47,16 @@ 'password' => '"'. $_POST['mysql_password'] .'"', 'database' => '"'. $_POST['mysql_database'] .'"' ); - - if ( $_POST['install_type'] == 'install' ) + // Drop the existing data in database so it can be recreated in the next if + if ( $_POST['install_type'] == 'reinstall' ) { + mysql_connect($_POST['mysql_host'], $_POST['mysql_username'], $_POST['mysql_password']); + mysql_select_db($_POST['mysql_database']); + $dropSQL = 'DROP TABLE `cal_items` ,' . ' `cal_users` ;' . ' '; + mysql_query($dropSQL) or die("Cannot delete existing sql data. Please check that it does exists!"); + mysql_close(); + } + + if ( $_POST['install_type'] == 'install' || $_POST['install_type'] == 'reinstall' ) { // Run MySQL installs mysql_connect($_POST['mysql_host'], $_POST['mysql_username'], $_POST['mysql_password']); @@ -171,6 +182,7 @@ <option value="install" selected>Install <option value="upgrade" disabled>Upgrade from 0.3 <option value="upgrade_conf" disabled>Upgrade from 0.3 (config only ) + <option value="reinstall">Reinstall </select> </font></td> </tr> |