diff options
| author | Christian Fowler <spider@viovio.com> | 2007-05-07 16:53:47 +0000 |
|---|---|---|
| committer | Christian Fowler <spider@viovio.com> | 2007-05-07 16:53:47 +0000 |
| commit | 2da4b04b5e606a29e55a64a9a8de80702d0cb1f2 (patch) | |
| tree | 6c1b21dbd08fcdb15bbf017e7aeb9c54cc65689e | |
| parent | 38e0ed2084f8285373a0ed1c91f4e97883123e2c (diff) | |
| download | quota-2da4b04b5e606a29e55a64a9a8de80702d0cb1f2.tar.gz quota-2da4b04b5e606a29e55a64a9a8de80702d0cb1f2.tar.bz2 quota-2da4b04b5e606a29e55a64a9a8de80702d0cb1f2.zip | |
INNER JOIN on attachments so orphans are not counted - use foreign_id, doh
| -rw-r--r-- | LibertyQuota.php | 8 |
1 files 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 @@ <?php /** - * $Header: /cvsroot/bitweaver/_bit_quota/LibertyQuota.php,v 1.13 2007/05/07 15:59:55 spiderr Exp $ + * $Header: /cvsroot/bitweaver/_bit_quota/LibertyQuota.php,v 1.14 2007/05/07 16:53:47 spiderr Exp $ * * Copyright (c) 2004 bitweaver.org * Copyright (c) 2003 tikwiki.org @@ -8,7 +8,7 @@ * All Rights Reserved. See copyright.txt for details and a complete list of authors. * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details * - * $Id: LibertyQuota.php,v 1.13 2007/05/07 15:59:55 spiderr Exp $ + * $Id: LibertyQuota.php,v 1.14 2007/05/07 16:53:47 spiderr Exp $ * @package quota */ @@ -28,7 +28,7 @@ require_once( LIBERTY_PKG_PATH.'LibertyAttachable.php' ); * * @author spider <spider@steelsun.com> * - * @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; } |
