====== Pagemove Plugin ====== ---- plugin ---- description: Move and rename pages and namespaces whilst maintaining the links author : previously Gary Owen, Arno Puschmann email : pagemove@gmail.com type : admin lastupdate : 2011-08-11 compatible : Anteater, Rincewind, Angua, Adora Belle, Weatherwax, Binky, Ponder Stibbons depends : conflicts : similar : editx, move tags : redirect, maintenance, namespace, move, rename, pagemove downloadurl: https://github.com/desolat/DokuWiki-Pagemove-Plugin/zipball/master bugtracker : https://github.com/desolat/DokuWiki-Pagemove-Plugin/issues sourcerepo : https://github.com/desolat/DokuWiki-Pagemove-Plugin ---- This plugin is reaching the end of its useful life. It was first created more than 6 years ago before DokuWiki had plugins and metafiles so had to do all the searching for backlinks, forwardlinks and media itself. Based on current reports, it is not able to achieve its main design criterion of maintaining page link integrity. Thankfully, others within the DokuWiki community have taken on the task creating a new PageMove plugin to suit the current architecture. When complete, this plugin will be retired. ====New successor: Move Plugin==== 2013-11-24 -- The plugin [[Move]] by [[user>Michitux]] implements a more robust move mechanism. It is recommended over this plugin, because it solves some of the typical shortcomings of this plugin. (old idea page: [[devel:ideas:PageMoveNG]]) ====== Warning! In the following use cases Pagemove is faulty ====== * If a namespace is moved in the same namespace to a subnamespace e.g. ''%%[[oldspace:]]%%'' moved to ''%%[[oldspace:subspace]]%%'' the cache is not updated so the links are "red" and on edit the page, the link are updated but not on the original page. * If a namespace is moved, links like ''%%[[..:example]]%%'' in the moved namespace will be updated incorrectly, the same with medialinks. * If a page is moved out of the root namespace, all links of the page which links to a page in the root, will be updated incorrectly. * Media won't be moved. * Drafts won't be moved. * When the underlying folder for a new sub-namespace can't be created, the history, meta and index files are lost. At least I lost them, the actual article was still there and was moved correct after fixing the folder issue. ====== Ideas for future development ====== To avoid broken links from external page, create an entry in the ''.changes'' meta file to indicate page has been moved (and where it has moved). So a message can be displayed when someone comes to that page that has moved. also a specific header could be sent to automatically redirect user or bot... Maybe also add a copy feature... ===== Feature request ===== ==== A Suggestion ==== The new links created after a page has been moved are all small letters and include the _ instead of spaces, so a link which I would like to look like this: [[X Wiki Page]]- that is to say, [[X Wiki Page]]- actually turns out looking like this: [[x_wiki_page]]. This also affects apostrophes, turning them into _ or eliminating them completely. Is there any way of keeping the link format with capital letters and spaces? ==== Move Media Files ==== If you can move whole namespace, you should also want to move all media files in folder too. And this is a most need improvement of DokuWiki as it is a file base wiki. Since there are no version control in media files, it worse if someone delete or upload a same name of old media files. ==== Move ACL ==== When moving a page, links are changed which is great, but ACL remains constant. Would it be possible to automatically move ACL from "oldpage" to "newpage" ? --- //[[hugoborrell@gmail.com|NewMorning]] 2009/02/06 05:02// Moving ACLs is never a good idea. No OS or app would do that, because it would make it much more complex and less intuitive. No one would allow that. imagine this: a company site with several departments like sales and marketing. Marketing manages their own branch of the wiki and so do sales. Now someone decides to move a page or namespace from sales to marketing. If ACLs would move with the pages marketing would not be able to manage those "moved" pages, since the ACL denies them. No good. There may be more examples why moving ACLs with data isn't a good idea. >It would be great than to be able to enable/disable such a feature :-P --- //[[xjouvin@yahoo.fr|inferneo]] 2009/10/03 15:49// ---- ==== Archive Old Topics ==== Maybe a general purpose function to select certain topics for archiving into a special namespace used for out-of-date topics and other data, that you still would like to have present for reference (but not in the original primary namespace). --- //2009/02/10 14:32// > Yes, exactly what I came here to look for, a way of 'archiving' old pages that I want to keep but want to move out of the 'primary' namespace. ==== Move the discussion ==== Would it be possible to check if there is a discussion linked with the page (which is to be moved) and if there is one then to move the discussion with the page? I mean a discussion from [[plugin:discussion:discussion|discussion plugin]]. ====== Comments and bug reports ====== ===== Return of the Broken Links ===== I had a similar problem to "Broken Links" below with pagemove_20100218.zip, but I can give more specifics. I have a namespace "analysis:", a page "analysis:main", and many other analysis:* pages as well, with links. I decide I want to make "main" sort higher in the index, so I had the bright idea of renaming it analysis:_start. I just RTFM, so I now understand this is a bad page name, but pagemove happily went and did it, only now all links to analysis: were changed to point to "analysis:start". I recovered from backups. And then I found that using the valid pagename 0start also tickles the exact same bug. So I have no idea, except it seems that in some cases the test for whether a link is to the page being moved is highly broken. Rob MacLachlan 2010/05/14 Update on 2010/05/14. I rolled back to the old version of pagemove that I had used successfully in the past (2007-02-12), and it does not have this problem. So there is definitely some code regression going on. For the moment I guess I'll just stick with that version. ===== broken links ===== After renaming a page in root namespace, hundreds of (other) links in root and all other namespaces were also changed to the new page name. Except on the pages with links to the renamed page – they were updated correctly. I could undo these faulty changes with the [[plugin:revert|revert plugin]] in admin panel by choosing a part of the wrong link as spam keyword. ===== Some Bug Fixes ===== I've coded some long time ago two patches: * [[http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/dokuwiki-plugin-pagemove/dokuwiki-plugin-pagemove-selflinks.patch | fixes update of selflinks in page]] * [[http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/dokuwiki-plugin-pagemove/dokuwiki-plugin-pagemove-redirectlinks.patch | handle of "~~REDIRECT>" links]] They have been updated recently for latest patch 0.10.0 (20100218) --- //[[glen@pld-linux.org|Elan Ruusamäe]] 2010-03-23 11:05 EET// =====Lots of warnings when moving a page===== I get a whole stream of warning messages when I move a page with this plugin:- Warning: in_array() [function.in-array]: Wrong datatype for second argument in /var/www/boatWiki/lib/plugins/pagemove/admin.php on line 897 [repeated 10 times] Warning: Cannot modify header information - headers already sent by (output started at /var/www/boatWiki/lib/plugins/pagemove/admin.php:897) in /var/www/boatWiki/inc/common.php on line 1543 It does seem to perform the move OK though. > I have 'fixed' it by changing line 897 of admin.php to the following:- > > if (((cleanID($mid) == $sid) and !isset($data[$cid])) or is_null($data[$cid]) or !in_array(noNS($mid), $data[$cid])) { > >> I have the same issue with the latest version. ===== Works, but edits a whole bunch of other pages needlessly ==== :!: :!: :!: :!: :!: :!: :!: :!: :) :) I tried out Version0.10.0-pagemove_20100218 and encountered the "Wrong datatype for second argument" bug mentioned above. I then implemented the suggested 'fix' by editing line 897 of admin.php. This removes the errors, but also edits a great deal of other pages that **do not ** link to the page you are moving. This is evident by looking at the wiki's "Recent Changes". The only thing that stopped this runaway process was the operation running out of memory. It doesn't appear to do anything to the edited pages, which at least was a relief. But as it stands I would not recommend anyone use this version of the plugin, or this 'fix'. ===== Bookmarklet ===== Add this as a bookmark to your browser and then click it to access the PageMove functionality -- easier than going via the Admin screen javascript:void(location.href=location.href+'&do=admin&page=pagemove') --RNM 18.06.09 ===== Broken links when using useslash parameter ===== There seems to be a bug when the wiki is configured with ''useslash'' parameter (slash separate namespaces). Every link, even external ones, seems to be rewritten, and become broken. For example: http://externalsite.com/randompage becomes http://mywiki.com/http/externalsite.com/randompage --- // djib 2009/02/15 // >Thanks for your report, djib. I took it into consideration before installing and testing this plugin. In my install (//2009-02-14//) **it works fine with ''useslash''**. I tried moving page back and forth between namespaces and any corruption as you reported did not appear - I use configs ''deaccent 0'' and ''userewrite 1''. I just found two issues: - backlinks to moved page links ex. ''[ [Foo Bar]]'' became rewritten to ''[ [foo_bar]]'', which I appreciate - ''?do=backlinks'' displayed nothing when the page was moved __between namespaces__, until I displayed the page containing this backlink - which may be caused by DokuWiki indexing concept. When the page was moved __within a namespace__, backlinks list was correct immediately. ---// LukeWestwalker 2009/06/19// Strange, I seem to be using the same configuration. $conf['youarehere'] = 1; $conf['deaccent'] = '0'; $conf['useheading'] = '1'; $conf['useacl'] = 1; $conf['sneaky_index'] = 1; $conf['iexssprotect'] = 0; $conf['userewrite'] = '1'; $conf['useslash'] = 1; --- // djib 2010/02/25 // ===== Links not changed when "useheading" is enabled ===== If "use first heading for pagename" is enabled, links to the "old" page are not updated correctly. --- // 2009/02/16 // I couldn't get it to work even if I disabled "use first heading for pagename". It just didn't update the links. I made sure I purged my test page with "''?purge=true''". --- // 2009/02/16 // jschwartz at the-infoshop dot com ===== viewcounter compatibility===== Hi There! I added a few lines to the ''admin.php'' to enable compatibility with the ''viewcounter'' plugin. at line ''204'' I added: //////// // Added by njckberry@hotmail.com to handle viewcounter info //Move the view counts $this->_pm_moveviews('datadir', '/^'.$opts['name'].'\.\w*?$/', $opts); //////// and then at line ''534'' I added: //////// // Added by njckberry@hotmail.com to handle viewcounter info function _pm_moveviews($dir, $regex, $opts){ global $conf; $views_path = $conf['datadir'].'/_views/'; if ($opts['ns'] == '') { $old_views_file = $opts['name']; } else { $old_views_file = $opts['ns'].':'.$opts['name']; } if ($opts['newns'] == '') { $new_views_file = $opts['newname']; } else { $new_views_file = $opts['newns'].':'.$opts['newname']; } io_rename($views_path.$old_views_file,$views_path.$new_views_file); } //////// I thought other users may find use with this. ---// Nick Berry 2009/06/24// ===== Links not changed when using default pagenames ===== When moving a start page of a namespace, links that point to this page using the default file syntax (link ends with a colon) are not updated. For example: When moving the page ''somewhere:old_namespace:start'' to ''somewhere:new_namespace:start'', * links like ''%%[[somewhere:old_namespace:]]%%'' are **not** updated, * links like ''%%[[somewhere:old_namespace:start]]%%'' **are** updated. ---// Martin Bast 2009/07/08// ===== Tip for Searching for Renamed Page ===== I'm not seeing how this plugin doesn't do exactly what it says it does. I was afraid to use it after all the negative feedback, but it works really well for me, so far, with "Adora Belle", keeps page history, and all links but self links. \\ The only tip I would give is to open the moved page after moving it, since the cache is cleared, and I haven't been able to search for a moved page until after I opened it. - KK 12/26/13