diff --git a/helper.php b/helper.php index 56bd22d..92cd7e5 100644 --- a/helper.php +++ b/helper.php @@ -141,7 +141,8 @@ public function move_page(&$opts, $checkonly = false) { lock($ID); $text = rawWiki($ID); - $text = $this->rewrite_content($text, $ID, array($ID => $opts['new_id'])); + $text = $this->rewrite_content($text, $ID, array($ID => $opts['new_id'])); + $oldRev = getRevisions($ID, -1, 1, 1024); // from changelog // Move the Subscriptions & Indexes $this->movemeta($opts); @@ -156,6 +157,10 @@ public function move_page(&$opts, $checkonly = false) { else { $lang_key = 'pm_move_rename'; } + + // Wait a second when the page has just been rewritten + if ($oldRev == time()) sleep(1); + $summary = sprintf($this->getLang($lang_key), $ID, $opts['new_id']); saveWikiText($opts['new_id'], $text, $summary); @@ -269,6 +274,9 @@ public function execute_rewrites($id, $text = null) { $text = $this->rewrite_content($text, $id, $meta['moves']); $file = wikiFN($id, '', false); if(is_writable($file)) { + // Wait a seconf if page has just been saved + $oldRev = getRevisions($id, -1, 1, 1024); // from changelog + if ($oldRev == time()) sleep(1); saveWikiText($id, $text, $this->getLang('pm_linkchange')); unset($meta['moves']); p_set_metadata($id, array('plugin_pagemove' => $meta), false, true);