Page MenuHomeWickedGov Phorge

clearInterwikiCache.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

clearInterwikiCache.php

<?php
/**
* @license GPL-2.0-or-later
* @file
* @ingroup Maintenance
*/
use MediaWiki\Maintenance\Maintenance;
// @codeCoverageIgnoreStart
require_once __DIR__ . '/Maintenance.php';
// @codeCoverageIgnoreEnd
/**
* Clear the cache of interwiki prefixes.
*
* @ingroup Maintenance
*/
class ClearInterwikiCache extends Maintenance {
public function __construct() {
parent::__construct();
$this->addDescription( 'Clear all interwiki links for all languages from the cache' );
}
public function execute() {
$lookup = $this->getServiceContainer()->getInterwikiLookup();
$dbr = $this->getReplicaDB();
$prefixes = $dbr->newSelectQueryBuilder()
->select( 'iw_prefix' )
->from( 'interwiki' )
->caller( __METHOD__ )
->fetchFieldValues();
foreach ( $prefixes as $prefix ) {
$this->output( "...$prefix\n" );
$lookup->invalidateCache( $prefix );
}
$this->output( "done\n" );
}
}
// @codeCoverageIgnoreStart
$maintClass = ClearInterwikiCache::class;
require_once RUN_MAINTENANCE_IF_MAIN;
// @codeCoverageIgnoreEnd

File Metadata

Mime Type
text/x-php
Expires
Tue, Dec 8, 01:49 (1 d, 6 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
43/b1/3e8369a6eed14ca510297556b077
Default Alt Text
clearInterwikiCache.php (1 KB)

Event Timeline