-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpost-install.xql
31 lines (26 loc) · 1.04 KB
/
post-install.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
25
26
27
28
29
30
31
xquery version "3.0";
(:declare variable $target external;:)
declare function local:mkcol-recursive($collection, $components) {
if (exists($components)) then
let $newColl := concat($collection, "/", $components[1])
return (
xmldb:create-collection($collection, $components[1]),
local:mkcol-recursive($newColl, subsequence($components, 2))
)
else
()
};
(: Helper function to recursively create a collection hierarchy. :)
declare function local:mkcol($collection, $path) {
local:mkcol-recursive($collection, tokenize($path, "/"))
};
let $target := "/db/apps/sade-textgrid-default-project"
return
(
local:mkcol("/system/config/db/", "/sade-projects/textgrid/data/"),
xmldb:copy($target || "/textgrid/", "/system/config/db/sade-projects/textgrid/data/", "collection.xconf"),
local:mkcol("", "/sade-projects/"),
xmldb:copy($target || "/textgrid", "/sade-projects/"),
xmldb:copy($target || "/tutorial", "/sade-projects/"),
xmldb:reindex("/db/sade-projects/textgrid/data/")
)