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 PageLatestRevisionChangedEvent::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 (
50 $event->isNominalContentChange()
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 ): void {
68 WikiModule::invalidateModuleCache(
69 $event->getDeletedPage(),
70 $event->getLatestRevisionBefore(),
71 null,
72 $this->localDomainId
73 );
74 }
75
76}
if(!defined('MW_SETUP_CALLBACK'))
Definition WebStart.php:68
Base class for event ingress objects.
Domain event representing page deletion.
Domain event representing a change to the page's latest revision.
getLatestRevisionBefore()
Returned the revision that used to be latest before the update.
getLatestRevisionAfter()
The revision that became the latest as a result of the update.
The ingres adapter for the resource loader component.
handlePageLatestRevisionChangedEvent(PageLatestRevisionChangedEvent $event)
Listener method for PageLatestRevisionChangedEvent, to be registered with a DomainEventSource.
const OBJECT_SPEC
Object spec intended for use with DomainEventSource::registerSubscriber().
handlePageDeletedEvent(PageDeletedEvent $event)
Listener method for PageDeletedEvent, to be registered with a DomainEventSource.
Abstraction for ResourceLoader modules which pull from wiki pages.
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 PageLatestRevisionChangedEvents.
Constants for representing well known causes for page updates.