The featurecollection itself has a properties key as well containing the attributes of
the wrmap element.
*/
+use MediaWiki\MediaWikiServices;
// DOM helper classes
public static function wikipage_to_image(Title $title, int $width) {
$file = false; // File class or false
// for NS_FILE titles, use the corresponding file as image
- if ($title->getNamespace() == NS_FILE) {
- $file = wfFindFile($title); // $file is a mediawiki File class or false
+ if ($title->inNamespace(NS_FILE)) {
+ $file = MediaWikiServices::getInstance()->getRepoGroup()->findFile($title); // $file is a mediawiki File class or false
} else {
$categories = $title->getParentCategories(); // e.g. array('Kategorie:Rodelbahn' => 'Juifenalm')
global $wgContLang;
$dbr = wfGetDB(DB_REPLICA);
$res = $dbr->select('wrsledruncache', 'image', array('page_id' => $title->getArticleID()), __METHOD__);
$image = $dbr->fetchRow($res);
- if ($image && !is_null($image['image'])) $file = wfFindFile($image['image']);
+ if ($image && !is_null($image['image'])) $file = MediaWikiServices::getInstance()->getRepoGroup()->findFile($image['image']);
$dbr->freeResult($res);
}
$key_inn = $wgContLang->getNSText(NS_CATEGORY) . ':Gasthaus';
$dbr = wfGetDB(DB_REPLICA);
$res = $dbr->select('wrinncache', 'image', array('page_id' => $title->getArticleID()), __METHOD__);
$image = $dbr->fetchRow($res);
- if ($image && !is_null($image['image'])) $file = wfFindFile($image['image']);
+ if ($image && !is_null($image['image'])) $file = MediaWikiServices::getInstance()->getRepoGroup()->findFile($image['image']);
$dbr->freeResult($res);
}
}