original_string: public static function store_log_for_task(task_base $task, string $logpath, bool $failed,
              int $dbreads, int $dbwrites, float $timestart, float $timeend) {
          global $DB;
  
          // Write this log to the database.
          $logdata = (object) [
              'type' => is_a($task, scheduled_task::class) ? self::TYPE_SCHEDULED : self::TYPE_ADHOC,
              'component' => $task->get_component(),
              'classname' => get_class($task),
              'userid' => 0,
              'timestart' => $timestart,
              'timeend' => $timeend,
              'dbreads' => $dbreads,
              'dbwrites' => $dbwrites,
              'result' => (int) $failed,
              'output' => file_get_contents($logpath),
          ];
  
          if (is_a($task, adhoc_task::class) && $userid = $task->get_userid()) {
              $logdata->userid = $userid;
          }
  
          $logdata->id = $DB->insert_record('task_log', $logdata);
      }
code: public static function store_log_for_task(task_base $task, string $logpath, bool $failed,
              int $dbreads, int $dbwrites, float $timestart, float $timeend) {
          global $DB;
  
          // Write this log to the database.
          $logdata = (object) [
              'type' => is_a($task, scheduled_task::class) ? self::TYPE_SCHEDULED : self::TYPE_ADHOC,
              'component' => $task->get_component(),
              'classname' => get_class($task),
              'userid' => 0,
              'timestart' => $timestart,
              'timeend' => $timeend,
              'dbreads' => $dbreads,
              'dbwrites' => $dbwrites,
              'result' => (int) $failed,
              'output' => file_get_contents($logpath),
          ];
  
          if (is_a($task, adhoc_task::class) && $userid = $task->get_userid()) {
              $logdata->userid = $userid;
          }
  
          $logdata->id = $DB->insert_record('task_log', $logdata);
      }
code_tokens: public static function store_log_for_task ( task_base $ task , string $ logpath , bool $ failed , int $ dbreads , int $ dbwrites , float $ timestart , float $ timeend ) { global $ DB ; // Write this log to the database. $ logdata = ( object ) [ 'type' => is_a ( $ task , scheduled_task :: class ) ? self :: TYPE_SCHEDULED : self :: TYPE_ADHOC , 'component' => $ task -> get_component ( ) , 'classname' => get_class ( $ task ) , 'userid' => 0 , 'timestart' => $ timestart , 'timeend' => $ timeend , 'dbreads' => $ dbreads , 'dbwrites' => $ dbwrites , 'result' => ( int ) $ failed , 'output' => file_get_contents ( $ logpath ) , ] ; if ( is_a ( $ task , adhoc_task :: class ) && $ userid = $ task -> get_userid ( ) ) { $ logdata -> userid = $ userid ; } $ logdata -> id = $ DB -> insert_record ( 'task_log' , $ logdata ) ; }
docstring: Store the log for the specified task.
  
  @param   task_base   $task The task that the log belongs to.
  @param   string      $logpath The path to the log on disk
  @param   bool        $failed Whether the task failed
  @param   int         $dbreads The number of DB reads
  @param   int         $dbwrites The number of DB writes
  @param   float       $timestart The start time of the task
  @param   float       $timeend The end time of the task
docstring_tokens: Store the log for the specified task .