Commit e03035307ec8c8e836ffa6895306a5765e53c1ca

Authored by Elena.Budnik
2 parents cbd2d61e 3c093c1c

merge from master

Showing 2 changed files with 41 additions and 98 deletions   Show diff stats
php/classes/AmdaAction.php
... ... @@ -2,10 +2,8 @@
2 2 /**
3 3 * @class AmdaAction
4 4 * @version $Id: AmdaAction.php 2976 2015-07-01 15:05:40Z benjamin $
5   - *
  5 + * @brief
6 6 */
7   -
8   -
9 7 class AmdaAction
10 8 {
11 9 private $xmlFiles = array('localParam' => 'LocalParams.xml', 'remoteParam' => 'RemoteParams.xml',
... ... @@ -483,14 +481,7 @@ class AmdaAction
483 481 else
484 482 {
485 483 $restricted = FALSE;
486   -// if ($child->tagName == 'dataCenter')
487   -// {
488   -// $restricted = ($child->getAttribute('available') != "1");
489   -// }
490   -//
491   - if ($id == 'CDAWEB' || $id == 'THEMIS'|| $id == 'MAPSKP')
492   - $restricted = FALSE;
493   -
  484 +
494 485 if ($child->tagName == 'dataset')
495 486 {
496 487 $nonavailable = ($child->getAttribute('disabled'));
... ... @@ -683,8 +674,7 @@ class AmdaAction
683 674 case 'request' :
684 675 $objectMgr = new RequestMgr($nodeType);
685 676 break;
686   - case 'bkgWorks' :
687   - require_once(INTEGRATION_SRC_DIR."RequestManager.php");
  677 + case 'bkgWorks' :
688 678 return $this->executeRequest($id, FunctionTypeEnumClass::PROCESSGETINFO);
689 679 break;
690 680 case 'myData' :
... ... @@ -722,7 +712,6 @@ class AmdaAction
722 712 $obj->id = substr($obj->id,strlen('alias_'));
723 713 break;
724 714 case 'bkgWorks' :
725   - require_once(INTEGRATION_SRC_DIR."RequestManager.php");
726 715 return $this->executeRequest($obj, FunctionTypeEnumClass::PROCESSDELETE);
727 716  
728 717 case 'myData' :
... ... @@ -857,8 +846,7 @@ class AmdaAction
857 846 */
858 847 public function getJobs($obj = null)
859 848 {
860   - require_once(INTEGRATION_SRC_DIR."RequestManager.php");
861   - $obj = (object) array();
  849 + $obj = (object) array();
862 850 return $this->executeRequest($obj, FunctionTypeEnumClass::PROCESSRUNNINGINFO);
863 851 }
864 852  
... ... @@ -909,7 +897,7 @@ class AmdaAction
909 897 }
910 898  
911 899 private function executeRequest($obj, $function)
912   - {
  900 + {
913 901 // Check user if access to DD Server and / or possible 'space consuming' action
914 902 if ( $function == FunctionTypeEnumClass::PARAMS ||
915 903 $function == FunctionTypeEnumClass::ACTION ||
... ... @@ -920,7 +908,6 @@ class AmdaAction
920 908 }
921 909  
922 910 $requestManager = new RequestManagerClass();
923   -
924 911 try {
925 912 $res = $requestManager->runIHMRequest($this->user, !empty($res['userHost']) ? $res['userHost'] : NULL, $function, $obj);
926 913 } catch (Exception $e) {
... ... @@ -935,8 +922,6 @@ class AmdaAction
935 922 */
936 923 public function execute($node, $obj)
937 924 {
938   - require_once(INTEGRATION_SRC_DIR."RequestManager.php");
939   -
940 925 // just convert TT / Catalog
941 926 if ($obj->nodeType == "download" && $obj->downloadSrc == "1")
942 927 return $this->executeRequest($obj, FunctionTypeEnumClass::TTCONVERT);
... ... @@ -956,7 +941,6 @@ class AmdaAction
956 941 */
957 942 public function compilParam($obj)
958 943 {
959   - require_once(INTEGRATION_SRC_DIR."RequestManager.php");
960 944 return $this->executeRequest($obj, FunctionTypeEnumClass::PARAMSGEN);
961 945 }
962 946  
... ... @@ -965,7 +949,6 @@ class AmdaAction
965 949 */
966 950 public function compilParamDelete($obj)
967 951 {
968   - require_once(INTEGRATION_SRC_DIR."RequestManager.php");
969 952 $res = $this->checkUser($obj);
970 953  
971 954 if (!$res['success'])
... ... @@ -984,7 +967,6 @@ class AmdaAction
984 967  
985 968 public function killPlotRequest()
986 969 {
987   - require_once(INTEGRATION_SRC_DIR."RequestManager.php");
988 970 return $this->executeRequest((object) array('nodeType' => 'killplot'), FunctionTypeEnumClass::PARAMS);
989 971 }
990 972  
... ... @@ -1326,7 +1308,6 @@ class AmdaAction
1326 1308 public function cleanUserWS()
1327 1309 {
1328 1310 $this->rrmdir(USERDIR.'DOWNLOAD.TEMP');
1329   - require_once(INTEGRATION_SRC_DIR."RequestManager.php");
1330 1311 IHMConfigClass::setUserName($this->user);
1331 1312  
1332 1313 // delete impex params and data
... ... @@ -1362,7 +1343,6 @@ class AmdaAction
1362 1343  
1363 1344 public function interactivePlot($obj, $multiPlotState)
1364 1345 {
1365   - require_once(INTEGRATION_SRC_DIR."RequestManager.php");
1366 1346 $inputobj = (Object)array(
1367 1347 'action' => $obj,
1368 1348 'multiPlotState' => $multiPlotState
... ... @@ -1372,7 +1352,6 @@ class AmdaAction
1372 1352  
1373 1353 public function getParamPlotInit($obj)
1374 1354 {
1375   - require_once(INTEGRATION_SRC_DIR."RequestManager.php");
1376 1355 // IMPEX param
1377 1356 if (preg_match("#^spase___IMPEX_#",$obj->paramId))
1378 1357 $type = 'impex_plot_init';
... ... @@ -1388,7 +1367,6 @@ class AmdaAction
1388 1367  
1389 1368 public function getParamInfo($obj)
1390 1369 {
1391   - require_once(INTEGRATION_SRC_DIR."RequestManager.php");
1392 1370 // IMPEX param
1393 1371 if (preg_match("#^spase___IMPEX_#",$obj->paramId))
1394 1372 $type = 'impex_param_info';
... ... @@ -1440,8 +1418,6 @@ class AmdaAction
1440 1418  
1441 1419 public function getRequestByProcessId($obj)
1442 1420 {
1443   - require_once(INTEGRATION_SRC_DIR."RequestManager.php");
1444   -
1445 1421 return $this->executeRequest($obj->processId, FunctionTypeEnumClass::PROCESSGETREQUEST);
1446 1422 }
1447 1423 }
... ...
php/config.php
... ... @@ -2,51 +2,32 @@
2 2 /**
3 3 * @file config.php
4 4 * @version $Id: config.php 2368 2014-05-21 08:46:23Z elena $
5   - *
6 5 */
7 6  
8 7 /*
9   - * ob_start
10   - * This function will turn output buffering on.
11   - * While output buffering is active no output is sent from the script (other than headers),
12   - * instead the output is stored in an internal buffer.
13   - * The contents of this internal buffer may be copied into a string variable using ob_get_contents().
14   - * To output what is stored in the internal buffer, use ob_end_flush().
15   - * Alternatively, ob_end_clean() will silently discard the buffer contents.
16   -*/
17   -// ob_start();
18   -
19   -/*
20 8 * Installation-dependent settings
21 9 */
22 10 require_once 'my_config.php';
23 11  
24   -if (is_file('amda_version.php')) {
25   - require_once 'amda_version.php';
26   -}
  12 +error_reporting(E_ERROR);
27 13  
28   -if (is_file('errors.php')) {
29   - require_once 'errors.php';
30   -}
  14 +if (is_file('amda_version.php')) require_once 'amda_version.php';
  15 +if (is_file('errors.php')) require_once 'errors.php';
31 16  
32   -/*----------------------- SYSTEM config section --------*/
  17 +// SYSTEM config section
33 18 if (!defined('PHP_VERSION_ID')) {
34   - $version = explode('.', PHP_VERSION);
35   - define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
36   -}
37   -
38   -if (!defined('MAGIC_FILE')) {
39   - define('MAGIC_FILE', '/usr/share/misc/magic');
  19 + $version = explode('.', PHP_VERSION);
  20 + define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
40 21 }
  22 +if (!defined('MAGIC_FILE')) define('MAGIC_FILE','/usr/share/misc/magic');
41 23  
42 24 date_default_timezone_set('UTC');
43   -/*-----------------------END SYSTEM config section --------*/
44 25  
45   -/*----------------------- GUESTS LOGIN section --------*/
46   -define("MaxGuests", 10); // Max Guests number
  26 +// GUESTS LOGIN section
  27 +define("MaxGuests", 10); // Max Guests number
47 28 define("GuestSessionDuration", 300); //300 minutes
48   -define("MaxGuestTimeInterval", 10); // days
49   -/*-----------------------END GUESTS LOGIN section --------*/
  29 +define("MaxGuestTimeInterval", 10); // days
  30 +
50 31  
51 32 // user WS size limit
52 33 define('DISK_QUOTA_standard', 1024*1024*200); // 200MB
... ... @@ -55,23 +36,26 @@ define('MAX_FILE_INDEX_TO_SHOW', 100);
55 36 // private key used to be considerate as a trust client for some functions of DD web service
56 37 define('DDSERVICE_PRIVATEKEY', '!%p856Dc');
57 38  
58   -define('IMPEX_INTERVAL_LIMIT', 86400); // one day for impex request
59 39  
60   -/*----------------------- BATCH JOBS section --------*/
61   -define('JOBTIMEOUT', '1'); // one cycle secs to sleep to allow job be executed
62   -define('PLOT_CYCLES_NUMBER', 500); // cycles number for PNG
63   -define('JOB_CYCLES_NUMBER', 5); // cycles number for all the jobs
  40 +// BATCH JOBS section
  41 +//define('JOBTIMEOUT', '1'); // one cycle secs to sleep to allow job be executed
  42 +//define('PLOT_CYCLES_NUMBER', 500); // cycles number for PNG
  43 +//define('JOB_CYCLES_NUMBER', 5); // cycles number for all the jobs
64 44 //define('TIMEOUT', '100'); //TODO secs wait before job is killed OR 'max_execution_time' - kill automatic?
65 45  
66   -/*-----------------------END BATCH JOBS section --------*/
67   -
68 46 // EPN-TAP services
69 47 define('EPNTAP_APIS', 'http://voparis-tap.obspm.fr/__system__/tap/run/tap/sync');
70 48 define('EPNTAP_AMDA', 'http://cdpp-epntap.irap.omp.eu/__system__/tap/run/tap/sync');
71 49  
  50 +<<<<<<< HEAD
72 51 /*----------------------- PHP run-time settings --------*/
73 52 ini_set('memory_limit', 128000000);
74 53 ini_set('max_execution_time', 600); // max PHP execution
  54 +=======
  55 +// PHP run-time settings
  56 +ini_set('memory_limit',128000000);
  57 +ini_set('max_execution_time',600); // max PHP execution
  58 +>>>>>>> master
75 59 ini_set('default_socket_timeout', 600); //TODO if this is needed ? IMPEX LONG DURATION WEBSERVICES
76 60 // to avoid 403 error while copying from URL
77 61 ini_set('user_agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:7.0) Gecko/201001012 Firefox/7.0');
... ... @@ -79,7 +63,6 @@ ini_set(&#39;user_agent&#39;, &#39;Mozilla/5.0 (X11; U; Linux i686; en-US; rv:7.0) Gecko/201
79 63 // ini_set('upload_max_filesize',100000000);
80 64 // ini_set('post_max_size',1050000000);
81 65  
82   -/*-----------------------END PHP run-time settings --------*/
83 66  
84 67 // General Info dirs
85 68 define('DATAPATH', IHM_SRC_DIR . 'generic_data/');
... ... @@ -99,10 +82,12 @@ define(&#39;specialGrpsXml&#39;, SpecialSettingsDir . &#39;Groups.xml&#39;);
99 82 define('specialSettingsXml', SpecialSettingsDir . 'Settings.xml');
100 83  
101 84 //Help info dirs
102   -define('HELPPATH', IHM_SRC_DIR . "help/");
  85 +define('HELPPATH', IHM_SRC_DIR."help/");
  86 +
  87 +// IMPEX section
  88 +define('SimuTargetsXml', DATAPATH.'SimuTemplate/TargetsSimu.xml');
  89 +define('IMPEX_INTERVAL_LIMIT', 86400); // one day for impex request
103 90  
104   -// IMPEX special files
105   -define('SimuTargetsXml', DATAPATH . 'SimuTemplate/TargetsSimu.xml');
106 91  
107 92 // Root User dir : All user dirs are defined in UserMgr.php
108 93 define('USERPATH', IHM_SRC_DIR . 'data/');
... ... @@ -110,22 +95,15 @@ define(&#39;USERPATH&#39;, IHM_SRC_DIR . &#39;data/&#39;);
110 95 // Shared dir
111 96 define('SHAREDPATH', IHM_SRC_DIR . 'shared_data/');
112 97  
113   -/*------------------- WEB SERVICES section ---------*/
114   -define('WSRESULT', USERPATH . 'WSRESULT/'); // Web Services result directory
115   -define('wsResultsXml', WSRESULT . 'WSresults.xml'); // Web Service result file
116   -
117   -define('plotsXml', IHM_SRC_DIR . 'public/WebServices/XML/AmdaPlots.xml'); // Web Service getPlot : list of parameters to plot
  98 +// WEB SERVICES section
  99 +define('WSRESULT', USERPATH.'WSRESULT/'); // Web Services result directory
  100 +define('wsResultsXml',WSRESULT.'WSresults.xml'); // Web Service result file
  101 +define('plotsXml', IHM_SRC_DIR.'public/WebServices/XML/AmdaPlots.xml'); // Web Service getPlot : list of parameters to plot
118 102  
119 103 // Web Service servers WSDL : $_SERVER['SERVER_NAME'] (par apache) gethostname() (par command)
120   -$SERVER_NAME = $_SERVER['SERVER_NAME'] ? $_SERVER['SERVER_NAME'] : gethostname();
121   -
122   -define('webAlias', "http://" . $SERVER_NAME . APACHE_ALIAS);
123   -define('wsdl_AMDA', webAlias . "public/wsdl/Methods_AMDA.wsdl");
124   -
125   -// Time interval between 2 queries before to ask for a new authentification, in seconds.
126   -define('timeLimitQuery', 600); // 10 minutes
127   -
128   -/*-------------------END WEB SERVICES section ---------*/
  104 +$SERVER_NAME = $_SERVER['SERVER_NAME'] ? $_SERVER['SERVER_NAME'] : gethostname();
  105 +define('webAlias',"http://".$SERVER_NAME.APACHE_ALIAS);
  106 +define('wsdl_AMDA', webAlias."public/wsdl/Methods_AMDA.wsdl");
129 107  
130 108 // AKKA - KERNELBIN is now the new kernel bin dir
131 109 define('KERNELBIN', NEWKERNEL_INSTALL_DIR . 'bin/');
... ... @@ -133,22 +111,11 @@ define(&#39;KERNELBIN&#39;, NEWKERNEL_INSTALL_DIR . &#39;bin/&#39;);
133 111 putenv("LD_LIBRARY_PATH=" . SYS_LIBS . ":" . DDLIB . ":" . CEFLIB . ":" . CDFLIB);
134 112 putenv("PATH=./:" . DDBIN . ":" . SYS_BIN . ":" . IHM_SRC_DIR . "php/bin");
135 113  
136   -putenv("DDPATH=" . DDRES_DIR);
  114 +putenv("DDPATH=".DDRES_DIR);
  115 +define('XMLPATH', IHM_SRC_DIR.'php/XML/');
137 116  
138   -// PHP classes
139   -define('XMLPATH', IHM_SRC_DIR . 'php/XML/');
140   -define('CLASSPATH', IHM_SRC_DIR . 'php/classes/');
141   -define('REMOTE_CLASSPATH', IHM_SRC_DIR . 'php/RemoteDataCenter/');
142   -define('OLD_CLASSPATH', IHM_SRC_DIR . 'php/old_amda/');
  117 +require_once(INTEGRATION_BASE_PATH.'src/amdaintegration_autoload.php');
143 118  
144   -set_include_path(".:" . CLASSPATH . ":" . REMOTE_CLASSPATH . ":" . OLD_CLASSPATH);
145   -
146   -if (!function_exists('__autoload')) {
147   - function __autoload($class_name)
148   - {
149   - require_once $class_name . '.php';
150   - }
151   -}
152 119  
153 120 global $API;
154 121 $API = array(
... ...