Community Support for OpenDocMan (Deprecated)

Full Version: Safer Install Script!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The current fresh install script is extremely hostile! It's unforgivable to drop an existing database, even if you put a Javascript warning up to let people know what's coming!

What I don't understand is why, if the database you specify already exists (which implies there's data in it already) you would drop it instead of just adding your new tables into it? Especially when you can conditionally create the database if it doesn't exist.

Here's the patch, somebody put it in into install/index.php straight away. Geez, this has the potential to be an absolutely awful first-run experience for new users. I'm disgusted.

Code:
install/index.php
170,173c170
<         $result = mysql_query("DROP DATABASE IF EXISTS {$GLOBALS['database']}")
<               or die("<br>Unable to Create Database - Error in query:" . mysql_error());
<
<         $result = mysql_query("CREATE DATABASE {$GLOBALS['database']}")
---
>         $result = mysql_query("CREATE DATABASE IF NOT EXISTS {$GLOBALS['database']}")
Thanks for the input. The installer has been that way since day one, which is not to say it is right, but you are actually the first person in ten years that has had an issue with that. The installer is going to be re-worked quite a bit for the next release, so I will make sure to have it be safer on fresh installs.

Thanks.
I'll be first one to admit that I'm paranoid. I'm glad no one else has had problems, but I think there should be a reasonable expectation that software should be safe to install in the majority of circumstances.

Imagine if you bought a new iPod and it told you it had to delete and reinitalize your iTunes library whether you had already been using it or not-- that's what OpenDocMan does with an existing MySQL database right now, and as I said, that's a really hostile thing to do to a brand new user.

Thanks for the quick response Steve.