>>> Hint: a patch that disables locking when the locktime is set to 0 >>> would be welcome. >> >> Would it be enough simply to return from locktimer.init without >> initializing, if the timeout value == 0? > > It's a start, but the lock functions itself should also check the > value and return early when it is 0. There's no sense in creating lock > files that immediately expire. The patch below disables lock file creation and Javascript timer initialization when locktime is 0. As lock files aren't created when locktime is 0, checklock($id) and unlock($id) always return false in their first check, so there is no need to modify those functions. Javascript timer initialization was fully disabled because returning from locktimer.init if timeout value is 0 isn't enough. As far as I can understand, the timeout received in init isn't the locktime, but the seconds to wait before displaying the alert. It is related to the locktime, but it is not exactly the locktime. Due to this, it has to be checked if timeout is -60 instead of 0 (as the timeout is passed as "$conf['locktime'] - 60") So, in my humble opinion, it is cleaner to disable timer initialization than check for a timeout partially based on a hardcoded value in another file. Finally, note that my knowledge about Dokuwiki internals is scarce. I have made a quick test and it worked fine, but these changes may have side effects I haven't found. -------------------------------------------------------------------------------- diff --git a/inc/common.php b/inc/common.php index 85187f1..fe7678c 100644 --- a/inc/common.php +++ b/inc/common.php @@ -732,6 +732,12 @@ function checklock($id){ * @author Andreas Gohr <andi@xxxxxxxxxxxxxx> */ function lock($id){ + global $conf; + + if($conf['locktime'] == 0){ + return; + } + $lock = wikiLockFN($id); if($_SERVER['REMOTE_USER']){ io_saveFile($lock,$_SERVER['REMOTE_USER']); diff --git a/lib/exe/js.php b/lib/exe/js.php index 38fda17..c7e218a 100644 --- a/lib/exe/js.php +++ b/lib/exe/js.php @@ -112,7 +112,9 @@ function js_out(){ js_runonstart("initSizeCtl('size__ctl','wiki__text')"); js_runonstart("initToolbar('tool__bar','wiki__text',toolbar)"); js_runonstart("initChangeCheck('".js_escape($lang['notsavedyet'])."')"); - js_runonstart("locktimer.init(".($conf['locktime'] - 60).",'".js_escape($lang['willexpire'])."',".$conf['usedraft'].")"); + if($conf['locktime'] != 0){ + js_runonstart("locktimer.init(".($conf['locktime'] - 60).",'".js_escape($lang['willexpire'])."',".$conf['usedraft'].")"); + } js_runonstart('scrollToMarker()'); js_runonstart('focusMarker()'); -- DokuWiki mailing list - more info at http://www.dokuwiki.org/mailinglist