| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Hook; |
| 4 | |
| 5 | use File; |
| 6 | use MediaWiki\Context\IContextSource; |
| 7 | |
| 8 | /** |
| 9 | * This is a hook handler interface, see docs/Hooks.md. |
| 10 | * Use the hook name "GetExtendedMetadata" to register handlers implementing this interface. |
| 11 | * |
| 12 | * @stable to implement |
| 13 | * @ingroup Hooks |
| 14 | */ |
| 15 | interface GetExtendedMetadataHook { |
| 16 | /** |
| 17 | * Use this hook to get extended file metadata for the API. |
| 18 | * |
| 19 | * @since 1.35 |
| 20 | * |
| 21 | * @param array &$combinedMeta Array of the form: |
| 22 | * 'MetadataPropName' => [ |
| 23 | * value' => prop value, |
| 24 | * 'source' => 'name of hook' |
| 25 | * ] |
| 26 | * @param File $file File in question |
| 27 | * @param IContextSource $context RequestContext (including language to use) |
| 28 | * @param bool $single Only extract the current language; if false, the prop value should |
| 29 | * be in the metadata multi-language array format: |
| 30 | * https://mediawiki.org/wiki/Manual:File_metadata_handling#Multi-language_array_format |
| 31 | * @param int &$maxCacheTime How long the results can be cached |
| 32 | * @return bool|void True or no return value to continue or false to abort |
| 33 | */ |
| 34 | public function onGetExtendedMetadata( &$combinedMeta, $file, $context, |
| 35 | $single, &$maxCacheTime |
| 36 | ); |
| 37 | } |