git://git.onelab.eu
/
plewww.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use readfile() function to reduce the memory footprint (and solve following);
[plewww.git]
/
planetlab
/
nodes
/
node_downloads.php
diff --git
a/planetlab/nodes/node_downloads.php
b/planetlab/nodes/node_downloads.php
index
2577c56
..
d43ada6
100644
(file)
--- a/
planetlab/nodes/node_downloads.php
+++ b/
planetlab/nodes/node_downloads.php
@@
-59,9
+59,11
@@
function deliver_and_unlink ($filename) {
header ("Pragma: hack");
header ("Cache-Control: public, must-revalidate");
header ("Pragma: hack");
header ("Cache-Control: public, must-revalidate");
- // outputs the whole file contents
- print (file_get_contents($filename));
-
+ // turn off output buffering
+ ob_end_flush();
+ // outputs the whole file contents without copying it to memory
+ readfile($filename);
+
// unlink the file
if (! unlink ($filename) ) {
// cannot unlink, but how can we notify this ?
// unlink the file
if (! unlink ($filename) ) {
// cannot unlink, but how can we notify this ?