Gerrit change 133955 <https://gerrit.wikimedia.org/r/#/c/133955/>, which I
plan to merge on Thursday for deployment to WMF wikis with
1.24wmf7<https://www.mediawiki.org/wiki/MediaWiki_1.24/Roadmap>ap>,
will cause the API to report an error when action=edit is used with the
"redirect" parameter and none of "appendtext",
"prependtext", or
"section=new" are used. This will occur regardless of whether the page
being edited is actually a redirect.
API action=edit has a "redirect" parameter, which will automatically edit
the target page if the supplied title is a redirect. The original intention
of this feature was to be used in combination with appendtext or
section=new for posting notifications to user talk pages without having to
first check whether the page is a redirect (see bug
24330<https://bugzilla.wikimedia.org/show_bug.cgi?id=24330>)0>).
But as currently implemented it will perform the edit even when replacement
page text is supplied, which is extremely prone to error: while reviewing
the patch proposing this change, I reviewed several scripts and bots that
were logged as submitting API requests with this combination of parameters
and every one would make erroneous edits when the target page is a redirect.
Clients not using the "redirect" parameter to action=edit or clients that
use it in combination with "appendtext", "prependtext", or
"section=new"
will not be affected by this change. Affected clients have several options
for coping with this change, such as:
- Stop supplying the "redirect" parameter to action=edit, which will
edit the redirect page itself.
- When fetching the page content to transform it for the edit, use the
"redirect" parameter to action=query and submit the edit to the target page
directly (and without using the "redirect" parameter to action=edit) rather
than via the redirect title.
- Use appendtext, prependtext, or section=new instead of loading the
page's wikitext and appending or prepending content on the client side.
- Detect the redirect when fetching the page content and treat the
unexpected redirect as an error condition. Or handle the error returned by
action=edit in whatever manner is appropriate to your script, bot, or tool.
See
https://www.mediawiki.org/wiki/MediaWiki_1.24/Roadmap for the
deployment schedule.
--
Brad Jorsch (Anomie)
Software Engineer
Wikimedia Foundation
_______________________________________________
Mediawiki-api-announce mailing list
Mediawiki-api-announce(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce