예제 #1
0
    include_once './includes/install.inc';
    drupal_load_updates();
    update_fix_schema_version();
    update_fix_watchdog_115();
    update_fix_watchdog();
    update_fix_sessions();
    $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : '';
    switch ($op) {
        case 'Update':
            $output = update_update_page();
            break;
        case 'finished':
            $output = update_finished_page(TRUE);
            break;
        case 'error':
            $output = update_finished_page(FALSE);
            break;
        case 'do_update':
            $output = update_do_update_page();
            break;
        case 'do_update_nojs':
            $output = update_progress_page_nojs();
            break;
        case 'selection':
            $output = update_selection_page();
            break;
        default:
            $output = update_info_page();
            break;
    }
} else {
/**
 * Perform updates for the non-JS version and return the status page.
 */
function update_progress_page_nojs()
{
    drupal_set_title('Updating');
    $new_op = 'do_update';
    if ($_SERVER['REQUEST_METHOD'] == 'GET') {
        // Error handling: if PHP dies, it will output whatever is in the output
        // buffer, followed by the error message.
        ob_start();
        $fallback = '<p class="error">An unrecoverable error has occurred. You can find the error message below. It is advised to copy it to the clipboard for reference. Please continue to the <a href="cvs_to_versioncontrol_project_update.php?op=error">update summary</a>.</p>';
        print theme('maintenance_page', $fallback, FALSE, TRUE);
        list($percentage, $message) = update_do_updates();
        if ($percentage == 100) {
            $new_op = 'finished';
        }
        // Updates successful; remove fallback
        ob_end_clean();
    } else {
        // Abort the update if the necessary modules aren't installed.
        if (!module_exists('versioncontrol') || !module_exists('versioncontrol_project') || !module_exists('cvs')) {
            print update_finished_page(FALSE);
            return NULL;
        }
        // This is the first page so return some output immediately.
        $percentage = 0;
        $message = 'Starting updates';
    }
    drupal_set_html_head('<meta http-equiv="Refresh" content="0; URL=cvs_to_versioncontrol_project_update.php?op=' . $new_op . '">');
    $output = theme('progress_bar', $percentage, $message);
    $output .= '<p>Updating your site will take a few seconds.</p>';
    // Note: do not output drupal_set_message()s until the summary page.
    print theme('maintenance_page', $output, FALSE);
    return NULL;
}
예제 #3
0
    $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : '';
    switch ($op) {
        case 'Update':
            // Check for a valid form token to protect against cross site request forgeries.
            if (drupal_valid_token($_REQUEST['edit']['form_token'], 'update_script_selection_form', TRUE)) {
                $output = update_update_page();
            } else {
                form_set_error('form_token', t('Validation error, please try again.  If this error persists, please contact the site administrator.'));
                $output = update_selection_page();
            }
            break;
        case 'finished':
            $output = update_finished_page(true);
            break;
        case 'error':
            $output = update_finished_page(false);
            break;
        case 'do_update':
            $output = update_do_update_page();
            break;
        case 'do_update_nojs':
            $output = update_progress_page_nojs();
            break;
        case 'selection':
            $output = update_selection_page();
            break;
        default:
            $output = update_info_page();
            break;
    }
} else {