Skip to content

Commit

Permalink
marklogic-community#710 Cleaner mimetype updating
Browse files Browse the repository at this point in the history
  • Loading branch information
kford-oconnors committed Jan 19, 2017
1 parent 130334b commit 2bc747c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions deploy/lib/xquery/setup.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -1033,16 +1033,14 @@ declare function setup:create-mimetypes($import-config as element(configuration)
let $extension as xs:string := $mimetype-config/mt:extension
let $format as xs:string := $mimetype-config/mt:format
let $admin-config := admin:get-configuration()
let $match := admin:mimetypes-get($admin-config)[mt:name = $name]
return
if (fn:deep-equal(admin:mimetypes-get($admin-config)[mt:name = $name],
admin:mimetype($name, $extension, $format))) then
if (fn:deep-equal($match, admin:mimetype($name, $extension, $format))) then
fn:concat("Mimetype ", $name, " already exists, not recreated..")
else
let $admin-config :=
admin:mimetypes-add(
if (admin:mimetypes-get($admin-config)[mt:name = $name])
then admin:mimetypes-delete($admin-config,
admin:mimetypes-get($admin-config)[mt:name = $name])
if ($match) then admin:mimetypes-delete($admin-config, $match)
else $admin-config,
admin:mimetype($name, $extension, $format))
return
Expand Down

0 comments on commit 2bc747c

Please sign in to comment.