<?php
- // $Id$
-
// cleaned up, keep only the actions related to downloading stuff
// REQUIRED : node_id=node_id
// (*) action='download-node-floppy' :
// (*) action='download-generic-usb':
// : performs actual generic download
-// delivering node-dependant images requires larger memory limit
-// trial and error, based on the current sizes
-// generic-ISO 43980800
-// generic-usb 44720128
-// 256M OK
-// 128M OK
-// 96M OK
-// 88M KO
-// 80M KO
-// 64M KO
-// Bottom line is, looks like we need in the order of twice the file size
-// so let's play it safe
-// Thierry - for 4.2, we need a larger area, was 100 for 4.1
-ini_set("memory_limit","150M");
+ini_set("memory_limit","512M");
+
+// disables mod_deflate compression when downloading the images
+// because apache reports a different size for the file when compressed
+// the transfer can be interrupted.
+apache_setenv('no-gzip', 1);
+ini_set('zlib.output_compression', 0);
// Require login
require_once 'plc_login.php';
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 ?
case "download-node-floppy":
case "download-node-iso":
case "download-node-usb":
+ case "download-node-usb-partition":
+
$nodes = $api->GetNodes( array( $node_id ) );
$node = $nodes[0];
case 'download-node-floppy':
$boot_action='node-floppy';
$location = "%d/%n-%v-rename-into-plnode%s";
+ $options = array();
break;
case 'download-node-iso':
$boot_action='node-iso';
$location = "%d/%n-%a-%v%s";
+ $options = array();
break;
case 'download-node-usb':
$boot_action='node-usb';
$location = "%d/%n-%a-%v%s";
+ $options = array();
+ break;
+ case "download-node-usb-partition":
+ $boot_action='node-usb';
+ $location = "%d/%n-%a-%v-partition%s";
+ $options = array('partition');
break;
}
- $filename=$api->GetBootMedium($node_id,$boot_action,$location);
+ $filename=$api->GetBootMedium($node_id,$boot_action,$location,$options);
$error=$api->error();
if (empty($error) && empty($filename)) {
$error="Unexpected error from GetBootMedium - probably wrong directory modes";
formerly downloaded boot medium for that node will become <span class='bold'>outdated</span>.
<br/>
<br/>
-In order to create a configuration file for this node using this page,
-the interface settings must be up to date. Below is summary of these
-values.
+Also please note that before you create a boot image for this node,
+the following data must be up to date, please review before downloading.
</p>
EOF;
$details->start();
if( ! $interface ) {
+ print ("<center>");
print (plc_warning("This node has no configured primary interface."));
+ print ("You can add one " . href(l_interface_add($node_id), "here "));
+ print ("</center>");
} else {
$details->tr(l_node_t($node_id,"Node details"),"center");
$details->th_td("node_id",$node_id);