From 2da4b04b5e606a29e55a64a9a8de80702d0cb1f2 Mon Sep 17 00:00:00 2001 From: Christian Fowler Date: Mon, 7 May 2007 16:53:47 +0000 Subject: INNER JOIN on attachments so orphans are not counted - use foreign_id, doh --- LibertyQuota.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/LibertyQuota.php b/LibertyQuota.php index b92de14..0e08a1b 100644 --- a/LibertyQuota.php +++ b/LibertyQuota.php @@ -1,6 +1,6 @@ * - * @version $Revision: 1.13 $ $Date: 2007/05/07 15:59:55 $ $Author: spiderr $ + * @version $Revision: 1.14 $ $Date: 2007/05/07 16:53:47 $ $Author: spiderr $ */ class LibertyQuota extends LibertyBase { /** @@ -221,7 +221,7 @@ class LibertyQuota extends LibertyBase { $ret = 0; if( is_numeric( $pUserId ) ) { // INNER JOIN on attachments so orphans are not counted - $ret = $this->mDb->getOne( "SELECT SUM(`file_size`) FROM `".BIT_DB_PREFIX."liberty_files` lf INNER JOIN `".BIT_DB_PREFIX."liberty_attachments` la ON (lf.`file_id`=la.`attachment_id`) WHERE lf.`user_id`=?", array( $pUserId ) ); + $ret = $this->mDb->getOne( "SELECT SUM(`file_size`) FROM `".BIT_DB_PREFIX."liberty_files` lf INNER JOIN `".BIT_DB_PREFIX."liberty_attachments` la ON (lf.`file_id`=la.`foreign_id`) WHERE lf.`user_id`=?", array( $pUserId ) ); } return $ret; } -- cgit v1.3