Commit 4dcb7e14 authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

tg status function fixedO

Merge branch 'hotfix/TG-status'
parents 8cb2adbf d44deb62
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://expath.org/ns/pkg" name="http://textgrid.de/ns/SADE" abbrev="SADE" version="2.2" spec="1.0">
<package xmlns="http://expath.org/ns/pkg" name="http://textgrid.de/ns/SADE" abbrev="SADE" version="2.2.1" spec="1.0">
<title>Scalable Architecture for Digital Editions powered by TextGrid</title>
<dependency package="http://exist-db.org/apps/markdown"/>
<dependency package="http://exist-db.org/apps/monex"/>
......
......@@ -427,13 +427,16 @@ let $col := "/db/sade-projects/textgrid"
let $res := "tgstatus.xml"
let $url := "https://dariah-de.github.io/status/textgrid/repstatus.html"
let $lastMod := xmldb:last-modified($col, $res)
let $doc := doc( $col || "/" || $res )
let $path := $col || "/" || $res
let $doc := doc( $path )
let $active := not( exists( $doc//ok ) )
let $needlookup := ( not(doc-available( $path )) or $lastMod < (current-dateTime() - xs:dayTimeDuration("PT12H")) )
let $getStatus :=
if( not( $active ) and $lastMod < (current-dateTime() - xs:dayTimeDuration("PT12H")) )
if( $needlookup )
then
let $status := httpclient:get(xs:anyURI($url), false(), ())//xhtml:div[contains(@class, 'repstatus')][not( contains(@class, 'ok') )]
let $status := if( exists( $status ) ) then $status else <ok/>
let $console := console:log( $status )
return
xmldb:store($col, $res, $status)
else if($active and $lastMod < (current-dateTime() - xs:dayTimeDuration("PT2H")))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment