From c85d6c634b0e5bdfdc88155c4c6cf1ec88a35b42 Mon Sep 17 00:00:00 2001 From: D-Groenewegen Date: Wed, 12 Jun 2024 10:43:51 +0200 Subject: [PATCH] Updates to wfFindFile again (#838) * 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 --- formats/dygraphs/SRF_Dygraphs.php | 10 ++-------- formats/media/MediaPlayer.php | 6 +----- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/formats/dygraphs/SRF_Dygraphs.php b/formats/dygraphs/SRF_Dygraphs.php index eb4cbc96..397e1a7b 100644 --- a/formats/dygraphs/SRF_Dygraphs.php +++ b/formats/dygraphs/SRF_Dygraphs.php @@ -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; } @@ -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 ) { diff --git a/formats/media/MediaPlayer.php b/formats/media/MediaPlayer.php index 58e2b00d..6c41b2e3 100644 --- a/formats/media/MediaPlayer.php +++ b/formats/media/MediaPlayer.php @@ -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 ); } }