More general thumbnail filename check on purge, to allow for general parameter strings
authorTim Starling <tstarling@users.mediawiki.org>
Mon, 30 Apr 2007 10:28:21 +0000 (10:28 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Mon, 30 Apr 2007 10:28:21 +0000 (10:28 +0000)
includes/Image.php

index 0c40c92..8cc8c39 100644 (file)
@@ -1075,7 +1075,9 @@ class Image
                $urls = array();
                foreach ( $files as $file ) {
                        $m = array();
-                       if ( preg_match( '/^\d+px/', $file, $m ) ) {
+                       # Check that the base image name is part of the thumb name
+                       # This is a basic sanity check to avoid erasing unrelated directories
+                       if ( strpos( $file, $this->name ) !== false ) {
                                $url = $this->thumbUrlFromName( $file );
                                $urls[] = $url;
                                @unlink( "$dir/$file" );