mod_attach: output stream wasn't working
This commit is contained in:
parent
f125be846c
commit
cff7056f8f
@ -329,6 +329,7 @@ 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 aid = %d ",
|
$r = q("select sum(filesize) as total from attach where aid = %d ",
|
||||||
intval($channel['channel_account_id'])
|
intval($channel['channel_account_id'])
|
||||||
@ -623,7 +624,7 @@ function attach_mkdir($channel,$observer_hash,$arr = null) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if($r) {
|
if($r) {
|
||||||
if(mkdir($path,STORAGE_DEFAULT_PERMISSIONS)) {
|
if(mkdir($path,STORAGE_DEFAULT_PERMISSIONS,true)) {
|
||||||
$ret['success'] = true;
|
$ret['success'] = true;
|
||||||
$ret['data'] = $arr;
|
$ret['data'] = $arr;
|
||||||
}
|
}
|
||||||
|
@ -163,6 +163,7 @@ class RedDirectory extends DAV\Node implements DAV\ICollection {
|
|||||||
intval($c[0]['channel_account_id'])
|
intval($c[0]['channel_account_id'])
|
||||||
);
|
);
|
||||||
if(($x) && ($x[0]['total'] + $size > $limit)) {
|
if(($x) && ($x[0]['total'] + $size > $limit)) {
|
||||||
|
logger('reddav: service class limit exceeded for ' . $c[0]['channel_name'] . ' total usage is ' . $x[0]['total'] . ' limit is ' . $limit);
|
||||||
attach_delete($c[0]['channel_id'],$hash);
|
attach_delete($c[0]['channel_id'],$hash);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -372,6 +373,7 @@ class RedFile extends DAV\Node implements DAV\IFile {
|
|||||||
intval($c[0]['channel_account_id'])
|
intval($c[0]['channel_account_id'])
|
||||||
);
|
);
|
||||||
if(($x) && ($x[0]['total'] + $size > $limit)) {
|
if(($x) && ($x[0]['total'] + $size > $limit)) {
|
||||||
|
logger('reddav: service class limit exceeded for ' . $c[0]['channel_name'] . ' total usage is ' . $x[0]['total'] . ' limit is ' . $limit);
|
||||||
attach_delete($c[0]['channel_id'],$this->data['hash']);
|
attach_delete($c[0]['channel_id'],$this->data['hash']);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -163,6 +163,9 @@ function change_channel($change_channel) {
|
|||||||
get_app()->set_observer($x[0]);
|
get_app()->set_observer($x[0]);
|
||||||
get_app()->set_perms(get_all_perms(local_user(),$hash));
|
get_app()->set_perms(get_all_perms(local_user(),$hash));
|
||||||
}
|
}
|
||||||
|
if(! is_dir('store/' . $r[0]['channel_address']))
|
||||||
|
@mkdir('store/' . $r[0]['channel_address'], STORAGE_DEFAULT_PERMISSIONS,true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
|
@ -27,10 +27,12 @@ function attach_init(&$a) {
|
|||||||
header('Content-type: ' . $r['data']['filetype']);
|
header('Content-type: ' . $r['data']['filetype']);
|
||||||
header('Content-disposition: attachment; filename=' . $r['data']['filename']);
|
header('Content-disposition: attachment; filename=' . $r['data']['filename']);
|
||||||
if($r['data']['flags'] & ATTACH_FLAG_OS ) {
|
if($r['data']['flags'] & ATTACH_FLAG_OS ) {
|
||||||
$stream = fopen('store/' . $c[0]['channel_address'] . '/' . $r['data']['data'],'rb');
|
$istream = fopen('store/' . $c[0]['channel_address'] . '/' . $r['data']['data'],'rb');
|
||||||
if($stream) {
|
$ostream = fopen('php://output','wb');
|
||||||
pipe_stream($stream,STDOUT);
|
if($istream && $ostream) {
|
||||||
fclose($stream);
|
pipe_streams($istream,$ostream);
|
||||||
|
fclose($istream);
|
||||||
|
fclose($ostream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1 +1 @@
|
|||||||
2014-01-10.553
|
2014-01-11.554
|
||||||
|
Reference in New Issue
Block a user