Merge "MimeAnalyzer: Add testcases for mp3 detection"
[lhc/web/wiklou.git] / maintenance / populateInterwiki.php
index 5d32b99..1b05e1e 100644 (file)
@@ -33,11 +33,6 @@ class PopulateInterwiki extends Maintenance {
         */
        private $source;
 
-       /**
-        * @var BagOStuff
-        */
-       private $cache;
-
        public function __construct() {
                parent::__construct();
 
@@ -61,11 +56,9 @@ TEXT
        }
 
        public function execute() {
-               $force = $this->getOption( 'force', false );
+               $force = $this->hasOption( 'force' );
                $this->source = $this->getOption( 'source', 'https://en.wikipedia.org/w/api.php' );
 
-               $this->cache = wfGetMainCache();
-
                $data = $this->fetchLinks();
 
                if ( $data === false ) {
@@ -136,7 +129,7 @@ TEXT
                                __METHOD__
                        );
 
-                       if ( ! $row ) {
+                       if ( !$row ) {
                                $dbw->insert(
                                        'interwiki',
                                        [
@@ -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;