Skip to content

Commit

Permalink
doc: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lens0021 committed Jul 10, 2022
1 parent 104d206 commit 5b5f00a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions includes/HookHandlers/RelatedArticles.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use Config;
use ExtensionRegistry;
use MediaWiki\MediaWikiServices;
use Title;
use MediaWiki\Page\PageStoreRecord;
use Title;
use Wikimedia\Rdbms\DBConnRef;
use Wikimedia\Rdbms\ILoadBalancer;
use Wikimedia\Rdbms\SelectQueryBuilder;
Expand Down Expand Up @@ -139,7 +139,7 @@ private function makeTitlesFromHereSQL( Title $title, DBConnRef $dbr, $targetNam
// Hide redirects
'rd_from' => null,
] )
->fields( self::getSelectFields() )
->fields( self::getSelectFields() )
->getSQL();
}

Expand Down Expand Up @@ -173,7 +173,7 @@ private function makeRedirectedTitlesFromHereSQL( Title $title, DBConnRef $dbr,
// Only redirects
'rd_from != 0',
] )
->fields( self::getSelectFields( 'target' ) )
->fields( self::getSelectFields( 'target' ) )
->getSQL();
}

Expand Down Expand Up @@ -203,7 +203,7 @@ private function makeTitlesToHereSQL( Title $title, DBConnRef $dbr, $targetNames
->conds( $targetNamespaces ? [
'page_namespace' => $targetNamespaces,
] : [] )
->fields( self::getSelectFields() )
->fields( self::getSelectFields() )
->getSQL();
}

Expand Down Expand Up @@ -245,6 +245,10 @@ private function makeTitlesToRedirectsOfHereSQL( Title $title, DBConnRef $dbr, $
->getSQL();
}

/**
* @param string|null $table
* @return array
*/
public static function getSelectFields( $table = null ) {
$pageLanguageUseDB = MediaWikiServices::getInstance()->getMainConfig()->get( 'PageLanguageUseDB' );

Expand All @@ -262,7 +266,8 @@ public static function getSelectFields( $table = null ) {
}

if ( $table ) {
foreach( $fields as $f ) {
$fieldMap = [];
foreach ( $fields as $f ) {
$fieldMap[$f] = "$table.$f";
}
return $fieldMap;
Expand Down

0 comments on commit 5b5f00a

Please sign in to comment.