From b8564134aaffc2ebe35fecd5dae4fd0f6523eb53 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 7 Jan 2014 14:10:28 -0800 Subject: make storage limit service classes apply to accounts, not channels. Also include a css file that was missing from work yesterday. --- include/attach.php | 4 ++-- include/photos.php | 6 ++---- include/reddav.php | 8 ++++---- 3 files changed, 8 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/attach.php b/include/attach.php index b48dd211a..c05c39020 100644 --- a/include/attach.php +++ b/include/attach.php @@ -330,8 +330,8 @@ function attach_store($channel,$observer_hash,$options = '',$arr = null) { $limit = service_class_fetch($channel_id,'attach_upload_limit'); if($limit !== false) { - $r = q("select sum(filesize) as total from attach where uid = %d ", - intval($channel_id) + $r = q("select sum(filesize) as total from attach where aid = %d ", + intval($channel['channel_account_id']) ); if(($r) && (($r[0]['total'] + $filesize) > ($limit - $existing_size))) { $ret['message'] = upgrade_message(true).sprintf(t("You have reached your limit of %1$.0f Mbytes attachment storage."),$limit / 1024000); diff --git a/include/photos.php b/include/photos.php index e41d1059a..e4367bf95 100644 --- a/include/photos.php +++ b/include/photos.php @@ -102,12 +102,10 @@ function photo_upload($channel, $observer, $args) { $imagedata = @file_get_contents($src); - $r = q("select sum(size) as total from photo where uid = %d and scale = 0 ", - intval($channel_id) + $r = q("select sum(size) as total from photo where aid = %d and scale = 0 ", + intval($account_id) ); -// FIXME service class limits should probably apply to accounts and not channels - $limit = service_class_fetch($channel_id,'photo_upload_limit'); if(($r) && ($limit !== false) && (($r[0]['total'] + strlen($imagedata)) > $limit)) { diff --git a/include/reddav.php b/include/reddav.php index 05a93b9f8..3bf670711 100644 --- a/include/reddav.php +++ b/include/reddav.php @@ -160,8 +160,8 @@ class RedDirectory extends DAV\Node implements DAV\ICollection { $limit = service_class_fetch($c[0]['channel_id'],'attach_upload_limit'); if($limit !== false) { - $x = q("select sum(filesize) as total from attach where uid = %d ", - intval($c[0]['channel_id']) + $x = q("select sum(filesize) as total from attach where aid = %d ", + intval($c[0]['channel_account_id']) ); if(($x) && ($x[0]['total'] + $r[0]['filesize'] > $limit)) { q("delete from attach where hash = '%s' and uid = %d limit 1", @@ -359,8 +359,8 @@ class RedFile extends DAV\Node implements DAV\IFile { $limit = service_class_fetch($c[0]['channel_id'],'attach_upload_limit'); if($limit !== false) { - $x = q("select sum(filesize) as total from attach where uid = %d ", - intval($c[0]['channel_id']) + $x = q("select sum(filesize) as total from attach where aid = %d ", + intval($c[0]['channel_account_id']) ); if(($x) && ($x[0]['total'] + $r[0]['filesize'] > $limit)) { q("delete from attach where hash = '%s' and uid = %d limit 1", -- cgit v1.2.3