-
Notifications
You must be signed in to change notification settings - Fork 1
/
sync.xql
24 lines (19 loc) · 891 Bytes
/
sync.xql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
xquery version "3.0";
declare namespace expath="http://expath.org/ns/pkg";
declare namespace repo="http://exist-db.org/xquery/repo";
import module namespace config="http://www.digital-archiv.at/ns/kongress/config" at "modules/config.xqm";
(:let $target-base-default := "C:\Users\skurz\Documents\git\":)
let $target-base-default := "C:\Users\pandorfer\Documents\Redmine\konde"
let $app-name := doc(concat($config:app-root, "/repo.xml"))//repo:target/text()
return
<response>{
try{
let $source := request:get-parameter("source",$config:app-root)
let $target-base := request:get-parameter("target-base",$target-base-default)
let $synced-files := file:sync($source, $target-base||"/"||$app-name, ())
return $synced-files
} catch * {
let $log := util:log("ERROR", ($err:code, $err:description) )
return <ERROR>{($err:code, $err:description)}</ERROR>
}
}</response>