Fetching edit notices via API

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Fetching edit notices via API

Huji Lee
Hi all,
Is there an API call that would allow you to retrieve the edit notice for a
page?
Huji

PS: I would ask it on Discourse, except
https://phabricator.wikimedia.org/T222045
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Fetching edit notices via API

Bryan Davis
On Sun, Apr 28, 2019 at 5:02 PM Huji Lee <[hidden email]> wrote:
>
> Hi all,
> Is there an API call that would allow you to retrieve the edit notice for a
> page?

I did not find a specific Action API that does this, but the edit
notices themselves are found at predictable URLs per
<https://www.mediawiki.org/wiki/Manual:Interface/Edit_notice>:
* MediaWiki:Editnotice-<N> (where N is the namespace id)
* MediaWiki:Editnotice-<N>-<Title> (where any '/' in the title is
replaced with '-')

You could also find all editnotice messages for a wiki using a prefix
search generator:

Bryan
--
Bryan Davis              Wikimedia Foundation    <[hidden email]>
[[m:User:BDavis_(WMF)]] Manager, Technical Engagement    Boise, ID USA
irc: bd808                                        v:415.839.6885 x6855

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Fetching edit notices via API

Bryan Davis
On Sun, Apr 28, 2019 at 8:02 PM Bryan Davis <[hidden email]> wrote:

>
> On Sun, Apr 28, 2019 at 5:02 PM Huji Lee <[hidden email]> wrote:
> >
> > Hi all,
> > Is there an API call that would allow you to retrieve the edit notice for a
> > page?
>
> I did not find a specific Action API that does this, but the edit
> notices themselves are found at predictable URLs per
> <https://www.mediawiki.org/wiki/Manual:Interface/Edit_notice>:
> * MediaWiki:Editnotice-<N> (where N is the namespace id)
> * MediaWiki:Editnotice-<N>-<Title> (where any '/' in the title is
> replaced with '-')
>
> You could also find all editnotice messages for a wiki using a prefix
> search generator:

<https://www.mediawiki.org/wiki/Special:ApiSandbox#action=query&format=json&prop=revisions&generator=prefixsearch&formatversion=2&rvprop=content&rvslots=main&gpssearch=Editnotice-&gpsnamespace=8&gpslimit=max>

(sorry for the early post on the prior message)

Bryan
--
Bryan Davis              Wikimedia Foundation    <[hidden email]>
[[m:User:BDavis_(WMF)]] Manager, Technical Engagement    Boise, ID USA
irc: bd808                                        v:415.839.6885 x6855

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Fetching edit notices via API

Brad Jorsch (Anomie)
In reply to this post by Bryan Davis
On Sun, Apr 28, 2019 at 10:03 PM Bryan Davis <[hidden email]> wrote:

> On Sun, Apr 28, 2019 at 5:02 PM Huji Lee <[hidden email]> wrote:
> >
> > Hi all,
> > Is there an API call that would allow you to retrieve the edit notice
> for a
> > page?
>
> I did not find a specific Action API that does this, but the edit
> notices themselves are found at predictable URLs per
> <https://www.mediawiki.org/wiki/Manual:Interface/Edit_notice>:
> * MediaWiki:Editnotice-<N> (where N is the namespace id)
> * MediaWiki:Editnotice-<N>-<Title> (where any '/' in the title is
> replaced with '-')
>
> You could also find all editnotice messages for a wiki using a prefix
> search generator:
>

This is your best bet. Note that, in namespaces with subpages, a page at
"Project:Foo/Bar/Baz" would display any editnotices at
MediaWiki:Editnotice-4-Foo and MediaWiki:Editnotice-4-Foo-Bar in addition
to MediaWiki:Editnotice-4-Foo-Bar-Baz.

There's also the 'TitleGetEditNotices' hook, which extensions can use to
add arbitrary other messages as edit notices. For example, GlobalUserPage
uses this to add a notice when editing the page used as a global user page
for a user, and TitleBlacklist uses it to add a notice when the tboverride
right is allowing the user to create/edit a blacklisted page.

There's also https://phabricator.wikimedia.org/T45683 about this question.


BTW, some incidental history: The per-page edit notices were removed in
2009 (r48276 <https://www.mediawiki.org/wiki/Special:Code/MediaWiki/48276>),
but for some unspecified reason only for namespaces without subpages, and
those were added back in 2011 (r97686
<https://www.mediawiki.org/wiki/Special:Code/MediaWiki/97686>) because the
inconsistency was seen as a bug rather than an incomplete removal. That
removal is why enwiki doesn't use the MediaWiki:Editnotice-<N>-<Title>
style notices, instead having every MediaWiki:Editnotice-<N> invoke a
template that transcludes subpages of Template:Editnotices/
<https://en.wikipedia.org/wiki/Special:PrefixIndex/Template:Editnotices/>
(plus that system has evolved to become a bit more flexible).

--
Brad Jorsch (Anomie)
Senior Software Engineer
Wikimedia Foundation
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l