| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Api\Hook; |
| 4 | |
| 5 | use MediaWiki\Api\ApiQueryBase; |
| 6 | |
| 7 | /** |
| 8 | * This is a hook handler interface, see docs/Hooks.md. |
| 9 | * Use the hook name "ApiQueryBaseBeforeQuery" to register handlers implementing this interface. |
| 10 | * |
| 11 | * @stable to implement |
| 12 | * @ingroup Hooks |
| 13 | */ |
| 14 | interface ApiQueryBaseBeforeQueryHook { |
| 15 | /** |
| 16 | * This hook is called for (some) API query modules before a |
| 17 | * database query is made. WARNING: It would be very easy to misuse this hook and |
| 18 | * break the module! Any joins added *must* join on a unique key of the target |
| 19 | * table unless you really know what you're doing. An API query module wanting to |
| 20 | * use this hook should see the ApiQueryBase::select() and |
| 21 | * ApiQueryBase::processRow() documentation. |
| 22 | * |
| 23 | * @since 1.35 |
| 24 | * |
| 25 | * @param ApiQueryBase $module Module in question |
| 26 | * @param array &$tables Array of tables to be queried |
| 27 | * @param array &$fields Array of columns to select |
| 28 | * @param array &$conds Array of WHERE conditionals for query |
| 29 | * @param array &$query_options Array of options for the database request |
| 30 | * @param array &$join_conds Join conditions for the tables |
| 31 | * @param array &$hookData Array that will be passed to the ApiQueryBaseAfterQuery and |
| 32 | * ApiQueryBaseProcessRow hooks, intended for inter-hook communication. |
| 33 | * @return bool|void True or no return value to continue or false to abort |
| 34 | */ |
| 35 | public function onApiQueryBaseBeforeQuery( $module, &$tables, &$fields, |
| 36 | &$conds, &$query_options, &$join_conds, &$hookData |
| 37 | ); |
| 38 | } |