Hard deprecate Interwiki static methods
authorKunal Mehta <legoktm@member.fsf.org>
Thu, 7 Jun 2018 18:40:46 +0000 (11:40 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Thu, 7 Jun 2018 18:40:46 +0000 (11:40 -0700)
Change-Id: I803df3ef90bf6b602e85ae48f25745f4dc6aab3a

includes/interwiki/Interwiki.php
maintenance/populateInterwiki.php
tests/phpunit/includes/interwiki/InterwikiTest.php

index 657849a..e6a943d 100644 (file)
@@ -66,6 +66,7 @@ class Interwiki {
         * @return bool Whether it exists
         */
        public static function isValidInterwiki( $prefix ) {
+               wfDeprecated( __METHOD__, '1.28' );
                return MediaWikiServices::getInstance()->getInterwikiLookup()->isValidInterwiki( $prefix );
        }
 
@@ -78,6 +79,7 @@ class Interwiki {
         * @return Interwiki|null|bool
         */
        public static function fetch( $prefix ) {
+               wfDeprecated( __METHOD__, '1.28' );
                return MediaWikiServices::getInstance()->getInterwikiLookup()->fetch( $prefix );
        }
 
@@ -88,6 +90,7 @@ class Interwiki {
         * @since 1.26
         */
        public static function invalidateCache( $prefix ) {
+               wfDeprecated( __METHOD__, '1.28' );
                MediaWikiServices::getInstance()->getInterwikiLookup()->invalidateCache( $prefix );
        }
 
@@ -101,6 +104,7 @@ class Interwiki {
         * @since 1.19
         */
        public static function getAllPrefixes( $local = null ) {
+               wfDeprecated( __METHOD__, '1.28' );
                return MediaWikiServices::getInstance()->getInterwikiLookup()->getAllPrefixes( $local );
        }
 
index 1b05e1e..acc66c5 100644 (file)
@@ -24,6 +24,8 @@
  * @author Katie Filbert < aude.wiki@gmail.com >
  */
 
+use MediaWiki\MediaWikiServices;
+
 require_once __DIR__ . '/Maintenance.php';
 
 class PopulateInterwiki extends Maintenance {
@@ -119,6 +121,7 @@ TEXT
                        }
                }
 
+               $lookup = MediaWikiServices::getInstance()->getInterwikiLookup();
                foreach ( $data as $d ) {
                        $prefix = $d['prefix'];
 
@@ -142,7 +145,7 @@ TEXT
                                );
                        }
 
-                       Interwiki::invalidateCache( $prefix );
+                       $lookup->invalidateCache( $prefix );
                }
 
                $this->output( "Interwiki links are populated.\n" );
index 0d41c52..409805b 100644 (file)
@@ -115,7 +115,7 @@ class InterwikiTest extends MediaWikiTestCase {
                $this->assertSame( true, $interwiki->isLocal(), 'isLocal' );
                $this->assertSame( false, $interwiki->isTranscludable(), 'isTranscludable' );
 
-               Interwiki::invalidateCache( 'de' );
+               $interwikiLookup->invalidateCache( 'de' );
                $this->assertNotSame( $interwiki, $interwikiLookup->fetch( 'de' ), 'invalidate cache' );
        }