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 2015/06/24 22:01:47 UTC

airavata-php-gateway git commit: fixing output path wrong issue

Repository: airavata-php-gateway
Updated Branches:
  refs/heads/airavata-php-gateway-0.15-release 1c6554016 -> 8d0cabda7


fixing output path wrong 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/8d0cabda
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/8d0cabda
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/8d0cabda

Branch: refs/heads/airavata-php-gateway-0.15-release
Commit: 8d0cabda731ddd36426eb475fedd54bbb1b557e3
Parents: 1c65540
Author: Supun Nakandala <sc...@apache.org>
Authored: Thu Jun 25 01:31:09 2015 +0530
Committer: Supun Nakandala <sc...@apache.org>
Committed: Thu Jun 25 01:31:09 2015 +0530

----------------------------------------------------------------------
 app/config/pga_config.php.template    |  9 +++++++--
 app/libraries/ExperimentUtilities.php | 29 ++++++++++-------------------
 2 files changed, 17 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/8d0cabda/app/config/pga_config.php.template
----------------------------------------------------------------------
diff --git a/app/config/pga_config.php.template b/app/config/pga_config.php.template
index 2807fa9..6af2116 100644
--- a/app/config/pga_config.php.template
+++ b/app/config/pga_config.php.template
@@ -92,9 +92,14 @@ return array(
         'server-allowed-file-size' => 64,
 
         /**
-         * directory in the web server where experiment data is staged. This path should be a relative path from app root
+         * directory in the web server where experiment data is staged. (relative to the web server documents root)
          */
-        'experiment-data-root' => '/../experimentData/',
+        'experiment-data-path-dir' => '/experimentData',
+
+        /**
+         * absolute path of the data dir
+         */
+        'experiment-data-path-absolute' => '/var/www/experimentData',
 
         /**
          * Advanced experiments options

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/8d0cabda/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index bc77987..a5c83a6 100644
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -16,22 +16,7 @@ use Airavata\Model\Workspace\Experiment\UserConfigurationData;
 
 class ExperimentUtilities
 {
-
-    private $sshUser;
-    private $hostName;
-    private static $pathConstant;
     private static $experimentPath;
-    private static $experimentDataPathAbsolute;
-
-    function __construct()
-    {
-        $this->sshUser = "root";
-        $this->hostName = $_SERVER['SERVER_NAME'];
-
-        self::$experimentDataPathAbsolute = base_path() . Config::get('pga_config.airavata')['experiment-data-root'];
-        self::$pathConstant = 'file://' . $this->sshUser . '@' . $this->hostName . ':' . self::$experimentDataPathAbsolute;
-        self::$experimentPath = null;
-    }
 
     /**
      * Launch the experiment with the given ID
@@ -174,9 +159,12 @@ class ExperimentUtilities
         }
 
         $advHandling = new AdvancedOutputDataHandling();
+        $sshUser = "root";
+        $hostName = $_SERVER['SERVER_NAME'];
+        $expPathConstant = 'file://' . $sshUser . '@' . $hostName . ':' . Config::get('pga_config.airavata')['experiment-data-root'];
 
         $advHandling->outputDataDir = str_replace(base_path() . Config::get('pga_config.airavata')['experiment-data-root'],
-            ExperimentUtilities::$pathConstant, ExperimentUtilities::$experimentPath);
+            $expPathConstant, ExperimentUtilities::$experimentPath);
         $userConfigData->advanceOutputDataHandling = $advHandling;
 
         //TODO: replace constructor with a call to airvata to get a prepopulated experiment template
@@ -300,7 +288,8 @@ class ExperimentUtilities
                         $experimentAssemblySuccessful = false;
                     }
 
-                    $experimentInput->value = str_replace(base_path() . Config::get('pga_config.airavata')['experiment-data-root'], ExperimentUtilities::$pathConstant, $filePath);
+                    $experimentInput->value = str_replace(base_path() . Config::get('pga_config.airavata')['experiment-data-root'],
+                        ExperimentUtilities::get_path_constants(), $filePath);
                     $experimentInput->type = $applicationInput->type;
 
                 } else {
@@ -590,11 +579,13 @@ 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(ExperimentUtilities::$experimentDataPathAbsolute, Config::get('pga_config.airavata')['experiment-data-root'], $output->value);
+                    $outputPath = str_replace(Config::get('pga_config.airavata')['experiment-data-absolute-path'],
+                        Config::get('pga_config.airavata')['experiment-data-dir'], $output->value);
                     $outputPathArray = explode("/", $outputPath);
 
                     echo '<p>' . $output->name . ' : ' . '<a target="_blank"
-                            href="' . URL::to("/") . "/.." . str_replace(ExperimentUtilities::$experimentDataPathAbsolute, Config::get('pga_config.airavata')['experiment-data-root'], $output->value) . '">' .
+                            href="' . URL::to("/") . "/.." . str_replace(Config::get('pga_config.airavata')['experiment-data-absolute-path'],
+                            Config::get('pga_config.airavata')['experiment-data-dir'], $output->value) . '">' .
                         $outputPathArray[sizeof($outputPathArray) - 1] . ' <span class="glyphicon glyphicon-new-window"></span></a></p>';
                 } elseif ($output->type == DataType::STRING) {
                     echo '<p>' . $output->value . '</p>';