Not logged in. · Lost password · Register
Forum: General Help and Support Features and Functionality RSS
Please provide the page move / rename functionality out of the box
Page:  1  2  3  4  next 
Avatar
borekb #1
Member since Jan 2010 · 35 posts
Group memberships: Members
Show profile · Link to this post
Subject: Please provide the page move / rename functionality out of the box
We love using DokuWiki for our internal documentation but we are not quite happy with the support for page or namespace renames. I know there is a pagemove plugin and we use it but it doesn't seem to be developed any more, there are known issues with it and quite honestly, the move/rename task seems to be so complex in details that it would be an outstanding achievement if any third-party developer could get it all right.

So I'm kindly asking whether the development team wouldn't consider adding the page move functionality directly to the core. I don't know about others but when we want to keep our documentation manageable, we need to move pages or whole namespaces quite frequently and we are hitting a lot of subtle issues with the third-party plugin.

There has been a feature request for it quite a long time ago: http://bugs.splitbrain.org/index.php?do=details&task_i… but it has been closed (possibly for valid reason back then). Rather than requesting reopening it or adding comments there, I'd rather start a discussion about whether the general public and the core developers think this should be provided in the basic distribution. We in our company certainly believe so.

Thanks,
Borek
Avatar
spaze #2
Member since Feb 2010 · 1 post
Group memberships: Members
Show profile · Link to this post
I just don't have much to add, but it would be really nice and helpful to have such feature in the core. You know, projects get renamed, classes refactored, typos fixed... and reflecting such changes in the wiki system looks like a natural thing to do.

So, yeah, +1.

Thanks,
spaze
chi #3
Member since Jun 2006 · 1851 posts · Location: Munich Germany
Group memberships: Members, Super Mods, Wiki Managers
Show profile · Link to this post
I started working on a new pagemove plugin a couple of weeks ago (unfortunately I just discoverd that I deleted my work *grml*) - however I'd like to share some information on why this functionality is so non-trivial to implement (maybe this helps someone who attempts to work on this as well).

The old pagemove plugin relied completely on regular expressions (to fix links etc.), which was not optimal because DokuWiki itself provides information about link references from pages to other pages and vice versa already in perfectly parsed form as instruction list for the XHTML renderer. So, there's no need to do the same work twice. Accessing that data is easy using built-in functions of DokuWiki.

I try to outline a possible model for a pagemove plugin using the functionality provided by DokuWiki (it's a bit technical though):

1. gather all needed information
    * backlinks (ft_backlinks()) - all pages that need to be fixed afterwards
    * image references (are images linked on the page to be moved - and should they be moved as well)
2. move the page (no brainer - dead easy)
3. parse the instructions list of every affected page and fix the references to the moved page (relative links, absolute links, CameCase links whatever), generate a new revision of each affected page

Point 3. is the real issue. Relying on DokuWikis parser/instruction mechanism would be the safest thing to do - because this way you could assure that everything will be 100% correct (if implemented correctly). However:

  * reading and modifying the cached instructions is easy
  * but then we would need to translate the instructions back to normal wiki text to safe the modified page - one could say you'd need a reverse renderer
  * I tried to create one, then I noticed that the renderer instructions for plugins needed to be translated back to wiki text as well - so, all plugin instructions from the original instructions would have to be converted to simple cdata instructions so they won't get lost in the process
  * then the page(s) would get saved etc.
  * old pages would have to be removed (probably it would be nice to have a way to check first if everything went well)

So, for a scenario were you only want to move one page the problem is that you never know how many pages reference the page you move, if it's a couple of hundred pages, the whole process could be quite expensive (think php timeouts etc.).

But for a scenario were you want to move a complete namespace the processing time/actions needed will just explode exponentially ;-).
Please add [SOLVED] to the initial thread subject if you feel your question has been answered.
If my answer doesn't make sense maybe your question didn't either - just visit http://facepalm.org.
Avatar
adrianlang (Moderator) #4
Member since Apr 2009 · 31 posts · Location: Berlin
Group memberships: Global Moderators, Members, Newsletter Team, Super Mods, Wiki Managers
Show profile · Link to this post
Hi chi, MediaWiki uses an indexer-like cronjob mechanism for page move cleanup … maybe we should do the same.
chi #5
Member since Jun 2006 · 1851 posts · Location: Munich Germany
Group memberships: Members, Super Mods, Wiki Managers
Show profile · Link to this post
Quote by adrianlang:
Hi chi, MediaWiki uses an indexer-like cronjob mechanism for page move cleanup … maybe we should do the same.

Sounds interesting can you elaborate (I dunno how mediawiki does it, will have to take a look at it)?
Please add [SOLVED] to the initial thread subject if you feel your question has been answered.
If my answer doesn't make sense maybe your question didn't either - just visit http://facepalm.org.
Avatar
adrianlang (Moderator) #6
Member since Apr 2009 · 31 posts · Location: Berlin
Group memberships: Global Moderators, Members, Newsletter Team, Super Mods, Wiki Managers
Show profile · Link to this post
I don’t know any technical details, but I can imagine your plugin to write a queue for linkfixes and handling them in the indexer (i. e. hooking into INDEXER_TASKS_RUN)
Avatar
borekb #7
Member since Jan 2010 · 35 posts
Group memberships: Members
Show profile · Link to this post
Thanks for your replies, in my eyes they confirm that the page move functionality is nontrivial and the more I'd like to see this in the core distribution.

Some technical comments / ideas:

• As outlined by chi, scaling is a problem (PHP timeouts etc.). However, I don't think the problem is exponential. In the worst case, you will need to iterate over all pages and search for broken links. In case of a page move, you will search for a single string change. In case of a namespace move, this is also true (you won't search for a move of a dozen of separate pages, just the namespace string). I'm not familiar with the internal APIs but even if you need to parse the files manually, it should have a computational complexity of O(N) which is good.
• If timeouts were going to be an issue (and they probably were), batch processing is an option as suggested by adrianlang. I can imagine a UI hints about the progress (like at the bottom of the moved page, there could be a subtle progress  bar indicating how much of the whole DokuWiki pages have been fixed yet etc.)

I've also tried to think about other approaches to link fixing. Here are 2 ideas:

• On disk, the link can be stored slightly differently than what sees in the textarea. Say that instead of [[namespace:page]], something like this is stored in the actual txt file: [[namespace:page(id=1234)]] Each page is given a unique ID and although DokuWiki would always make its best effort to hide this from the user, it would guarantee that 2 pages are always linked in a unique way, even when their paths change. This solution would create its own set of problems but it's an option that came to mind.
• There could be a page move log. Say that you rename a page from ns:pagename to ns:new_pagename, this log would contain a line like this: ns:pagename -> ns:new_pagename. If DokuWiki sees a broken page link, it could use this log to see if the link can't be restored from there. If it can, it would then fix the link automatically. (This could be used in connection with the batch processing, guaranteeing that links would work even on pages that haven't been batch-processed yet.)

Besides link fixing, what else needs to be done upon page move? Updating search index? Anything else? I'm not sure how that would affect complexity but working out a system for automatic links update would be worth alone I think.

Thoughts?

BTW, out of interest, is there a list of core DokuWiki developers? Are they reading this?
Avatar
andi (Administrator) #8
Member since May 2006 · 2446 posts · Location: Berlin Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by borekb:
BTW, out of interest, is there a list of core DokuWiki developers? Are they reading this?

As stated in the forum rules, this whole discussion would be much better placed on the mailinglist.
Read this if you don't get any useful answers.
Lies dies wenn du keine hilfreichen Antworten bekommst.
Avatar
borekb #9
Member since Jan 2010 · 35 posts
Group memberships: Members
Show profile · Link to this post
Quote by andi:
As stated in the forum rules, this whole discussion would be much better placed on the mailinglist.

Sorry for a newbie question but can I post to the mailing list and track the conversation without subscribing to the whole list (my email account is bombarded from many different places already)? Sorry if this forum was the wrong place to start this conversation.

Any thoughts on the actual topic, or should I post it to the mailing list first?
Avatar
adrianlang (Moderator) #10
Member since Apr 2009 · 31 posts · Location: Berlin
Group memberships: Global Moderators, Members, Newsletter Team, Super Mods, Wiki Managers
Show profile · Link to this post
Just wanted to point out that MediaWiki does not fix links after page move. The old page gets replaced by a redirect to the new one, but links stay the same.
chi #11
Member since Jun 2006 · 1851 posts · Location: Munich Germany
Group memberships: Members, Super Mods, Wiki Managers
Show profile · Link to this post
Quote by adrianlang:
Just wanted to point out that MediaWiki does not fix links after page move. The old page gets replaced by a redirect to the new one, but links stay the same.

Hmmm, I see. A combination of both might make sense. Creating a pagemove queue + redirects. Maybe then PARSER_CACHE_USE could be the correct place to hook in with an action plugin (check if the viewed page is listed in the pagemove queue and fix references to pages for which only redirects exist).
Please add [SOLVED] to the initial thread subject if you feel your question has been answered.
If my answer doesn't make sense maybe your question didn't either - just visit http://facepalm.org.
Avatar
borekb #12
Member since Jan 2010 · 35 posts
Group memberships: Members
Show profile · Link to this post
Hi chi, you mentioned a new plugin of your own that was going to handle renames well. Is it available anywhere or is it still work in progress?

Thanks,
Borek
chi #13
Member since Jun 2006 · 1851 posts · Location: Munich Germany
Group memberships: Members, Super Mods, Wiki Managers
Show profile · Link to this post
Quote by borekb:
Hi chi, you mentioned a new plugin of your own that was going to handle renames well. Is it available anywhere or is it still work in progress?

It's still a work in progress. However, I'm moving atm and won't have much time working on it. This will change in approximately 3 weeks from now ;-).
Please add [SOLVED] to the initial thread subject if you feel your question has been answered.
If my answer doesn't make sense maybe your question didn't either - just visit http://facepalm.org.
Avatar
borekb #14
Member since Jan 2010 · 35 posts
Group memberships: Members
Show profile · Link to this post
Understood, you're working on chi-move first, page-move second :) Is it possible to post to the development mailing list without flooding my inbox from yet another source? I'd like to ping the guys there.
chi #15
Member since Jun 2006 · 1851 posts · Location: Munich Germany
Group memberships: Members, Super Mods, Wiki Managers
Show profile · Link to this post
Quote by borekb:
Understood, you're working on chi-move first, page-move second :) Is it possible to post to the development mailing list without flooding my inbox from yet another source? I'd like to ping the guys there.

Nope, you have to be subscribed. Also I'd say it's bit too early for that ;-).
Please add [SOLVED] to the initial thread subject if you feel your question has been answered.
If my answer doesn't make sense maybe your question didn't either - just visit http://facepalm.org.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Page:  1  2  3  4  next 
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20120620-dev, © 2003-2011 by Yves Goergen
Current time: 2014-04-18, 15:49:22 (UTC +02:00)