MediaWiki
REL1_19
|
00001 <?php 00007 require_once( dirname( __FILE__ ) . '/commandLine.inc' ); 00008 00009 function purgeStaleMemcachedText() { 00010 global $wgMemc, $wgDBname; 00011 $db = wfGetDB( DB_MASTER ); 00012 $maxTextId = $db->selectField( 'text', 'max(old_id)' ); 00013 $latestReplicatedTextId = $db->selectField( array( 'recentchanges', 'revision' ), 'rev_text_id', 00014 array( 'rev_id = rc_this_oldid', "rc_timestamp < '20101225183000'"), 'purgeStaleMemcachedText', 00015 array( 'ORDER BY' => 'rc_timestamp DESC' ) ); 00016 $latestReplicatedTextId -= 100; # A bit of paranoia 00017 00018 echo "Going to purge text entries from $latestReplicatedTextId to $maxTextId in $wgDBname\n"; 00019 00020 for ( $i = $latestReplicatedTextId; $i < $maxTextId; $i++ ) { 00021 $key = wfMemcKey( 'revisiontext', 'textid', $i ); 00022 00023 while (1) { 00024 if (! $wgMemc->delete( $key ) ) { 00025 echo "Memcache delete for $key returned false\n"; 00026 } 00027 if ( $wgMemc->get( $key ) ) { 00028 echo "There's still content in $key!\n"; 00029 } else { 00030 break; 00031 } 00032 } 00033 00034 } 00035 } 00036 00037 purgeStaleMemcachedText(); 00038