Platonides <Platonides <at> gmail.com> writes:
On 06/11/12 23:35, Amelia Ireland wrote:
Hello all,
Is it possible to pause and resume a Mediawiki edit?
To explain, I've written a MW extension that accesses an external
database; this database requires OAuth authentication [1.0, pre-OAuth
wars version], which is a three-step process requiring the user to be
redirected to an external site to allow the extension access to the
external db. If the MW extension already has an access token for the
extDb, all is well. However, if there isn't a token, there is a
problem. This is a tag extension, and is triggered by finding a
certain XML tag in the wiki page, which typically occurs in the
'preview' or 'submit' of an edit, e.g.
http://server.com/wiki/index.php?title=Bibliography&action=submit (the
parser hook is ParserFirstCallInit). The callback URL constructed by
the OAuth code returns you to the page you were editing, but in its
pre-edit state: i.e. you lose all your edits.
How can I resume the edit and not lose my edit data?
Thanks for any help, clues, or workarounds!
Store the submitted data in the session, then in the callback add a
parameter that makes your extension to load the data from the session.
Would you be able to provide a few pointers as to how to accomplish this? I am
not familiar with the MW core code, having only really done extension hacking.I
guess I need to be looking at the User class and methods like loadFromSession().
If you could direct me to some existing code I could base mine on, that would be
really helpful.
It probably makes more sense to give your wiki server
credentials to
read the external db, though.
I don't have any control over this, unfortunately -- the external DB is run by a
company and I have been unsuccessful in even finding out from them how long the
DB access tokens are valid for.
Thanks,
Amelia.