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


PHP backup_controller::get_status方法代码示例

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


在下文中一共展示了backup_controller::get_status方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save_controller

 /**
  * Send one backup controller to DB
  *
  * @param backup_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|backup_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 backup_controller) {
         throw new backup_controller_exception('backup_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 backup_dbops_exception('backup_controller_dbops_saving_checksum_mismatch');
     }
     // Cannot request to $includeobj and $cleanobj at the same time.
     if ($includeobj and $cleanobj) {
         throw new backup_dbops_exception('backup_controller_dbops_saving_cannot_include_and_delete');
     }
     // Get all the columns
     $rec = new stdclass();
     $rec->backupid = $controller->get_backupid();
     $rec->operation = $controller->get_operation();
     $rec->type = $controller->get_type();
     $rec->itemid = $controller->get_id();
     $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:janeklb,项目名称:moodle,代码行数:59,代码来源:backup_controller_dbops.class.php


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