Skip to content

Conversation

@MichaelRBond
Copy link
Contributor

On large downloads, the /tmp directory was filling up and causing the download to be 0 bytes. This addresses that issue.

This is to address the issue in ticket: https://systems.lib.wvu.edu/helpdesk/viewTicket/?id=14773

THis has been tested on MFCS dev with record P31 and P3001. P31 worked previously and continues to work with this update. P3001 was too large to download previously, and now works correctly.

Also, added a fixme comment where there is a logic error that needs to be fixed.
Copy link
Contributor

@ddavisgraphics ddavisgraphics left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left commentary. I don't want to merge code in with Fix Me or Todos in them.

}

//determine the field name
// FIXME: this will only grab the LAST file field, if a form has Multiple
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears incomplete, if there is a FIXME in the comments your acknowledging that the code doesn't work properly. These are the things I want to avoid merging into the codebase.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is absolutely nothing wrong with fixme and todos in code. They are reminders and notes. This code does not introduce a new issue. it is noting an existing issue that was discovered while reviewing code.

that existing issue is in no way related to the current problem. It should be addressed at a later date.

header("Content-Description: File Transfer");
header("Content-type: application/zip");
header("Content-Disposition: attachment; filename=\"".$object['idno'].".".$type."\"");
header(sprintf('Content-Disposition: attachment; filename="%s.%s"',$object['idno'],$type));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous version included slashes for the directory, is this not necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the previous version included slashed escaping the quotes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duh... I see that now. Sorry, I was thinking filesystem while looking at it.

$destinationFile = sys_get_temp_dir()."/".time().".".$type;
$destinationFile = sprintf("%s/%s.%s",mfcs::config('mfcsDownloadAllDir'),time(),$type);

if ($type == "zip") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious, would it be better to do something similar to the export scripts where you use symbolic linking, follow the links, and then zip the file following the symbolic links.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might make it more performant (likely would), but that should be addressed in a separate pull request.

Doing that would not address the problem that the temporary directory isn't configurable, which this does.

@ddavisgraphics ddavisgraphics merged commit 63770c9 into develop Feb 23, 2017
@ddavisgraphics ddavisgraphics deleted the DownloadAll branch February 23, 2017 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants