getErrorMsg(); if (!$database->_resource) { db_err ('stepBack2','The password and username provided are incorrect.'); } // Does this code actually do anything??? $configArray['DBhostname'] = $DBhostname; $configArray['DBuserName'] = $DBuserName; $configArray['DBpassword'] = $DBpassword; $configArray['DBname'] = $DBname; $configArray['DBPrefix'] = $DBPrefix; $sql = "CREATE DATABASE `$DBname`"; $database->setQuery( $sql ); $database->query(); $test = $database->getErrorNum(); if ($test != 0 && $test != 1007) { db_err( 'stepBack', 'A database error occurred: ' . $database->getErrorMsg() ); } // db is now new or existing, create the db object connector to do the serious work $database = new database( $DBhostname, $DBuserName, $DBpassword, $DBname, $DBPrefix ); // delete existing mos table if requested if ($DBDel) { $query = "SHOW TABLES FROM `$DBname`"; $database->setQuery( $query ); $errors = array(); if ($tables = $database->loadResultArray()) { foreach ($tables as $table) { if (strpos( $table, $DBPrefix ) === 0) { if ($DBBackup) { $butable = str_replace( $DBPrefix, $BUPrefix, $table ); $query = "DROP TABLE IF EXISTS `$butable`"; $database->setQuery( $query ); $database->query(); if ($database->getErrorNum()) { $errors[$database->getQuery()] = $database->getErrorMsg(); } $query = "RENAME TABLE `$table` TO `$butable`"; $database->setQuery( $query ); $database->query(); if ($database->getErrorNum()) { $errors[$database->getQuery()] = $database->getErrorMsg(); } } $query = "DROP TABLE IF EXISTS `$table`"; $database->setQuery( $query ); $database->query(); if ($database->getErrorNum()) { $errors[$database->getQuery()] = $database->getErrorMsg(); } } } } } populate_db( $database, 'joomla.sql' ); if ($DBSample) { populate_db( $database, 'sample_data.sql' ); } $DBcreated = 1; } function db_err($step, $alert) { global $DBhostname,$DBuserName,$DBpassword,$DBDel,$DBname; echo "
\n"; //echo ""; echo ""; exit(); } /** * @param object * @param string File name */ function populate_db( &$database, $sqlfile='mambo.sql') { global $errors; $mqr = @get_magic_quotes_runtime(); @set_magic_quotes_runtime(0); $query = fread( fopen( 'sql/' . $sqlfile, 'r' ), filesize( 'sql/' . $sqlfile ) ); @set_magic_quotes_runtime($mqr); $pieces = split_sql($query); for ($i=0; $isetQuery( $pieces[$i] ); if (!$database->query()) { $errors[] = array ( $database->getErrorMsg(), $pieces[$i] ); } } } } /** * @param string */ function split_sql($sql) { $sql = trim($sql); $sql = ereg_replace("\n#[^\n]*\n", "\n", $sql); $buffer = array(); $ret = array(); $in_string = false; for($i=0; $i"; ?> Joomla! - Web Installer
" /> " /> " /> " /> " /> " />
pre-installation check
license
step 1
step 2
step 3
step 4
Joomla! is Free Software released under the GNU/GPL License.