You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by di...@apache.org on 2019/05/22 19:15:45 UTC
[airavata-php-gateway] branch tus-integration updated: Creating sym
links for input files larger that 1 GB
This is an automated email from the ASF dual-hosted git repository.
dimuthuupe pushed a commit to branch tus-integration
in repository https://gitbox.apache.org/repos/asf/airavata-php-gateway.git
The following commit(s) were added to refs/heads/tus-integration by this push:
new 4407c6b Creating sym links for input files larger that 1 GB
4407c6b is described below
commit 4407c6bfc96fa3a78a12a0833c39644aea8e59d5
Author: Dimuthu Wannipurage <di...@gmail.com>
AuthorDate: Wed May 22 14:28:30 2019 -0400
Creating sym links for input files larger that 1 GB
---
app/libraries/ExperimentUtilities.php | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 58a1445..997a824 100755
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -410,6 +410,8 @@ class ExperimentUtilities
if (isset($_POST[$applicationInput->sanitizedFormName]) && (trim($_POST[$applicationInput->sanitizedFormName]) != '')) {
+ Log::info('Processing input ' . $applicationInput->sanitizedFormName);
+
$tus_data_dir = "/data/gateway-user-data/tus-temp-dir/";
$tus_download_url = trim($_POST[$applicationInput->sanitizedFormName]);
$file_uuid = explode("/", $tus_download_url)[4];
@@ -436,7 +438,21 @@ class ExperimentUtilities
CommonUtilities::print_warning_message('Uploaded file already exists! Overwriting...');
}
- $moveFile = copy($tus_bin_file, $filePath);
+ Log::info('Starting the file movement from ' . $tus_bin_file . ' to ' . $filePath);
+
+ $bin_file_size = filesize($tus_bin_file) / (1000 * 1000 * 1000);
+ Log::info('File size ' . $bin_file_size);
+
+ if ($bin_file_size > 1) {
+ Log::info("Creating sym link as the file size is too large");
+ $moveFile = symlink($tus_bin_file, $filePath);
+ } else {
+ Log::info("Copying the file ...");
+ $moveFile = copy($tus_bin_file, $filePath);
+ }
+
+ Log::info('File moved to storage ' . $filePath);
+
if (!$moveFile) {
CommonUtilities::print_error_message('<p>Error moving uploaded file ' . $file_name . '!
Please try again later or report a bug using the link in the Help menu.</p>');