Tim Starling writes:
You can add or modify messages when the cache is built by hooking LocalisationCacheRecache, and you can add a cache dependency to trigger a rebuild by adding elements to $allData['deps'].
Thanks. Do I need to do both, or is this an either/or choice?
What extension is this for?
A parser tag extension (unreleased) that hits a SQL Server database to retrieve data. The parser tag dynamically categorizes its calling articles in "Category:Pages that hit SQL Server databases" for our bookkeeping purposes (and our DBA staff). To make this flexible, the extension doesn't insert a category tag directly, but transcludes a system message that contains the category tag. (This way we can change the category tag by editing the system message, rather than modifying PHP code.) That's where we're calling $wgMessageCache->addMessage().
DanB