Don't use a dynamic hook name when calling a hook

It breaks my script.

Remove the IContentHandlerFactory consts without deprecation, they were
only introduced two weeks ago and are not used by anything.

Change-Id: I22eb637b64a9be8472affed1b4ae60c8fa3af93d
This commit is contained in:
Tim Starling 2020-02-24 13:19:03 +11:00
parent b21a156729
commit adc3c5f247
3 changed files with 7 additions and 7 deletions

View file

@ -118,7 +118,7 @@ final class ContentHandlerFactory implements IContentHandlerFactory {
*/
public function getContentModels(): array {
$modelsFromHook = [];
Hooks::run( self::HOOK_NAME_GET_CONTENT_MODELS, [ &$modelsFromHook ] );
Hooks::run( 'GetContentModels', [ &$modelsFromHook ] );
$models = array_merge( // auto-registered from config and MediaServiceWiki or manual
array_keys( $this->handlerSpecs ),
@ -247,7 +247,7 @@ final class ContentHandlerFactory implements IContentHandlerFactory {
*/
private function createContentHandlerFromHook( string $modelID ): ContentHandler {
$contentHandler = null;
Hooks::run( self::HOOK_NAME_BY_MODEL_NAME, [ $modelID, &$contentHandler ] );
Hooks::run( 'ContentHandlerForModelID', [ $modelID, &$contentHandler ] );
$this->validateContentHandler( $modelID, $contentHandler );
'@phan-var ContentHandler $contentHandler';

View file

@ -9,10 +9,6 @@ use MWUnknownContentModelException;
interface IContentHandlerFactory {
public const HOOK_NAME_BY_MODEL_NAME = 'ContentHandlerForModelID';
public const HOOK_NAME_GET_CONTENT_MODELS = 'GetContentModels';
/**
* Returns a ContentHandler instance for the given $modelID.
*

View file

@ -538,7 +538,11 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
Title::newFromTitleValue( $target ) :
Title::newFromText( $target );
$page = WikiPage::factory( $title );
Hooks::run( $action . 'ArticleComplete', [ $this->getUser(), &$page ] );
if ( $action === 'Watch' ) {
Hooks::run( 'WatchArticleComplete', [ $this->getUser(), &$page ] );
} else {
Hooks::run( 'UnwatchArticleComplete', [ $this->getUser(), &$page ] );
}
}
return true;
}