Commit 497993cfa0e238c2ee441a00e76f06673e9491ef
1 parent
ae02da3a
Exists in
master
and in
99 other branches
delete remote params description if VI in DDBASE was deleted
Showing
2 changed files
with
50 additions
and
1 deletions
Show diff stats
... | ... | @@ -0,0 +1,45 @@ |
1 | +<?php | |
2 | +/* | |
3 | +* Executable to clean up Remote Params | |
4 | +*/ | |
5 | + | |
6 | + if (!function_exists('__autoload')) { | |
7 | + function __autoload($class_name) { | |
8 | + require_once $class_name . '.php'; | |
9 | + } | |
10 | + } | |
11 | + | |
12 | + $AMDA_IHM = getenv('AMDA_IHM'); | |
13 | + | |
14 | + require_once $AMDA_IHM."/php/config.php"; | |
15 | + | |
16 | + if (file_exists(DATAPATH."/RemoteData/Bases.xml")) { | |
17 | + | |
18 | + try { | |
19 | + $client = new SoapClient(DD_WSDL); | |
20 | + } | |
21 | + catch (SoapFault $exception) { | |
22 | + $msg = $exception->faultstring.PHP_EOL; | |
23 | + exit($msg); | |
24 | + } | |
25 | + | |
26 | + $basesDom = new DomDocument("1.0"); | |
27 | + $basesDom->load(DDSERVICE."/BASE/INFO/Bases.xml"); // Remote from DDBASE/INFO | |
28 | + foreach ($basesDom->getElementsByTagName("dataCenter") as $center) { | |
29 | + $id = $center->getAttribute("xml:id"); | |
30 | + if (is_dir(DATAPATH."/RemoteData/$id")) { | |
31 | + foreach (glob(DATAPATH."/RemoteData/$id/*") as $file) { | |
32 | + if (basename($file) == "base.xml") continue; | |
33 | + $ds = basename($file,".nc"); | |
34 | + if ($client->isRemoteViAdded($id, strtolower($ds))) continue; // VI exists; do nothing | |
35 | + | |
36 | + // vi was deleted in DDBASE; delete everything | |
37 | + unlink($file); | |
38 | + $paramId = strtolower($id)."_".strtolower($ds); | |
39 | + foreach (glob(DATAPATH."/RemoteData/PARAMS/$paramId*.xml") as $xml) unlink($xml); | |
40 | + foreach (glob(DATAPATH."/LocalData/ParamDef/$paramId*.xml") as $xml) unlink($xml); | |
41 | + } | |
42 | + } | |
43 | + } | |
44 | + } | |
45 | +?> | ... | ... |
update_amda/makeRemote
... | ... | @@ -53,11 +53,15 @@ |
53 | 53 | |
54 | 54 | # copy "DDBASE" Remote Params descriptions |
55 | 55 | if [ -d "$RemoteData/PARAMS" ]; then |
56 | + # remove PARAMS if no such VI in the database | |
57 | + php $AMDA_IHM/php/RemoteDataCenter/cleanRemoteParams.php | |
58 | + | |
56 | 59 | for param_def in $RemoteData/PARAMS/*.xml |
57 | 60 | do |
58 | 61 | xml=`basename $param_def` |
59 | 62 | if [ ! -f "$PARAMS_LOCALDB_DIR/$xml" ]; then |
60 | - cp $param_def $PARAMS_LOCALDB_DIR/ | |
63 | + #cp $param_def $PARAMS_LOCALDB_DIR/ | |
64 | + ln -s $param_def $PARAMS_LOCALDB_DIR/$xml | |
61 | 65 | fi |
62 | 66 | done |
63 | 67 | fi | ... | ... |