DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:move

This is an old revision of the document!


Move Plugin

Compatible with DokuWiki

Hrun, Detritus, "Elenor Of Tsort"

plugin Move pages, media files and namespaces while maintaining the link structure

Last updated on
2015-10-18
Provides
Helper, Admin, Action
Repository
Source
Conflicts with
autolink2, snippets, cherokee-based, sxs

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Similar to editx, openas, pagemove

Tagged with maintenance, move, namespace, rename

This plugin allows to move pages and namespaces including media files and automatically adjusts all links and media references that point to these pages. Unlike the old pagemove plugin this plugin uses the DokuWiki parser which allows it to correctly identify all links and nothing else.

Parts of this plugin, like some of the translated strings, some parts of the structure of the code and parts of the user interface have been taken from the old pagemove plugin by Gary Owen, Arno Puschmann and Christoph Jähnigen.

Installation and Precautions

This plugin moves files inside your DokuWiki data directory and can automatically change a lot of pages. Even though the plugin has been successfully tested it is always possible that something doesn't work as expected in your case and your wiki might be left in an inconsistent state. This plugin is also still rather new and might behave incorrectly in certain cases.

Please make a backup before using this plugin, especially if you plan to make larger changes!

Warning: This plugin does not update ACL rules. For example if you had an ACL rule that read-protected a certain wiki page this rule won't have any effect anymore after moving that page.

Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.

:!: When updating an existing installation of this plugin it might be necessary to de-install the old plugin version first and re-install the new version thereafter. Severe problems (e.g. inconsistent application menues with the old plugin screen combined with several unlogical [admin] buttons) have been observed after upating the plugin. For instance when originally installed on Dokuwiki release 2014-09-29 “Hrun” and updated onto Dokuwiki release 2015-08-10 “Detritus”.

Usage

Except for the single page rename, the plugin requires manager privileges to use it.

Move current page or namespace

Screenshot

This is the main part of the plugin. To use it navigate to the page (or page in namespace) you want to change, then open the Admin menu and select the move plugin from the list of additional plugins.

In the box switch between the current page or namespace and give a new location. Clicking start will preview your changes and you can start the move operation. To move a namespace with some pages in subspaces but none directly under the namespace, use the tree based move method.

Tree based move

To plan more complicated restructuring of your wiki, the move plugin comes with a tree-based move manager. It is linked from the page described above.

Screenshot

The Move Manager allows you to plan all moves and renames to be executed by drag'n'drop operations. Simply move pages, media files and namespaces to their desired locations until the tree represents the new layout you want to have.

One thing you cannot do with this method is to create a new namespace. If you need to do that, use the other interface to move one page or namespace to the new namespace. After that, the new namespace will appear in this interface so you can move everything else to it.

  • FIXME Please add some comments about how to activate and use the Move Manager
  • FIXME the screenshot (move-manager.png) is not working

Simple Page Rename

Screenshot

This feature is available to users and groups that have been configured through the allowrename option in the config manager. It is automatically available on all templates that implement the TEMPLATE_PAGETOOLS_DISPLAY event.
Actually it is defined in source code and only available for the templates dokuwiki, arago and bootstrap3 (action/rename.php line 45).

Users can simply rename (or move) the page they are currently on.

 Screenshot

Support for other plugins

The move plugin allows plugins to move their own data and to adapt their syntax when a page or media file is moved. Currently the following plugins support this:

Plugins not explicitly stating their compatibility are most probably not adjusted.

For plugin authors

The move plugin emits the following events:

  • PLUGIN_MOVE_PAGE_RENAME
    • The before action is executed before a single page is moved, if the default action is prevented the move won't be executed (but it won't trigger an error/abort the move, FIXME this should be changed)
    • The after action is executed after the page has been moved. Plugins can use this in order to move their own data that is associated to the page $ID and it can add additional pages whose syntax needs to be adjusted because of this move.
    • data is an array with the following keys:
      • opts ⇒ array – compatibility to old plugins, shouldn't be used
      • affected_pages ⇒ array – page ids that are (possibly) affected by this move, initially populated from the relation_references metadata index. can be adjusted
      • src_id ⇒ string – the original ID of the page
      • dst_id ⇒ string – the new ID of the page
  • PLUGIN_MOVE_MEDIA_RENAME
    • Same as before, but for media files
  • PLUGIN_MOVE_HANDLERS_REGISTER
    • This event is called when the page content shall be rewritten. This can either happen
      • if the page itself is moved, then you will get the new id and the page id will also be part of the moves or
      • if other moves affect the page and the page is viewed for the first time.
    • Note that before moving the page itself it will be rewritten so it will never be that the page itself is moved while the links are adjusted.
    • data:
      • id – the id of the page that shall be modified
      • moves – the page moves that might affect the page
      • media_moves – the media moves that might affect the page
      • handlers – the array of handlers, see below for more information
    • Plugin handlers can be registered in the $handlers array, the key is the plugin name as it is given to the handler. The handler needs to be a valid callback, it will get the following parameters:
      • $match, $state, $pos, $pluginname, $handler. The first three parameters are equivalent to the parameters of the handle()-function of syntax plugins, $pluginname is just the plugin name again so handler functions that handle multiple plugins/plugin parts can distinguish for which the match is. The last parameter is the handler object. It has the following properties and functions that can be used:
        • id, ns: id and namespace of the old page
        • new_id, new_ns: new id and namespace (can be identical to id and ns)
        • moves: array of page moves, the same as moves in the event
        • media_moves: array of media moves, the sames as media_moves in the event
        • adaptRelativeId($id): adapts the relative $id according to the moves

Have a look at the include plugin for a relatively simple case of a plugin that handles page moves. These events might be subject to change though I'll try to keep them as compatible as possible. If you add your plugin to the list of supported plugins I'll have a look if I could break it before changing anything that might affect plugins.

Feel free to open a bug report if your plugin needs additional support from the move plugin.

Issues and feature requests

Please report bugs and feature requests in the issue tracker.

plugin/move.1468861812.txt.gz · Last modified: 2016-07-18 19:10 by 213.129.127.24

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki