diff options
-rw-r--r-- | includes/file.inc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/includes/file.inc b/includes/file.inc index d649364c1..bb9a6a594 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -1121,6 +1121,7 @@ function file_validate_size($file, $file_limit = 0, $user_limit = 0) { $errors[] = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size($file->filesize), '%maxsize' => format_size($file_limit))); } + // Save a query by only calling file_space_used() when a limit is provided. if ($user_limit && (file_space_used($user->uid) + $file->filesize) > $user_limit) { $errors[] = t('The file is %filesize which would exceed your disk quota of %quota.', array('%filesize' => format_size($file->filesize), '%quota' => format_size($user_limit))); } @@ -1597,4 +1598,4 @@ function drupal_chmod($path, $mode = NULL) { /** * @} End of "defgroup file". - */
\ No newline at end of file + */ |