original_string: public static function adhoc_task_from_record($record) {
          $classname = self::get_canonical_class_name($record->classname);
          if (!class_exists($classname)) {
              debugging("Failed to load task: " . $classname, DEBUG_DEVELOPER);
              return false;
          }
          $task = new $classname;
          if (isset($record->nextruntime)) {
              $task->set_next_run_time($record->nextruntime);
          }
          if (isset($record->id)) {
              $task->set_id($record->id);
          }
          if (isset($record->component)) {
              $task->set_component($record->component);
          }
          $task->set_blocking(!empty($record->blocking));
          if (isset($record->faildelay)) {
              $task->set_fail_delay($record->faildelay);
          }
          if (isset($record->customdata)) {
              $task->set_custom_data_as_string($record->customdata);
          }
  
          if (isset($record->userid)) {
              $task->set_userid($record->userid);
          }
  
          return $task;
      }
code: public static function adhoc_task_from_record($record) {
          $classname = self::get_canonical_class_name($record->classname);
          if (!class_exists($classname)) {
              debugging("Failed to load task: " . $classname, DEBUG_DEVELOPER);
              return false;
          }
          $task = new $classname;
          if (isset($record->nextruntime)) {
              $task->set_next_run_time($record->nextruntime);
          }
          if (isset($record->id)) {
              $task->set_id($record->id);
          }
          if (isset($record->component)) {
              $task->set_component($record->component);
          }
          $task->set_blocking(!empty($record->blocking));
          if (isset($record->faildelay)) {
              $task->set_fail_delay($record->faildelay);
          }
          if (isset($record->customdata)) {
              $task->set_custom_data_as_string($record->customdata);
          }
  
          if (isset($record->userid)) {
              $task->set_userid($record->userid);
          }
  
          return $task;
      }
code_tokens: public static function adhoc_task_from_record ( $ record ) { $ classname = self :: get_canonical_class_name ( $ record -> classname ) ; if ( ! class_exists ( $ classname ) ) { debugging ( "Failed to load task: " . $ classname , DEBUG_DEVELOPER ) ; return false ; } $ task = new $ classname ; if ( isset ( $ record -> nextruntime ) ) { $ task -> set_next_run_time ( $ record -> nextruntime ) ; } if ( isset ( $ record -> id ) ) { $ task -> set_id ( $ record -> id ) ; } if ( isset ( $ record -> component ) ) { $ task -> set_component ( $ record -> component ) ; } $ task -> set_blocking ( ! empty ( $ record -> blocking ) ) ; if ( isset ( $ record -> faildelay ) ) { $ task -> set_fail_delay ( $ record -> faildelay ) ; } if ( isset ( $ record -> customdata ) ) { $ task -> set_custom_data_as_string ( $ record -> customdata ) ; } if ( isset ( $ record -> userid ) ) { $ task -> set_userid ( $ record -> userid ) ; } return $ task ; }
docstring: Utility method to create an adhoc task from a DB record.
  
  @param \stdClass $record
  @return \core\task\adhoc_task
docstring_tokens: Utility method to create an adhoc task from a DB record .