Ejemplo n.º 1
0
            // Update the progress bar status
            update_install_progress_bar();
            $upgrade_result_title = T_('Upgrade completed successfully!');
            $upgrade_result_body = sprintf(T_('Now you can <a %s>log in</a> with your usual b2evolution username and password.'), 'href="' . $admin_url . '"');
            ?>
			<p class="alert alert-success"><evo:success><?php 
            echo $upgrade_result_title;
            ?>
</evo:success></p>
			<p><?php 
            echo $upgrade_result_body;
            ?>
</p>
			<?php 
            // Display modal window with upgrade data and instructions
            display_install_result_window($upgrade_result_title, $upgrade_result_body);
        } else {
            // There has been an error during upgrade... (or upgrade was not performed)
            if ($is_automated_upgrade) {
                // disable maintenance mode at the end of the upgrade script
                // TODO: check all exist conditions, and do this only when upgrade was aborted, not when upgrade failed in the middle...
                switch_maintenance_mode(false, 'upgrade');
            }
            ?>
			<p class="alert alert-danger" style="margin-top: 40px;"><evo:error><?php 
            echo T_('Upgrade failed!');
            ?>
</evo:error></p>
			<?php 
            // A link back to install menu
            display_install_back_link();
Ejemplo n.º 2
0
/**
 * Install new DB.
 */
function install_newdb()
{
    global $new_db_version, $admin_url, $baseurl, $install_login, $random_password, $create_sample_contents;
    /*
     * -----------------------------------------------------------------------------------
     * NEW DB: Create a plain new db structure + sample contents
     * -----------------------------------------------------------------------------------
     */
    require_once dirname(__FILE__) . '/_functions_create.php';
    if ($old_db_version = get_db_version()) {
        echo '<p class="text-warning"><strong><evo:warning>' . T_('OOPS! It seems b2evolution is already installed!') . '</evo:warning></strong></p>';
        if ($old_db_version < $new_db_version) {
            echo '<p>' . sprintf(T_('Would you like to <a %s>upgrade your existing installation now</a>?'), 'href="?action=evoupgrade"') . '</p>';
        }
        return;
    }
    /**
     * 1 - If current installation is local, test or intranet
     *     Used to turn off gravatar and all ping plugins
     *
     * @var integer
     */
    $local_installation = param('local_installation', 'integer', $create_sample_contents == 'all' ? intval(check_local_installation()) : 0);
    echo '<h2>' . T_('Creating b2evolution tables...') . '</h2>';
    evo_flush();
    create_tables();
    // Update the progress bar status
    update_install_progress_bar();
    echo '<h2>' . T_('Creating minimum default data...') . '</h2>';
    evo_flush();
    create_default_data();
    if ($create_sample_contents) {
        global $Settings, $test_install_all_features;
        echo '<h2>' . T_('Installing sample contents...') . '</h2>';
        evo_flush();
        // We're gonna need some environment in order to create the demo contents...
        load_class('settings/model/_generalsettings.class.php', 'GeneralSettings');
        load_class('users/model/_usersettings.class.php', 'UserSettings');
        /**
         * @var GeneralSettings
         */
        $Settings = new GeneralSettings();
        /**
         * @var UserCache
         */
        $UserCache =& get_UserCache();
        // Create $current_User object.
        // (Assigning by reference does not work with "global" keyword (PHP 5.2.8))
        $GLOBALS['current_User'] =& $UserCache->get_by_ID(1);
        create_demo_contents();
    }
    // Update the progress bar status
    update_install_progress_bar();
    track_step('install-success');
    $install_result_title = T_('Installation successful!');
    $install_result_body = '<p><strong>' . sprintf(T_('Now you can <a %s>log in</a> with the following credentials:'), 'href="' . $admin_url . '"') . '</strong></p>' . '<table>' . '<tr><td>' . T_('Login') . ': &nbsp;</td><td><strong><evo:login>' . (isset($install_login) ? $install_login : '******') . '</evo:login></strong></td></tr>' . '<tr><td>' . T_('Password') . ': &nbsp;</td><td><strong><evo:password>' . $random_password . '</evo:password></strong></td></tr>' . '</table>' . '<br /><p>' . T_('Note that password carefully! It is a <em>random</em> password that is given to you when you install b2evolution. If you lose it, you will have to delete the database tables and re-install anew.') . '</p>';
    // Display installation data and instructions
    echo '<h2>' . $install_result_title . '</h2>';
    echo $install_result_body;
    // Modal window with installation data and instructions
    display_install_result_window($install_result_title, $install_result_body);
}