Commit 9d2f7fc909d50f0252534be9c3cf7355c79b42ee

Authored by Elena.Budnik
1 parent 10e15e17

correction in utils

Showing 1 changed file with 12 additions and 19 deletions   Show diff stats
src/DDSERVICES/REST/utils/generateGranulesIndex.php
... ... @@ -5,30 +5,21 @@
5 5 * @version $Id: $
6 6 */
7 7  
8   - define('BASE','/data/DDBASE/');
9   -
10   - require_once BASE.'DDService/DDserverWeb_ini.php';
11   -
12   - if (!getenv('DDBASE'))
13   - define('DDBASE', BASE.'DATA');
14   - else
15   - define('DDBASE', getenv('DDBASE'));
  8 + require_once '../DDserverWeb_ini.php';
16 9  
17 10 $ddSys = new DOMDocument('1.0');
18   - $ddSys->load(DDBASE.'/DDsys.xml');
  11 + $ddSys->load(baseDir.'/DDsys.xml');
19 12 $dataSets = $ddSys->getElementsByTagName('VI');
20 13  
21 14 foreach ($dataSets as $VI)
22 15 {
23   - $vi_ = $VI->getElementsByTagName("NAME")->item(0);
24   - // only local bases
25   - if ($vi_->getAttribute("base") != "LOCAL") continue;
26   - $id = $vi_->nodeValue;
27   -
  16 + $id = $VI->getElementsByTagName('NAME')->item(0)->nodeValue;
28 17 $main = array();
29 18 $index = array();
30   - $location = $VI->getElementsByTagName("LOCATION")->item(0)->nodeValue;
31   -
  19 + $location = $VI->getElementsByTagName("LOCATION")->item(0)->nodeValue;
  20 +
  21 + if (file_exists($location."RestrictedAccess")) continue; // PrivateAccess
  22 +
32 23 foreach (glob($location."*.nc.gz") as $granule)
33 24 {
34 25 $cmd = 'stat --printf="%s" '. $granule;
... ... @@ -36,7 +27,9 @@
36 27 $index[$file] = exec($cmd);
37 28 }
38 29  
39   - $main[substr($location,strlen(DDBASE))] = $index;
40   - file_put_contents(BASE."GRANULES/$id.json", json_encode($main));
41   - }
  30 + $main[substr($location,strlen(baseDir))] = $index;
  31 + file_put_contents("../GRANULES/$id.json", json_encode($main));
  32 +
  33 + }
  34 +
42 35 ?>
... ...