Skip to content

Commit

Permalink
Prevent creation of more than one revision/second
Browse files Browse the repository at this point in the history
  • Loading branch information
michitux committed Dec 30, 2012
1 parent 7363e4a commit 493bca2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 493bca2

Please sign in to comment.