本文整理汇总了PHP中restore_controller::get_format方法的典型用法代码示例。如果您正苦于以下问题:PHP restore_controller::get_format方法的具体用法?PHP restore_controller::get_format怎么用?PHP restore_controller::get_format使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类restore_controller
的用法示例。
在下文中一共展示了restore_controller::get_format方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_controller
/**
* Send one restore controller to DB
*
* @param restore_controller $controller controller to send to DB
* @param string $checksum hash of the controller to be checked
* @param bool $includeobj to decide if the object itself must be updated (true) or no (false)
* @param bool $cleanobj to decide if the object itself must be cleaned (true) or no (false)
* @return int id of the controller record in the DB
* @throws backup_controller_exception|restore_dbops_exception
*/
public static function save_controller($controller, $checksum, $includeobj = true, $cleanobj = false)
{
global $DB;
// Check we are going to save one backup_controller
if (!$controller instanceof restore_controller) {
throw new backup_controller_exception('restore_controller_expected');
}
// Check checksum is ok. Only if we are including object info. Sounds silly but it isn't ;-).
if ($includeobj and !$controller->is_checksum_correct($checksum)) {
throw new restore_dbops_exception('restore_controller_dbops_saving_checksum_mismatch');
}
// Cannot request to $includeobj and $cleanobj at the same time.
if ($includeobj and $cleanobj) {
throw new restore_dbops_exception('restore_controller_dbops_saving_cannot_include_and_delete');
}
// Get all the columns
$rec = new stdclass();
$rec->backupid = $controller->get_restoreid();
$rec->operation = $controller->get_operation();
$rec->type = $controller->get_type();
$rec->itemid = $controller->get_courseid();
$rec->format = $controller->get_format();
$rec->interactive = $controller->get_interactive();
$rec->purpose = $controller->get_mode();
$rec->userid = $controller->get_userid();
$rec->status = $controller->get_status();
$rec->execution = $controller->get_execution();
$rec->executiontime = $controller->get_executiontime();
$rec->checksum = $checksum;
// Serialize information
if ($includeobj) {
$rec->controller = base64_encode(serialize($controller));
} else {
if ($cleanobj) {
$rec->controller = '';
}
}
// Send it to DB
if ($recexists = $DB->get_record('backup_controllers', array('backupid' => $rec->backupid))) {
$rec->id = $recexists->id;
$rec->timemodified = time();
$DB->update_record('backup_controllers', $rec);
} else {
$rec->timecreated = time();
$rec->timemodified = 0;
$rec->id = $DB->insert_record('backup_controllers', $rec);
}
return $rec->id;
}
示例2: get_format
/**
* Gets the format for the backup
* @return int
*/
public function get_format()
{
return $this->controller->get_format();
}