diff options
author | Mario <mario@mariovavti.com> | 2019-04-01 12:42:07 +0200 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2019-04-01 12:42:07 +0200 |
commit | 2bdcd436bb3b8ed3090a500550bf93d30d15aa7f (patch) | |
tree | 44182c8a92515986e2ca704ba4c4bb2d4e1be96a /include/import.php | |
parent | b384b275466655659c063253e82962c3fe524f6f (diff) | |
parent | a1bea7d7cc33cfaec3114e7cb97093ec647a026a (diff) | |
download | volse-hubzilla-2bdcd436bb3b8ed3090a500550bf93d30d15aa7f.tar.gz volse-hubzilla-2bdcd436bb3b8ed3090a500550bf93d30d15aa7f.tar.bz2 volse-hubzilla-2bdcd436bb3b8ed3090a500550bf93d30d15aa7f.zip |
Merge branch 'dev' into 'dev'
check service class limits when syncing files
See merge request hubzilla/core!1578
Diffstat (limited to 'include/import.php')
-rw-r--r-- | include/import.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/import.php b/include/import.php index 8d1a19202..7a1e9aa55 100644 --- a/include/import.php +++ b/include/import.php @@ -1155,6 +1155,9 @@ function sync_files($channel, $files) { require_once('include/attach.php'); if($channel && $files) { + + $limit = service_class_fetch($channel['channel_id'], 'attach_upload_limit'); + foreach($files as $f) { if(! $f) continue; @@ -1275,6 +1278,17 @@ function sync_files($channel, $files) { } else { logger('sync_files attach does not exists: ' . print_r($att,true), LOGGER_DEBUG); + + if($limit !== false) { + $r = q("select sum(filesize) as total from attach where aid = %d ", + intval($channel['channel_account_id']) + ); + if(($r) && (($r[0]['total'] + $att['filesize']) > $limit)) { + logger('service class limit exceeded'); + continue; + } + } + create_table_from_array('attach',$att); } |