starting to work toward the table creation/upgrade parts

This commit is contained in:
seek3r 2000-11-30 22:29:06 +00:00
parent 9ca2298a8e
commit 2dacbb8e21
3 changed files with 36 additions and 8 deletions

View File

@ -126,7 +126,7 @@
}
function show_steps($stage, $note = False) {
global $phpgw_info, $PHP_SELF;
global $phpgw_info, $phpgw_domain, $SetupDomain, $PHP_SELF;
/* The stages are as follows:
Stage 1.1 = header does not exists yet
@ -160,7 +160,28 @@
}elseif ($stage == 2.2) {
echo '<tr><td align="center">O</td><td><form action="./tables.php" method=post>Your database exist but your pre-beta tables need upgrading.<br> <input type=submit value="Create one now"></form></td></tr>';
}elseif ($stage == 2.3) {
echo '<tr><td align="center">O</td><td><form action="./tables.php" method=post>Your database exist, would you like to create your tables now?<br> <input type=submit value="Create tables"></form></td></tr>';
/* commented out because I cannot accuratly figure out if the DB exists */
// echo '<tr><td align="center">O</td><td><form action="./tables.php" method=post>Your database exist, would you like to create your tables now?<br> <input type=submit value="Create tables"></form></td></tr>';
echo '<tr><td align="center">O</td><td>Make sure that your database is created and the account permissions are set.<br>';
if ($phpgw_domain[$SetupDomain]["db_type"] == "mysql"){
echo "
<br>Instructions for creating the database in MySQL:<br>
Login to mysql -<br>
<i>[user@server user]# mysql -u root -p</i><br>
Create the empty database and grant user permissions -<br>
<i>mysql> create database phpgroupware;</i><br>
<i>mysql> grant all on phpgroupware.* to phpgroupware@localhost identified by 'password';</i><br>
";
}elseif ($phpgw_domain[$SetupDomain]["db_type"] == "pgsql"){
echo "
<br>Instructions for creating the database in PostgreSQL:<br>
Start the postmaster<br>
<i>[user@server user]# postmaster -i -D /home/[username]/[dataDir]</i><br>
Create the empty database -<br>
<i>[user@server user]# createdb phpgroupware</i><br>
";
}
echo '<form action="./tables.php" method=post>Once the database is setup correctly <br><input type=submit value="Create the tables"></form></td></tr>';
}elseif ($stage == 2.4) {
echo '<tr><td align="center">O</td><td><form action="./tables.php" method=post>Your database exist but your tables need upgrading.<br> <input type=submit value="upgrade now"></form></td></tr>';
}elseif ($stage == 2.5) {

View File

@ -59,16 +59,17 @@
}
}else{
/* no tables, so checking if we can create them */
/* I cannot get either to work properly
$db->free();
$isdb = $db->connect("kljkjh", "localhost", "phpgroupware", "phpgr0upwar3");
echo "isdb: ".$isdb."<br>\n";
*/
$db->free();
$db_rights = $db->query("CREATE TABLE phpgw_testrights ( testfield varchar(5) NOT NULL )");
echo "db_rights: ".$db_rights."<br>\n";
if (isset($db_rights)){
//if (isset($isdb)){
$stage = 2.3;
$header_msg = "Stage 2 (Create tables)";
}else{

View File

@ -16,11 +16,17 @@
// page explaining what to do from there (ie, create there own account)
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True, "currentapp" => "home", "noapi" => True);
include("./inc/functions.inc.php");
include("../header.inc.php");
include("../version.inc.php"); // To set the current core version
// Authorize the user to use setup app and load the database
include("./inc/setup_auth.inc.php");
if (!auth()){
Header("Location: index.php");
exit;
}
echo "keep going";
exit;
// Does not return unless user is authorized
// $db->Halt_On_Error = "report";