You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2016/03/25 19:01:09 UTC
airavata-php-gateway git commit: fixing cloning issue
Repository: airavata-php-gateway
Updated Branches:
refs/heads/develop c17be8554 -> be798e60d
fixing cloning issue
Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/be798e60
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/be798e60
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/be798e60
Branch: refs/heads/develop
Commit: be798e60d127a6c406c455c93fb2061f75df08c4
Parents: c17be85
Author: scnakandala <su...@gmail.com>
Authored: Fri Mar 25 14:01:05 2016 -0400
Committer: scnakandala <su...@gmail.com>
Committed: Fri Mar 25 14:01:05 2016 -0400
----------------------------------------------------------------------
app/libraries/ExperimentUtilities.php | 74 +++++++++++++++---------------
1 file changed, 38 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/be798e60/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 9bb91c1..9ba0028 100644
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -283,50 +283,52 @@ class ExperimentUtilities
}
}
} elseif ($applicationInput->type == DataType::URI) {
- $file = $_FILES[$applicationInput->name];
-
- //
- // move file to experiment data directory
- //
- if(!empty($applicationInput->value)){
- $filePath = ExperimentUtilities::$experimentPath . $applicationInput->value;
- }else{
- $filePath = ExperimentUtilities::$experimentPath . $file['name'];
- }
+ if ($_FILES[$applicationInput->name]['name']) {
+ $file = $_FILES[$applicationInput->name];
+
+ //
+ // move file to experiment data directory
+ //
+ if (!empty($applicationInput->value)) {
+ $filePath = ExperimentUtilities::$experimentPath . $applicationInput->value;
+ } else {
+ $filePath = ExperimentUtilities::$experimentPath . $file['name'];
+ }
- // check if file already exists
- if (is_file($filePath)) {
- unlink($filePath);
+ // check if file already exists
+ if (is_file($filePath)) {
+ unlink($filePath);
- CommonUtilities::print_warning_message('Uploaded file already exists! Overwriting...');
- }
+ CommonUtilities::print_warning_message('Uploaded file already exists! Overwriting...');
+ }
- $moveFile = move_uploaded_file($file['tmp_name'], $filePath);
+ $moveFile = move_uploaded_file($file['tmp_name'], $filePath);
- if (!$moveFile) {
- CommonUtilities::print_error_message('<p>Error moving uploaded file ' . $file['name'] . '!
+ 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>');
- $experimentAssemblySuccessful = false;
- }
+ $experimentAssemblySuccessful = false;
+ }
- $experimentInput->type = $applicationInput->type;
+ $experimentInput->type = $applicationInput->type;
$dataProductModel = new DataProductModel();
- $dataProductModel->gatewayId = Config::get("pga_config.airavata")["gateway-id"];
- $dataProductModel->ownerName = Session::get("username");
- $dataProductModel->productName = basename($filePath);
- $dataProductModel->dataProductType = DataProductType::FILE;
-
- $dataReplicationModel = new DataReplicaLocationModel();
- $dataReplicationModel->storageResourceId = Config::get("pga_config.airavata")["gateway-data-store-resource-id"];
- $dataReplicationModel->replicaName = basename($filePath) . " gateway data store copy";
- $dataReplicationModel->replicaLocationCategory = ReplicaLocationCategory::GATEWAY_DATA_STORE;
- $dataReplicationModel->replicaPersistentType = ReplicaPersistentType::TRANSIENT;
- $hostName = $_SERVER['SERVER_NAME'];
- $dataReplicationModel->filePath = "file://" . $hostName . ":" . $filePath;
+ $dataProductModel->gatewayId = Config::get("pga_config.airavata")["gateway-id"];
+ $dataProductModel->ownerName = Session::get("username");
+ $dataProductModel->productName = basename($filePath);
+ $dataProductModel->dataProductType = DataProductType::FILE;
- $dataProductModel->replicaLocations[] = $dataReplicationModel;
- $uri = Airavata::registerDataProduct(Session::get('authz-token'), $dataProductModel);
- $experimentInput->value = $uri;
+ $dataReplicationModel = new DataReplicaLocationModel();
+ $dataReplicationModel->storageResourceId = Config::get("pga_config.airavata")["gateway-data-store-resource-id"];
+ $dataReplicationModel->replicaName = basename($filePath) . " gateway data store copy";
+ $dataReplicationModel->replicaLocationCategory = ReplicaLocationCategory::GATEWAY_DATA_STORE;
+ $dataReplicationModel->replicaPersistentType = ReplicaPersistentType::TRANSIENT;
+ $hostName = $_SERVER['SERVER_NAME'];
+ $dataReplicationModel->filePath = "file://" . $hostName . ":" . $filePath;
+
+ $dataProductModel->replicaLocations[] = $dataReplicationModel;
+ $uri = Airavata::registerDataProduct(Session::get('authz-token'), $dataProductModel);
+ $experimentInput->value = $uri;
+ }
} else {
CommonUtilities::print_error_message('I cannot accept this input type yet!');
}