original_string: public static function add_user_private_files($draftid) {
          global $CFG, $USER;
          require_once($CFG->libdir . "/filelib.php");
  
          $params = self::validate_parameters(self::add_user_private_files_parameters(), array('draftid' => $draftid));
  
          if (isguestuser()) {
              throw new invalid_parameter_exception('Guest users cannot upload files');
          }
  
          $context = context_user::instance($USER->id);
          require_capability('moodle/user:manageownfiles', $context);
  
          $maxbytes = $CFG->userquota;
          $maxareabytes = $CFG->userquota;
          if (has_capability('moodle/user:ignoreuserquota', $context)) {
              $maxbytes = USER_CAN_IGNORE_FILE_SIZE_LIMITS;
              $maxareabytes = FILE_AREA_MAX_BYTES_UNLIMITED;
          }
  
          $options = array('subdirs' => 1,
                           'maxbytes' => $maxbytes,
                           'maxfiles' => -1,
                           'areamaxbytes' => $maxareabytes);
  
          file_merge_files_from_draft_area_into_filearea($draftid, $context->id, 'user', 'private', 0, $options);
  
          return null;
      }
code: public static function add_user_private_files($draftid) {
          global $CFG, $USER;
          require_once($CFG->libdir . "/filelib.php");
  
          $params = self::validate_parameters(self::add_user_private_files_parameters(), array('draftid' => $draftid));
  
          if (isguestuser()) {
              throw new invalid_parameter_exception('Guest users cannot upload files');
          }
  
          $context = context_user::instance($USER->id);
          require_capability('moodle/user:manageownfiles', $context);
  
          $maxbytes = $CFG->userquota;
          $maxareabytes = $CFG->userquota;
          if (has_capability('moodle/user:ignoreuserquota', $context)) {
              $maxbytes = USER_CAN_IGNORE_FILE_SIZE_LIMITS;
              $maxareabytes = FILE_AREA_MAX_BYTES_UNLIMITED;
          }
  
          $options = array('subdirs' => 1,
                           'maxbytes' => $maxbytes,
                           'maxfiles' => -1,
                           'areamaxbytes' => $maxareabytes);
  
          file_merge_files_from_draft_area_into_filearea($draftid, $context->id, 'user', 'private', 0, $options);
  
          return null;
      }
code_tokens: public static function add_user_private_files ( $ draftid ) { global $ CFG , $ USER ; require_once ( $ CFG -> libdir . "/filelib.php" ) ; $ params = self :: validate_parameters ( self :: add_user_private_files_parameters ( ) , array ( 'draftid' => $ draftid ) ) ; if ( isguestuser ( ) ) { throw new invalid_parameter_exception ( 'Guest users cannot upload files' ) ; } $ context = context_user :: instance ( $ USER -> id ) ; require_capability ( 'moodle/user:manageownfiles' , $ context ) ; $ maxbytes = $ CFG -> userquota ; $ maxareabytes = $ CFG -> userquota ; if ( has_capability ( 'moodle/user:ignoreuserquota' , $ context ) ) { $ maxbytes = USER_CAN_IGNORE_FILE_SIZE_LIMITS ; $ maxareabytes = FILE_AREA_MAX_BYTES_UNLIMITED ; } $ options = array ( 'subdirs' => 1 , 'maxbytes' => $ maxbytes , 'maxfiles' => - 1 , 'areamaxbytes' => $ maxareabytes ) ; file_merge_files_from_draft_area_into_filearea ( $ draftid , $ context -> id , 'user' , 'private' , 0 , $ options ) ; return null ; }
docstring: Copy files from a draft area to users private files area.
  
  @throws invalid_parameter_exception
  @param int $draftid Id of a draft area containing files.
  @return array An array of warnings
  @since Moodle 2.6
docstring_tokens: Copy files from a draft area to users private files area .