Beispiel #1
0
        print_error('unknownbackuptype');
}
// Backup of large courses requires extra memory. Use the amount configured
// in admin settings.
raise_memory_limit(MEMORY_EXTRA);
if (!($bc = backup_ui::load_controller($backupid))) {
    $bc = new backup_controller($type, $id, backup::FORMAT_MOODLE, backup::INTERACTIVE_YES, backup::MODE_GENERAL, $USER->id);
}
$backup = new backup_ui($bc);
$PAGE->set_title($heading);
$PAGE->set_heading($heading);
$renderer = $PAGE->get_renderer('core', 'backup');
echo $OUTPUT->header();
// Prepare a progress bar which can display optionally during long-running
// operations while setting up the UI.
$slowprogress = new core_backup_display_progress_if_slow(get_string('preparingui', 'backup'));
$previous = optional_param('previous', false, PARAM_BOOL);
if ($backup->get_stage() == backup_ui::STAGE_SCHEMA && !$previous) {
    // After schema stage, we are probably going to get to the confirmation stage,
    // The confirmation stage has 2 sets of progress, so this is needed to prevent
    // it showing 2 progress bars.
    $twobars = true;
    $slowprogress->start_progress('', 2);
} else {
    $twobars = false;
}
$backup->get_controller()->set_progress($slowprogress);
$backup->process();
if ($backup->enforce_changed_dependencies()) {
    debugging('Your settings have been altered due to unmet dependencies', DEBUG_DEVELOPER);
}
Beispiel #2
0
    $courseshortname = $SITE->shortname;
} else {
    $coursefullname = $course->fullname;
    $courseshortname = $course->shortname;
}

// Show page header.
$PAGE->set_title($courseshortname . ': ' . get_string('restore'));
$PAGE->set_heading($coursefullname);

$renderer = $PAGE->get_renderer('core','backup');
echo $OUTPUT->header();

// Prepare a progress bar which can display optionally during long-running
// operations while setting up the UI.
$slowprogress = new core_backup_display_progress_if_slow(get_string('preparingui', 'backup'));

// Overall, allow 10 units of progress.
$slowprogress->start_progress('', 10);

// This progress section counts for loading the restore controller.
$slowprogress->start_progress('', 1, 1);

// Restore of large courses requires extra memory. Use the amount configured
// in admin settings.
raise_memory_limit(MEMORY_EXTRA);

if ($stage & restore_ui::STAGE_CONFIRM + restore_ui::STAGE_DESTINATION) {
    $restore = restore_ui::engage_independent_stage($stage, $contextid);
} else {
    $restoreid = optional_param('restore', false, PARAM_ALPHANUM);