Update metadata headers

This commit is contained in:
netravnen 2020-02-07 19:42:07 +00:00
parent 2ddda3a4b6
commit 5c95d6eaff
2 changed files with 60 additions and 56 deletions

View file

@ -6,35 +6,9 @@ require ("lib/define.php");
require ("lib/functions.php"); require ("lib/functions.php");
// Define array() we are going to populate with data. // Define array() we are going to populate with data.
$roas[] = array();
$roas["slurmVersion"] = 1; $roas["slurmVersion"] = 1;
$roas["metadata"]["human"]["commit"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%H'");
$roas["metadata"]["human"]["merge"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%p'");
$roas["metadata"]["human"]["author"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%an'");
$roas["metadata"]["human"]["date"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%aD'");
$roas["metadata"]["human"]["subject"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%s'");
$roas["metadata"]["human"]["url"] = "https://git.dn42.us/dn42/registry/commit/";
$roas["metadata"]["human"]["url"] .= $roas["metadata"]["human"]["commit"];
/*
* Function: Add metadata
*
* Add info
* 1. generation time (now),
* 2. expire time (now + 3 days),
* 3. number of routes
*
* Numbers must be unquoted integers, and timeformat must
* be epoch format. TImezone is set to Etc/UTC.
*/
$roas["metadata"]["counts"] = (int)count($roas["roas"]);
$roas["metadata"]["generated"] = (int)(date_format(new \DateTime("now",new \DateTimeZone("UTC")),"U"));
$roas["metadata"]["valid"] = (int)(date_format(date_modify(new \DateTime("now",new \DateTimeZone("UTC")),"+3day"),"U"));
//$roas["metadata"]["signature"] = "";
//$roas["metadata"]["signatureData"] = "";
// Additional human read-able DateTime format, example: 2013-04-12T15:52:01+00:00
$roas["metadata"]["human"]["generated"] = date_format(new \DateTime("now",new \DateTimeZone("UTC")),"c");
$roas["metadata"]["human"]["valid"] = date_format(date_modify(new \DateTime("now",new \DateTimeZone("UTC")),"+3day"),"c");
$roas["validationOutputFilters"]["prefixFilters"] = array(); $roas["validationOutputFilters"]["prefixFilters"] = array();
$roas["validationOutputFilters"]["bgpsecFilters"] = array(); $roas["validationOutputFilters"]["bgpsecFilters"] = array();
@ -246,6 +220,34 @@ foreach ($raw_array as $sub_array)
} }
} }
$roas["metadata"]["human"]["merge"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%p'");
$roas["metadata"]["human"]["author"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%an'");
$roas["metadata"]["human"]["date"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%aD'");
$roas["metadata"]["human"]["subject"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%s'");
$roas["metadata"]["human"]["url"] = "https://git.dn42.us/dn42/registry/commit/";
$roas["metadata"]["human"]["url"] .= $roas["metadata"]["human"]["commit"];
/*
* Function: Add metadata
*
* Add info
* 1. generation time (now),
* 2. expire time (now + 3 days),
* 3. number of routes
*
* Numbers must be unquoted integers, and timeformat must
* be epoch format. TImezone is set to Etc/UTC.
*/
$roas["metadata"]["counts"] = (int)count($roas["roas"]);
$roas["metadata"]["generated"] = (int)(date_format(new \DateTime("now",new \DateTimeZone("UTC")),"U"));
$roas["metadata"]["valid"] = (int)(date_format(date_modify(new \DateTime("now",new \DateTimeZone("UTC")),"+3day"),"U"));
//$roas["metadata"]["signature"] = "";
//$roas["metadata"]["signatureData"] = "";
// Additional human read-able DateTime format, example: 2013-04-12T15:52:01+00:00
$roas["metadata"]["human"]["generated"] = date_format(new \DateTime("now",new \DateTimeZone("UTC")),"c");
$roas["metadata"]["human"]["valid"] = date_format(date_modify(new \DateTime("now",new \DateTimeZone("UTC")),"+3day"),"c");
writeRoutinatorExceptionFile($roas); writeRoutinatorExceptionFile($roas);
?> ?>

View file

@ -6,34 +6,7 @@ require ("lib/define.php");
require ("lib/functions.php"); require ("lib/functions.php");
// Define array() we are going to populate with data. // Define array() we are going to populate with data.
$roas["metadata"]["human"]["commit"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%H'"); $roas[] = array();
$roas["metadata"]["human"]["merge"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%p'");
$roas["metadata"]["human"]["author"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%an'");
$roas["metadata"]["human"]["date"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%aD'");
$roas["metadata"]["human"]["subject"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%s'");
$roas["metadata"]["human"]["url"] = "https://git.dn42.us/dn42/registry/commit/";
$roas["metadata"]["human"]["url"] .= $roas["metadata"]["human"]["commit"];
/*
* Function: Add metadata
*
* Add info
* 1. generation time (now),
* 2. expire time (now + 3 days),
* 3. number of routes
*
* Numbers must be unquoted integers, and timeformat must
* be epoch format. TImezone is set to Etc/UTC.
*/
$roas["metadata"]["counts"] = (int)count($roas["roas"]);
$roas["metadata"]["generated"] = (int)(date_format(new \DateTime("now",new \DateTimeZone("UTC")),"U"));
$roas["metadata"]["valid"] = (int)(date_format(date_modify(new \DateTime("now",new \DateTimeZone("UTC")),"+3day"),"U"));
//$roas["metadata"]["signature"] = "";
//$roas["metadata"]["signatureData"] = "";
// Additional human read-able DateTime format, example: 2013-04-12T15:52:01+00:00
$roas["metadata"]["human"]["generated"] = date_format(new \DateTime("now",new \DateTimeZone("UTC")),"c");
$roas["metadata"]["human"]["valid"] = date_format(date_modify(new \DateTime("now",new \DateTimeZone("UTC")),"+3day"),"c");
/* /*
* *
@ -241,6 +214,35 @@ foreach ($raw_array as $sub_array)
} }
} }
$roas["metadata"]["human"]["commit"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%H'");
$roas["metadata"]["human"]["merge"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%p'");
$roas["metadata"]["human"]["author"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%an'");
$roas["metadata"]["human"]["date"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%aD'");
$roas["metadata"]["human"]["subject"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --date=iso8601 --merges --pretty='format:%s'");
$roas["metadata"]["human"]["url"] = "https://git.dn42.us/dn42/registry/commit/";
$roas["metadata"]["human"]["url"] .= $roas["metadata"]["human"]["commit"];
/*
* Function: Add metadata
*
* Add info
* 1. generation time (now),
* 2. expire time (now + 3 days),
* 3. number of routes
*
* Numbers must be unquoted integers, and timeformat must
* be epoch format. TImezone is set to Etc/UTC.
*/
$roas["metadata"]["counts"] = (int)count($roas["roas"]);
$roas["metadata"]["generated"] = (int)(date_format(new \DateTime("now",new \DateTimeZone("UTC")),"U"));
$roas["metadata"]["valid"] = (int)(date_format(date_modify(new \DateTime("now",new \DateTimeZone("UTC")),"+3day"),"U"));
//$roas["metadata"]["signature"] = "";
//$roas["metadata"]["signatureData"] = "";
// Additional human read-able DateTime format, example: 2013-04-12T15:52:01+00:00
$roas["metadata"]["human"]["generated"] = date_format(new \DateTime("now",new \DateTimeZone("UTC")),"c");
$roas["metadata"]["human"]["valid"] = date_format(date_modify(new \DateTime("now",new \DateTimeZone("UTC")),"+3day"),"c");
writeExportJSON($roas); writeExportJSON($roas);
writeBirdConfig($roas); writeBirdConfig($roas);