Developing extensions/Access to in-process data


This article gives a short introduction on how to gain access to in-process data when using an extension, through a registered hook, or an additional parser function.

In general, the Help:SemanticData object when in an intermediary state (being processed in hooks or through the parser) is attached to MediaWiki's ParserOutput to allow interdependent data exchange during the request.

To avoid loss of data or inconsistencies when accessing the Help:SemanticData object, it is recommended to use a ParserData instance as gateway.

    // Create in-memory ParserOutput transfer object
    $parserData = ApplicationFactory::getInstance()->newParserData(
    // Access the SemanticData object

    // Do something

An individual extension is required to finalize its update process by invoking (otherwise the extended SemanticData instance will not be transferred to the ParserOutput object):

    // Ensures that objects are pushed to the ParserOutput

This ensures that the ParserOutput contains the most up-to-date Help:SemanticData object at the time when the LinksUpdateConstructed hook is called which then will trigger the Store::updateData together with the accumulated data.


ParserData::updateStore is not for public use therefore an extension is not expected to call this function.

See also[edit]