Reverted r84395,r98710: thumbnails must be purged on file deletion
authorAaron Schulz <aaron@users.mediawiki.org>
Thu, 27 Oct 2011 23:34:54 +0000 (23:34 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Thu, 27 Oct 2011 23:34:54 +0000 (23:34 +0000)
includes/DefaultSettings.php
includes/filerepo/File.php
includes/filerepo/ForeignAPIFile.php
includes/filerepo/LocalFile.php
includes/media/Generic.php

index 1491f3b..7b296c4 100644 (file)
@@ -4836,12 +4836,6 @@ $wgJobClasses = array(
        'uploadFromUrl' => 'UploadFromUrlJob',
 );
 
-/**
- * Extensions of "thumbnails" that are very expensive to regenerate and should be
- * excluded from normal action=purge thumbnail removal.
- */
-$wgExcludeFromThumbnailPurge = array();
-
 /**
 
  * Jobs that must be explicitly requested, i.e. aren't run by job runners unless special flags are set.
index 2fe73cc..63719ee 100644 (file)
@@ -811,9 +811,8 @@ abstract class File {
         * Purge shared caches such as thumbnails and DB data caching
         * STUB
         * Overridden by LocalFile
-        * @param array $options Array with options, currently undefined
         */
-       function purgeCache( $options = array() ) {}
+       function purgeCache() {}
 
        /**
         * Purge the file description page, but don't go after
index e027ddd..ba699be 100644 (file)
@@ -209,11 +209,8 @@ class ForeignAPIFile extends File {
                return $files;
        }
 
-       /**
-        * @see File::purgeCache()
-        */
-       function purgeCache( $options = array() ) {
-               $this->purgeThumbnails( $options );
+       function purgeCache() {
+               $this->purgeThumbnails();
                $this->purgeDescriptionPage();
        }
 
@@ -224,18 +221,11 @@ class ForeignAPIFile extends File {
                $wgMemc->delete( $key );
        }
 
-       function purgeThumbnails( $options = array() ) {
+       function purgeThumbnails() {
                global $wgMemc;
                $key = $this->repo->getLocalCacheKey( 'ForeignAPIRepo', 'ThumbUrl', $this->getName() );
                $wgMemc->delete( $key );
-               
                $files = $this->getThumbnails();
-               // Give media handler a chance to filter the purge list
-               $handler = $this->getHandler();
-               if ( $handler ) {
-                       $handler->filterThumbnailPurgeList( $files, $options );
-               }
-               
                $dir = $this->getThumbPath( $this->getName() );
                foreach ( $files as $file ) {
                        unlink( $dir . $file );
index 460ed27..c26812a 100644 (file)
@@ -674,12 +674,12 @@ class LocalFile extends File {
        /**
         * Delete all previously generated thumbnails, refresh metadata in memcached and purge the squid
         */
-       function purgeCache( $options = array() ) {
+       function purgeCache() {
                // Refresh metadata cache
                $this->purgeMetadataCache();
 
                // Delete thumbnails
-               $this->purgeThumbnails( $options );
+               $this->purgeThumbnails();
 
                // Purge squid cache for this file
                SquidUpdate::purge( array( $this->getURL() ) );
@@ -722,18 +722,11 @@ class LocalFile extends File {
        /**
         * Delete cached transformed files for the current version only.
         */
-       function purgeThumbnails( $options = array() ) {
+       function purgeThumbnails() {
                global $wgUseSquid;
-               
-               // Get a list of thumbnails and URLs
+
+               // Delete thumbnails
                $files = $this->getThumbnails();
-               
-               // Give media handler a chance to filter the purge list
-               $handler = $this->getHandler();
-               if ( $handler ) {
-                       $handler->filterThumbnailPurgeList( $files, $options );
-               }
-               
                $dir = array_shift( $files );
                $this->purgeThumbList( $dir, $files );
 
@@ -756,16 +749,8 @@ class LocalFile extends File {
         * @param $files array of strings: relative filenames (to $dir)
         */
        protected function purgeThumbList($dir, $files) {
-               global $wgExcludeFromThumbnailPurge;
-
                wfDebug( __METHOD__ . ": " . var_export( $files, true ) . "\n" );
                foreach ( $files as $file ) {
-                       // Only remove files not in the $wgExcludeFromThumbnailPurge configuration variable
-                       $ext = pathinfo( "$dir/$file", PATHINFO_EXTENSION );
-                       if ( in_array( $ext, $wgExcludeFromThumbnailPurge ) ) {
-                               continue;
-                       }
-
                        # Check that the base file name is part of the thumb name
                        # This is a basic sanity check to avoid erasing unrelated directories
                        if ( strpos( $file, $this->getName() ) !== false ) {
index 12f35db..5cd5a20 100644 (file)
@@ -504,16 +504,6 @@ abstract class MediaHandler {
                }
                return false;
        }
-       
-       /**
-        * Remove files from the purge list
-        * 
-        * @param array $files
-        * @param array $options
-        */
-       public function filterThumbnailPurgeList( &$files, $options ) {
-               // Do nothing
-       }
 }
 
 /**