Skip to content

Commit

Permalink
Use ExtensionRegistry for checking HitCounters
Browse files Browse the repository at this point in the history
  • Loading branch information
Universal-Omega authored Mar 20, 2022
1 parent deff07b commit 00c6eb7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions includes/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use DateInterval;
use DateTime;
use Exception;
use ExtensionRegistry;
use MediaWiki\MediaWikiServices;
use MediaWiki\User\UserFactory;
use MWException;
Expand Down Expand Up @@ -886,7 +887,7 @@ private function _addlasteditor( $option ) {
* @param mixed $option
*/
private function _addpagecounter( $option ) {
if ( class_exists( '\\HitCounters\\Hooks' ) ) {
if ( ExtensionRegistry::getInstance()->isLoaded( 'HitCounters' ) ) {
$this->addTable( 'hit_counter', 'hit_counter' );
$this->addSelect(
[
Expand Down Expand Up @@ -1781,7 +1782,7 @@ private function _ordermethod( $option ) {
$this->addOrderBy( 'cl1.cl_timestamp' );
break;
case 'counter':
if ( class_exists( '\\HitCounters\\Hooks' ) ) {
if ( ExtensionRegistry::getInstance()->isLoaded( 'HitCounters' ) ) {
// If the "addpagecounter" parameter was not used the table and join need to be added now.
if ( !array_key_exists( 'hit_counter', $this->tables ) ) {
$this->addTable( 'hit_counter', 'hit_counter' );
Expand Down

0 comments on commit 00c6eb7

Please sign in to comment.