X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecials%2FSpecialWantedpages.php;h=8cea6ccb7768ef55c85fc7d9433fe10d39ed4ee8;hp=76b721c5423462d4635ad9d8ed2e629a4b12a197;hb=22806b0a4509e97b56fb52b387e17e3c80fb7eb2;hpb=2f885ee6b797e5a176ce7b270b674a04b5945b06 diff --git a/includes/specials/SpecialWantedpages.php b/includes/specials/SpecialWantedpages.php index 76b721c542..8cea6ccb77 100644 --- a/includes/specials/SpecialWantedpages.php +++ b/includes/specials/SpecialWantedpages.php @@ -49,6 +49,7 @@ class WantedPagesPage extends WantedQueryPage { } function getQueryInfo() { + $dbr = wfGetDB( DB_REPLICA ); $count = $this->getConfig()->get( 'WantedPagesThreshold' ) - 1; $query = [ 'tables' => [ @@ -63,13 +64,13 @@ class WantedPagesPage extends WantedQueryPage { ], 'conds' => [ 'pg1.page_namespace IS NULL', - "pl_namespace NOT IN ( '" . NS_USER . "', '" . NS_USER_TALK . "' )", - "pg2.page_namespace != '" . NS_MEDIAWIKI . "'" + 'pl_namespace NOT IN (' . $dbr->makeList( [ NS_USER, NS_USER_TALK ] ) . ')', + 'pg2.page_namespace != ' . $dbr->addQuotes( NS_MEDIAWIKI ), ], 'options' => [ 'HAVING' => [ - "COUNT(*) > $count", - "COUNT(*) > SUM(pg2.page_is_redirect)" + 'COUNT(*) > ' . $dbr->addQuotes( $count ), + 'COUNT(*) > SUM(pg2.page_is_redirect)' ], 'GROUP BY' => [ 'pl_namespace', 'pl_title' ] ], @@ -84,7 +85,9 @@ class WantedPagesPage extends WantedQueryPage { ] ]; // Replacement for the WantedPages::getSQL hook - Hooks::run( 'WantedPages::getQueryInfo', [ &$this, &$query ] ); + // Avoid PHP 7.1 warning from passing $this by reference + $wantedPages = $this; + Hooks::run( 'WantedPages::getQueryInfo', [ &$wantedPages, &$query ] ); return $query; }