pageswap is a script that allows a user to swap the histories of two pages (with reasonable restrictions), sometimes known as a history swap, sometimes called a round-robin move. The script requires the user to have suppressredirect
and move-subpages
rights (on enwiki, these are usually granted via either the page mover permission or as part of the standard administrator toolset). The script will add a "Swap" tab to the top of the page near the "new section" button.
To use this script: Copy the line below, then [[click here]], paste the line, and hit Publish changes.
{{subst:Iusc|User:Andy M. Wang/pageswap.js|User:Andy M. Wang/pageswap}}
- Report any issues to me, Andy M. Wang. I'm not much of a JavaScript guru, and if anyone would like to help improve the script, feedback is always welcome. Feel free to adapt the script as you see fit as well.
Usage
edit- Go to the page to be swapped (i.e. page A as described at WP:PMVR#rr). At the top of the page, there should be an additional option to "Swap" (right below "Move" or "Purge"). Click "Swap".
- Enter the full page name complete with namespace prefix. (Click cancel to step out.) Proceed through the forms as appropriate. (Press "OK" for "Yes", "Cancel" for "No".)
- (Manually perform step 4 of the round-robin move if necessary, including correcting any moved redirects, and creating new redlinked talk pages.)
- (Manually perform any necessary post-move cleanup.)
Description
editBecause the round-robin move involves three distinct moves, in which each move step might fail for legitimate reasons, (target of a subpage is create-protected, a talk page is move-protected, or a target namespaces does not have subpages enabled, the target doesn't actually exist, etc) much of the script involves various checks to try to ensure that the three moves can happen unimpeded to the best of its ability. The script will detect the existence of talk pages and subpages and prompt the user. The script will not move subpages if the number of subpages of a namespace exceeds 100 pages. (In this case, attempt to perform the move manually, moving batches of 100 at a time.)
Editors can specify a default move reason via moveReasonDefault in their common.js or skin. This is helpful for those who use pageswap who frequently perform similar actions with the same move summary. (For example, var moveReasonDefault = "Requested at WP:RMTR" would be a reasonable summary for editors who answer WP:RMTR requests with a swap.)
If the move is complicated (i.e. subpages and talk subpages exist for source and destination), there will be a number of screens alerting you of the configuration to help you make the best decision about whether subpages should be moved. Occasionally, a (sub)page may be move-protected or immovable.
The prefix for the intermediate title (C) used for page B (as described at WP:PMVR#rr) is hard-coded as "Draft:Move/"
per convention.
To cancel out of the swap routine, currently you will need to step through the sequence of menus, but just be sure to click cancel at the last screen that asks if you want to proceed.
Page swapping is enabled for most namespaces that can handle them. The ability to swap a page in a subject space with one in a talk space is currently disabled. Users who are unable to suppressredirect
or move-subpages
have the swap functionality disabled.
Future goals
editOrdered by priority:
- Check create protection of swap subpages (very uncommon)
- When sum of subj talk >100 subpages and subj <= 100 subpages, consider disabling move talk. Allow option to move talk and subpages separately later?
Out of scope
edit- Checking template/file namespace for incoming links to orig. title
- Correcting redirects unrelated to the source page
- Correcting or retargeting any redirects of moved pages (including subpages)
- Other post-move cleanup (editnotices, lede/dab/hatnote corrections) These actions should be performed post-move manually.
- Create newly red-linked subject / talk / subpages as redirects
Script
editThe live script is at User:Andy M. Wang/pageswap.js. Latest version published 02:00, 20 September 2018 (UTC).
A beta version of the script is also available at User:Andy M. Wang/pageswapbeta.js (diff), but its use is not recommended, as it may contain untested or breaking code.
Version history
edit- 1.1, around 25 August 2016.
- 1.2, on 25 August 2016. Adds talk page create protection checks and disallows move talk if detected. Streamlining of outputs when checking subpages.
- 1.3, on 4 October 2016. Allows the swap portlet link to show on Book and Portal namespaces (with a "not supported" reason elaborating why).
- 1.4, on 1–2 November 2016. Post-move message updates.
- 1.5, on 10 September 2017. Declares dependencies on mediawiki.api and mediawiki.util.
- 1.6, on 18 December 2017. (Feature request) Adds support for a default "Move reason" via variable moveReasonDefault.
- 1.6.1, on 20 September 2018. Change redirect suppression criteria shortcut link in edit summary per WP:SHORT.