make storage limit service classes apply to accounts, not channels. Also include a css file that was missing from work yesterday.
This commit is contained in:
parent
e635dcb309
commit
b8564134aa
@ -330,8 +330,8 @@ function attach_store($channel,$observer_hash,$options = '',$arr = null) {
|
|||||||
|
|
||||||
$limit = service_class_fetch($channel_id,'attach_upload_limit');
|
$limit = service_class_fetch($channel_id,'attach_upload_limit');
|
||||||
if($limit !== false) {
|
if($limit !== false) {
|
||||||
$r = q("select sum(filesize) as total from attach where uid = %d ",
|
$r = q("select sum(filesize) as total from attach where aid = %d ",
|
||||||
intval($channel_id)
|
intval($channel['channel_account_id'])
|
||||||
);
|
);
|
||||||
if(($r) && (($r[0]['total'] + $filesize) > ($limit - $existing_size))) {
|
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);
|
$ret['message'] = upgrade_message(true).sprintf(t("You have reached your limit of %1$.0f Mbytes attachment storage."),$limit / 1024000);
|
||||||
|
@ -102,12 +102,10 @@ function photo_upload($channel, $observer, $args) {
|
|||||||
|
|
||||||
$imagedata = @file_get_contents($src);
|
$imagedata = @file_get_contents($src);
|
||||||
|
|
||||||
$r = q("select sum(size) as total from photo where uid = %d and scale = 0 ",
|
$r = q("select sum(size) as total from photo where aid = %d and scale = 0 ",
|
||||||
intval($channel_id)
|
intval($account_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
// FIXME service class limits should probably apply to accounts and not channels
|
|
||||||
|
|
||||||
$limit = service_class_fetch($channel_id,'photo_upload_limit');
|
$limit = service_class_fetch($channel_id,'photo_upload_limit');
|
||||||
|
|
||||||
if(($r) && ($limit !== false) && (($r[0]['total'] + strlen($imagedata)) > $limit)) {
|
if(($r) && ($limit !== false) && (($r[0]['total'] + strlen($imagedata)) > $limit)) {
|
||||||
|
@ -160,8 +160,8 @@ class RedDirectory extends DAV\Node implements DAV\ICollection {
|
|||||||
|
|
||||||
$limit = service_class_fetch($c[0]['channel_id'],'attach_upload_limit');
|
$limit = service_class_fetch($c[0]['channel_id'],'attach_upload_limit');
|
||||||
if($limit !== false) {
|
if($limit !== false) {
|
||||||
$x = q("select sum(filesize) as total from attach where uid = %d ",
|
$x = q("select sum(filesize) as total from attach where aid = %d ",
|
||||||
intval($c[0]['channel_id'])
|
intval($c[0]['channel_account_id'])
|
||||||
);
|
);
|
||||||
if(($x) && ($x[0]['total'] + $r[0]['filesize'] > $limit)) {
|
if(($x) && ($x[0]['total'] + $r[0]['filesize'] > $limit)) {
|
||||||
q("delete from attach where hash = '%s' and uid = %d limit 1",
|
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');
|
$limit = service_class_fetch($c[0]['channel_id'],'attach_upload_limit');
|
||||||
if($limit !== false) {
|
if($limit !== false) {
|
||||||
$x = q("select sum(filesize) as total from attach where uid = %d ",
|
$x = q("select sum(filesize) as total from attach where aid = %d ",
|
||||||
intval($c[0]['channel_id'])
|
intval($c[0]['channel_account_id'])
|
||||||
);
|
);
|
||||||
if(($x) && ($x[0]['total'] + $r[0]['filesize'] > $limit)) {
|
if(($x) && ($x[0]['total'] + $r[0]['filesize'] > $limit)) {
|
||||||
q("delete from attach where hash = '%s' and uid = %d limit 1",
|
q("delete from attach where hash = '%s' and uid = %d limit 1",
|
||||||
|
@ -42,10 +42,11 @@ function filestorage_content(&$a) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q("select channel_id from channel where channel_address = '%s'",
|
$r = q("select * from channel where channel_address = '%s'",
|
||||||
dbesc($which)
|
dbesc($which)
|
||||||
);
|
);
|
||||||
if($r) {
|
if($r) {
|
||||||
|
$channel = $r[0];
|
||||||
$owner = intval($r[0]['channel_id']);
|
$owner = intval($r[0]['channel_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,8 +147,8 @@ function filestorage_content(&$a) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$limit = service_class_fetch ($owner,'attach_upload_limit');
|
$limit = service_class_fetch ($owner,'attach_upload_limit');
|
||||||
$r = q("select sum(filesize) as total from attach where uid = %d ",
|
$r = q("select sum(filesize) as total from attach where aid = %d ",
|
||||||
intval($owner)
|
intval($channel['channel_account_id'])
|
||||||
);
|
);
|
||||||
$used = $r[0]['total'];
|
$used = $r[0]['total'];
|
||||||
|
|
||||||
|
@ -687,8 +687,8 @@ function photos_content(&$a) {
|
|||||||
|
|
||||||
/* Show space usage */
|
/* Show space usage */
|
||||||
|
|
||||||
$r = q("select sum(size) as total from photo where uid = %d and scale = 0 ",
|
$r = q("select sum(size) as total from photo where aid = %d and scale = 0 ",
|
||||||
intval($a->data['channel']['channel_id'])
|
intval($a->data['channel']['channel_account_id'])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,2 +1 @@
|
|||||||
2014-01-06.549
|
2014-01-07.550
|
||||||
|
|
||||||
|
11
view/css/mod_filestorage.css
Normal file
11
view/css/mod_filestorage.css
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#attach-edit-backlink, #cut-paste-link {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#attach-edit-submit {
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#cutpasteinput {
|
||||||
|
width: 600px;
|
||||||
|
}
|
Reference in New Issue
Block a user