query("SELECT table_name FROM information_schema.tables WHERE table_schema='".$_SESSION['installer']['config']['mysql']['database']."';"); foreach($tablesResult->fetch_all() as $row){ $tablesInDatabase[] = $row[0]; } } catch(Exception $e){ } /*-----------------------------------------------------------------------------*/ $databaseSchema = array( 'domains' => "CREATE TABLE IF NOT EXISTS ___database___.___table___ (___id___ INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, ___domain___ VARCHAR(128) NOT NULL, PRIMARY KEY (___domain___), UNIQUE KEY ___id___ (___id___)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;", 'users' => "CREATE TABLE IF NOT EXISTS ___database___.___table___ (___id___ INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, ___username___ VARCHAR(128) NOT NULL DEFAULT '', ___domain___ VARCHAR(128) NOT NULL DEFAULT '', ___password___ VARCHAR(128) NOT NULL DEFAULT '', ___mailbox_limit___ INT(10) NOT NULL DEFAULT '128', ___max_user_redirects___ INT(10) NOT NULL DEFAULT '0', PRIMARY KEY (___username___,___domain___), UNIQUE KEY ___id___ (___id___)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;", 'aliases' => "CREATE TABLE IF NOT EXISTS ___database___.___table___ (___id___ INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, ___source___ VARCHAR(128) NOT NULL, ___destination___ TEXT NOT NULL, ___multi_source___ VARCHAR(32) DEFAULT NULL, ___is_created_by_user___ INT(1) NOT NULL DEFAULT '0', PRIMARY KEY (___source___), UNIQUE KEY ___id___ (___id___)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;", ); /** * @param string $stmt * @param string $database * @param string $table * @param array $attributes * * @return string */ function prepareSchemaTableStmt($stmt, $database, $table, $attributes) { $attributes['database'] = $database; $attributes['table'] = $table; foreach($attributes as $search => $replace){ $stmt = str_replace('___'.$search.'___', '`'.Database::getInstance()->escape($replace).'`', $stmt); } return $stmt; } $preparedSchemaStmt = ''; $allTablesFromSchemaExist = true; foreach($databaseSchema as $table => $stmt){ $preparedSchemaStmt .= prepareSchemaTableStmt( $stmt, $_SESSION['installer']['config']['mysql']['database'], $exampleConfigValues['schema']['tables'][$table], $exampleConfigValues['schema']['attributes'][$table] ).PHP_EOL; // check if tables exist, should be enough for now if(!in_array($exampleConfigValues['schema']['tables'][$table], $tablesInDatabase)){ $allTablesFromSchemaExist = false; } } $commandDenied = false; /*-----------------------------------------------------------------------------*/ if(isset($_GET['go'])){ if($_GET['go'] == 'next' && $_SERVER['REQUEST_METHOD'] == 'POST'){ if(isset($_POST['manual'])){ if($_POST['manual'] == 1){ // display SQL } elseif($_POST['manual'] == 2){ // check if schema was created if($allTablesFromSchemaExist){ // saving information $_SESSION['installer']['config']['schema'] = $exampleConfigValues['schema']; installer_message('Database schema was manually created.'); installer_next($thisStep, 2); } else{ $_POST['manual'] = 1; } } } else{ if(!$allTablesFromSchemaExist){ try{ foreach(explode(PHP_EOL, $preparedSchemaStmt) as $stmt){ Database::getInstance()->query($stmt); } // saving information $_SESSION['installer']['config']['schema'] = $exampleConfigValues['schema']; installer_message('Database schema was automatically created.'); installer_next($thisStep, 2); } catch(Exception $e){ if(strpos($e->getMessage(), 'command denied') !== false){ $commandDenied = true; } else{ throw $e; } } } } } elseif($_GET['go'] == 'prev'){ // reset unset($_SESSION['installer']['config']['schema']); installer_prev($thisStep); } } ?>

Step 2 of : Create database schema.

The schema already exists in database "".
Your next possible steps:
Back Retry
Copy the SQL-Code above and import it into your database "".

Once you have imported the schema, you can continue by clicking on the Continue button.

Back
The following database schema will be created in database "".
Please make sure that "" is clean / empty database!
The user "" is missing the permission to execute MySQL "CREATE" commands.
Also make sure that the database user "" has the privileges to create the schema.
$mappedTable): ?>
Table ""

Click on the Continue button to try creating the schema automatically.

Back