MediaWiki master
clearInterwikiCache.php
Go to the documentation of this file.
1<?php
22require_once __DIR__ . '/Maintenance.php';
23
30
31 public function __construct() {
32 parent::__construct();
33 $this->addDescription( 'Clear all interwiki links for all languages from the cache' );
34 }
35
36 public function execute() {
37 $lookup = $this->getServiceContainer()->getInterwikiLookup();
38
39 $dbr = $this->getReplicaDB();
40 $prefixes = $dbr->newSelectQueryBuilder()
41 ->select( 'iw_prefix' )
42 ->from( 'interwiki' )
43 ->caller( __METHOD__ )
44 ->fetchFieldValues();
45
46 foreach ( $prefixes as $prefix ) {
47 $this->output( "...$prefix\n" );
48 $lookup->invalidateCache( $prefix );
49 }
50 $this->output( "done\n" );
51 }
52}
53
54$maintClass = ClearInterwikiCache::class;
55require_once RUN_MAINTENANCE_IF_MAIN;
Clear the cache of interwiki prefixes.
execute()
Do the actual work.
__construct()
Default constructor.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
output( $out, $channel=null)
Throw some output to the user.
getServiceContainer()
Returns the main service container.
addDescription( $text)
Set the description text.