original_string: public function process() {
          global $DB;
          $filepathdir = make_backup_temp_directory($this->filepath, false);
          if (!file_exists($filepathdir) || !is_dir($filepathdir)) {
              throw new restore_ui_exception('invalidrestorepath');
          }
          if (optional_param('searchcourses', false, PARAM_BOOL)) {
              return false;
          }
          $this->target = optional_param('target', backup::TARGET_NEW_COURSE, PARAM_INT);
          $targetid = optional_param('targetid', null, PARAM_INT);
          if (!is_null($this->target) && !is_null($targetid) && confirm_sesskey()) {
              if ($this->target == backup::TARGET_NEW_COURSE) {
                  list($fullname, $shortname) = restore_dbops::calculate_course_names(0, get_string('restoringcourse', 'backup'), get_string('restoringcourseshortname', 'backup'));
                  $this->courseid = restore_dbops::create_new_course($fullname, $shortname, $targetid);
              } else {
                  $this->courseid = $targetid;
              }
              return ($DB->record_exists('course', array('id' => $this->courseid)));
          }
          return false;
      }
code: public function process() {
          global $DB;
          $filepathdir = make_backup_temp_directory($this->filepath, false);
          if (!file_exists($filepathdir) || !is_dir($filepathdir)) {
              throw new restore_ui_exception('invalidrestorepath');
          }
          if (optional_param('searchcourses', false, PARAM_BOOL)) {
              return false;
          }
          $this->target = optional_param('target', backup::TARGET_NEW_COURSE, PARAM_INT);
          $targetid = optional_param('targetid', null, PARAM_INT);
          if (!is_null($this->target) && !is_null($targetid) && confirm_sesskey()) {
              if ($this->target == backup::TARGET_NEW_COURSE) {
                  list($fullname, $shortname) = restore_dbops::calculate_course_names(0, get_string('restoringcourse', 'backup'), get_string('restoringcourseshortname', 'backup'));
                  $this->courseid = restore_dbops::create_new_course($fullname, $shortname, $targetid);
              } else {
                  $this->courseid = $targetid;
              }
              return ($DB->record_exists('course', array('id' => $this->courseid)));
          }
          return false;
      }
code_tokens: public function process ( ) { global $ DB ; $ filepathdir = make_backup_temp_directory ( $ this -> filepath , false ) ; if ( ! file_exists ( $ filepathdir ) || ! is_dir ( $ filepathdir ) ) { throw new restore_ui_exception ( 'invalidrestorepath' ) ; } if ( optional_param ( 'searchcourses' , false , PARAM_BOOL ) ) { return false ; } $ this -> target = optional_param ( 'target' , backup :: TARGET_NEW_COURSE , PARAM_INT ) ; $ targetid = optional_param ( 'targetid' , null , PARAM_INT ) ; if ( ! is_null ( $ this -> target ) && ! is_null ( $ targetid ) && confirm_sesskey ( ) ) { if ( $ this -> target == backup :: TARGET_NEW_COURSE ) { list ( $ fullname , $ shortname ) = restore_dbops :: calculate_course_names ( 0 , get_string ( 'restoringcourse' , 'backup' ) , get_string ( 'restoringcourseshortname' , 'backup' ) ) ; $ this -> courseid = restore_dbops :: create_new_course ( $ fullname , $ shortname , $ targetid ) ; } else { $ this -> courseid = $ targetid ; } return ( $ DB -> record_exists ( 'course' , array ( 'id' => $ this -> courseid ) ) ) ; } return false ; }
docstring: Processes the destination stage.
  @return bool
  @throws coding_exception
  @throws restore_ui_exception
docstring_tokens: Processes the destination stage .