Repository: airavata-php-gateway Updated Branches: refs/heads/file-management dbf6db428 -> bb5c809b8
changing config value names 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/bb5c809b Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/bb5c809b Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/bb5c809b Branch: refs/heads/file-management Commit: bb5c809b8c23599788646228492de759e07acc6e Parents: dbf6db4 Author: scnakandala <[email protected]> Authored: Sun Nov 1 16:02:40 2015 -0500 Committer: scnakandala <[email protected]> Committed: Sun Nov 1 16:02:40 2015 -0500 ---------------------------------------------------------------------- app/config/pga_config.php.template | 2 +- app/controllers/DownloadFileController.php | 2 +- app/libraries/ExperimentUtilities.php | 24 ++++++++---------------- 3 files changed, 10 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bb5c809b/app/config/pga_config.php.template ---------------------------------------------------------------------- diff --git a/app/config/pga_config.php.template b/app/config/pga_config.php.template index b33173b..4e8aa27 100644 --- a/app/config/pga_config.php.template +++ b/app/config/pga_config.php.template @@ -116,7 +116,7 @@ return array( /** * absolute path of the data dir */ - 'experiment-data-absolute-path' => '/var/www/experimentData', + 'data-archive-path' => '/var/www/experimentData', /** * username for the user for accessing the experiment data over ssh http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bb5c809b/app/controllers/DownloadFileController.php ---------------------------------------------------------------------- diff --git a/app/controllers/DownloadFileController.php b/app/controllers/DownloadFileController.php index 99151e8..c073a71 100644 --- a/app/controllers/DownloadFileController.php +++ b/app/controllers/DownloadFileController.php @@ -11,7 +11,7 @@ class DownloadFileController extends Controller { public function downloadFile(){ if(Input::has("filePath") ){ $filePath = Input::get("filePath"); - $file= Config::get('pga_config.airavata')["experiment-data-absolute-path"] . "/" . Session::get("username") . "/" . $filePath; + $file= Config::get('pga_config.airavata')["data-archive-path"] . "/" . Session::get("username") . "/" . $filePath; $headers = array( 'application/octet-stream', ); http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bb5c809b/app/libraries/ExperimentUtilities.php ---------------------------------------------------------------------- diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php index 1c5e0c3..a15ff58 100644 --- a/app/libraries/ExperimentUtilities.php +++ b/app/libraries/ExperimentUtilities.php @@ -74,7 +74,7 @@ class ExperimentUtilities if ($input->type == DataType::URI && empty($input->metaData)) { $explode = explode('/', $input->value); echo '<p><a target="_blank" - href="' . URL::to("/") . "/.." . Config::get('pga_config.airavata')['experiment-data-dir'] + href="' . URL::to("/") . "/download-file?filePath=" . "/" . $explode[sizeof($explode) - 2] . '/' . $explode[sizeof($explode) - 1] . '">' . $explode[sizeof($explode) - 1] . ' <span class="glyphicon glyphicon-new-window"></span></a></p>'; @@ -158,14 +158,6 @@ class ExperimentUtilities ExperimentUtilities::create_experiment_folder_path(); } -// $advHandling = new AdvancedOutputDataHandling(); - $hostName = $_SERVER['SERVER_NAME']; - $expPathConstant = 'file://' . Config::get('pga_config.airavata')['ssh-user'] . '@' . $hostName . ':' . Config::get('pga_config.airavata')['experiment-data-absolute-path']; - -// $advHandling->outputDataDir = str_replace(Config::get('pga_config.airavata')['experiment-data-absolute-path'], -// $expPathConstant, ExperimentUtilities::$experimentPath); -// $userConfigData->advanceOutputDataHandling = $advHandling; - //TODO: replace constructor with a call to airvata to get a prepopulated experiment template $experiment = new ExperimentModel(); @@ -340,7 +332,7 @@ class ExperimentUtilities public static function create_experiment_folder_path() { do { - ExperimentUtilities::$experimentPath = Config::get('pga_config.airavata')['experiment-data-absolute-path'] . + ExperimentUtilities::$experimentPath = Config::get('pga_config.airavata')['data-archive-path'] . "/" . str_replace(' ', '', Session::get('username')) . "/" . md5(rand() * time()) . '/'; } while (is_dir(ExperimentUtilities::$experimentPath)); // if dir already exists, try again // create upload directory @@ -421,8 +413,8 @@ class ExperimentUtilities $experimentInputs = $experiment->experimentInputs; ExperimentUtilities::create_experiment_folder_path(); $hostName = $_SERVER['SERVER_NAME']; - $expPathConstant = 'file://' . Config::get('pga_config.airavata')['ssh-user'] . '@' . $hostName . ':' . Config::get('pga_config.airavata')['experiment-data-absolute-path']; - $outputDataDir = str_replace(Config::get('pga_config.airavata')['experiment-data-absolute-path'], + $expPathConstant = 'file://' . Config::get('pga_config.airavata')['ssh-user'] . '@' . $hostName . ':' . Config::get('pga_config.airavata')['data-archive-path']; + $outputDataDir = str_replace(Config::get('pga_config.airavata')['data-archive-path'], $expPathConstant, ExperimentUtilities::$experimentPath); //$experiment->userConfigurationData->advanceOutputDataHandling->outputDataDir = $outputDataDir; @@ -631,15 +623,15 @@ class ExperimentUtilities if ($output->type == DataType::URI || $output->type == DataType::STDOUT || $output->type == DataType::STDERR) { $explode = explode('/', $output->value); //echo '<p>' . $output->key . ': <a href="' . $output->value . '">' . $output->value . '</a></p>'; - $outputPath = str_replace(Config::get('pga_config.airavata')['experiment-data-absolute-path'], - Config::get('pga_config.airavata')['experiment-data-dir'], $output->value); + $outputPath = str_replace(Config::get('pga_config.airavata')['data-archive-path'], + "/download-file?filePath=", $output->value); if(file_exists(str_replace('//','/',$output->value))){ $outputPathArray = explode("/", $outputPath); echo '<p>' . $output->name . ' : ' . '<a target="_blank" - href="' . URL::to("/") . "/.." . str_replace(Config::get('pga_config.airavata')['experiment-data-absolute-path'], - Config::get('pga_config.airavata')['experiment-data-dir'], $output->value) . '">' . + href="' . URL::to("/") . str_replace(Config::get('pga_config.airavata')['data-archive-path'], + "/download-file?filePath=", $output->value) . '">' . $outputPathArray[sizeof($outputPathArray) - 1] . ' <span class="glyphicon glyphicon-new-window"></span></a></p>'; } } elseif ($output->type == DataType::STRING) {
