Topic on Project:Support desk

How to get oldid of a page?

4
Mfort123 (talkcontribs)

[]

Is there anyway of getting the 'oldid' or 'direction' parameters with the arguments passed to the hooks 'getUserPermissionErrors' or 'performMediawikiAction' ?

I'm unable to get a proper URL from $title,$request,etc. It's like there is some kind of hash applied to the request URL and it's impossible to strip out the parameter values that I'm looking for. For instance, $request->getRequestURL() doesn't yield the original URL path such as 'http://www.example.com/mediawiki/index.php?title=Main_Page&oldid=617'

My setup:

  • mw 1.23
  • apache server
  • API must stay disabled

Any ideas are appreciated.

Mfort123 (talkcontribs)

I did some more searching and it seems like I would need to get a 'revision' object and then I could use the 'getId()' method. Is there any way of getting a revision object associated with a request,user or title object?

Florianschmidtwelzow (talkcontribs)

Why not just (for MediaWikiPerformAction) $reuest->getVal( 'oldid' ) or $request->getValues() (to get all values of this request). If you really need a Revision object (i think not), you can create one from the oldid param: $rev = Revision::newFromId( $oldid ). But if you really need a revision object, look for a Hooks with a revision as a paremeter, i think it will be better for what you want to do.

Last question: What do you want to do (for what you need the oldid param)? :)

Mfort123 (talkcontribs)

I went with $article->getOldId();

I have to modify certain permissions based on the time that someone joined a specific group.

Reply to "How to get oldid of a page?"