Manual:Hooks/ApiQueryBaseAfterQuery

From MediaWiki.org
Jump to navigation Jump to search
ApiQueryBaseAfterQuery
Available from version 1.29.0 (Gerrit change 313830)
Called for (some) API query modules after the database query has returned.
Define function:
public static function onApiQueryBaseAfterQuery( $module, $result, &$hookData ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"ApiQueryBaseAfterQuery": "MyExtensionHooks::onApiQueryBaseAfterQuery"
	}
}

For MediaWiki ≤1.25:

$wgHooks['ApiQueryBaseAfterQuery'][] = 'MyExtensionHooks::onApiQueryBaseAfterQuery';
Called from:File(s): ApiQueryBase.php
Function(s): select

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

Called for (some) API query modules after the database query has returned. An API query module wanting to use this hook should see the ApiQueryBase::select() and ApiQueryBase::processRow() documentation.

Details[edit]

  • $module: ApiQueryBase module in question
  • $result: ResultWrapper|bool returned from the IDatabase::select()
  • &$hookData: array that was passed to the ApiQueryBaseBeforeQuery hook and will be passed to the ApiQueryBaseProcessRow hook, intended for inter-hook communication.