Skip to content

Commit

Permalink
Replace wfFindFile (#780)
Browse files Browse the repository at this point in the history
* replace wfFindFile (w backw support)

* sp
  • Loading branch information
D-Groenewegen authored Oct 24, 2023
1 parent b148377 commit 1ff2d50
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion formats/dygraphs/SRF_Dygraphs.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
use MediaWiki\MediaWikiServices;

/**
* A query printer that uses the dygraphs JavaScript library
Expand Down Expand Up @@ -74,7 +75,13 @@ protected function getResultData( SMWQueryResult $result, $outputMode ) {
$aggregatedValues['subject'] = $this->makePageFromTitle( $subject->getTitle() )->getLongHTMLText(
$this->getLinker( $field->getResultSubject() )
);
$aggregatedValues['url'] = wfFindFile( $subject->getTitle() )->getUrl();
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();
}

$dataSource = true;
}

Expand Down

0 comments on commit 1ff2d50

Please sign in to comment.