ILIAS
trunk Revision v11.0_alpha-2638-g80c1d007f79
◀ ilDoc Overview
MemoryStreamToTempFileStream.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\Filesystem\Util
;
22
23
use
ILIAS\Filesystem\Stream\FileStream
;
24
use
ILIAS\Filesystem\Stream\Streams
;
25
29
trait
MemoryStreamToTempFileStream
30
{
31
protected
function
maybeSafeToTempStream(FileStream $stream): FileStream
32
{
33
if
($stream->getMetadata()[
'uri'
] ===
'php://memory'
) {
34
// save stream to temp file
35
$tmp = tmpfile();
36
fwrite($tmp, (
string
)$stream);
37
$temp_stream = Streams::ofResource($tmp);
38
$temp_stream->rewind();
39
40
return
$temp_stream;
41
}
42
return
$stream;
43
}
44
}
MemoryStreamToTempFileStream
ILIAS\Filesystem\Util
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Streams
FileStream
components
ILIAS
Filesystem
src
Util
MemoryStreamToTempFileStream.php
Generated on Sun Aug 31 2025 23:02:59 for ILIAS by
1.8.13 (using
Doxyfile
)