Skip to content

Commit

Permalink
Only rewrite pages that are not currently edited
Browse files Browse the repository at this point in the history
Pages that are currently edited will be rewritten after they were saved.
  • Loading branch information
michitux committed Dec 29, 2012
1 parent 4e15b85 commit 45ec917
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions action.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,19 @@ public function register($controller) {
* @param mixed $param Optional parameters (not used)
*/
function handle_read(Doku_Event $event, $param) {
global $ACT;
static $stack = array();
// handle only reads of the current revision
if ($event->data[3]) return;

$id = $event->data[2];
if ($event->data[1]) $id = $event->data[1].':'.$id;
if (isset($stack[$id])) return;

// Don't change the page when the user is currently changing the page content or the page is locked by another user
if ((isset($ACT) && (in_array($ACT, array('save', 'preview', 'recover', 'revert'))))
|| checklock($id) !== false) return;

$meta = p_get_metadata($id, 'plugin_pagemove', METADATA_DONT_RENDER);
if ($meta && isset($meta['moves'])) {
$stack[$id] = true;
Expand Down

0 comments on commit 45ec917

Please sign in to comment.