- composer updates

- embargo date optional in oai datacite and dc - cmpare unix timestamps
This commit is contained in:
Arno Kaimbacher 2020-06-08 16:04:32 +02:00
parent c0e381ba3a
commit a52d029ac8
4 changed files with 50 additions and 33 deletions

View File

@ -68,8 +68,8 @@ class RequestController extends Controller
{ {
//$this->middleware('auth'); //$this->middleware('auth');
// Initialize member variables. // Initialize member variables.
$this->xml = new \DomDocument; $this->xml = new \DomDocument();
$this->proc = new \XSLTProcessor; $this->proc = new \XSLTProcessor();
$this->configuration = new OaiModelConfiguration(); $this->configuration = new OaiModelConfiguration();
} }
@ -115,6 +115,10 @@ class RequestController extends Controller
// Set response time // Set response time
$this->proc->setParameter('', 'responseDate', date("Y-m-d\TH:i:s\Z")); $this->proc->setParameter('', 'responseDate', date("Y-m-d\TH:i:s\Z"));
// set timestamp
$date = new \DateTime();
$unixTimestamp = $date->getTimestamp();
$this->proc->setParameter('', 'unixTimestamp', $unixTimestamp);
// set OAI base url // set OAI base url
$uri = explode('?', $_SERVER['REQUEST_URI'], 2); $uri = explode('?', $_SERVER['REQUEST_URI'], 2);

68
composer.lock generated
View File

@ -745,16 +745,16 @@
}, },
{ {
"name": "laravel/framework", "name": "laravel/framework",
"version": "v6.18.16", "version": "v6.18.18",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/framework.git", "url": "https://github.com/laravel/framework.git",
"reference": "73f18a6bc58fb91aa83925161db25aa3674b73e9" "reference": "9e5226ecc28f960cba1bd38b6d1d82a52e072dc3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/73f18a6bc58fb91aa83925161db25aa3674b73e9", "url": "https://api.github.com/repos/laravel/framework/zipball/9e5226ecc28f960cba1bd38b6d1d82a52e072dc3",
"reference": "73f18a6bc58fb91aa83925161db25aa3674b73e9", "reference": "9e5226ecc28f960cba1bd38b6d1d82a52e072dc3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -765,7 +765,7 @@
"ext-mbstring": "*", "ext-mbstring": "*",
"ext-openssl": "*", "ext-openssl": "*",
"league/commonmark": "^1.3", "league/commonmark": "^1.3",
"league/flysystem": "^1.0.8", "league/flysystem": "^1.0.34",
"monolog/monolog": "^1.12|^2.0", "monolog/monolog": "^1.12|^2.0",
"nesbot/carbon": "^2.0", "nesbot/carbon": "^2.0",
"opis/closure": "^3.1", "opis/closure": "^3.1",
@ -888,7 +888,7 @@
"framework", "framework",
"laravel" "laravel"
], ],
"time": "2020-05-26T14:31:44+00:00" "time": "2020-06-02T22:32:07+00:00"
}, },
{ {
"name": "laravel/tinker", "name": "laravel/tinker",
@ -1450,16 +1450,16 @@
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",
"version": "v4.4.0", "version": "v4.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nikic/PHP-Parser.git", "url": "https://github.com/nikic/PHP-Parser.git",
"reference": "bd43ec7152eaaab3bd8c6d0aa95ceeb1df8ee120" "reference": "53c2753d756f5adb586dca79c2ec0e2654dd9463"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bd43ec7152eaaab3bd8c6d0aa95ceeb1df8ee120", "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/53c2753d756f5adb586dca79c2ec0e2654dd9463",
"reference": "bd43ec7152eaaab3bd8c6d0aa95ceeb1df8ee120", "reference": "53c2753d756f5adb586dca79c2ec0e2654dd9463",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1498,20 +1498,20 @@
"parser", "parser",
"php" "php"
], ],
"time": "2020-04-10T16:34:50+00:00" "time": "2020-06-03T07:24:19+00:00"
}, },
{ {
"name": "opis/closure", "name": "opis/closure",
"version": "3.5.3", "version": "3.5.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/opis/closure.git", "url": "https://github.com/opis/closure.git",
"reference": "cac47092144043d5d676e2e7cf8d0d2f83fc89ca" "reference": "1d0deef692f66dae5d70663caee2867d0971306b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/opis/closure/zipball/cac47092144043d5d676e2e7cf8d0d2f83fc89ca", "url": "https://api.github.com/repos/opis/closure/zipball/1d0deef692f66dae5d70663caee2867d0971306b",
"reference": "cac47092144043d5d676e2e7cf8d0d2f83fc89ca", "reference": "1d0deef692f66dae5d70663caee2867d0971306b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1559,7 +1559,7 @@
"serialization", "serialization",
"serialize" "serialize"
], ],
"time": "2020-05-25T09:32:45+00:00" "time": "2020-06-07T11:41:29+00:00"
}, },
{ {
"name": "paragonie/random_compat", "name": "paragonie/random_compat",
@ -1608,16 +1608,16 @@
}, },
{ {
"name": "phpoption/phpoption", "name": "phpoption/phpoption",
"version": "1.7.3", "version": "1.7.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/schmittjoh/php-option.git", "url": "https://github.com/schmittjoh/php-option.git",
"reference": "4acfd6a4b33a509d8c88f50e5222f734b6aeebae" "reference": "b2ada2ad5d8a32b89088b8adc31ecd2e3a13baf3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/schmittjoh/php-option/zipball/4acfd6a4b33a509d8c88f50e5222f734b6aeebae", "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/b2ada2ad5d8a32b89088b8adc31ecd2e3a13baf3",
"reference": "4acfd6a4b33a509d8c88f50e5222f734b6aeebae", "reference": "b2ada2ad5d8a32b89088b8adc31ecd2e3a13baf3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1659,7 +1659,17 @@
"php", "php",
"type" "type"
], ],
"time": "2020-03-21T18:07:53+00:00" "funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption",
"type": "tidelift"
}
],
"time": "2020-06-07T10:40:07+00:00"
}, },
{ {
"name": "psr/container", "name": "psr/container",
@ -3879,27 +3889,27 @@
}, },
{ {
"name": "vlucas/phpdotenv", "name": "vlucas/phpdotenv",
"version": "v3.6.5", "version": "v3.6.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/vlucas/phpdotenv.git", "url": "https://github.com/vlucas/phpdotenv.git",
"reference": "8b64814b356b96a90d2bc942b152c80d8888b8d4" "reference": "4669484ccbc38fe7c4e0c50456778f2010566aad"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/8b64814b356b96a90d2bc942b152c80d8888b8d4", "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/4669484ccbc38fe7c4e0c50456778f2010566aad",
"reference": "8b64814b356b96a90d2bc942b152c80d8888b8d4", "reference": "4669484ccbc38fe7c4e0c50456778f2010566aad",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^5.4 || ^7.0 || ^8.0", "php": "^5.4 || ^7.0 || ^8.0",
"phpoption/phpoption": "^1.5", "phpoption/phpoption": "^1.5.2",
"symfony/polyfill-ctype": "^1.9" "symfony/polyfill-ctype": "^1.16"
}, },
"require-dev": { "require-dev": {
"ext-filter": "*", "ext-filter": "*",
"ext-pcre": "*", "ext-pcre": "*",
"phpunit/phpunit": "^4.8.35 || ^5.0 || ^6.0 || ^7.0" "phpunit/phpunit": "^4.8.35 || ^5.7.27 || ^6.5.6 || ^7.0"
}, },
"suggest": { "suggest": {
"ext-filter": "Required to use the boolean validator.", "ext-filter": "Required to use the boolean validator.",
@ -3948,7 +3958,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2020-05-23T09:42:03+00:00" "time": "2020-06-02T14:08:54+00:00"
}, },
{ {
"name": "yajra/laravel-datatables-oracle", "name": "yajra/laravel-datatables-oracle",

View File

@ -17,6 +17,7 @@
<xsl:output method="xml" indent="yes" encoding="utf-8" /> <xsl:output method="xml" indent="yes" encoding="utf-8" />
<xsl:param name="responseDate" /> <xsl:param name="responseDate" />
<xsl:param name="unixTimestamp" />
<xsl:param name="email" /> <xsl:param name="email" />
<xsl:param name="earliestDatestamp" /> <xsl:param name="earliestDatestamp" />
<xsl:param name="setPubType" /> <xsl:param name="setPubType" />
@ -379,7 +380,7 @@
<xsl:apply-templates select="Coverage" mode="oai_dc" /> <xsl:apply-templates select="Coverage" mode="oai_dc" />
<!-- dc:rights --> <!-- dc:rights -->
<xsl:apply-templates select="Licence" mode="oai_dc" /> <xsl:apply-templates select="Licence" mode="oai_dc" />
<xsl:if test="EmbargoDate"> <xsl:if test="EmbargoDate and ($unixTimestamp &lt; EmbargoDate/@UnixTimestamp)">
<dc:rights>embargo</dc:rights> <dc:rights>embargo</dc:rights>
</xsl:if> </xsl:if>
</oai_dc:dc> </oai_dc:dc>
@ -524,12 +525,14 @@
</xsl:template> </xsl:template>
<xsl:template match="EmbargoDate" mode="oai_dc"> <xsl:template match="EmbargoDate" mode="oai_dc">
<xsl:if test="$unixTimestamp &lt; ./@UnixTimestamp" >
<dc:date> <dc:date>
<xsl:text>info:eu-repo/date/embargoEnd/</xsl:text> <xsl:text>info:eu-repo/date/embargoEnd/</xsl:text>
<xsl:value-of select="./@Year"/> <xsl:value-of select="./@Year"/>
- <xsl:value-of select="format-number(./@Month,'00')"/> - <xsl:value-of select="format-number(./@Month,'00')"/>
- <xsl:value-of select="format-number(./@Day,'00')"/> - <xsl:value-of select="format-number(./@Day,'00')"/>
</dc:date> </dc:date>
</xsl:if>
</xsl:template> </xsl:template>

View File

@ -124,7 +124,7 @@
<xsl:template name="RdrDate2" mode="oai_datacite" <xsl:template name="RdrDate2" mode="oai_datacite"
xmlns="http://datacite.org/schema/kernel-4"> xmlns="http://datacite.org/schema/kernel-4">
<xsl:if test="EmbargoDate"> <xsl:if test="EmbargoDate and ($unixTimestamp &lt; EmbargoDate/@UnixTimestamp)">
<date> <date>
<xsl:attribute name="dateType">Available</xsl:attribute> <xsl:attribute name="dateType">Available</xsl:attribute>
<xsl:variable name="embargoDate" select="concat( <xsl:variable name="embargoDate" select="concat(