file_space_used

6 file.inc file_space_used($uid = NULL)
7 file.inc file_space_used($uid = NULL, $status = FILE_STATUS_PERMANENT)
8 file.inc file_space_used($uid = NULL, $status = FILE_STATUS_PERMANENT)

Determine total disk space used by a single user or the whole filesystem.

Parameters

$uid: An optional user id. A NULL value returns the total space used by all files.

Related topics

2 calls to file_space_used()

File

includes/file.inc, line 493
API for handling file uploads and server file management.

Code

function file_space_used($uid = NULL) {
  if (isset($uid)) {
    return (int) db_result(db_query('SELECT SUM(filesize) FROM {files} WHERE uid = %d', $uid));
  }
  return (int) db_result(db_query('SELECT SUM(filesize) FROM {files}'));
}

Comments

Clarification

Hello

This function will not be accurate if someone decides to delete some files manually using an FTP software. Of course, that kind of practice is highly discouraged.

Cheers

Login or register to post comments