Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7424718
LintEventIngress.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
LintEventIngress.php
View Options
<?php
namespace
MediaWiki\Linter
;
use
MediaWiki\DomainEvent\DomainEventIngress
;
use
MediaWiki\Page\Event\PageRevisionUpdatedEvent
;
use
MediaWiki\Revision\SlotRecord
;
class
LintEventIngress
extends
DomainEventIngress
{
private
TotalsLookup
$totalsLookup
;
private
Database
$database
;
public
function
__construct
(
TotalsLookup
$totalsLookup
,
Database
$database
)
{
$this
->
totalsLookup
=
$totalsLookup
;
$this
->
database
=
$database
;
}
/**
* Remove entries from the linter table upon page content model change away from wikitext
*
* @noinspection PhpUnused
* @param PageRevisionUpdatedEvent $event
* @return void
*/
public
function
handlePageRevisionUpdatedEvent
(
PageRevisionUpdatedEvent
$event
)
{
$page
=
$event
->
getPage
();
$tags
=
$event
->
getTags
();
if
(
in_array
(
"mw-blank"
,
$tags
)
||
(
in_array
(
"mw-contentmodelchange"
,
$tags
)
&&
!
in_array
(
$event
->
getLatestRevisionAfter
()->
getSlot
(
SlotRecord
::
MAIN
)->
getModel
(),
Hooks
::
LINTABLE_CONTENT_MODELS
)
)
)
{
$this
->
totalsLookup
->
updateStats
(
$this
->
database
->
setForPage
(
$page
->
getId
(),
$page
->
getNamespace
(),
[]
)
);
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 07:32 (19 h, 16 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
e9/9b/4b4c9b9b39343a51b5fee4906d71
Default Alt Text
LintEventIngress.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment