Hey, I have written a hook but the only time it is getting called is if I do a purge. Any ideas?
file: extensions/myext.php <?php function testing() { printf("TESTING 1 2 3\n"); }
$wgExtensionFunctions[] = "wfMyExtension"; function wfMyExtension() { global $wgParser; $wgParser->setHook( "myextension", "testing" ); }
?>
Added to the end of LocalSettins.php
require("extensions/myext.php");
Its like the tag is ignored unless an action=purge is specified. Thanks.
MedaiWiki 1.6.8 php 5.1.4
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Pat Felsted wrote:
I have written a hook but the only time it is getting called is if I do a purge. Any ideas?
This is because MediaWiki has aggressive HTML caching and will avoid re-parsing wikitext (unless told to do so, of course). You can fix this by disabling caching, but expect a noticeable performance hit.
Thanks brion on irc told me that as well.
$parser->disableCache();
Did the trick. Thanks.
"Edward Z. Yang" edwardzyang@thewritingpot.com 7/21/2006 5:56 PM
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Pat Felsted wrote:
I have written a hook but the only time it is getting called is if I
do
a purge. Any ideas?
This is because MediaWiki has aggressive HTML caching and will avoid re-parsing wikitext (unless told to do so, of course). You can fix this by disabling caching, but expect a noticeable performance hit.
_______________________________________________ Wikitech-l mailing list Wikitech-l@wikimedia.org http://mail.wikipedia.org/mailman/listinfo/wikitech-l
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Moin,
On Saturday 22 July 2006 02:00, Pat Felsted wrote:
Thanks brion on irc told me that as well.
$parser->disableCache();
Please note that, as someone already wrote, brings a very noticable performance hit. Unless you have no other means, you should not do this.
My idea for presentations to use the dynamic list extension (or whatever it was called) didn't work out to the same problem - it disables the cache and every page you view is rendered painfully slow for each _viewer_ even when the page hasn't/couldn't have changed.
In the end it was better to write a new extension and structure it so that by using templates the page is only re-rendered when necessary.
In case your custom tags is something really should be different (like "current system status" or something), then there really is no way around disabling the parser cache, but maybe it would be better to embed an iframe with an href to another server for that, so that the wiki HTML can stay the same and dynamically include the information.
if you have question to that, don't hesitate to email me off list :D
Best wishes,
Tels
- -- Signed on Sat Jul 22 13:15:25 2006 with key 0x93B84C15. Visit my photo gallery at http://bloodgate.com/photos/ PGP key on http://bloodgate.com/tels.asc or per email.
"Retsina?" - "Ja, Papa?" - "Angriff im Morgengrauen." - "Is gut, Papa."
wikitech-l@lists.wikimedia.org