Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Commit

Permalink
#163 now using xdmp:save() to get files instead of going through the …
Browse files Browse the repository at this point in the history
…evaler.
  • Loading branch information
dmcassel committed Jan 13, 2014
1 parent e0080e3 commit 7c08aa0
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions deploy/lib/server_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -786,16 +786,21 @@ def save_files_to_fs(target_db, target_dir)
if (uri.end_with?("/"))
# create the directory so that it will exist when we try to save files
Dir.mkdir("#{target_dir}" + uri)
else
r = execute_query %Q{
fn:doc("#{uri}")
},
{ :db_name => target_db }

body = JSON.parse(r.body)[0]['result']
File.open("#{target_dir}#{uri}", 'w') { |file| file.write(body) }
end
end
r = execute_query %Q{
for $uri in cts:uris()
return
xdmp:save(
"#{target_dir}" ||$uri,
fn:doc($uri),
<options xmlns="xdmp:save">
<indent-untyped>yes</indent-untyped>
</options>
)
},
{ :db_name => target_db }

end

end
Expand Down

0 comments on commit 7c08aa0

Please sign in to comment.