Override ContentHandler::getDeletionUpdates and ContentHandler::getSecondaryDataUpdates.

Use it instead of Content::getDeletionUpdates and Content::getSecondaryDataUpdates.

Bug: T285730
Bug: T285729
Change-Id: Ie4ea0917f120809be59e2b7afad51cd189d64dd1
This commit is contained in:
Roman Stolar 2021-07-15 16:40:45 +02:00
parent 5b4ee6084f
commit ffa6b4de09
2 changed files with 37 additions and 28 deletions

View file

@ -94,32 +94,4 @@ class GadgetDefinitionContent extends JsonContent {
return $info;
}
/**
* @param WikiPage $page
* @param ParserOutput|null $parserOutput
* @return DeferrableUpdate[]
*/
public function getDeletionUpdates( WikiPage $page, ParserOutput $parserOutput = null ) {
return array_merge(
parent::getDeletionUpdates( $page, $parserOutput ),
[ new GadgetDefinitionDeletionUpdate( $page->getTitle() ) ]
);
}
/**
* @param Title $title
* @param Content|null $old
* @param bool $recursive
* @param ParserOutput|null $parserOutput
* @return DataUpdate[]
*/
public function getSecondaryDataUpdates( Title $title, Content $old = null,
$recursive = true, ParserOutput $parserOutput = null
) {
return array_merge(
parent::getSecondaryDataUpdates( $title, $old, $recursive, $parserOutput ),
[ new GadgetDefinitionSecondaryDataUpdate( $title ) ]
);
}
}

View file

@ -1,4 +1,5 @@
<?php
/**
* Copyright 2014
*
@ -20,6 +21,8 @@
* @file
*/
use MediaWiki\Revision\SlotRenderingProvider;
class GadgetDefinitionContentHandler extends JsonContentHandler {
public function __construct() {
parent::__construct( 'GadgetDefinition' );
@ -64,4 +67,38 @@ class GadgetDefinitionContentHandler extends JsonContentHandler {
],
];
}
/**
* @param Title $title The title of the page to supply the updates for.
* @param string $role The role (slot) in which the content is being used.
* @return DeferrableUpdate[] A list of DeferrableUpdate objects for putting information
* about this content object somewhere.
*/
public function getDeletionUpdates( Title $title, $role ) {
return array_merge(
parent::getDeletionUpdates( $title, $role ),
[ new GadgetDefinitionDeletionUpdate( $title ) ]
);
}
/**
* @param Title $title The title of the page to supply the updates for.
* @param Content $content The content to generate data updates for.
* @param string $role The role (slot) in which the content is being used.
* @param SlotRenderingProvider $slotOutput A provider that can be used to gain access to
* a ParserOutput of $content by calling $slotOutput->getSlotParserOutput( $role, false ).
* @return DeferrableUpdate[] A list of DeferrableUpdate objects for putting information
* about this content object somewhere.
*/
public function getSecondaryDataUpdates(
Title $title,
Content $content,
$role,
SlotRenderingProvider $slotOutput
) {
return array_merge(
parent::getSecondaryDataUpdates( $title, $content, $role, $slotOutput ),
[ new GadgetDefinitionSecondaryDataUpdate( $title ) ]
);
}
}