X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/135e5fc63a47d198e6ab6b0ebf30c87087d3f5d5..b3ff3c8c4bfd7523369b0e48e1054cc42965e674:/IkiWiki.pm diff --git a/IkiWiki.pm b/IkiWiki.pm index 40622a5be..dcb68bca6 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -38,6 +38,7 @@ sub defaultconfig () { #{{{ wikiname => "wiki", default_pageext => "mdwn", cgi => 0, + post_commit => 0, rcs => '', notify => 0, url => '', @@ -601,7 +602,7 @@ sub lockwiki () { #{{{ } open(WIKILOCK, ">$config{wikistatedir}/lockfile") || error ("cannot write to $config{wikistatedir}/lockfile: $!"); - if (! flock(WIKILOCK, 2 | 4)) { + if (! flock(WIKILOCK, 2 | 4)) { # LOCK_EX | LOCK_NB debug("wiki seems to be locked, waiting for lock"); my $wait=600; # arbitrary, but don't hang forever to # prevent process pileup @@ -617,6 +618,29 @@ sub unlockwiki () { #{{{ close WIKILOCK; } #}}} +sub commit_hook_enabled () { #{{{ + open(COMMITLOCK, "+>$config{wikistatedir}/commitlock") || + error ("cannot write to $config{wikistatedir}/commitlock: $!"); + if (! flock(COMMITLOCK, 1 | 4)) { # LOCK_SH | LOCK_NB to test + close COMMITLOCK; + return 0; + } + close COMMITLOCK; + return 1; +} #}}} + +sub disable_commit_hook () { #{{{ + open(COMMITLOCK, ">$config{wikistatedir}/commitlock") || + error ("cannot write to $config{wikistatedir}/commitlock: $!"); + if (! flock(COMMITLOCK, 2)) { # LOCK_EX + error("failed to get commit lock"); + } +} #}}} + +sub enable_commit_hook () { #{{{ + close COMMITLOCK; +} #}}} + sub loadindex () { #{{{ open (IN, "$config{wikistatedir}/index") || return; while () {