check service class limits when syncing files
This commit is contained in:
parent
103563b375
commit
cbaf0a3864
@ -1155,6 +1155,9 @@ function sync_files($channel, $files) {
|
|||||||
require_once('include/attach.php');
|
require_once('include/attach.php');
|
||||||
|
|
||||||
if($channel && $files) {
|
if($channel && $files) {
|
||||||
|
|
||||||
|
$limit = service_class_fetch($channel['channel_id'], 'attach_upload_limit');
|
||||||
|
|
||||||
foreach($files as $f) {
|
foreach($files as $f) {
|
||||||
if(! $f)
|
if(! $f)
|
||||||
continue;
|
continue;
|
||||||
@ -1275,6 +1278,17 @@ function sync_files($channel, $files) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
logger('sync_files attach does not exists: ' . print_r($att,true), LOGGER_DEBUG);
|
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);
|
create_table_from_array('attach',$att);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user