本文整理汇总了PHP中restore_controller::finish_ui方法的典型用法代码示例。如果您正苦于以下问题:PHP restore_controller::finish_ui方法的具体用法?PHP restore_controller::finish_ui怎么用?PHP restore_controller::finish_ui使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类restore_controller
的用法示例。
在下文中一共展示了restore_controller::finish_ui方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fulldelete
// went really wrong in backup, throw error. Note that backup::MODE_IMPORT
// backups don't store resulting files ever
$tempdestination = $CFG->tempdir . '/backup/' . $backupid;
if (!file_exists($tempdestination) || !is_dir($tempdestination)) {
print_error('unknownbackupexporterror');
// shouldn't happen ever
}
// Prepare the restore controller. We don't need a UI here as we will just use what
// ever the restore has (the user has just chosen).
$rc = new restore_controller($backupid, $course->id, backup::INTERACTIVE_YES, backup::MODE_IMPORT, $USER->id, $restoretarget);
// Convert the backup if required.... it should NEVER happed
if ($rc->get_status() == backup::STATUS_REQUIRE_CONV) {
$rc->convert();
}
// Mark the UI finished.
$rc->finish_ui();
// Execute prechecks
$warnings = false;
if (!$rc->execute_precheck()) {
$precheckresults = $rc->get_precheck_results();
if (is_array($precheckresults)) {
if (!empty($precheckresults['errors'])) {
// If errors are found, terminate the import.
fulldelete($tempdestination);
echo $OUTPUT->header();
echo $renderer->precheck_notices($precheckresults);
echo $OUTPUT->continue_button(new moodle_url('/course/view.php', array('id' => $course->id)));
echo $OUTPUT->footer();
die;
}
if (!empty($precheckresults['warnings'])) {
示例2: restore_to_course
function restore_to_course($courseid, $backupid, $restoretarget, $admin) {
global $CFG;
// Check whether the backup directory still exists. If missing, something
// went really wrong in backup, throw error. Note that backup::MODE_IMPORT
// backups don't store resulting files ever
$tempdestination = $CFG->tempdir . '/backup/' . $backupid;
if (!file_exists($tempdestination) || !is_dir($tempdestination)) {
print_error('unknownbackupexporterror'); // shouldn't happen ever
}
$rc = new restore_controller($backupid, $courseid, backup::INTERACTIVE_YES,
backup::MODE_IMPORT,$admin->id,$restoretarget);
// Convert the backup if required.... it should NEVER happed
if ($rc->get_status() == backup::STATUS_REQUIRE_CONV) {
$rc->convert();
}
// Mark the UI finished.
$rc->finish_ui();
// Execute prechecks
$rc->execute_precheck();
//if ($restoretarget == backup::TARGET_CURRENT_DELETING || $restoretarget == backup::TARGET_EXISTING_DELETING) {
// restore_dbops::delete_course_content($courseid);
//}
// Execute the restore.
$rc->execute_plan();
$rc->destroy();
unset($rc);
// Delete the temp directory now
fulldelete($tempdestination);
}