MediaWiki
REL1_22
|
00001 <?php 00024 require_once __DIR__ . '/Maintenance.php'; 00025 00031 class ClearInterwikiCache extends Maintenance { 00032 00033 public function __construct() { 00034 parent::__construct(); 00035 $this->mDescription = "Clear all interwiki links for all languages from the cache"; 00036 } 00037 00038 public function execute() { 00039 global $wgLocalDatabases, $wgMemc; 00040 $dbr = wfGetDB( DB_SLAVE ); 00041 $res = $dbr->select( 'interwiki', array( 'iw_prefix' ), false ); 00042 $prefixes = array(); 00043 foreach ( $res as $row ) { 00044 $prefixes[] = $row->iw_prefix; 00045 } 00046 00047 foreach ( $wgLocalDatabases as $db ) { 00048 $this->output( "$db..." ); 00049 foreach ( $prefixes as $prefix ) { 00050 $wgMemc->delete( "$db:interwiki:$prefix" ); 00051 } 00052 $this->output( "done\n" ); 00053 } 00054 } 00055 } 00056 00057 $maintClass = "ClearInterwikiCache"; 00058 require_once RUN_MAINTENANCE_IF_MAIN;