Commit b3ed6bd46e7f3b5ecbca6a43f8aef823e16c3d61

Authored by Benjamin Renard
1 parent f17b62ee
Exists in SpeasyGet

Optimize remote tree update

Showing 1 changed file with 8 additions and 5 deletions   Show diff stats
php/classes/UserMgr.php
@@ -307,7 +307,10 @@ class UserMgr @@ -307,7 +307,10 @@ class UserMgr
307 307
308 if ($init_res['success']) { // USERWSDIR.'RemoteParams.xml' exists 308 if ($init_res['success']) { // USERWSDIR.'RemoteParams.xml' exists
309 // check/change access rights 309 // check/change access rights
310 - $basesWS = $this->paramMgr->xmlDom->getElementsByTagName('dataCenter'); // RemoteParams.xml 310 +
  311 + $xpath = new DOMXpath($this->paramMgr->xmlDom);
  312 +
  313 + $basesWS = $xpath->query('//dataCenter'); // RemoteParams.xml
311 $delete = new UserDeleteObsolete(); 314 $delete = new UserDeleteObsolete();
312 315
313 $basesWsId = array(); 316 $basesWsId = array();
@@ -379,10 +382,10 @@ class UserMgr @@ -379,10 +382,10 @@ class UserMgr
379 } 382 }
380 383
381 if ($baseId !== "FMI_GUMICS") { 384 if ($baseId !== "FMI_GUMICS") {
382 - // Update Info on External Data Sets in RemoteTree.xml  
383 - $dataSets = $base->getElementsByTagName("dataset");  
384 - if ($dataSets->length > 0) {  
385 - foreach ($dataSets as $dataSet) { 385 + // Update Info on External Data Sets in RemoteTree.xml
  386 + $dataSets = $xpath->query('.//dataset', $base);
  387 + if ($dataSets->length > 0) {
  388 + foreach ($dataSets as $dataSet) {
386 $dataSetID = $dataSet->getAttribute("xml:id"); 389 $dataSetID = $dataSet->getAttribute("xml:id");
387 $origDataSet = $this->baseExtXml->getElementById($dataSetID); 390 $origDataSet = $this->baseExtXml->getElementById($dataSetID);
388 if ($origDataSet != null) { 391 if ($origDataSet != null) {