Sorry all for the dupe - Gmail's wigging out on me :(
On 2/21/07, Jim Wilson wilson.jim.r@gmail.com wrote:
Thanks for bringing this up, Jim.
For reference, what he's referring to is the practice of creating one's own hooks from within an extension. In this case, we did so via a line like this:
wgRunHooks('PagesOnDemand', array( &$title, &$article));
The key here being that it would be up to another extension to hook onto 'PagesOnDemand' and perform some processing. (We refer to these extensions as 'extension modules' casually amongst ourselves to distinguish them from first-order extensions).
The question is, should we document publicly (other than in our own documentation) the hook "PagesOnDemand" in order to reduce the likelihood of collisions with other extensions' hooks? If so, where would be a good place for it?
This presupposes - to an extent - that others also are in the practice of writing "meta extensions" - extensions which provide hooks for other extensions. I'm not sure how widely this is done.
Regarding Cite in particular - it would be useful to some if there were strategically placed calls to wfRunHooks which expose some of the internals to third-party extensions.
In Jim's case, he needs to be able to modify a <ref>'s inner text based on the value of the 'name' key (if provided). This could be met by injecting the following at the beginning of the stack() method:
wfRunHooks('CiteBeforeStack', array( &$str, &$key ));
''Note: I'll be happy to provide a patch if necessary''
He could then hook 'CiteBeforeStack' and modify $str to be whatever he needed. As it is today, he hacks the Cite extension to do what he wants.
So, in general, what is the community's standpoint on extensions hooking into extensions? Is this encouraged, discouraged, common or uncommon? We'd like to hear your thoughts.
Thanks in advance,
Jim R. Wilson (jimbojw)
On 2/21/07, Jim Hu < jimhu@tamu.edu> wrote:
There are cases where it would be useful to run hooks from inside extensions. For example, there's a hook in an extension that Jim Wilson and I just wrote, and I wish there were hooks in Cite.php.
Seems to me that this should be accompanied by registering the hook name with mediawiki to avoid name collisions. Should extension authors just go and add these to the mediawiki.org and meta hooks documentation? Or should there be some recommendation for hook names from extensions?
Jim
Jim Hu Associate Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l