original_string: public static function get_private_files_info($userid = 0) {
          global $CFG, $USER;
          require_once($CFG->libdir . '/filelib.php');
  
          $params = self::validate_parameters(self::get_private_files_info_parameters(), array('userid' => $userid));
          $warnings = array();
  
          $context = context_system::instance();
          self::validate_context($context);
  
          if (empty($params['userid']) || $params['userid'] == $USER->id) {
              $usercontext = context_user::instance($USER->id);
              require_capability('moodle/user:manageownfiles', $usercontext);
          } else {
              $user = core_user::get_user($params['userid'], '*', MUST_EXIST);
              core_user::require_active_user($user);
              // Only admins can retrieve other users information.
              require_capability('moodle/site:config', $context);
              $usercontext = context_user::instance($user->id);
          }
  
          $fileareainfo = file_get_file_area_info($usercontext->id, 'user', 'private');
  
          $result = array();
          $result['filecount'] = $fileareainfo['filecount'];
          $result['foldercount'] = $fileareainfo['foldercount'];
          $result['filesize'] = $fileareainfo['filesize'];
          $result['filesizewithoutreferences'] = $fileareainfo['filesize_without_references'];
          $result['warnings'] = $warnings;
          return $result;
      }
code: public static function get_private_files_info($userid = 0) {
          global $CFG, $USER;
          require_once($CFG->libdir . '/filelib.php');
  
          $params = self::validate_parameters(self::get_private_files_info_parameters(), array('userid' => $userid));
          $warnings = array();
  
          $context = context_system::instance();
          self::validate_context($context);
  
          if (empty($params['userid']) || $params['userid'] == $USER->id) {
              $usercontext = context_user::instance($USER->id);
              require_capability('moodle/user:manageownfiles', $usercontext);
          } else {
              $user = core_user::get_user($params['userid'], '*', MUST_EXIST);
              core_user::require_active_user($user);
              // Only admins can retrieve other users information.
              require_capability('moodle/site:config', $context);
              $usercontext = context_user::instance($user->id);
          }
  
          $fileareainfo = file_get_file_area_info($usercontext->id, 'user', 'private');
  
          $result = array();
          $result['filecount'] = $fileareainfo['filecount'];
          $result['foldercount'] = $fileareainfo['foldercount'];
          $result['filesize'] = $fileareainfo['filesize'];
          $result['filesizewithoutreferences'] = $fileareainfo['filesize_without_references'];
          $result['warnings'] = $warnings;
          return $result;
      }
code_tokens: public static function get_private_files_info ( $ userid = 0 ) { global $ CFG , $ USER ; require_once ( $ CFG -> libdir . '/filelib.php' ) ; $ params = self :: validate_parameters ( self :: get_private_files_info_parameters ( ) , array ( 'userid' => $ userid ) ) ; $ warnings = array ( ) ; $ context = context_system :: instance ( ) ; self :: validate_context ( $ context ) ; if ( empty ( $ params [ 'userid' ] ) || $ params [ 'userid' ] == $ USER -> id ) { $ usercontext = context_user :: instance ( $ USER -> id ) ; require_capability ( 'moodle/user:manageownfiles' , $ usercontext ) ; } else { $ user = core_user :: get_user ( $ params [ 'userid' ] , '*' , MUST_EXIST ) ; core_user :: require_active_user ( $ user ) ; // Only admins can retrieve other users information. require_capability ( 'moodle/site:config' , $ context ) ; $ usercontext = context_user :: instance ( $ user -> id ) ; } $ fileareainfo = file_get_file_area_info ( $ usercontext -> id , 'user' , 'private' ) ; $ result = array ( ) ; $ result [ 'filecount' ] = $ fileareainfo [ 'filecount' ] ; $ result [ 'foldercount' ] = $ fileareainfo [ 'foldercount' ] ; $ result [ 'filesize' ] = $ fileareainfo [ 'filesize' ] ; $ result [ 'filesizewithoutreferences' ] = $ fileareainfo [ 'filesize_without_references' ] ; $ result [ 'warnings' ] = $ warnings ; return $ result ; }
docstring: Returns general information about files in the user private files area.
  
  @param int $userid Id of the user, default to current user.
  @return array of warnings and file area information
  @since Moodle 3.4
  @throws moodle_exception
docstring_tokens: Returns general information about files in the user private files area .