本文整理汇总了PHP中backup_controller::finish_ui方法的典型用法代码示例。如果您正苦于以下问题:PHP backup_controller::finish_ui方法的具体用法?PHP backup_controller::finish_ui怎么用?PHP backup_controller::finish_ui使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backup_controller
的用法示例。
在下文中一共展示了backup_controller::finish_ui方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
if ($options['courseshortname']) {
$course = $DB->get_record('course', array('shortname' => $options['courseshortname']), '*', MUST_EXIST);
}
}
cli_heading('Performing backup...');
$bc = new backup_controller(backup::TYPE_1COURSE, $course->id, backup::FORMAT_MOODLE, backup::INTERACTIVE_YES, backup::MODE_GENERAL, $admin->id);
// Set the default filename.
$format = $bc->get_format();
$type = $bc->get_type();
$id = $bc->get_id();
$users = $bc->get_plan()->get_setting('users')->get_value();
$anonymised = $bc->get_plan()->get_setting('anonymize')->get_value();
$filename = backup_plan_dbops::get_default_backup_filename($format, $type, $id, $users, $anonymised);
$bc->get_plan()->get_setting('filename')->set_value($filename);
// Execution.
$bc->finish_ui();
$bc->execute_plan();
$results = $bc->get_results();
$file = $results['backup_destination'];
// May be empty if file already moved to target location.
// Do we need to store backup somewhere else?
if (!empty($dir)) {
if ($file) {
mtrace("Writing " . $dir . '/' . $filename);
if ($file->copy_content_to($dir . '/' . $filename)) {
$file->delete();
mtrace("Backup completed.");
} else {
mtrace("Destination directory does not exist or is not writable. Leaving the backup in the course backup file area.");
}
}
示例2: foreach
function backup_template($courseid_from,$settings,$config,$admin) {
$bc = new backup_controller(backup::TYPE_1COURSE, $courseid_from, backup::FORMAT_MOODLE,
backup::INTERACTIVE_YES, backup::MODE_IMPORT,$admin->id);
$backupid = $bc->get_backupid();
$bc->get_plan()->get_setting('users')->set_status(backup_setting::LOCKED_BY_CONFIG);
foreach ($settings as $setting => $configsetting) {
if ($bc->get_plan()->setting_exists($setting)) {
$bc->get_plan()->get_setting($setting)->set_value($config->{$configsetting});
}
}
$bc->finish_ui();
$bc->execute_plan();
$bc->destroy();
unset($bc);
return $backupid;
}