]>
Commit | Line | Data |
---|---|---|
876cb737 ER |
1 | --- dokuwiki-plugin-pagemove-20110811/admin.php~ 2012-06-12 23:48:17.000000000 +0300 |
2 | +++ dokuwiki-plugin-pagemove-20110811/admin.php 2012-06-12 23:50:28.916910665 +0300 | |
3 | @@ -370,10 +370,10 @@ | |
4 | ||
5 | // Set things up to display the new page. | |
6 | io_saveFile($conf['cachedir'].'/purgefile', time()); | |
7 | - $ID = $opts['new_id']; | |
8 | - $ACT = 'show'; | |
9 | - $INFO = pageinfo(); | |
10 | - $this->show_form = false; | |
196e1755 | 11 | + |
876cb737 ER |
12 | + // redirect to page display |
13 | + Header("Location: ".wl($opts['new_id'])); | |
14 | + exit; | |
15 | } | |
16 | else { | |
17 | $this->errors[] = $this->lang['pm_fatal']; | |
18 | @@ -618,14 +618,28 @@ | |
19 | saveWikiText($ID, '', $this->lang['pm_delete'] ); | |
20 | } | |
21 | ||
22 | + // replace our old id with new one as we already renamed the page but | |
23 | + // there might be backlinks (links to self in this case). | |
24 | + $opts['id'] = cleanID($opts['ns'].':'.$opts['name']); | |
25 | + $selfmod = isset($backlinks[$opts['id']]); | |
26 | + if ($selfmod) { | |
4e6df534 ER |
27 | + $backlinks[$opts['new_id']] = $backlinks[$opts['id']]; |
28 | + unset($backlinks[$opts['id']]); | |
876cb737 ER |
29 | + } |
30 | + | |
31 | // Loop through backlinks | |
32 | foreach($backlinksById as $backlinkingId => $backlinks) { | |
33 | - $this->_pm_updatebacklinks($backlinkingId, $backlinks, $opts, $brackets); | |
34 | + $this->_pm_updatebacklinks($backlinkingId, $backlinks, $opts); | |
35 | } | |
4e6df534 | 36 | |
876cb737 ER |
37 | // Move the old revisions |
38 | $this->_pm_movemeta('olddir', '/^'.$opts['name'].'\.[0-9]{10}\.txt(\.gz)?$/', $opts); | |
39 | ||
40 | + // remove cache. again if we ourselves were modified (due backlinks) | |
41 | + if ($selfmod) { | |
4e6df534 ER |
42 | + $cache = new cache_instructions($opts['new_id'], wikiFN($opts['new_id'])); |
43 | + $cache->removeCache(); | |
876cb737 | 44 | + } |
4e6df534 | 45 | } |
876cb737 ER |
46 | |
47 | ||
48 | @@ -637,7 +637,7 @@ | |
4e6df534 ER |
49 | * |
50 | * @author Gary Owen <gary@isection.co.uk> | |
51 | */ | |
876cb737 ER |
52 | - function _pm_updatebacklinks($backlinkingId, $links, $opts, &$brackets) { |
53 | + function _pm_updatebacklinks($backlinkingId, $links, $opts) { | |
54 | global $ID; | |
4e6df534 | 55 | |
876cb737 ER |
56 | // Get namespace of document we are editing |
57 | @@ -730,8 +730,8 @@ | |
58 | // Make the changes | |
59 | $this->_pm_updatelinks($text, $oid); | |
4e6df534 | 60 | |
876cb737 ER |
61 | - // Save backlink and release lock |
62 | - saveWikiText($backlinkingId, $text, sprintf($this->lang['pm_linkchange'], $ID, $opts['new_id'])); | |
63 | + // Save backlink and release lock. call the edit minor to avoid mail flood on marge backlinks changes | |
64 | + saveWikiText($backlinkingId, $text, sprintf($this->lang['pm_linkchange'], $ID, $opts['new_id']), 1); | |
65 | unlock($backlinkingId); | |
4e6df534 ER |
66 | } |
67 |