Could anyone please tell me which function gets called on the 'Save Page' submit action. I am making chnages to a existing page in the locally installed wiki. I want to add some data to tables that i have added to the wiki database. Once a user its submit i want to be able to identify my tagged text from the text and then insert it. So for this i want ot figure out whihc function will get called when a user hits 'Save Page' button on edit page.
Thanks
On Sat, Nov 26, 2005 at 12:42:23PM -0500, Amruta Lonkar wrote:
Could anyone please tell me which function gets called on the 'Save Page' submit action. I am making chnages to a existing page in the locally installed wiki. I want to add some data to tables that i have added to the wiki database. Once a user its submit i want to be able to identify my tagged text from the text and then insert it. So for this i want ot figure out whihc function will get called when a user hits 'Save Page' button on edit page.
See: http://meta.wikimedia.org/wiki/Write_your_own_MediaWiki_extension http://meta.wikimedia.org/wiki/MediaWiki_Hooks_and_their_Parameters http://cvs.sourceforge.net/viewcvs.py/wikipedia/phase3/docs/hooks.txt?rev=1.... http://wikipedia.sourceforge.net/doc/
"Hooks are registered by adding them to the global $wgHooks array for a given event."
I don't think the Mediawiki API docs can show all the "wgHooks" (yet), but by using: grep -r wfRunHooks wiki/includes/* | less you can see all the existing hooks in the code.
Examples:
# This method will be called before an article is saved $wgHooks['ArticleSaveComplete'][] = 'myFunction';
# This method will be called before an article is displayed or previewed. $wgHooks['ParserAfterStrip'][] = 'myOtherFunction';
Jama Poulsen http://wikicompany.org http://debianlinux.net
Ok so i created a extensin file for rendering the referece information in the current article. I had a question will this be called even when the article is previewed and not actually saved?
I have created a table called reference links similar to the imagelinks table. When a user enters his reference using an external link his reference gets entered into the reference table and in the textarea he can actually see the <ref>23</ref>, where the 23 is the refId from the reference table. I want to insert this info in the referencelinks table only when article is finally saved and not previewed. But when a user hits preview it should show actually pull up the reference name from the database and show that and similarly for preview.
Also if i want to insert the info to be inserted in the referencelinks table can i do it before i do the rendering in the extension file istelf or will i still need to use hooks?
Thanks
Quoting Jama Poulsen jama@debianlinux.net:
On Sat, Nov 26, 2005 at 12:42:23PM -0500, Amruta Lonkar wrote:
Could anyone please tell me which function gets called on the 'Save Page' submit action. I am making chnages to a existing page in the locally installed wiki. I want to add some data to tables that i have added to the wiki database. Once a user its submit i want to be able to identify my tagged text from the text and then insert it. So for this i want ot figure out whihc function will get called when a user hits 'Save Page' button on edit page.
See: http://meta.wikimedia.org/wiki/Write_your_own_MediaWiki_extension http://meta.wikimedia.org/wiki/MediaWiki_Hooks_and_their_Parameters
http://cvs.sourceforge.net/viewcvs.py/wikipedia/phase3/docs/hooks.txt?
rev=1.9&view=auto
http://wikipedia.sourceforge.net/doc/
"Hooks are registered by adding them to the global $wgHooks array for a given event."
I don't think the Mediawiki API docs can show all the "wgHooks" (yet), but by using: grep -r wfRunHooks wiki/includes/* | less you can see all the existing hooks in the code.
Examples:
# This method will be called before an article is saved $wgHooks['ArticleSaveComplete'][] = 'myFunction';
# This method will be called before an article is displayed or previewed. $wgHooks['ParserAfterStrip'][] = 'myOtherFunction';
Jama Poulsen http://wikicompany.org http://debianlinux.net _______________________________________________ MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
-- Amruta
Amruta Lonkar wrote:
Ok so i created a extensin file for rendering the referece information in the current article. I had a question will this be called even when the article is previewed and not actually saved?
Parser extensions are called whenever the parser encounters that extension. This is uncoditional to the destination or purpose of rendering (as long as it is a full rendering).
I have created a table called reference links similar to the imagelinks table. When a user enters his reference using an external link his reference gets entered into the reference table and in the textarea he can actually see the <ref>23</ref>, where the 23 is the refId from the reference table. I want to insert this info in the referencelinks table only when article is finally saved and not previewed. But when a user hits preview it should show actually pull up the reference name from the database and show that and similarly for preview.
Check the hooks ArticleSave and ArticleSaveComplete. Wait for those to be called before commiting data to the DB.
Also if i want to insert the info to be inserted in the referencelinks table can i do it before i do the rendering in the extension file istelf or will i still need to use hooks?
No. The HTML for an extension must be returned to the parser at the time of the call. And you can not be sure what data would need to be changed before the parser has completed parsing extensions and calling them.
-- Jamie ------------------------------------------------------------------- http://endeavour.zapto.org/astro73/ Thank you to JosephM for inviting me to Gmail! Have lots of invites. Gmail now has 2GB.
mediawiki-l@lists.wikimedia.org