MediaWiki
REL1_39
clearInterwikiCache.php
Go to the documentation of this file.
1
<?php
24
use
MediaWiki\MainConfigNames
;
25
26
require_once __DIR__ .
'/Maintenance.php'
;
27
33
class
ClearInterwikiCache
extends
Maintenance
{
34
35
public
function
__construct
() {
36
parent::__construct();
37
$this->
addDescription
(
'Clear all interwiki links for all languages from the cache'
);
38
}
39
40
public
function
execute
() {
41
$dbr
= $this->
getDB
(
DB_REPLICA
);
42
$cache
= ObjectCache::getLocalClusterInstance();
43
$res
=
$dbr
->newSelectQueryBuilder()
44
->select(
'iw_prefix'
)
45
->from(
'interwiki'
)
46
->caller( __METHOD__ )
47
->fetchResultSet();
48
$prefixes = [];
49
foreach
(
$res
as $row ) {
50
$prefixes[] = $row->iw_prefix;
51
}
52
53
foreach
( $this->
getConfig
()->
get
( MainConfigNames::LocalDatabases ) as $wikiId ) {
54
$this->
output
(
"$wikiId..."
);
55
foreach
( $prefixes as $prefix ) {
56
$cache
->delete(
"$wikiId:interwiki:$prefix"
);
57
}
58
$this->
output
(
"done\n"
);
59
}
60
}
61
}
62
63
$maintClass
= ClearInterwikiCache::class;
64
require_once RUN_MAINTENANCE_IF_MAIN;
getDB
getDB()
ClearInterwikiCache
Maintenance script to clear the cache of interwiki prefixes for all local wikis.
Definition
clearInterwikiCache.php:33
ClearInterwikiCache\execute
execute()
Do the actual work.
Definition
clearInterwikiCache.php:40
ClearInterwikiCache\__construct
__construct()
Default constructor.
Definition
clearInterwikiCache.php:35
Maintenance
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Definition
Maintenance.php:66
Maintenance\output
output( $out, $channel=null)
Throw some output to the user.
Definition
Maintenance.php:443
Maintenance\addDescription
addDescription( $text)
Set the description text.
Definition
Maintenance.php:319
Maintenance\getConfig
getConfig()
Definition
Maintenance.php:597
MediaWiki\MainConfigNames
A class containing constants representing the names of configuration variables.
Definition
MainConfigNames.php:23
$maintClass
$maintClass
Definition
clearInterwikiCache.php:63
$cache
$cache
Definition
mcc.php:33
DB_REPLICA
const DB_REPLICA
Definition
defines.php:26
$res
$res
Definition
testCompression.php:57
$dbr
$dbr
Definition
testCompression.php:54
maintenance
clearInterwikiCache.php
Generated on Mon Dec 16 2024 06:37:10 for MediaWiki by
1.10.0