diff --git a/php/classes/AmdaAction.php b/php/classes/AmdaAction.php index 9a46114..cc0d8c5 100644 --- a/php/classes/AmdaAction.php +++ b/php/classes/AmdaAction.php @@ -2,10 +2,8 @@ /** * @class AmdaAction * @version $Id: AmdaAction.php 2976 2015-07-01 15:05:40Z benjamin $ - * + * @brief */ - - class AmdaAction { private $xmlFiles = array('localParam' => 'LocalParams.xml', 'remoteParam' => 'RemoteParams.xml', @@ -483,14 +481,7 @@ class AmdaAction else { $restricted = FALSE; -// if ($child->tagName == 'dataCenter') -// { -// $restricted = ($child->getAttribute('available') != "1"); -// } -// - if ($id == 'CDAWEB' || $id == 'THEMIS'|| $id == 'MAPSKP') - $restricted = FALSE; - + if ($child->tagName == 'dataset') { $nonavailable = ($child->getAttribute('disabled')); @@ -683,8 +674,7 @@ class AmdaAction case 'request' : $objectMgr = new RequestMgr($nodeType); break; - case 'bkgWorks' : - require_once(INTEGRATION_SRC_DIR."RequestManager.php"); + case 'bkgWorks' : return $this->executeRequest($id, FunctionTypeEnumClass::PROCESSGETINFO); break; case 'myData' : @@ -722,7 +712,6 @@ class AmdaAction $obj->id = substr($obj->id,strlen('alias_')); break; case 'bkgWorks' : - require_once(INTEGRATION_SRC_DIR."RequestManager.php"); return $this->executeRequest($obj, FunctionTypeEnumClass::PROCESSDELETE); case 'myData' : @@ -857,8 +846,7 @@ class AmdaAction */ public function getJobs() { - require_once(INTEGRATION_SRC_DIR."RequestManager.php"); - $obj = (object) array(); + $obj = (object) array(); return $this->executeRequest($obj, FunctionTypeEnumClass::PROCESSRUNNINGINFO); } @@ -906,7 +894,7 @@ class AmdaAction } private function executeRequest($obj, $function) - { + { // Check user if access to DD Server and / or possible 'space consuming' action if ( $function == FunctionTypeEnumClass::PARAMS || $function == FunctionTypeEnumClass::ACTION || @@ -917,7 +905,6 @@ class AmdaAction } $requestManager = new RequestManagerClass(); - try { $res = $requestManager->runIHMRequest($this->user, !empty($res['userHost']) ? $res['userHost'] : NULL, $function, $obj); } catch (Exception $e) { @@ -932,8 +919,6 @@ class AmdaAction */ public function execute($node, $obj) { - require_once(INTEGRATION_SRC_DIR."RequestManager.php"); - // just convert TT / Catalog if ($obj->nodeType == "download" && $obj->downloadSrc == "1") return $this->executeRequest($obj, FunctionTypeEnumClass::TTCONVERT); @@ -953,7 +938,6 @@ class AmdaAction */ public function compilParam($obj) { - require_once(INTEGRATION_SRC_DIR."RequestManager.php"); return $this->executeRequest($obj, FunctionTypeEnumClass::PARAMSGEN); } @@ -962,7 +946,6 @@ class AmdaAction */ public function compilParamDelete($obj) { - require_once(INTEGRATION_SRC_DIR."RequestManager.php"); $res = $this->checkUser($obj); if (!$res['success']) @@ -981,7 +964,6 @@ class AmdaAction public function killPlotRequest() { - require_once(INTEGRATION_SRC_DIR."RequestManager.php"); return $this->executeRequest((object) array('nodeType' => 'killplot'), FunctionTypeEnumClass::PARAMS); } @@ -1323,7 +1305,6 @@ class AmdaAction public function cleanUserWS() { $this->rrmdir(USERDIR.'DOWNLOAD.TEMP'); - require_once(INTEGRATION_SRC_DIR."RequestManager.php"); IHMConfigClass::setUserName($this->user); // delete impex params and data @@ -1359,7 +1340,6 @@ class AmdaAction public function interactivePlot($obj, $multiPlotState) { - require_once(INTEGRATION_SRC_DIR."RequestManager.php"); $inputobj = (Object)array( 'action' => $obj, 'multiPlotState' => $multiPlotState @@ -1369,7 +1349,6 @@ class AmdaAction public function getParamPlotInit($obj) { - require_once(INTEGRATION_SRC_DIR."RequestManager.php"); // IMPEX param if (preg_match("#^spase___IMPEX_#",$obj->paramId)) $type = 'impex_plot_init'; @@ -1385,7 +1364,6 @@ class AmdaAction public function getParamInfo($obj) { - require_once(INTEGRATION_SRC_DIR."RequestManager.php"); // IMPEX param if (preg_match("#^spase___IMPEX_#",$obj->paramId)) $type = 'impex_param_info'; @@ -1437,8 +1415,6 @@ class AmdaAction public function getRequestByProcessId($obj) { - require_once(INTEGRATION_SRC_DIR."RequestManager.php"); - return $this->executeRequest($obj->processId, FunctionTypeEnumClass::PROCESSGETREQUEST); } } diff --git a/php/config.php b/php/config.php index 19e36f9..e3b0ff0 100644 --- a/php/config.php +++ b/php/config.php @@ -2,49 +2,31 @@ /** * @file config.php * @version $Id: config.php 2368 2014-05-21 08:46:23Z elena $ - * */ /* - * ob_start - * This function will turn output buffering on. - * While output buffering is active no output is sent from the script (other than headers), - * instead the output is stored in an internal buffer. - * The contents of this internal buffer may be copied into a string variable using ob_get_contents(). - * To output what is stored in the internal buffer, use ob_end_flush(). - * Alternatively, ob_end_clean() will silently discard the buffer contents. -*/ -// ob_start(); - -/* * Installation-dependent settings */ require_once 'my_config.php'; -if (is_file('amda_version.php')) - require_once 'amda_version.php'; +error_reporting(E_ERROR); -if (is_file('errors.php')) - require_once 'errors.php'; +if (is_file('amda_version.php')) require_once 'amda_version.php'; +if (is_file('errors.php')) require_once 'errors.php'; -/*----------------------- SYSTEM config section --------*/ -if (!defined('PHP_VERSION_ID')) -{ +// SYSTEM config section +if (!defined('PHP_VERSION_ID')) { $version = explode('.', PHP_VERSION); define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2])); } - -if (!defined('MAGIC_FILE')) - define('MAGIC_FILE','/usr/share/misc/magic'); - +if (!defined('MAGIC_FILE')) define('MAGIC_FILE','/usr/share/misc/magic'); date_default_timezone_set('UTC'); -/*-----------------------END SYSTEM config section --------*/ -/*----------------------- GUESTS LOGIN section --------*/ -define("MaxGuests", 10); // Max Guests number +// GUESTS LOGIN section +define("MaxGuests", 10); // Max Guests number define("GuestSessionDuration", 300); //300 minutes -define("MaxGuestTimeInterval", 10); // days -/*-----------------------END GUESTS LOGIN section --------*/ +define("MaxGuestTimeInterval", 10); // days + // user WS size limit define('DISK_QUOTA_standard', 1024*1024*200); // 200MB @@ -53,21 +35,18 @@ define('MAX_FILE_INDEX_TO_SHOW', 100); // private key used to be considerate as a trust client for some functions of DD web service define('DDSERVICE_PRIVATEKEY','!%p856Dc'); -define('IMPEX_INTERVAL_LIMIT', 86400); // one day for impex request -/*----------------------- BATCH JOBS section --------*/ -define('JOBTIMEOUT', '1'); // one cycle secs to sleep to allow job be executed -define('PLOT_CYCLES_NUMBER', 500); // cycles number for PNG -define('JOB_CYCLES_NUMBER', 5); // cycles number for all the jobs +// BATCH JOBS section +//define('JOBTIMEOUT', '1'); // one cycle secs to sleep to allow job be executed +//define('PLOT_CYCLES_NUMBER', 500); // cycles number for PNG +//define('JOB_CYCLES_NUMBER', 5); // cycles number for all the jobs //define('TIMEOUT', '100'); //TODO secs wait before job is killed OR 'max_execution_time' - kill automatic? -/*-----------------------END BATCH JOBS section --------*/ - // EPN-TAP services define('EPNTAP_APIS','http://voparis-tap.obspm.fr/__system__/tap/run/tap/sync'); define('EPNTAP_AMDA','http://cdpp-epntap.irap.omp.eu/__system__/tap/run/tap/sync'); -/*----------------------- PHP run-time settings --------*/ +// PHP run-time settings ini_set('memory_limit',128000000); ini_set('max_execution_time',600); // max PHP execution ini_set('default_socket_timeout', 600); //TODO if this is needed ? IMPEX LONG DURATION WEBSERVICES @@ -77,7 +56,6 @@ ini_set('user_agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:7.0) Gecko/201 // ini_set('upload_max_filesize',100000000); // ini_set('post_max_size',1050000000); -/*-----------------------END PHP run-time settings --------*/ // General Info dirs define('DATAPATH', IHM_SRC_DIR.'generic_data/'); @@ -97,10 +75,11 @@ define('specialGrpsXml',SpecialSettingsDir.'Groups.xml'); define('specialSettingsXml',SpecialSettingsDir.'Settings.xml'); //Help info dirs -define('HELPPATH', IHM_SRC_DIR."help/"); +define('HELPPATH', IHM_SRC_DIR."help/"); -// IMPEX special files +// IMPEX section define('SimuTargetsXml', DATAPATH.'SimuTemplate/TargetsSimu.xml'); +define('IMPEX_INTERVAL_LIMIT', 86400); // one day for impex request // Root User dir : All user dirs are defined in UserMgr.php define('USERPATH', IHM_SRC_DIR.'data/'); @@ -108,18 +87,15 @@ define('USERPATH', IHM_SRC_DIR.'data/'); // Shared dir define('SHAREDPATH', IHM_SRC_DIR.'shared_data/'); -/*------------------- WEB SERVICES section ---------*/ +// WEB SERVICES section define('WSRESULT', USERPATH.'WSRESULT/'); // Web Services result directory define('wsResultsXml',WSRESULT.'WSresults.xml'); // Web Service result file - define('plotsXml', IHM_SRC_DIR.'public/WebServices/XML/AmdaPlots.xml'); // Web Service getPlot : list of parameters to plot // Web Service servers WSDL : $_SERVER['SERVER_NAME'] (par apache) gethostname() (par command) $SERVER_NAME = $_SERVER['SERVER_NAME'] ? $_SERVER['SERVER_NAME'] : gethostname(); - define('webAlias',"http://".$SERVER_NAME.APACHE_ALIAS); define('wsdl_AMDA', webAlias."public/wsdl/Methods_AMDA.wsdl"); -/*-------------------END WEB SERVICES section ---------*/ // AKKA - KERNELBIN is now the new kernel bin dir define('KERNELBIN',NEWKERNEL_INSTALL_DIR.'bin/'); @@ -128,21 +104,26 @@ putenv("LD_LIBRARY_PATH=".SYS_LIBS.":".DDLIB.":".CEFLIB.":".CDFLIB); putenv("PATH=./:".DDBIN.":".SYS_BIN.":".IHM_SRC_DIR."php/bin"); putenv("DDPATH=".DDRES_DIR); - -// PHP classes define('XMLPATH', IHM_SRC_DIR.'php/XML/'); -define('CLASSPATH', IHM_SRC_DIR.'php/classes/'); -define('REMOTE_CLASSPATH', IHM_SRC_DIR.'php/RemoteDataCenter/'); -define('OLD_CLASSPATH', IHM_SRC_DIR.'php/old_amda/'); -set_include_path(".:".CLASSPATH.":".REMOTE_CLASSPATH.":".OLD_CLASSPATH); +// PHP classes -if (!function_exists('__autoload')) -{ - function __autoload($class_name) { - require_once $class_name . '.php'; - } -} +// define('CLASSPATH', IHM_SRC_DIR.'php/classes'); +// define('REMOTE_CLASSPATH', IHM_SRC_DIR.'php/RemoteDataCenter'); +// define('OLD_CLASSPATH', IHM_SRC_DIR.'php/old_amda'); +// define('INTEGRATION_CLASSPATH', INTEGRATION_BASE_PATH.'src'); +// define('CONFIG_CLASSPATH', INTEGRATION_BASE_PATH.'src/InputOutput/IHMImpl/Config'); +// +// set_include_path(".:".CLASSPATH.":".REMOTE_CLASSPATH.":".INTEGRATION_CLASSPATH.":".CONFIG_CLASSPATH.":".OLD_CLASSPATH); +// +// if (!function_exists('__autoload')) +// { +// function __autoload($class_name) { +// require_once $class_name . '.php'; +// } +// } + +require_once(INTEGRATION_BASE_PATH.'src/amdaintegration_autoload.php'); global $API; $API = array( -- libgit2 0.21.2