Skip to content

Commit

Permalink
Updates to wfFindFile again (#838)
Browse files Browse the repository at this point in the history
* Update MediaPlayer.php

No need to support older method. Since SRF 4.0.x (now obsolete), the minimum version is MW 1.35.

* Update SRF_Dygraphs.php

No need to support wfFindFile (MW 1.33 or older). SRF's minimum version is MW 1.34.

* Update SRF_Dygraphs.php

whitespace
  • Loading branch information
D-Groenewegen authored Jun 12, 2024
1 parent 32cf562 commit c85d6c6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
10 changes: 2 additions & 8 deletions formats/dygraphs/SRF_Dygraphs.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,7 @@ protected function getResultData( SMWQueryResult $result, $outputMode ) {
$aggregatedValues['subject'] = $this->makePageFromTitle( $subject->getTitle() )->getLongHTMLText(
$this->getLinker( $field->getResultSubject() )
);
if ( method_exists( MediaWikiServices::class, 'getRepoGroup' ) ) {
$aggregatedValues['url'] = MediaWikiServices::getInstance()->getRepoGroup()->findFile( $subject->getTitle() )->getUrl();
} else {
// Before MW 1.34
$aggregatedValues['url'] = wfFindFile( $subject->getTitle() )->getUrl();
}

$aggregatedValues['url'] = MediaWikiServices::getInstance()->getRepoGroup()->findFile( $subject->getTitle() )->getUrl();
$dataSource = true;
}

Expand Down Expand Up @@ -115,7 +109,7 @@ protected function getResultData( SMWQueryResult $result, $outputMode ) {
$aggregatedValues['subject'] = $this->makePageFromTitle(
$title
)->getLongHTMLText( $this->getLinker( $field->getResultSubject() ) );
$aggregatedValues['url'] = wfFindFile( $title )->getUrl();
$aggregatedValues['url'] = MediaWikiServices::getInstance()->getRepoGroup()->findFile( $title )->getUrl();
$dataSource = true;
continue;
} elseif ( $dataItem->getDIType() == SMWDataItem::TYPE_URI && $this->params['datasource'] === 'url' && !$dataSource ) {
Expand Down
6 changes: 1 addition & 5 deletions formats/media/MediaPlayer.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,6 @@ public function getParamDefinitions( array $definitions ) {
* @return bool|File
*/
private function findFile( Title $title ) {
if ( method_exists( MediaWikiServices::class, 'getRepoGroup' ) ) {
return MediaWikiServices::getInstance()->getRepoGroup()->findFile( $title );
}
// TODO: Remove when min MW version is 1.34
return wfFindFile( $title );
return MediaWikiServices::getInstance()->getRepoGroup()->findFile( $title );
}
}

0 comments on commit c85d6c6

Please sign in to comment.