diff --git a/generic_data/migration/Deleted.xml b/generic_data/migration/Deleted.xml new file mode 100644 index 0000000..707b8b8 --- /dev/null +++ b/generic_data/migration/Deleted.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/generic_data/migration/Functions.xml b/generic_data/migration/Functions.xml new file mode 100644 index 0000000..90596a7 --- /dev/null +++ b/generic_data/migration/Functions.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/generic_data/migration/Modified.xml b/generic_data/migration/Modified.xml new file mode 100644 index 0000000..4efb7d2 --- /dev/null +++ b/generic_data/migration/Modified.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/generic_data/migration/NotReady.xml b/generic_data/migration/NotReady.xml new file mode 100644 index 0000000..e42396b --- /dev/null +++ b/generic_data/migration/NotReady.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/generic_data/migration/SpectraModifs.xml b/generic_data/migration/SpectraModifs.xml new file mode 100644 index 0000000..19c41b0 --- /dev/null +++ b/generic_data/migration/SpectraModifs.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/generic_data/migration/Template.xml b/generic_data/migration/Template.xml new file mode 100644 index 0000000..a1caf27 --- /dev/null +++ b/generic_data/migration/Template.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/php/RemoteDataCenter/Bases.xml b/php/RemoteDataCenter/Bases.xml index 5124ec9..43fce67 100644 --- a/php/RemoteDataCenter/Bases.xml +++ b/php/RemoteDataCenter/Bases.xml @@ -1,10 +1,9 @@ - - - + + diff --git a/php/classes/UserDeleteObsolete.php b/php/classes/UserDeleteObsolete.php index 17d2bf5..21d5971 100644 --- a/php/classes/UserDeleteObsolete.php +++ b/php/classes/UserDeleteObsolete.php @@ -5,181 +5,170 @@ * */ - class UserDeleteObsolete { +class UserDeleteObsolete { - private $dataset, $vi, $Mgr; - private $ws_deleted; + private $dataset, $vi, $Mgr; + private $ws_deleted; - function __construct() { - - $this->ws_deleted = array(); - } - - public function setVI($vi) { - $this->vi = $vi; - $this->dataset = strtolower($vi); - } - - - public function deleteDerived() { - - $msg = 'WS (Derived) Params:
'; - // derived parameters - $this->Mgr = new DerivedParamMgr('derivedParam'); - // get params - $wsParams = $this->Mgr->contentDom->getElementsByTagName('param'); + function __construct() { + $this->ws_deleted = array(); + } + + public function setVI($vi) { + $this->vi = $vi; + $this->dataset = strtolower($vi); + } + + public function deleteDerived() { + $msg = 'WS (Derived) Params:
'; + // derived parameters + $this->Mgr = new DerivedParamMgr('derivedParam'); + // get params + $wsParams = $this->Mgr->contentDom->getElementsByTagName('param'); + + if ($wsParams->length == 0) { + return array('success' => true, 'msg' => 'No parameters'); + } + + foreach ($wsParams as $param) { + $id = $param->getAttribute('xml:id'); + $name = $param->getAttribute('name'); + $expression = $param->getAttribute('buildchain'); + + if (strpos(strtolower($expression), $this->dataset)) { + $msg .= 'deleted name:'.$name.'; expression: '.$expression.'
'; + $obj = new stdClass(); + $obj->leaf = true; + $obj->id = $id; + $this->Mgr->deleteObject($obj); + // error_log( 'For INFO : DELETED '.$expression,1,email); + $this->ws_deleted[] = $name; + } + } + + $msg .= ' ok
'; + return array('success' => true, 'msg' => $msg); + } - if ($wsParams->length == 0) { - return array('success' => true, 'msg' => 'No parameters'); - } - - foreach ($wsParams as $param) { - $id = $param->getAttribute('xml:id'); - $name = $param->getAttribute('name'); - $expression = $param->getAttribute('buildchain'); - - if (strpos(strtolower($expression), $this->dataset)) { - $msg .= 'deleted name:'.$name.'; expression: '.$expression.'
'; - $obj = new stdClass(); - $obj->leaf = true; - $obj->id = $id; - $this->Mgr->deleteObject($obj); - // error_log( 'For INFO : DELETED '.$expression,1,email); - $this->ws_deleted[] = $name; - } - } - $msg .= ' ok
'; - return array('success' => true, 'msg' => $msg); - } - - - - public function deleteConditions() { - - $msg = 'Conditions:
'; - // conditons - $this->Mgr = new RequestMgr('condition'); - - $conditions = $this->Mgr->contentDom->getElementsByTagName('condition'); - - if ($conditions->length == 0) { - return array('success' => true, 'msg' => 'No conditions'); - } - - foreach ($conditions as $item) { - $id = $item->getAttribute('xml:id'); - $name = $item->getAttribute('name'); - - $expression = strtolower($this->Mgr->getObject($id)->expression); - - if (strpos($expression, $this->dataset)) { - $obj = new stdClass(); - $obj->leaf = true; - $obj->id = $id; - $this->Mgr->deleteObject($obj); - $msg .= 'deleted name:'.$obj->name.'; expression:'.$expression.'
'; - - } - } - - $msg .= ' ok
'; - - return array('success' => true, 'msg' => $msg); - } - - public function deleteRequests() { - - $msg = 'Requests:
'; - // requests - $this->Mgr = new RequestMgr('request'); - $requests = $this->Mgr->contentDom->getElementsByTagName('request'); - - if (count($requests) == 0) { - return array('success' => true, 'msg' => 'No requests'); - } - - foreach ($requests as $item) { - - $id = $item->getAttribute('xml:id'); - $name = $item->getAttribute('name'); - - $objplot = $this->Mgr->getObject($id); - $obj = new stdClass(); - $obj->leaf = true; - $obj->id = $id; + public function deleteConditions() { + + $msg = 'Conditions:
'; + // conditons + $this->Mgr = new RequestMgr('condition'); + + $conditions = $this->Mgr->contentDom->getElementsByTagName('condition'); + + if ($conditions->length == 0) { + return array('success' => true, 'msg' => 'No conditions'); + } + + foreach ($conditions as $item) { + $id = $item->getAttribute('xml:id'); + $name = $item->getAttribute('name'); + + $expression = strtolower($this->Mgr->getObject($id)->expression); + + if (strpos($expression, $this->dataset)) { + $obj = new stdClass(); + $obj->leaf = true; + $obj->id = $id; + $this->Mgr->deleteObject($obj); + $msg .= 'deleted name:'.$obj->name.'; expression:'.$expression.'
'; + } + } + + $msg .= ' ok
'; + + return array('success' => true, 'msg' => $msg); + } + + public function deleteRequests() { + + $msg = 'Requests:
'; + // requests + $this->Mgr = new RequestMgr('request'); + $requests = $this->Mgr->contentDom->getElementsByTagName('request'); + + if (count($requests) == 0) { + return array('success' => true, 'msg' => 'No requests'); + } + + foreach ($requests as $item) { + + $id = $item->getAttribute('xml:id'); + $name = $item->getAttribute('name'); + + $objplot = $this->Mgr->getObject($id); + $obj = new stdClass(); + $obj->leaf = true; + $obj->id = $id; - foreach ($objplot->children as $panel) { - foreach ($panel->children as $param) { - - $parID = strtolower($param->name); - - if ($this->ws_deleted && substr($parId,0,3) == "ws_") { - if (array_search($this->ws_deleted, $parId)) { - - $this->Mgr->deleteObject($obj); - $msg .= 'request deleted '.$name.'
'; - continue 3; - } - } - - if (strpos($parID, $this->dataset)) { - $this->Mgr->deleteObject($obj); - $msg .= 'request deleted '.$name.'
'; - continue 3; - } - } - } - } - $msg .= ' ok
'; - - return array('success' => true, 'msg' => $msg); - } - - public function deleteAliases() { - - $msg = 'Aliases:
'; - $this->Mgr = new AliasMgr(); - $aliases = $this->Mgr->contentDom->getElementsByTagName('alias'); - - foreach ($aliases as $alias) { - $id = $alias->getAttribute('xml:id'); - $name = $alias->getAttribute('name'); - if (strpos(strtolower($id), $this->dataset)) { - $obj = new stdClass(); - $obj->leaf = true; - $obj->id = $id; - $this->Mgr->deleteObject($obj); - $msg .= 'alias deleted '.$name.'
'; - } - } - return array('success' => true, 'msg' => $msg); - } - - - public function deleteInTree() { - - $msg = 'Dataset in RemoteParams:
'; - - $this->Mgr = new ParamMgr(); - $xp = new domxpath($this->Mgr->xmlDom); - - $nodeToDelete = $xp->query("//dataset[@name='".$this->vi."']"); - if ($nodeToDelete->length > 0) { - $instrNode = $nodeToDelete->item(0)->parentNode; - $instrNode->removeChild($nodeToDelete->item(0)); - if (!$instrNode->hasChildNodes()) { - $missionNode = $instrNode->parentNode; - $missionNode->removeChild($instrNode); - if (!$missionNode->hasChildNodes()) { - $datacenterNode = $missionNode->parentNode; - $datacenterNode->removeChild($missionNode); - } - } - - $this->Mgr->xmlDom->save($this->Mgr->xmlName); - $msg .= 'dataset deleted '.$this->vi.'
'; - } - return array('success' => true, 'msg' => $msg); - } + foreach ($objplot->children as $panel) { + foreach ($panel->children as $param) { + $parID = strtolower($param->name); + if ($this->ws_deleted && substr($parId,0,3) == "ws_") { + if (array_search($this->ws_deleted, $parId)) { + $this->Mgr->deleteObject($obj); + $msg .= 'request deleted '.$name.'
'; + continue 3; + } + } + + if (strpos($parID, $this->dataset)) { + $this->Mgr->deleteObject($obj); + $msg .= 'request deleted '.$name.'
'; + continue 3; + } + } + } + } + $msg .= ' ok
'; + + return array('success' => true, 'msg' => $msg); + } + + public function deleteAliases() { + $msg = 'Aliases:
'; + $this->Mgr = new AliasMgr(); + $aliases = $this->Mgr->contentDom->getElementsByTagName('alias'); + + foreach ($aliases as $alias) { + $id = $alias->getAttribute('xml:id'); + $name = $alias->getAttribute('name'); + if (strpos(strtolower($id), $this->dataset)) { + $obj = new stdClass(); + $obj->leaf = true; + $obj->id = $id; + $this->Mgr->deleteObject($obj); + $msg .= 'alias deleted '.$name.'
'; + } + } + return array('success' => true, 'msg' => $msg); + } + + public function deleteInTree() { + $msg = 'Dataset in RemoteParams:
'; + + $this->Mgr = new ParamMgr(); + $xp = new domxpath($this->Mgr->xmlDom); + + $nodeToDelete = $xp->query("//dataset[@name='".$this->vi."']"); + if ($nodeToDelete->length > 0) { + $instrNode = $nodeToDelete->item(0)->parentNode; + $instrNode->removeChild($nodeToDelete->item(0)); + if (!$instrNode->hasChildNodes()) { + $missionNode = $instrNode->parentNode; + $missionNode->removeChild($instrNode); + if (!$missionNode->hasChildNodes()) { + $datacenterNode = $missionNode->parentNode; + $datacenterNode->removeChild($missionNode); + } + } + + $this->Mgr->xmlDom->save($this->Mgr->xmlName); + $msg .= 'dataset deleted '.$this->vi.'
'; + } + return array('success' => true, 'msg' => $msg); + } } ?> \ No newline at end of file diff --git a/php/classes/UserWsTransfer.php b/php/classes/UserWsTransfer.php index d31d53a..1b2c352 100644 --- a/php/classes/UserWsTransfer.php +++ b/php/classes/UserWsTransfer.php @@ -13,9 +13,9 @@ class UserWsTransfer { { define('OLDUSERPATH', 'http://cdpp1.irap.omp.eu/AMDA-NG/data/'); // define('OLDUSERPATH', 'http://amda-dev.irap.omp.eu/~budnik/AMDA-NG4/trunk/data/'); - define('NEWUSERPATH', '/home/budnik/AMDA/AMDA_IHM/data/'); + define('NEWUSERPATH', USERPATH); define('TRANSFERUSER', $user); - define('CONVERSIONDIR', '/home/budnik/AMDA/AMDA_Migration/conversion/'); + define('CONVERSIONDIR', DATAPATH."migration/"); $this->oldWs = new DomDocument("1.0"); $this->newWs = new DomDocument("1.0"); -- libgit2 0.21.2