Fix "Fatal error: Call to undefined method WikiPage::getCount"

This was removed in MediaWiki 1.25 (90d90dad6e).

Bug: T104100
Change-Id: I25edf9e9f10cd3e14e02e63cab86fb5164af8d1a
(cherry picked from commit abb31b0023)
This commit is contained in:
Timo Tijhof 2015-06-28 02:02:51 +01:00 committed by Krinkle
parent ec5723fcc2
commit c02d9aafae

View file

@ -324,9 +324,16 @@ class AbuseFilter {
$vars->setVar( $prefix . '_NAMESPACE', $title->getNamespace() );
$vars->setVar( $prefix . '_TEXT', $title->getText() );
$vars->setVar( $prefix . '_PREFIXEDTEXT', $title->getPrefixedText() );
global $wgDisableCounters;
if ( !$wgDisableCounters && !$title->isSpecialPage() ) {
$vars->setVar( $prefix . '_VIEWS', WikiPage::factory( $title )->getCount() );
// Support: MediaWiki 1.24 and earlier
if ( method_exists( 'WikiPage', 'getCount' ) ) {
$vars->setVar( $prefix . '_VIEWS', WikiPage::factory( $title )->getCount() );
// Support: MediaWiki 1.25+ with HitCounters extension
} elseif ( method_exists( 'HitCounters\HitCounters', 'getCount' ) ) {
$vars->setVar( $prefix . '_VIEWS', HitCounters\HitCounters::getCount( $title ) );
}
}
// Use restrictions.