Skip to content

Instantly share code, notes, and snippets.

@ebernhardson
Last active August 29, 2015 14:04
Show Gist options
  • Save ebernhardson/25b804581549ebf21df1 to your computer and use it in GitHub Desktop.
Save ebernhardson/25b804581549ebf21df1 to your computer and use it in GitHub Desktop.
<?php
echo "Replace wgMemc\n";
$realMemc = $wgMemc;
$wgMemc = new HashBagOStuff;
echo "Locate workflow for ", $argv[1], "\n";
$workflow = Flow\Container::get( 'factory.loader.workflow' )->createWorkflowLoader( Title::newFromText( $argv[1] ) )->getWorkflow();
echo "Get list of topics\n";
$pager = new Flow\Data\Pager( Flow\Container::get( 'storage' )->getStorage( 'TopicListEntry' ), array( 'topic_list_id' => $workflow->getId() ), array() );
echo "Get posts within topics\n";
$found = Flow\Container::get( 'query.topiclist' )->getResults( $pager->getPage()->getResults() );
echo "Detect all used memcache keys\n";
$reflProp = new ReflectionProperty( $wgMemc, 'bag' );
$reflProp->setAccessible( true );
$keys = array_keys( $reflProp->getValue( $wgMemc ) );
echo "Purging keys: ", implode( ', ', $keys ), "\n";
foreach ( $keys as $key ) { $realMemc->delete( $key ); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment