]> ToastFreeware Gitweb - philipp/winterrodeln/mediawiki_extensions/wrmap.git/blobdiff - wrmap.body.php
Replace removed function wfFindFile.
[philipp/winterrodeln/mediawiki_extensions/wrmap.git] / wrmap.body.php
index 033303b1529854fdaa511427b2ab177071e248f8..49ee8279e714130b6d9d97453d80b8fc20b707ff 100644 (file)
@@ -156,6 +156,7 @@ as value.
 The featurecollection itself has a properties key as well containing the attributes of
 the wrmap element.
 */
+use MediaWiki\MediaWikiServices;
 
 
 // DOM helper classes
@@ -236,8 +237,8 @@ class WrBaseMap {
        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;
@@ -247,7 +248,7 @@ class WrBaseMap {
                                $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';
@@ -256,7 +257,7 @@ class WrBaseMap {
                                $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);
                        }
                }