pagemove plugin by Gary Owen
Move and rename pages whilst maintaining the links
Last updated on 2007-07-22. Provides Admin.
No compatibility info given!
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…
Use the events system to play nice with other plugins that use events.
Actually the only problem was that deleting the old page was not signaling IO_WIKIPAGE_WRITE. Change line 218 ofadmin.phpfrom:
if (@file_exists(wikiFN($opts['new_id']))) @unlink(wikiFN($ID));
to:
if (@file_exists(wikiFN($opts['new_id']))) saveWikiText($ID, '', 'Deleted by PageMove plugin');
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?
This would be great to get the same functionality for a whole namespace : if I have many page in a namespace “oldname” and want them in “newname”, I can move all pages manually with your very good plugin, but it can be a lot of work, or I can change the folder name with ftp access but I will loose all internal links. Could you implement your plugin to become some sort of a “namespacemove” plugin ? — NewMorning 2009/02/06 05:02
I'd be interested in this update too if this is possible to add this function.
me too Horst JENS 2009/08/17
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.
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” ? — 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— inferneo 2009/10/03 15:49
—-
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
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
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 withuseslash. I tried moving page back and forth between namespaces and any corruption as you reported did not appear - I use configsdeaccent 0anduserewrite 1. I just found two issues:
[ [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
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
Make sure you are logged in with Admin or Management privileges works for me (2006-02-14) when logged in as admin only. To overcome it I used this solution from the forum. — LukeWestwalker 2009/06/21
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
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,
[[somewhere:old_namespace:]] are not updated,[[somewhere:old_namespace:start]] are updated.— Martin Bast 2009/07/08
If you use any root relative namespace links, e.g. [[:space1:space2:space3]], then these links will not be updated when the referred namespace is moved via the plugin.
For example:
When moving the page oldspace:space2 to newspace:space2,
[[:oldspace:space2]] are not updated,[[oldspace:space2]] are updated.— Bobby Metz 2009/07/14
If you use any page header references, e.g. [[#header1]], then these links will be broken when the referred namespace is moved via the plugin.
For example, let's say page oldspace:space2 contains the following syntax:
===== Scripts ==== [[#script1.sh|My #1 Script]] [[#script2.sh|My #2 Script]] [[#script3.sh|My #3 Script]] ==== script1.sh ==== ==== script2.sh ==== ==== script3.sh ====
When moving oldspace:space2 to newspace:space2
[[#script1.sh|My #1 Script]] are changed to [[oldspace:space2#script1.sh|My #1 Script]]Thus breaking the link since the page has been moved.
— Bobby Metz 2009/07/14