// Only do updates since last update - this is only necessary if updating via CVS of a previous // version, but well worth doing anyway. InstallLoadSql("{$baseDir}/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("{$baseDir}/db/upgrade_latest.sql")) { // Need to get the installed version again, as it should have been // updated by the from/to stuff. InstallLoadSql("{$baseDir}/db/upgrade_latest.sql", $db_version['last_db_update']); } } } else { dPmsg("Installing database"); InstallLoadSql("{$baseDir}/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!<br>" . $db->ErrorMsg() . "<br>"; } if ($dbErr) { $dbMsg = "DB setup incomplete - the following errors occured:<br>" . $dbMsg; } else { $dbMsg = "Database successfully setup<br>"; }
// 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!<br>' . $db->ErrorMsg() . '<br>'; } if ($dbErr) { $dbMsg = 'DB setup incomplete - the following errors occured:<br>' . $dbMsg; } else { $dbMsg = 'Database successfully setup<br>'; }
if ($err == -3) { set_error("The configuration file {$config_filename} is not writable. Change its permissions so it is, then re-run step 4."); } } } // Try connecting to database $db = mysql_connect($database_host, $database_username, $database_password); if (!$db) { set_error('Database host name, username and/or password incorrect. MySQL Error:<br />' . mysql_error()); } if ($install_tables == true) { // Try to create the database mysql_query('CREATE DATABASE IF NOT EXISTS `' . $database_name . '`'); mysql_select_db($database_name, $db); //$import_filename = $path_to_root."/sql/mysql/weberp-demo.sql"; InstallLoadSql($path_to_root . "/sql/mysql/weberp-new.sql"); // echo $import_filename; //$shell_command = C_MYSQL_PATH . " -h $host -u $user -p{$password} $dbname < $filename"; //shell_exec($shell_command); //shell_exec("mysql -u ".$database_username." -p".$database_password." ".$database_name." < ".$import_filename); if (!db_import($import_filename, $db_connections[$id])) { set_error("Import error, try to import {$import_filename} manually via phpMyAdmin"); } } else { mysql_select_db($database_name, $db); } $sql = "UPDATE www_users SET password = '******', email = '" . $admin_email . "' WHERE user_id = 'admin'"; mysql_query($sql, "could not update admin account"); $sql = "UPDATE companies SET coyname = '" . $company_name . " WHERE coycode = 1"; mysql_query($sql, "could not update company name. Do it manually later in Setup"); session_unset();