From 28b62f357d80d86e17f9688d65809cb959f4be6c Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 22 Jul 2009 17:05:44 +1200 Subject: fixed SQL in checking for monthly quota - works in postgres and mysql --- classes/File.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'classes/File.php') diff --git a/classes/File.php b/classes/File.php index 7ee8f6e08..0c4fbf7e6 100644 --- a/classes/File.php +++ b/classes/File.php @@ -122,6 +122,7 @@ class File extends Memcached_DataObject } function isRespectsQuota($user,$fileSize) { + if ($fileSize > common_config('attachments', 'file_quota')) { return sprintf(_('No file may be larger than %d bytes ' . 'and the file you sent was %d bytes. Try to upload a smaller version.'), @@ -135,8 +136,7 @@ class File extends Memcached_DataObject if ($total > common_config('attachments', 'user_quota')) { return sprintf(_('A file this large would exceed your user quota of %d bytes.'), common_config('attachments', 'user_quota')); } - - $query .= ' AND month(modified) = month(now()) and year(modified) = year(now())'; + $query .= ' AND EXTRACT(month FROM file.modified) = EXTRACT(month FROM now()) and EXTRACT(year FROM file.modified) = EXTRACT(year FROM now())'; $this->query($query); $this->fetch(); $total = $this->total + $fileSize; -- cgit v1.2.3-54-g00ecf