如何让MediaWiki忽略来自Google Search Appliance的页面浏览? [英] How can I get MediaWiki to ignore page views from a Google Search Appliance?

查看:104
本文介绍了如何让MediaWiki忽略来自Google Search Appliance的页面浏览?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个 MediaWiki 页面上的页面浏览计数器似乎是一种识别值得放置的热门页面的好方法为了保持最新和有用而付出了更多的努力,但是我遇到了一个问题.

The page view counter on each MediaWiki page seems like a great way to identify popular pages which are worth putting more effort into keeping up-to-date and useful, but I've hit a problem.

我们使用 Google Search Appliance 为我们的MediaWiki安装编制索引.我的问题是,GSA每次抓取页面时都会增加页面视图计数器.这完全占据了统计数据的主导地位,淹没了真实用户的观点.

We use a Google Search Appliance to index our MediaWiki installation. The problem I have is that the GSA increments the page view counter each time it crawls the page. This completely dominates the statistics, swamping the views made by real users.

我知道如何重置页面计数器以重新开始.但是,是否有一种方法可以配置MediaWiki以忽略来自GSA的页面请求以计数页面浏览量?

I know how to reset the page counters to start again. But is there a way to configure MediaWiki to ignore page requests from the GSA for the purposes of counting page views?

推荐答案

这可以通过在Article.php中添加条件来实现:

this can be done by adding a condition in Article.php:

includes/Article.php:2861:function viewUpdates():

if( !$wgDisableCounters && !$wgUser->isAllowed('bot') && $this->getID() ) {

添加:

&& strpos($_SERVER['HTTP_USER_AGENT'], 'gsa-crawler') === false

其中gsa-crawler是默认gsa UA的一部分...

where gsa-crawler is part of the default gsa UA...

另一种方法是在GSA中设置表单身份验证",并以bot组中的用户身份登录wikimedia.

another way is to setup Forms Authentication in GSA, and have it login to wikimedia as a user in the bot group..

这篇关于如何让MediaWiki忽略来自Google Search Appliance的页面浏览?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆