0;
$diskSpace = disk_free_space("/home/embedded/library/upload");
error_log("Free Diskspace for Firmware upload is: ". $diskSpace );
class CNotification
{
var $guid;
var $alertlevel;
var $emailaddress;
var $enabled;
var $active;
var $systemAccount;
var $accountName;
var $comment;
function CNotification( $aGuid, $aAlertlevel, $aEmailaddress, $aAccountName, $aEnabled=true, $aSystemAccount=false, $aComment="" )
{
$this->guid = $aGuid;
$this->alertlevel = $aAlertlevel;
$this->emailaddress = $aEmailaddress;
$this->enabled = $aEnabled;
$this->active = $aActive;
$this->systemAccount = $aSystemAccount;
$this->accountName = $aAccountName;
$this->comment = $aComment;
}
};
$doDiskClean = 0;
if($_SERVER[REQUEST_METHOD] == "POST")
{
if($_POST[RunDiskClean] == '1' )
{
$doDiskClean = 1;
}
else
{
$operationInProgress = true;
$status = new ReturnStatus();
// Check for loaded drives
if($hasLoadedDrives)
{
error_log("Install failed - drives are loaded.");
$status->context = "lib_fw_update";
$status->setErrorCode(0x1);
print $status->out();
return;
}
$tmp_name = $_FILES['softwareUpdate']['tmp_name'];
error_log("The File has been uploaded - we will now verify it.");
$l = print_r($_FILES, TRUE);
error_log($l);
if ($brand != 'dell') {
/* get the notifications list and disable techsup if enabled*/
$addrs = get_notifications( $user );
error_log("notifications: ".print_r($addrs,true));
foreach($addrs as $addr)
{
if (($addr->emailaddress == "techsup@quantum.com") ) {
if ($addr->enabled) {
error_log("techsup@quantum.com is enabled, disabling it.");
$addr->enabled=false;
$addr->comment="Disabled by firmware update.";
error_log("addr: ".print_r($addr,true));
$notification = new CNotification( $addr->guid, 3, $addr->address, $addr->name, $addr->enabled, true, $addr->comment);
update_notification($user, $notification);
} else {
error_log("techsup@quantum.com is disabled.");
}
}
}
}
if(is_uploaded_file($_FILES['softwareUpdate']['tmp_name']))
{
/* CMIResult::FirmwareUpdateInProgress = 4125 */
set_single_user_mode($user, true, 4125);
$iRet = update_system_software($user, $_FILES['softwareUpdate']['tmp_name'], true);
if( $iRet == 0 )
{
error_log("Closing the progress window.");
/*###########################################################
# Note: The code in $status->out() calls returnStatus( 1 )
# Which closes the popup and reloads the homepage in the
# main Window.
###########################################################*/
// Close the progress Window.
print $status->closeOut(1);
error_log("Distroying the Session in updateSoftware");
session_destroy();
unset( $_SESSION['login'] );
unset( $_SESSION['user'] );
unset( $_SESSION );
error_log("Exiting now!!!");
exit(0);
}
else
{
error_log("Problem Upgrading Software");
set_single_user_mode($user, false);
error_log("Failed software update");
$status->setErrorCode($iRet);
}
}
else
{
if (is_null($_FILES["softwareUpdate"]))
{
error_log("The file is too big. softwareUpdate was NULL");
$status->setErrorCode("4109");
}
else
{
switch ($HTTP_POST_FILES['softwareUpdate']['error'])
{
case 1 : //uploaded file exceeds the upload_max_filesize directive in php.ini
case 2 : //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form
error_log("The file you are trying to upload is too big.");
$status->setErrorCode("4109");
break;
case 3 : //uploaded file was only partially uploaded
error_log("The file you are trying upload was only partially uploaded.");
$status->setErrorCode("4110");
break;
case 4 : //no file was uploaded
error_log("You must select an image for upload.");
$status->setErrorCode("4111");
break;
default : //a default error, just in case! :)
error_log("There was a problem with your upload.");
$status->setErrorCode("4108");
break;
}
}
}
print $status->out();
return;
}
}
?>
Setup License
Disk Space Preparation
Please wait while the library frees up disk space for the Firmware upload.
/dev/null", $iRet);
error_log("Call to DiskSpaceClean.sh returned a \"$iRet\" and the output was \"$sRet\"");
$diskSpace = disk_free_space("/home/embedded/library/upload");
error_log("NEW - Free Diskspace for Firmware upload is: ". $diskSpace );
}
?>