/**
 * Bootstrap installation
 * @param $root_path
 */
function install_directus($root_path)
{
    global $install_state;
    install_session_init($root_path);
    // add step query string
    $param_step = isset($_GET['step']) ? (int) $_GET['step'] : false;
    if ($param_step < 0) {
        $param_step = 0;
        install_redirect_step($param_step);
        exit;
    }
    if ($param_step === false) {
        Session::clear();
        $param_step = 0;
        install_redirect_step($param_step);
        exit;
    }
    // Get current step
    $install_step = install_get_step($param_step);
    $install_state['current_step'] = $install_step->getNumber();
    if (!install_can_do($param_step, $install_state)) {
        // Go to the next remaining step
        install_goto_step(false, $install_state);
        exit;
    }
    $executed = install_do($install_step, $install_state);
    if (!$executed) {
        View::displayStep($install_step, $install_state);
        Session::save($install_state);
    } else {
        Session::save($install_state);
        $install_step = install_get_step($install_step->getNumber() + 1);
        if ($install_step == false) {
            if (install_confirmed()) {
                install_goto_directus($install_state);
            } else {
                install_redirect_step($param_step = 0);
            }
        } else {
            install_goto_step($install_step, $install_state);
        }
    }
}