original_string: protected function process_attachment($acceptedtypes, \context_user $context, $itemid, \stdClass $attachment) {
          global $USER, $CFG;
  
          // Create the file record.
          $record = new \stdClass();
          $record->filearea   = 'draft';
          $record->component  = 'user';
  
          $record->itemid     = $itemid;
          $record->license    = $CFG->sitedefaultlicense;
          $record->author     = fullname($USER);
          $record->contextid  = $context->id;
          $record->userid     = $USER->id;
  
          // All files sent by e-mail should have a flat structure.
          $record->filepath   = '/';
  
          $record->filename = $attachment->filename;
  
          mtrace("--> Attaching {$record->filename} to " .
                 "/{$record->contextid}/{$record->component}/{$record->filearea}/" .
                 "{$record->itemid}{$record->filepath}{$record->filename}");
  
          $fs = get_file_storage();
          return $fs->create_file_from_string($record, $attachment->content);
      }
code: protected function process_attachment($acceptedtypes, \context_user $context, $itemid, \stdClass $attachment) {
          global $USER, $CFG;
  
          // Create the file record.
          $record = new \stdClass();
          $record->filearea   = 'draft';
          $record->component  = 'user';
  
          $record->itemid     = $itemid;
          $record->license    = $CFG->sitedefaultlicense;
          $record->author     = fullname($USER);
          $record->contextid  = $context->id;
          $record->userid     = $USER->id;
  
          // All files sent by e-mail should have a flat structure.
          $record->filepath   = '/';
  
          $record->filename = $attachment->filename;
  
          mtrace("--> Attaching {$record->filename} to " .
                 "/{$record->contextid}/{$record->component}/{$record->filearea}/" .
                 "{$record->itemid}{$record->filepath}{$record->filename}");
  
          $fs = get_file_storage();
          return $fs->create_file_from_string($record, $attachment->content);
      }
code_tokens: protected function process_attachment ( $ acceptedtypes , \ context_user $ context , $ itemid , \ stdClass $ attachment ) { global $ USER , $ CFG ; // Create the file record. $ record = new \ stdClass ( ) ; $ record -> filearea = 'draft' ; $ record -> component = 'user' ; $ record -> itemid = $ itemid ; $ record -> license = $ CFG -> sitedefaultlicense ; $ record -> author = fullname ( $ USER ) ; $ record -> contextid = $ context -> id ; $ record -> userid = $ USER -> id ; // All files sent by e-mail should have a flat structure. $ record -> filepath = '/' ; $ record -> filename = $ attachment -> filename ; mtrace ( "--> Attaching {$record->filename} to " . "/{$record->contextid}/{$record->component}/{$record->filearea}/" . "{$record->itemid}{$record->filepath}{$record->filename}" ) ; $ fs = get_file_storage ( ) ; return $ fs -> create_file_from_string ( $ record , $ attachment -> content ) ; }
docstring: Process attachments included in a message.
  
  @param string[] $acceptedtypes String The mimetypes of the acceptable attachment types.
  @param \context_user $context context_user The context of the user creating this attachment.
  @param int $itemid int The itemid to store this attachment under.
  @param \stdClass $attachment stdClass The Attachment data to store.
  @return \stored_file
docstring_tokens: Process attachments included in a message .