]> git.pld-linux.org Git - packages/dokuwiki-plugin-pagemove.git/blob - dokuwiki-plugin-pagemove-selflinks.patch
- update to 20110811
[packages/dokuwiki-plugin-pagemove.git] / dokuwiki-plugin-pagemove-selflinks.patch
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;
11 +
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) {
27 +            $backlinks[$opts['new_id']] = $backlinks[$opts['id']];
28 +            unset($backlinks[$opts['id']]);
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          }
36  
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) {
42 +            $cache = new cache_instructions($opts['new_id'], wikiFN($opts['new_id']));
43 +            $cache->removeCache();
44 +        }
45      }
46  
47  
48 @@ -637,7 +637,7 @@
49       *
50       * @author  Gary Owen <gary@isection.co.uk>
51       */
52 -    function _pm_updatebacklinks($backlinkingId, $links, $opts, &$brackets) {
53 +    function _pm_updatebacklinks($backlinkingId, $links, $opts) {
54          global $ID;
55  
56          // Get namespace of document we are editing
57 @@ -730,8 +730,8 @@
58          // Make the changes
59          $this->_pm_updatelinks($text, $oid);
60  
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);
66      }
67  
This page took 0.071526 seconds and 3 git commands to generate.