Commit 7b51463679965fde403461412b8222f8d1a7cc65
1 parent
981cd087
Exists in
master
and in
110 other branches
add migration post processing
Showing
3 changed files
with
30 additions
and
6 deletions
Show diff stats
generic_data/migration/Modified.xml
... | ... | @@ -20,7 +20,6 @@ |
20 | 20 | <param_convert xml:id="vex_venus_r" oldid="sys_vex_r"/> |
21 | 21 | <param_convert xml:id="it_v_gse" oldid="it_v"/> |
22 | 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 | 23 | <param_convert xml:id="lat_mex_iau" oldid="pol_mex_pc(1)"/> |
25 | 24 | <param_convert xml:id="lon_mex_iau" oldid="pol_mex_pc(2)"/> |
26 | 25 | <param_convert xml:id="b_t96gsm" oldid="bt96"/> |
... | ... |
php/classes/UserWsTransfer.php
... | ... | @@ -7,7 +7,7 @@ class UserWsTransfer { |
7 | 7 | |
8 | 8 | private $oldWs, $newWs, $Mgr; |
9 | 9 | private $oldWsDir, $newWsDir; |
10 | - private $ws_deleted, $wsd_deleted, $pairs, $specParams; | |
10 | + private $ws_deleted, $wsd_deleted, $pairs, $specParams, $postPairs; | |
11 | 11 | |
12 | 12 | function __construct($user) |
13 | 13 | { |
... | ... | @@ -29,6 +29,7 @@ class UserWsTransfer { |
29 | 29 | $this->ws_deleted = array(); |
30 | 30 | $this->wsd_deleted = array(); |
31 | 31 | $this->getModified(); |
32 | + $this->getReprocessed(); | |
32 | 33 | $this->getSpectra(); |
33 | 34 | } |
34 | 35 | |
... | ... | @@ -127,6 +128,23 @@ class UserWsTransfer { |
127 | 128 | $this->pairs = $pairs; |
128 | 129 | } |
129 | 130 | |
131 | + private function getReprocessed() | |
132 | + { | |
133 | + $convertXML = new DomDocument("1.0"); | |
134 | + $modifiedFile = CONVERSIONDIR.'PostProcess.xml'; | |
135 | + | |
136 | + if (!$convertXML->load($modifiedFile)) | |
137 | + error_log('ERROR loading '.$modifiedFile,1,email); | |
138 | + $convertedNodes = $convertXML->getElementsByTagName('param_convert'); | |
139 | + | |
140 | + foreach ($convertedNodes as $item) { | |
141 | + $pairs[$item->getAttribute('oldid')] = $item->getAttribute('xml:id'); | |
142 | + } | |
143 | + krsort($pairs, SORT_NATURAL); | |
144 | + | |
145 | + $this->postPairs = $pairs; | |
146 | + } | |
147 | + | |
130 | 148 | private function getSpectra() |
131 | 149 | { |
132 | 150 | $convertXML = new DomDocument("1.0"); |
... | ... | @@ -144,11 +162,13 @@ class UserWsTransfer { |
144 | 162 | private function updateParams($expression) |
145 | 163 | { |
146 | 164 | $newExp = strtr($expression, $this->pairs); |
147 | - $expression = $newExp; | |
148 | - | |
149 | - return $expression; | |
165 | + if (!empty($this->postPairs)) | |
166 | + $expFinal = strtr($newExp, $this->postPairs); | |
167 | + | |
168 | + return $expFinal; | |
150 | 169 | } |
151 | - | |
170 | + | |
171 | + | |
152 | 172 | protected function createDom() |
153 | 173 | { |
154 | 174 | $types = array('param' => 'derived', 'mydata' => 'myData'); |
... | ... | @@ -273,6 +293,7 @@ class UserWsTransfer { |
273 | 293 | if ($nodeInWS) { |
274 | 294 | $buildchain = $nodeInWS->getAttribute('buildchain'); |
275 | 295 | $buildchainUpdated = $this->updateParams($buildchain); |
296 | + | |
276 | 297 | $nodeInWS->setAttribute('buildchain',$buildchainUpdated); |
277 | 298 | } |
278 | 299 | } |
... | ... |