手册:钩子/APIEditBeforeSave
Appearance
此功能自1.28.0版本起被弃用后,已在版本1.34.0从MediaWiki核心代码移除。
请参见EditFilterMergedContent以获取使用此功能的替代方式。 |
| APIEditBeforeSave | |
|---|---|
| 自version 1.13.0 版可用 在version 1.34.0 (Gerrit change 519797)版被移除 Called right before saving an edit submitted through api.php?action=edit | |
| 定义函数: | public static function onAPIEditBeforeSave( $editPage, $text, &$resultArr ) { ... }
|
| 附加钩子: | 在extension.json中:
{
"Hooks": {
"APIEditBeforeSave": "MediaWiki\\Extension\\MyExtension\\Hooks::onAPIEditBeforeSave"
}
}
|
| 调用自: | 文件: api/ApiEditPage.php |
| 介面: | APIEditBeforeSaveHook.php |
更多有关附加钩子的信息,请参见Manual:函数钩。
有关使用此钩子的扩展示例,请参见Category:APIEditBeforeSave extensions/zh。
细节
- $editPage: 编辑页面目标
- $text: the new text of the article (has yet to be saved)
- $resultArr: data in this array will be added to the API result
注释
Return true to continue processing, return false to abort processing and reject the edit.
If $resultArr was filled, the API will return an <edit result="Failure"> element with the contents of $resultArr added in.
If $resultArr wasn't filled, the API will return an error message.