]> ToastFreeware Gitweb - philipp/winterrodeln/mediawiki_extensions/wrmap.git/blobdiff - wrmap.body.php
Use ILoadBalancer::getConnection() instead of deprecated wfGetDB().
[philipp/winterrodeln/mediawiki_extensions/wrmap.git] / wrmap.body.php
index 4ae49bac9e8be845a9bddec823ff7c4d3bba305a..2c6287fc49e55c5220a381dead7223282042ca78 100644 (file)
@@ -240,12 +240,13 @@ class WrBaseMap {
                if ($title->inNamespace(NS_FILE)) {
                        $file = MediaWikiServices::getInstance()->getRepoGroup()->findFile($title); // $file is a mediawiki File class or false
                } else {
+                       $lb = MediaWikiServices::getInstance()->getDBLoadBalancer();
                        $categories = $title->getParentCategories(); // e.g. array('Kategorie:Rodelbahn' => 'Juifenalm')
                        $wgContLang = MediaWikiServices::getInstance()->getContentLanguage();
                        $key_sledrun = $wgContLang->getNSText(NS_CATEGORY) . ':Rodelbahn';
                        if (array_key_exists($key_sledrun, $categories)) {
                                // for sledrun titles use the image from the rodelbahnbox
-                               $dbr = wfGetDB(DB_REPLICA);
+                               $dbr = $lb->getConnection( DB_REPLICA );
                                $res = $dbr->select('wrsledruncache', 'image', array('page_id' => $title->getArticleID()), __METHOD__);
                                $image = $res->fetchRow();
                                if ($image && !is_null($image['image'])) $file = MediaWikiServices::getInstance()->getRepoGroup()->findFile($image['image']);
@@ -253,7 +254,7 @@ class WrBaseMap {
                        $key_inn = $wgContLang->getNSText(NS_CATEGORY) . ':Gasthaus';
                        if (array_key_exists($key_inn, $categories)) {
                                // for inn titles use the image from the gasthausbox
-                               $dbr = wfGetDB(DB_REPLICA);
+                               $dbr = $lb->getConnection( DB_REPLICA );
                                $res = $dbr->select('wrinncache', 'image', array('page_id' => $title->getArticleID()), __METHOD__);
                                $image = $res->fetchRow();
                                if ($image && !is_null($image['image'])) $file = MediaWikiServices::getInstance()->getRepoGroup()->findFile($image['image']);
@@ -271,7 +272,8 @@ class WrBaseMap {
        // Returns an array of features
        public static function sledruns_to_json_features() {
                $json_features = array(); // result
-               $dbr = wfGetDB(DB_REPLICA);
+               $lb = MediaWikiServices::getInstance()->getDBLoadBalancer();
+               $dbr = $lb->getConnection( DB_REPLICA );
                $res = $dbr->select(array('wrsledruncache', 'wrreportcache'), array('wrsledruncache.page_title', 'position_latitude', 'position_longitude', 'date_report', '`condition`'), array('show_in_overview', 'not under_construction'), __METHOD__, array(), array('wrreportcache' => array('left outer join', 'wrsledruncache.page_id=wrreportcache.page_id')));
                while ($sledrun = $res->fetchRow()) {
                        $lat = $sledrun['position_latitude'];