Commit 08a894625b8b808e474e4dd3e20fbda9c14d7ae6

Authored by Elena.Budnik
1 parent 167bd1f8

convert old user ws

generic_data/migration/Deleted.xml 0 โ†’ 100644
... ... @@ -0,0 +1,19 @@
  1 +<?xml version="1.0"?>
  2 +<root>
  3 + <deleted xml:id="c1_pp_"/>
  4 + <deleted xml:id="c3_pp_"/>
  5 + <deleted xml:id="_xyz_pre"/>
  6 + <deleted xml:id="ros_rsn_"/>
  7 + <deleted xml:id="cass_caps_elssec"/>
  8 + <deleted xml:id="cass_caps_snghr"/>
  9 + <deleted xml:id="wnd_swe_he"/>
  10 + <deleted xml:id="ros_b_ib"/>
  11 + <deleted xml:id="ros_b_ob"/>
  12 + <deleted xml:id="ros_xyz_fixed"/>
  13 + <deleted xml:id="ulys_carr"/>
  14 + <deleted xml:id="juno_cruise_xyzhci"/>
  15 + <deleted xml:id="juno_cruise_xyzhee"/>
  16 + <deleted xml:id="juno_cruise_xyzheeq"/>
  17 + <deleted xml:id="juno_cruise_lonhci"/>
  18 + <deleted xml:id="juno_cruise_lathci"/>
  19 +</root>
... ...
generic_data/migration/Functions.xml 0 โ†’ 100644
... ... @@ -0,0 +1,18 @@
  1 +<?xml version="1.0"?>
  2 +<root>
  3 + <deleted xml:id="gsegsm_"/>
  4 + <deleted xml:id="gsesm_"/>
  5 + <deleted xml:id="shiftN_"/>
  6 + <deleted xml:id="median_"/>
  7 + <deleted xml:id="rms_"/>
  8 + <deleted xml:id="min_"/>
  9 + <deleted xml:id="max_"/>
  10 + <deleted xml:id="var_"/>
  11 + <deleted xml:id="skew_"/>
  12 + <deleted xml:id="rms_sm_"/>
  13 + <deleted xml:id="min_sm_"/>
  14 + <deleted xml:id="max_sm_"/>
  15 + <deleted xml:id="var_sm_"/>
  16 + <deleted xml:id="skew_sm_"/>
  17 + <deleted xml:id="fix"/>
  18 +</root>
... ...
generic_data/migration/Modified.xml 0 โ†’ 100644
... ... @@ -0,0 +1,30 @@
  1 +<?xml version="1.0"?>
  2 +<conversion>
  3 + <param_convert xml:id="ace_xyz_gse" oldid="ace_xyz"/>
  4 + <param_convert xml:id="sw_v_gse" oldid="sw_v"/>
  5 + <param_convert xml:id="c1_xyz_gse" oldid="c1_xyz"/>
  6 + <param_convert xml:id="c2_xyz_gse" oldid="c2_xyz"/>
  7 + <param_convert xml:id="c3_xyz_gse" oldid="c3_xyz"/>
  8 + <param_convert xml:id="c4_xyz_gse" oldid="c4_xyz"/>
  9 + <param_convert xml:id="c1_b_gse" oldid="c1_b"/>
  10 + <param_convert xml:id="c2_b_gse" oldid="c2_b"/>
  11 + <param_convert xml:id="c3_b_gse" oldid="c3_b"/>
  12 + <param_convert xml:id="c4_b_gse" oldid="c4_b"/>
  13 + <param_convert xml:id="mex_xyz_mso" oldid="mex_xyz"/>
  14 + <param_convert xml:id="vex_xyz_vso" oldid="vex_xyz"/>
  15 + <param_convert xml:id="mav_sun_r" oldid="mav_r_iausun"/>
  16 + <param_convert xml:id="mav_mars_r" oldid="mav_r_iaumars"/>
  17 + <param_convert xml:id="cass_r_sat" oldid="cass_r_ksm"/>
  18 + <param_convert xml:id="mex_mars_r" oldid="sys_mex_r"/>
  19 + <param_convert xml:id="ros_cg_r" oldid="ros_r_cso"/>
  20 + <param_convert xml:id="vex_venus_r" oldid="sys_vex_r"/>
  21 + <param_convert xml:id="it_v_gse" oldid="it_v"/>
  22 + <param_convert xml:id="cass_wl" oldid="cass_wl_iau"/>
  23 + <!--<param_convert xml:id="mex_mars_r" oldid="pol_mex_pc(0)"/>-->
  24 + <param_convert xml:id="lat_mex_iau" oldid="pol_mex_pc(1)"/>
  25 + <param_convert xml:id="lon_mex_iau" oldid="pol_mex_pc(2)"/>
  26 + <param_convert xml:id="b_t96gsm" oldid="bt96"/>
  27 + <param_convert xml:id="mgs_mars_r" oldid="pol_mgs_pc(0)"/>
  28 + <param_convert xml:id="lon_mgs_iau" oldid="pol_mgs_pc(1)"/>
  29 + <param_convert xml:id="lat_mgs_iau" oldid="pol_mgs_pc(2)"/>
  30 +</conversion>
0 31 \ No newline at end of file
... ...
generic_data/migration/NotReady.xml 0 โ†’ 100644
... ... @@ -0,0 +1,30 @@
  1 +<?xml version="1.0"?>
  2 +<root>
  3 + <deleted xml:id="footprints"/>
  4 + <deleted xml:id="exomars"/>
  5 + <deleted xml:id="mms1_"/>
  6 + <deleted xml:id="mms2_"/>
  7 + <deleted xml:id="mms3_"/>
  8 + <deleted xml:id="mms4_"/>
  9 + <deleted xml:id="bepi_"/>
  10 + <deleted xml:id="mpo_"/>
  11 + <deleted xml:id="mmo_"/>
  12 + <deleted xml:id="io_jup_"/>
  13 + <deleted xml:id="eur_jup_"/>
  14 + <deleted xml:id="gan_jup_"/>
  15 + <deleted xml:id="cal_jup_"/>
  16 + <deleted xml:id="ros_mip_"/>
  17 + <deleted xml:id="ros_lap"/>
  18 + <deleted xml:id="ros_ica_en"/>
  19 + <deleted xml:id="vex_o_flux"/>
  20 + <deleted xml:id="vex_h_flux"/>
  21 + <deleted xml:id="mex_o_flux"/>
  22 + <deleted xml:id="mex_h_flux"/>
  23 + <deleted xml:id="vex_o_spec"/>
  24 + <deleted xml:id="vex_h_spec"/>
  25 + <deleted xml:id="mex_o_spec"/>
  26 + <deleted xml:id="mex_h_spec"/>
  27 + <deleted xml:id="ba2000"/>
  28 + <deleted xml:id="bt96"/>
  29 + <deleted xml:id="bcain"/>
  30 +</root>
... ...
generic_data/migration/SpectraModifs.xml 0 โ†’ 100644
... ... @@ -0,0 +1,22 @@
  1 +<?xml version="1.0"?>
  2 +<root>
  3 + <deleted xml:id="e_mgs_omni"/>
  4 + <deleted xml:id="mex_els_spec"/>
  5 + <deleted xml:id="vex_els_spec"/>
  6 + <deleted xml:id="hia_padflux_c1"/>
  7 + <deleted xml:id="hia_padflux_c3"/>
  8 + <deleted xml:id="sta_swea_pad"/>
  9 + <deleted xml:id="stb_swea_pad"/>
  10 + <deleted xml:id="mex_h_spec"/>
  11 + <deleted xml:id="mex_h_flux"/>
  12 + <deleted xml:id="mex_o_spec"/>
  13 + <deleted xml:id="mex_o_flux"/>
  14 + <deleted xml:id="vex_h_spec"/>
  15 + <deleted xml:id="vex_h_flux"/>
  16 + <deleted xml:id="vex_o_spec"/>
  17 + <deleted xml:id="vex_o_flux"/>
  18 + <deleted xml:id="mav_sta_c0"/>
  19 + <deleted xml:id="mav_sta_c6"/>
  20 + <deleted xml:id="gtl_lep_espec"/>
  21 + <deleted xml:id="gtl_lep_ispec"/>
  22 +</root>
0 23 \ No newline at end of file
... ...
generic_data/migration/Template.xml 0 โ†’ 100644
... ... @@ -0,0 +1,7 @@
  1 +<?xml version="1.0"?>
  2 +<root>
  3 + <deleted xml:id="bt96"/>
  4 + <deleted xml:id="ba2000"/>
  5 + <deleted xml:id="bmorsch_mso"/>
  6 + <deleted xml:id="bcain_mso"/>
  7 +</root>
... ...
php/RemoteDataCenter/Bases.xml
1 1 <?xml version="1.0"?>
2 2 <dataRoot xml:id="myRemoteData-treeRootNode">
3   - <!--<dataCenter name="CLWEB@IRAP" desc="CLWeb_Internal_Data_Base" default="yes" id1="CLWeb" xml:id="CLWeb"/>-->
4 3 <dataCenter name="LATMOS" desc="Latmos Hybrid Simulation Database" isSimulation='1' default="yes" id1="LATMOS" xml:id="LATMOS"/>
5 4 <dataCenter name="FMI_HYBRID" desc="FMI Hybrid Simulation Database" isSimulation='1' default="yes" id1="FMI_HYBRID" xml:id="FMI_HYBRID"/>
6   - <dataCenter name="FMI_GUMICS" desc="FMI MHD simulation database" isSimulation='1' default="yes" id1="FMI_GUMICS" xml:id="FMI_GUMICS"/>
7   - <!--<dataCenter name="SINP" desc="Paraboloid model calculates the magnetic fields in the Earth's magnetosphere depending on external conditions in solar wind and on geomagnetic activity level" isSimulation='1' default="yes" id1="SINP" xml:id="SINP"/>-->
  5 + <dataCenter name="FMI_GUMICS" desc="FMI MHD simulation database" isSimulation='1' addable="true" default="yes" id1="FMI_GUMICS" xml:id="FMI_GUMICS"/>
  6 + <dataCenter name="SINP" desc="Paraboloid model calculates the magnetic fields in the Earth's magnetosphere depending on external conditions in solar wind and on geomagnetic activity level" isSimulation='1' default="yes" id1="SINP" xml:id="SINP"/>
8 7 <dataCenter name="LESIA" desc="LESIA MASER" default="yes" id1="LESIA" isSimulation='1' xml:id="LESIA"/>
9 8 <!--<dataCenter name="CDPP" desc="CCMC BATSRUS with RCM v8.01" default="yes" id1="CCMC" isSimulation='1' xml:id="CCMC"/>-->
10 9 <dataCenter name="IPIM" desc="IPIM @ IRAP" default="yes" id1="IPIM" isSimulation='1' xml:id="IPIM"/>
... ...
php/classes/UserDeleteObsolete.php
... ... @@ -5,181 +5,170 @@
5 5 *
6 6 */
7 7  
8   - class UserDeleteObsolete {
  8 +class UserDeleteObsolete {
9 9  
10   - private $dataset, $vi, $Mgr;
11   - private $ws_deleted;
  10 + private $dataset, $vi, $Mgr;
  11 + private $ws_deleted;
12 12  
13   - function __construct() {
14   -
15   - $this->ws_deleted = array();
16   - }
17   -
18   - public function setVI($vi) {
19   - $this->vi = $vi;
20   - $this->dataset = strtolower($vi);
21   - }
22   -
23   -
24   - public function deleteDerived() {
25   -
26   - $msg = '<b>WS (Derived) Params:</b><br/>';
27   - // derived parameters
28   - $this->Mgr = new DerivedParamMgr('derivedParam');
29   - // get params
30   - $wsParams = $this->Mgr->contentDom->getElementsByTagName('param');
  13 + function __construct() {
  14 + $this->ws_deleted = array();
  15 + }
  16 +
  17 + public function setVI($vi) {
  18 + $this->vi = $vi;
  19 + $this->dataset = strtolower($vi);
  20 + }
  21 +
  22 + public function deleteDerived() {
  23 + $msg = '<b>WS (Derived) Params:</b><br/>';
  24 + // derived parameters
  25 + $this->Mgr = new DerivedParamMgr('derivedParam');
  26 + // get params
  27 + $wsParams = $this->Mgr->contentDom->getElementsByTagName('param');
  28 +
  29 + if ($wsParams->length == 0) {
  30 + return array('success' => true, 'msg' => 'No parameters');
  31 + }
  32 +
  33 + foreach ($wsParams as $param) {
  34 + $id = $param->getAttribute('xml:id');
  35 + $name = $param->getAttribute('name');
  36 + $expression = $param->getAttribute('buildchain');
  37 +
  38 + if (strpos(strtolower($expression), $this->dataset)) {
  39 + $msg .= 'deleted name:<b>'.$name.'</b>; expression: '.$expression.'<br/>';
  40 + $obj = new stdClass();
  41 + $obj->leaf = true;
  42 + $obj->id = $id;
  43 + $this->Mgr->deleteObject($obj);
  44 + // error_log( 'For INFO : DELETED '.$expression,1,email);
  45 + $this->ws_deleted[] = $name;
  46 + }
  47 + }
  48 +
  49 + $msg .= ' ok<br/>';
  50 + return array('success' => true, 'msg' => $msg);
  51 + }
31 52  
32   - if ($wsParams->length == 0) {
33   - return array('success' => true, 'msg' => 'No parameters');
34   - }
35   -
36   - foreach ($wsParams as $param) {
37   - $id = $param->getAttribute('xml:id');
38   - $name = $param->getAttribute('name');
39   - $expression = $param->getAttribute('buildchain');
40   -
41   - if (strpos(strtolower($expression), $this->dataset)) {
42   - $msg .= 'deleted name:<b>'.$name.'</b>; expression: '.$expression.'<br/>';
43   - $obj = new stdClass();
44   - $obj->leaf = true;
45   - $obj->id = $id;
46   - $this->Mgr->deleteObject($obj);
47   - // error_log( 'For INFO : DELETED '.$expression,1,email);
48   - $this->ws_deleted[] = $name;
49   - }
50   - }
51   - $msg .= ' ok<br/>';
52   - return array('success' => true, 'msg' => $msg);
53   - }
54   -
55   -
56   -
57   - public function deleteConditions() {
58   -
59   - $msg = '<b>Conditions:</b><br/>';
60   - // conditons
61   - $this->Mgr = new RequestMgr('condition');
62   -
63   - $conditions = $this->Mgr->contentDom->getElementsByTagName('condition');
64   -
65   - if ($conditions->length == 0) {
66   - return array('success' => true, 'msg' => 'No conditions');
67   - }
68   -
69   - foreach ($conditions as $item) {
70   - $id = $item->getAttribute('xml:id');
71   - $name = $item->getAttribute('name');
72   -
73   - $expression = strtolower($this->Mgr->getObject($id)->expression);
74   -
75   - if (strpos($expression, $this->dataset)) {
76   - $obj = new stdClass();
77   - $obj->leaf = true;
78   - $obj->id = $id;
79   - $this->Mgr->deleteObject($obj);
80   - $msg .= 'deleted name:<b>'.$obj->name.'</b>; expression:'.$expression.'<br/>';
81   -
82   - }
83   - }
84   -
85   - $msg .= ' ok<br/>';
86   -
87   - return array('success' => true, 'msg' => $msg);
88   - }
89   -
90   - public function deleteRequests() {
91   -
92   - $msg = '<b>Requests:</b><br/>';
93   - // requests
94   - $this->Mgr = new RequestMgr('request');
95   - $requests = $this->Mgr->contentDom->getElementsByTagName('request');
96   -
97   - if (count($requests) == 0) {
98   - return array('success' => true, 'msg' => 'No requests');
99   - }
100   -
101   - foreach ($requests as $item) {
102   -
103   - $id = $item->getAttribute('xml:id');
104   - $name = $item->getAttribute('name');
105   -
106   - $objplot = $this->Mgr->getObject($id);
107   - $obj = new stdClass();
108   - $obj->leaf = true;
109   - $obj->id = $id;
  53 + public function deleteConditions() {
  54 +
  55 + $msg = '<b>Conditions:</b><br/>';
  56 + // conditons
  57 + $this->Mgr = new RequestMgr('condition');
  58 +
  59 + $conditions = $this->Mgr->contentDom->getElementsByTagName('condition');
  60 +
  61 + if ($conditions->length == 0) {
  62 + return array('success' => true, 'msg' => 'No conditions');
  63 + }
  64 +
  65 + foreach ($conditions as $item) {
  66 + $id = $item->getAttribute('xml:id');
  67 + $name = $item->getAttribute('name');
  68 +
  69 + $expression = strtolower($this->Mgr->getObject($id)->expression);
  70 +
  71 + if (strpos($expression, $this->dataset)) {
  72 + $obj = new stdClass();
  73 + $obj->leaf = true;
  74 + $obj->id = $id;
  75 + $this->Mgr->deleteObject($obj);
  76 + $msg .= 'deleted name:<b>'.$obj->name.'</b>; expression:'.$expression.'<br/>';
  77 + }
  78 + }
  79 +
  80 + $msg .= ' ok<br/>';
  81 +
  82 + return array('success' => true, 'msg' => $msg);
  83 + }
  84 +
  85 + public function deleteRequests() {
  86 +
  87 + $msg = '<b>Requests:</b><br/>';
  88 + // requests
  89 + $this->Mgr = new RequestMgr('request');
  90 + $requests = $this->Mgr->contentDom->getElementsByTagName('request');
  91 +
  92 + if (count($requests) == 0) {
  93 + return array('success' => true, 'msg' => 'No requests');
  94 + }
  95 +
  96 + foreach ($requests as $item) {
  97 +
  98 + $id = $item->getAttribute('xml:id');
  99 + $name = $item->getAttribute('name');
  100 +
  101 + $objplot = $this->Mgr->getObject($id);
  102 + $obj = new stdClass();
  103 + $obj->leaf = true;
  104 + $obj->id = $id;
110 105  
111   - foreach ($objplot->children as $panel) {
112   - foreach ($panel->children as $param) {
113   -
114   - $parID = strtolower($param->name);
115   -
116   - if ($this->ws_deleted && substr($parId,0,3) == "ws_") {
117   - if (array_search($this->ws_deleted, $parId)) {
118   -
119   - $this->Mgr->deleteObject($obj);
120   - $msg .= 'request deleted '.$name.'<br/>';
121   - continue 3;
122   - }
123   - }
124   -
125   - if (strpos($parID, $this->dataset)) {
126   - $this->Mgr->deleteObject($obj);
127   - $msg .= 'request deleted '.$name.'<br/>';
128   - continue 3;
129   - }
130   - }
131   - }
132   - }
133   - $msg .= ' ok<br/>';
134   -
135   - return array('success' => true, 'msg' => $msg);
136   - }
137   -
138   - public function deleteAliases() {
139   -
140   - $msg = '<b>Aliases:</b><br/>';
141   - $this->Mgr = new AliasMgr();
142   - $aliases = $this->Mgr->contentDom->getElementsByTagName('alias');
143   -
144   - foreach ($aliases as $alias) {
145   - $id = $alias->getAttribute('xml:id');
146   - $name = $alias->getAttribute('name');
147   - if (strpos(strtolower($id), $this->dataset)) {
148   - $obj = new stdClass();
149   - $obj->leaf = true;
150   - $obj->id = $id;
151   - $this->Mgr->deleteObject($obj);
152   - $msg .= 'alias deleted '.$name.'<br/>';
153   - }
154   - }
155   - return array('success' => true, 'msg' => $msg);
156   - }
157   -
158   -
159   - public function deleteInTree() {
160   -
161   - $msg = '<b>Dataset in RemoteParams:</b><br/>';
162   -
163   - $this->Mgr = new ParamMgr();
164   - $xp = new domxpath($this->Mgr->xmlDom);
165   -
166   - $nodeToDelete = $xp->query("//dataset[@name='".$this->vi."']");
167   - if ($nodeToDelete->length > 0) {
168   - $instrNode = $nodeToDelete->item(0)->parentNode;
169   - $instrNode->removeChild($nodeToDelete->item(0));
170   - if (!$instrNode->hasChildNodes()) {
171   - $missionNode = $instrNode->parentNode;
172   - $missionNode->removeChild($instrNode);
173   - if (!$missionNode->hasChildNodes()) {
174   - $datacenterNode = $missionNode->parentNode;
175   - $datacenterNode->removeChild($missionNode);
176   - }
177   - }
178   -
179   - $this->Mgr->xmlDom->save($this->Mgr->xmlName);
180   - $msg .= 'dataset deleted '.$this->vi.'<br/>';
181   - }
182   - return array('success' => true, 'msg' => $msg);
183   - }
  106 + foreach ($objplot->children as $panel) {
  107 + foreach ($panel->children as $param) {
  108 + $parID = strtolower($param->name);
  109 + if ($this->ws_deleted && substr($parId,0,3) == "ws_") {
  110 + if (array_search($this->ws_deleted, $parId)) {
  111 + $this->Mgr->deleteObject($obj);
  112 + $msg .= 'request deleted '.$name.'<br/>';
  113 + continue 3;
  114 + }
  115 + }
  116 +
  117 + if (strpos($parID, $this->dataset)) {
  118 + $this->Mgr->deleteObject($obj);
  119 + $msg .= 'request deleted '.$name.'<br/>';
  120 + continue 3;
  121 + }
  122 + }
  123 + }
  124 + }
  125 + $msg .= ' ok<br/>';
  126 +
  127 + return array('success' => true, 'msg' => $msg);
  128 + }
  129 +
  130 + public function deleteAliases() {
  131 + $msg = '<b>Aliases:</b><br/>';
  132 + $this->Mgr = new AliasMgr();
  133 + $aliases = $this->Mgr->contentDom->getElementsByTagName('alias');
  134 +
  135 + foreach ($aliases as $alias) {
  136 + $id = $alias->getAttribute('xml:id');
  137 + $name = $alias->getAttribute('name');
  138 + if (strpos(strtolower($id), $this->dataset)) {
  139 + $obj = new stdClass();
  140 + $obj->leaf = true;
  141 + $obj->id = $id;
  142 + $this->Mgr->deleteObject($obj);
  143 + $msg .= 'alias deleted '.$name.'<br/>';
  144 + }
  145 + }
  146 + return array('success' => true, 'msg' => $msg);
  147 + }
  148 +
  149 + public function deleteInTree() {
  150 + $msg = '<b>Dataset in RemoteParams:</b><br/>';
  151 +
  152 + $this->Mgr = new ParamMgr();
  153 + $xp = new domxpath($this->Mgr->xmlDom);
  154 +
  155 + $nodeToDelete = $xp->query("//dataset[@name='".$this->vi."']");
  156 + if ($nodeToDelete->length > 0) {
  157 + $instrNode = $nodeToDelete->item(0)->parentNode;
  158 + $instrNode->removeChild($nodeToDelete->item(0));
  159 + if (!$instrNode->hasChildNodes()) {
  160 + $missionNode = $instrNode->parentNode;
  161 + $missionNode->removeChild($instrNode);
  162 + if (!$missionNode->hasChildNodes()) {
  163 + $datacenterNode = $missionNode->parentNode;
  164 + $datacenterNode->removeChild($missionNode);
  165 + }
  166 + }
  167 +
  168 + $this->Mgr->xmlDom->save($this->Mgr->xmlName);
  169 + $msg .= 'dataset deleted '.$this->vi.'<br/>';
  170 + }
  171 + return array('success' => true, 'msg' => $msg);
  172 + }
184 173 }
185 174 ?>
186 175 \ No newline at end of file
... ...
php/classes/UserWsTransfer.php
... ... @@ -13,9 +13,9 @@ class UserWsTransfer {
13 13 {
14 14 define('OLDUSERPATH', 'http://cdpp1.irap.omp.eu/AMDA-NG/data/');
15 15 // define('OLDUSERPATH', 'http://amda-dev.irap.omp.eu/~budnik/AMDA-NG4/trunk/data/');
16   - define('NEWUSERPATH', '/home/budnik/AMDA/AMDA_IHM/data/');
  16 + define('NEWUSERPATH', USERPATH);
17 17 define('TRANSFERUSER', $user);
18   - define('CONVERSIONDIR', '/home/budnik/AMDA/AMDA_Migration/conversion/');
  18 + define('CONVERSIONDIR', DATAPATH."migration/");
19 19  
20 20 $this->oldWs = new DomDocument("1.0");
21 21 $this->newWs = new DomDocument("1.0");
... ...