Pmiazga has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/335167 )

Change subject: Hygiene: Don't use deprecated 
ConfigFactory::getDefaultInstance()
......................................................................

Hygiene: Don't use deprecated ConfigFactory::getDefaultInstance()

Changes:
 - use MediaWikiServices::getConfigFactory() instead of depreacted func

Change-Id: Id983f3cc57a4d1d23ef8dd0a52e78320dd51e9ca
---
M includes/FooterHooks.php
M includes/Hooks.php
M includes/SidebarHooks.php
3 files changed, 15 insertions(+), 11 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/RelatedArticles 
refs/changes/67/335167/1

diff --git a/includes/FooterHooks.php b/includes/FooterHooks.php
index 0ba1115..fc18da9 100644
--- a/includes/FooterHooks.php
+++ b/includes/FooterHooks.php
@@ -3,10 +3,10 @@
 namespace RelatedArticles;
 
 use BetaFeatures;
+use MediaWiki\MediaWikiServices;
 use OutputPage;
 use ResourceLoader;
 use Skin;
-use ConfigFactory;
 use User;
 use DisambiguatorHooks;
 use Title;
@@ -24,7 +24,8 @@
         * @return boolean Always <code>true</code>
         */
        public static function onMakeGlobalVariablesScript( &$vars, OutputPage 
$out ) {
-               $config = ConfigFactory::getDefaultInstance()->makeConfig( 
'RelatedArticles' );
+               $config = MediaWikiServices::getInstance()->getConfigFactory()
+                       ->makeConfig( 'RelatedArticles' );
 
                $vars['wgRelatedArticles'] = $out->getProperty( 
'RelatedArticles' );
 
@@ -76,7 +77,8 @@
         * @return bool
         */
        private static function isReadMoreAllowedOnSkin( User $user, Skin $skin 
) {
-               $config = ConfigFactory::getDefaultInstance()->makeConfig( 
'RelatedArticles' );
+               $config = MediaWikiServices::getInstance()->getConfigFactory()
+                       ->makeConfig( 'RelatedArticles' );
                $blacklistedSkins = $config->get( 
'RelatedArticlesFooterBlacklistedSkins' );
                $skinName = $skin->getSkinName();
                $isBlacklistedSkin = in_array( $skinName, $blacklistedSkins );
@@ -115,7 +117,8 @@
         * @return boolean Always <code>true</code>
         */
        public static function onBeforePageDisplay( OutputPage $out, Skin $skin 
) {
-               $config = ConfigFactory::getDefaultInstance()->makeConfig( 
'RelatedArticles' );
+               $config = MediaWikiServices::getInstance()->getConfigFactory()
+                       ->makeConfig( 'RelatedArticles' );
                $showReadMore = $config->get( 'RelatedArticlesShowInFooter' );
 
                $title = $out->getContext()->getTitle();
@@ -165,7 +168,8 @@
         * @return boolean
         */
        public static function onResourceLoaderGetConfigVars( &$vars ) {
-               $config = ConfigFactory::getDefaultInstance()->makeConfig( 
'RelatedArticles' );
+               $config = MediaWikiServices::getInstance()->getConfigFactory()
+                       ->makeConfig( 'RelatedArticles' );
                $vars['wgRelatedArticlesLoggingSamplingRate'] =
                        $config->get( 'RelatedArticlesLoggingSamplingRate' );
                $vars['RelatedArticlesEnabledSamplingRate']
@@ -240,7 +244,8 @@
         * @return bool
         */
        public static function onGetBetaFeaturePreferences( User $user, array 
&$preferences ) {
-               $config = ConfigFactory::getDefaultInstance()->makeConfig( 
'RelatedArticles' );
+               $config =               $config = 
MediaWikiServices::getInstance()->getConfigFactory()
+                       ->makeConfig( 'RelatedArticles' );
                $showReadMore = $config->get( 'RelatedArticlesShowInFooter' );
 
                if ( $showReadMore ) {
diff --git a/includes/Hooks.php b/includes/Hooks.php
index 6329e0f..a785ae6 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -81,7 +81,7 @@
         * @see 
https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderTestModules
         *
         * @param array $modules
-        * @param ResourceLoader $rl
+        * @param \ResourceLoader $rl
         * @return bool
         */
        public static function onResourceLoaderTestModules( &$modules, &$rl ) {
diff --git a/includes/SidebarHooks.php b/includes/SidebarHooks.php
index 2cd3417..ec7b622 100644
--- a/includes/SidebarHooks.php
+++ b/includes/SidebarHooks.php
@@ -2,10 +2,8 @@
 
 namespace RelatedArticles;
 
-use ConfigFactory;
+use MediaWiki\MediaWikiServices;
 use Title;
-use SkinTemplate;
-use BaseTemplate;
 use Skin;
 use Html;
 use User;
@@ -106,7 +104,8 @@
         * @throws \ConfigException
         */
        private static function isInSidebar( $relatedPages, User $user ) {
-               $config = ConfigFactory::getDefaultInstance()->makeConfig( 
'RelatedArticles' );
+               $config = MediaWikiServices::getInstance()->getConfigFactory()
+                       ->makeConfig( 'RelatedArticles' );
 
                if ( !$relatedPages || !$config->get( 
'RelatedArticlesShowInSidebar' ) ) {
                        return false;

-- 
To view, visit https://gerrit.wikimedia.org/r/335167
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id983f3cc57a4d1d23ef8dd0a52e78320dd51e9ca
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/RelatedArticles
Gerrit-Branch: master
Gerrit-Owner: Pmiazga <pmia...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to