MediaWiki master
ResourceLoaderEventIngress.php
Go to the documentation of this file.
1<?php
2
4
12
21 extends DomainEventIngress
23{
24
26 public const OBJECT_SPEC = [
27 'class' => self::class,
28 'services' => [
29 'DBLoadBalancerFactory'
30 ],
31 'events' => [
32 PageRevisionUpdatedEvent::TYPE,
33 PageDeletedEvent::TYPE,
34 ],
35 ];
36
37 private string $localDomainId;
38
39 public function __construct( LBFactory $lbFactory ) {
40 $this->localDomainId = $lbFactory->getLocalDomainID();
41 }
42
49 if (
51 || $event->hasCause( PageUpdateCauses::CAUSE_MOVE )
52 ) {
54 $event->getPage(),
56 $event->getLatestRevisionAfter(),
57 $this->localDomainId
58 );
59 }
60 }
61
67 public function handlePageDeletedEvent( PageDeletedEvent $event ) {
69 $event->getDeletedPage(),
71 null,
72 $this->localDomainId
73 );
74 }
75
76}
Base class for event ingress objects.
Domain event representing page deletion.
getDeletedPage()
Returns the page that was deleted, as it was before the deletion.
getLatestRevisionBefore()
Returns the revision that was the page's latest revision when the page was deleted.
Domain event representing a page update.
getLatestRevisionAfter()
The revision that became the latest as a result of the update.
isNominalContentChange()
Whether the update nominally changed the content of the page.
getLatestRevisionBefore()
Returned the revision that used to be latest before the update.
hasCause(string $cause)
Checks whether the update had the given cause.
The ingres adapter for the resource loader component.
const OBJECT_SPEC
Object spec intended for use with DomainEventSource::registerSubscriber().
handlePageDeletedEvent(PageDeletedEvent $event)
Listener method for PageDeletedEvent, to be registered with a DomainEventSource.
handlePageRevisionUpdatedEvent(PageRevisionUpdatedEvent $event)
Listener method for PageRevisionUpdatedEvent, to be registered with a DomainEventSource.
static invalidateModuleCache(PageIdentity $page, ?RevisionRecord $old, ?RevisionRecord $new, string $domain)
Clear the preloadTitleInfo() cache for all wiki modules on this wiki on page change if it was a JS or...
getLocalDomainID()
Get the local (and default) database domain ID of connection handles.
Listener interface for PageDeletedEvents.
Listener interface for PageRevisionUpdatedEvents.
Constants for representing well known causes for page updates.