MediaWiki master
LanguageEventIngress.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\Languages;
4
9
17
18 private MessageCache $messageCache;
19
21 public const OBJECT_SPEC = [
22 'class' => self::class,
23 'services' => [
24 'MessageCache'
25 ],
26 'events' => [
28 ],
29 ];
30
34 public function __construct( MessageCache $messageCache ) {
35 $this->messageCache = $messageCache;
36 }
37
44 if ( $event->getPage()->getNamespace() === NS_MEDIAWIKI
45 && $event->isModifiedSlot( SlotRecord::MAIN )
46 ) {
47 $content = $event->getNewRevision()->getMainContentRaw();
48 $this->messageCache->updateMessageOverride( $event->getPage(), $content );
49 }
50 }
51
52}
const NS_MEDIAWIKI
Definition Defines.php:73
Base class for classes that implement DomainEventSubscriber.
The ingres adapter for the language component.
const OBJECT_SPEC
Object spec intented for use with DomainEventSource::registerSubscriber().
handlePageUpdatedEventAfterCommit(PageUpdatedEvent $event)
Listener method for PageUpdatedEvent, to be registered with a DomainEventSource.
Value object representing a content slot associated with a page revision.
Domain event representing a page edit.
getPage()
Returns the page that was edited.
isModifiedSlot(string $slotRole)
Whether the given slot was modified by the edit.
getNewRevision()
The revision that became the current one because of the edit.
Cache messages that are defined by MediaWiki-namespace pages or by hooks.