getLastUpdate.php
1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* @file getLastUpdate.php
* @brief Returns last modif of *_times.nc for a given DataSet
* @version $Id: $
*/
if (!isset($_GET['id'])) exit('INPUT ERROR');
require_once './DDserverWeb_ini.php';
error_reporting(E_ERROR | E_WARNING | E_PARSE);
$replace = array("-" => "_");
$dataSet = strtr($_GET['id'], $replace);
$referXML = baseDir."/DDsys.xml";
$DDsys = new DOMDocument("1.0");
$DDsys->load($referXML);
$xp = new domxpath($DDsys);
$VI_NAME = $xp->query("//NAME[.='".$dataSet."']");
if ($VI_NAME->item(0)->nodeValue != NULL)
{
$VI = $VI_NAME->item(0)->parentNode;
$location = $VI->getElementsByTagName("LOCATION")->item(0)->nodeValue;
$times = $VI->getElementsByTagName("TIMES")->item(0)->nodeValue;
if (!file_exists($location.$times))
exit('NO TIMES FILE');
$cmd = 'date "+%Y-%m-%dT%H:%M:%SZ" -u -r '. $location.$times; // for NFS
$dateModif = exec($cmd);
exit($dateModif);
}
else {
exit('NO SUCH DATASET');
}
?>