Jump to content

扩展:ApiFeatureUsage

From mediawiki.org
This page is a translated version of the page Extension:ApiFeatureUsage and the translation is 46% complete.
MediaWiki扩展手册
ApiFeatureUsage
发行状态: 稳定版
实现 特殊页面 , API
描述 Access API功能使用日志摘要
作者 Brad Jorsch (Anomie留言)
最新版本 1.0 (2016-12-07)
兼容性政策 快照跟随MediaWiki发布。 master分支不向后兼容。
MediaWiki 1.25+
PHP 5.5.9+
数据库更改
虚拟域 virtual-apifeatureusage
  • $wgApiFeatureUsageQueryEngineConf
许可证 GNU General Public License 2.0 or later
下載
翻译ApiFeatureUsage扩展
問題 开启的任务 · 报告错误

ApiFeatureUsage 扩展添加了一个特殊页面和一个 API 模块来获取 ApiBase::logFeatureUsage() 记录的数据摘要,这通常表明使用了已弃用的 API 功能。

依赖性

日志数据必须添加到某种存储系统中。目前 Elasticsearch 通过 Extension:Elastica 获得支持。

安裝

  • 下载文件,并解压ApiFeatureUsage文件夹到extensions/目录中。
    开发者和代码贡献人员应改从Git安装此扩展,输入:
    cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/ApiFeatureUsage
    
  • 請新增下列代码到您的LocalSettings.php 文件的底部:
    wfLoadExtension( 'ApiFeatureUsage' );
    
  • Yes 完成 – 請导航至您的wiki上的Special:Version,以验证此扩展已成功安装。

配置

Parameters
Name Description
$wgApiFeatureUsageQueryEngineConf Configuration array for accessing the log storage backend.
class
Backend access class to instantiate. Either this or factory is required.
factory
PHP callable which must return an instance of a backend access class. Either this or class is required.
Name Required? Description Default
serverList Required Array of Elasticsearch servers.
maxConnectionAttempts Optional Maximum connection attempts. 1
indexPrefix Optional Prefix for the indexes to use. apifeatureusage-
indexFormat Optional Date formatting for the indexes to use, see the PHP manual. Y.m.d
type Optional Elasticsearch type to query. api-feature-usage-sanitized
featureField Optional Field name for the logged value of $feature. feature
timestampField Optional Field name for the logged timestamp. @timestamp
agentField Optional Field name for the logged user agent. agent

用法

该扩展添加了一个新的特殊页面 Special:ApiFeatureUsage,其中包含一个简单的表单来请求用户代理和日期范围内的功能使用日志摘要。

该扩展还添加了一个 API 查询子模块,meta=featureusage。 有关详细信息,请参阅自动生成的 API 文档

参阅