Skip to content

Commit

Permalink
marklogic-community#109 implement "clean triggers"
Browse files Browse the repository at this point in the history
  • Loading branch information
dmcassel committed Mar 4, 2016
1 parent e28e9ff commit cc2e2ee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions deploy/lib/server_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1896,8 +1896,8 @@ def deploy_triggers
end

def clean_triggers
cpf_code = File.read ServerConfig.expand_path("#{@@path}/lib/xquery/triggers.xqy")
r = execute_query %Q{#{cpf_code} cpf:clean-triggers()}, :db_name => @properties["ml.triggers-db"]
triggers_code = File.read ServerConfig.expand_path("#{@@path}/lib/xquery/triggers.xqy")
r = execute_query %Q{#{triggers_code} triggers:clean-triggers()}, :db_name => @properties["ml.triggers-db"]
end

def xcc
Expand Down
7 changes: 7 additions & 0 deletions deploy/lib/xquery/triggers.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,10 @@ declare function triggers:resolve-permissions($perms as element(sec:permission)*
<sec:role-id>{xdmp:role($perm/sec:role-name)}</sec:role-id>
</sec:permission>
};

declare function triggers:clean-triggers()
{
for $trigger in /trgr:trigger
return
xdmp:document-delete(fn:base-uri($trigger))
};

0 comments on commit cc2e2ee

Please sign in to comment.