Manual:Hooks/ApiCheckCanExecute

From MediaWiki.org
Jump to: navigation, search
ApiCheckCanExecute
Available from version 1.20.0
Called during ApiMain::checkCanExecute().
Define function:
public static function onApiCheckCanExecute( $module, $user, &$message ) { ... }
Attach hook:
$wgHooks['ApiCheckCanExecute'][] = 'MyExtensionHooks::onApiCheckCanExecute';
Called from: File(s): ApiMain.php

For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:ApiCheckCanExecute extensions.

Details[edit]

Called during ApiMain::checkCanExecute(). Use to further authenticate and authorize API clients before executing the module. Return false and set a message to cancel the request.

  • $module: Module object
  • $user: Current user
  • &$message: API usage message to die with. Since 1.27, it is preferred to use an ApiMessage object here. A string or array is currently passed to ApiBase::dieUsageMsg(), but this is planned to change in 1.29.