$dbtype, 'dbhost' => $dbhost, 'dbname' => $dbname, 'dbpass' => $dbpass, 'dbuser' => $dbuser, 'dbpersist' => $dbpersist, 'root_dir' => $baseDir, 'base_url' => $baseUrl ); // Version array for moving from version to version. $versionPath = array( '1.0.2', '2.0-alpha', '2.0-beta', '2.0', '2.0.1', '2.0.2', '2.0.3', '2.0.4', '2.1-rc1', '2.1-rc2', ); global $lastDBUpdate; $lastDBUpdate = ''; require_once( DP_BASE_DIR.'/lib/adodb/adodb.inc.php' ); @include_once DP_BASE_DIR.'/includes/version.php'; $db = NewADOConnection($dbtype); if(!empty($db)) { $dbc = $db->Connect($dbhost,$dbuser,$dbpass); if ($dbc) $existing_db = $db->SelectDB($dbname); } else { $dbc = false; } $current_version = $dp_version_major . '.' . $dp_version_minor; $current_version .= isset($dp_version_patch) ? ('.'.$dp_version_patch) : ''; $current_version .= isset($dp_version_prepatch) ? ('-'.$dp_version_prepatch) : ''; if ($dobackup){ if( $dbc ) { require_once( DP_BASE_DIR.'/lib/adodb/adodb-xmlschema.inc.php' ); $schema = new adoSchema( $db ); $sql = $schema->ExtractSchema(true); header('Content-Disposition: attachment; filename="dPdbBackup'.date('Ymd').date('His').'.xml"'); header('Content-Type: text/xml'); echo $sql; exit; } else { $backupMsg = 'ERROR: No Database Connection available! - Backup not performed!'; } } ?> dotProject Installer

dotProject Logo dotProject Installer

Progress:
Execute('DROP DATABASE IF EXISTS '.$dbname); 
	 $existing_db = false;
  }

  if (! $existing_db) {
		dPmsg('Creating new Database');
		$db->Execute('CREATE DATABASE '.$dbname);
         $dbError = $db->ErrorNo();
 
         if ($dbError <> 0 && $dbError <> 1007) {
                 $dbErr = true;
                $dbMsg .= 'A Database Error occurred. Database has not been created! The provided database details are probably not correct.
'.$db->ErrorMsg().'
'; } } } // For some reason a db->SelectDB call here doesn't work. $db->Execute('USE ' . $dbname); $db_version = InstallGetVersion($mode, $db); $code_updated = ''; if ($mode == 'upgrade') { dPmsg('Applying database updates'); $last_version = $db_version['code_version']; // Convert the code version to a version string. if ($last_version != $current_version) { // Check for from and to versions $from_key = array_search($last_version, $versionPath); $to_key = array_search($current_version, $versionPath); for ($i = $from_key; $i < $to_key; $i++) { $from_version = str_replace(array('.','-'), '', $versionPath[$i]); $to_version = str_replace(array('.','-'), '', $versionPath[$i+1]); // Only do updates since last update - this is only necessary if updating via CVS of a previous // version, but well worth doing anyway. InstallLoadSql(DP_BASE_DIR."/db/upgrade_{$from_version}_to_{$to_version}.sql", $db_version['last_db_update']); $db_version['last_db_update'] = $lastDBUpdate; // Global set by InstallLoadSql. } } else if (file_exists(DP_BASE_DIR.'/db/upgrade_latest.sql')) { // Need to get the installed version again, as it should have been // updated by the from/to stuff. InstallLoadSql(DP_BASE_DIR.'/db/upgrade_latest.sql', $db_version['last_db_update']); } } else { dPmsg('Installing database'); InstallLoadSql(DP_BASE_DIR.'/db/dotproject.sql'); // After all the updates, find the new version information. $new_version = InstallGetVersion($mode, $db); $lastDBUpdate = $new_version['last_db_update']; $code_updated = $new_version['last_code_update']; } $dbError = $db->ErrorNo(); if ($dbError <> 0 && $dbError <> 1007) { $dbErr = true; $dbMsg .= 'A Database Error occurred. Database has probably not been populated completely!
'.$db->ErrorMsg().'
'; } if ($dbErr) { $dbMsg = 'DB setup incomplete - the following errors occured:
'.$dbMsg; } else { $dbMsg = 'Database successfully setup
'; } if ($mode == 'upgrade') { dPmsg('Applying data modifications'); // Check for an upgrade script and run it if necessary. // Note we don't need to run individual version files any more if (file_exists(DP_BASE_DIR.'/db/upgrade_latest.php')) { include_once DP_BASE_DIR.'/db/upgrade_latest.php'; $code_updated = dPupgrade($db_version['code_version'], $current_version, $db_version['last_code_update']); } else { dPmsg('No data updates required'); } } else { include_once DP_BASE_DIR.'/db/upgrade_permissions.php'; // Always required on install. } dPmsg('Updating version information'); // No matter what occurs we should update the database version in the dpversion table. if (empty($lastDBUpdate)) { $lastDBUpdate = $code_updated; } $sql = "UPDATE dpversion SET db_version = '$dp_version_major', last_db_update = '$lastDBUpdate', code_version = '$current_version', last_code_update = '$code_updated' WHERE 1"; $db->Execute($sql); } else { $dbMsg = 'Not Created'; if (! $dbc) { $dbErr=1; $dbMsg .= '
No Database Connection available! ' . ($db ? $db->ErrorMsg() : ''); } } // always create the config file content dPmsg('Creating config'); $config = ''; $config = trim($config); if ($do_cfg || $do_db_cfg){ if ( (is_writable('../includes/config.php') || ! is_file('../includes/config.php') ) && ($fp = fopen('../includes/config.php', 'w'))) { fputs( $fp, $config, strlen( $config ) ); fclose( $fp ); $cFileMsg = 'Config file written successfully'."\n"; } else { $cFileErr = true; $cFileMsg = 'Config file could not be written'."\n"; } } //echo $msg; ?>

Database Installation Feedback:
Please note that errors relating to dropping indexes during upgrades are NORMAL and do not indicate a problem.
Config File Creation Feedback:
The following Content should go to ./includes/config.php. Create that text file manually and copy the following lines in by hand. Delete all empty lines and empty spaces after '?>' and save. This file should be readable by the webserver.

Login and Configure the dotProject System Environment

The Administrator login has been set to admin with a password of passwd. It is a good idea to change this password when you first log in