3 * @ingroup Maintenance Memcached
7 require_once( dirname( __FILE__
) . '/commandLine.inc' );
9 function purgeStaleMemcachedText() {
10 global $wgMemc, $wgDBname;
11 $db = wfGetDB( DB_MASTER
);
12 $maxTextId = $db->selectField( 'text', 'max(old_id)' );
13 $latestReplicatedTextId = $db->selectField( array( 'recentchanges', 'revision' ), 'rev_text_id',
14 array( 'rev_id = rc_this_oldid', "rc_timestamp < '20101225183000'"), 'purgeStaleMemcachedText',
15 array( 'ORDER BY' => 'rc_timestamp DESC' ) );
16 $latestReplicatedTextId -= 100; # A bit of paranoia
18 echo "Going to purge text entries from $latestReplicatedTextId to $maxTextId in $wgDBname\n";
20 for ( $i = $latestReplicatedTextId; $i < $maxTextId; $i++
) {
21 $key = wfMemcKey( 'revisiontext', 'textid', $i );
24 if (! $wgMemc->delete( $key ) ) {
25 echo "Memcache delete for $key returned false\n";
27 if ( $wgMemc->get( $key ) ) {
28 echo "There's still content in $key!\n";
37 purgeStaleMemcachedText();