Avoid hardcoding cache and cache key in populateInterwiki.php
authorTimo Tijhof <krinklemail@gmail.com>
Wed, 4 Jan 2017 03:00:10 +0000 (19:00 -0800)
committerKrinkle <krinklemail@gmail.com>
Wed, 4 Jan 2017 03:00:54 +0000 (03:00 +0000)
Follows-up 0ac10f3790.

Bug: T114577
Change-Id: I1f5fbc40adc66a673428e495be94fc8118d6e14f

maintenance/populateInterwiki.php

index 5d32b99..6c812bf 100644 (file)
@@ -33,11 +33,6 @@ class PopulateInterwiki extends Maintenance {
         */
        private $source;
 
-       /**
-        * @var BagOStuff
-        */
-       private $cache;
-
        public function __construct() {
                parent::__construct();
 
@@ -64,8 +59,6 @@ TEXT
                $force = $this->getOption( 'force', false );
                $this->source = $this->getOption( 'source', 'https://en.wikipedia.org/w/api.php' );
 
-               $this->cache = wfGetMainCache();
-
                $data = $this->fetchLinks();
 
                if ( $data === false ) {
@@ -149,7 +142,7 @@ TEXT
                                );
                        }
 
-                       $this->clearCacheEntry( $prefix );
+                       Interwiki::invalidateCache( $prefix );
                }
 
                $this->output( "Interwiki links are populated.\n" );
@@ -157,14 +150,6 @@ TEXT
                return true;
        }
 
-       /**
-        * @param string $prefix
-        */
-       private function clearCacheEntry( $prefix ) {
-               $key = wfMemcKey( 'interwiki', $prefix );
-               $this->cache->delete( $key );
-       }
-
 }
 
 $maintClass = PopulateInterwiki::class;