当前位置: 首页>>代码示例>>PHP>>正文


PHP restore_controller::get_interactive方法代码示例

本文整理汇总了PHP中restore_controller::get_interactive方法的典型用法代码示例。如果您正苦于以下问题:PHP restore_controller::get_interactive方法的具体用法?PHP restore_controller::get_interactive怎么用?PHP restore_controller::get_interactive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在restore_controller的用法示例。


在下文中一共展示了restore_controller::get_interactive方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
 }
开发者ID:renatosousafilho,项目名称:moodle-restore,代码行数:59,代码来源:restore_controller_dbops.class.php


注:本文中的restore_controller::get_interactive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。