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