1<?php 2 3namespace MediaWiki\Api\Hook; 4 5use ApiBase; 6use IApiMessage; 7use Message; 8use User; 9 10/** 11 * This is a hook handler interface, see docs/Hooks.md. 12 * Use the hook name "ApiCheckCanExecute" to register handlers implementing this interface. 13 * 14 * @stable to implement 15 * @ingroup Hooks 16 */ 17interface ApiCheckCanExecuteHook { 18 /** 19 * This hook is called during ApiMain::checkCanExecute. Use this hook to further 20 * authenticate and authorize API clients before executing the module. 21 * 22 * @since 1.35 23 * 24 * @param ApiBase $module 25 * @param User $user Current user 26 * @param IApiMessage|Message|string|array &$message API message to die with. 27 * Specific values accepted depend on the MediaWiki version: 28 * * 1.29+: IApiMessage, Message, string message key, or key+parameters array to 29 * pass to ApiBase::dieWithError(). 30 * * 1.27+: IApiMessage, or a key or key+parameters in ApiBase::$messageMap. 31 * * Earlier: A key or key+parameters in ApiBase::$messageMap. 32 * @return bool|void True or no return value to continue, or false and set a 33 * message to cancel the request 34 */ 35 public function onApiCheckCanExecute( $module, $user, &$message ); 36} 37