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