Merge "Make HTMLFileCache also work when gzip is not enabled server-side."
[lhc/web/wiklou.git] / maintenance / purgeStaleMemcachedText.php
index f183b5e..ec7b081 100644 (file)
@@ -1,4 +1,23 @@
 <?php
+/**
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Maintenance Memcached
+ */
 
 require_once( dirname( __FILE__ ) . '/commandLine.inc' );
 
@@ -14,8 +33,19 @@ function purgeStaleMemcachedText() {
        echo "Going to purge text entries from $latestReplicatedTextId to $maxTextId in $wgDBname\n";
 
        for ( $i = $latestReplicatedTextId; $i < $maxTextId; $i++ ) {
-               $key = wfMemcKey( 'revisiontext', 'textid', $i++ );
-               $wgMemc->delete( $key );
+               $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;
+                       }
+               }
+               
        }
 }