summaryrefslogtreecommitdiff
path: root/maintenance/purgeStaleMemcachedText.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
committerPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
commitca32f08966f1b51fcb19460f0996bb0c4048e6fe (patch)
treeec04cc15b867bc21eedca904cea9af0254531a11 /maintenance/purgeStaleMemcachedText.php
parenta22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c (diff)
Update to MediaWiki 1.18.0
* also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing
Diffstat (limited to 'maintenance/purgeStaleMemcachedText.php')
-rw-r--r--maintenance/purgeStaleMemcachedText.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/maintenance/purgeStaleMemcachedText.php b/maintenance/purgeStaleMemcachedText.php
new file mode 100644
index 00000000..c4f5006f
--- /dev/null
+++ b/maintenance/purgeStaleMemcachedText.php
@@ -0,0 +1,34 @@
+<?php
+
+require_once( dirname( __FILE__ ) . '/commandLine.inc' );
+
+function purgeStaleMemcachedText() {
+ global $wgMemc, $wgDBname;
+ $db = wfGetDB( DB_MASTER );
+ $maxTextId = $db->selectField( 'text', 'max(old_id)' );
+ $latestReplicatedTextId = $db->selectField( array( 'recentchanges', 'revision' ), 'rev_text_id',
+ array( 'rev_id = rc_this_oldid', "rc_timestamp < '20101225183000'"), 'purgeStaleMemcachedText',
+ array( 'ORDER BY' => 'rc_timestamp DESC' ) );
+ $latestReplicatedTextId -= 100; # A bit of paranoia
+
+ echo "Going to purge text entries from $latestReplicatedTextId to $maxTextId in $wgDBname\n";
+
+ for ( $i = $latestReplicatedTextId; $i < $maxTextId; $i++ ) {
+ $key = wfMemcKey( 'revisiontext', 'textid', $i );
+
+ while (1) {
+ if (! $wgMemc->delete( $key ) ) {
+ echo "Memcache delete for $key returned false\n";
+ }
+ if ( $wgMemc->get( $key ) ) {
+ echo "There's still content in $key!\n";
+ } else {
+ break;
+ }
+ }
+
+ }
+}
+
+purgeStaleMemcachedText();
+