Example #1
0
 case STEP_DB_INIT:
     // save db_prefix/_name and finally create the tables
     $db_type = $config['db_type'];
     list($dext, $dsub) = explode(':', $db_type);
     require_once 'include/database/' . $dext . '/install.php';
     $page_title = $language['title_' . $db_type . '_pop'];
     // save the db data from previous step
     if ($superCage->post->keyExists('db_name') && !isset($config['db_populated'])) {
         setTmpConfig('db_name', $superCage->post->getRaw('db_name'));
         setTmpConfig('db_prefix', $superCage->post->getRaw('db_prefix'));
     }
     // populate db if not done yet
     $set_populated = false;
     if (!isset($config['db_populated']) && isset($config['db_name'])) {
         $msg = $language['db_populating'];
         if (populateDatabase()) {
             $set_populated = true;
         }
     } elseif (!isset($config['db_populated']) && !isset($config['db_name'])) {
         $msg = sprintf($language['not_here_yet'], '<strong><a href="install.php?step=7">', '</a></strong>');
     }
     if (isset($config['db_populated'])) {
         html_header();
         if ($error != '') {
             html_error();
         }
         $temp_data = '<tr><td><br /><br />' . $language['db_alr_populated'] . '<br /><br /></td></tr>';
         html_content($language['db_populating']);
         html_footer();
         setTmpConfig('step', STEP_SET_ADMIN);
     } else {
Example #2
0
function CreateDatabase($arrayconfig)
{
    $q = new mysql();
    $errors = null;
    $lang = $arrayconfig["LANG"];
    $DBcreated = false;
    $DBtype = 'mysql';
    $DBhostname = $q->mysql_server;
    $DBuserName = $q->mysql_admin;
    $DBpassword = $q->mysql_password;
    $DBname = $arrayconfig["DB"];
    $DBPrefix = 'jos_';
    $DBOld = "bu";
    $DBversion = null;
    if ($q->DATABASE_EXISTS($arrayconfig["DB"])) {
        write_events("Database already exists");
        return true;
    }
    $q->CREATE_DATABASE($arrayconfig["DB"]);
    if (!$q->ok) {
        write_events("Error: {$q->mysql_error}");
    }
    if (!$q->DATABASE_EXISTS($arrayconfig["DB"])) {
        write_events("Failed to create database {$arrayconfig["DB"]} \"{$q->mysql_error}\"");
        set_status("{failed}");
        return false;
    }
    write_events("Database successfully created");
    $dbscheme = '/usr/local/share/artica/joomla_src/installation/sql/mysql/joomla.sql';
    populateDatabase($dbscheme, $arrayconfig["DB"]);
    $dbscheme = '/usr/local/share/artica/joomla_src/installation/sql/mysql/sample_data.sql';
    populateDatabase($dbscheme, $arrayconfig["DB"]);
    WriteAdmin($arrayconfig["uid"], $arrayconfig["DB"]);
    return true;
}