Merge "Purge videos from squid on action=purge"
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 6 Dec 2012 20:03:40 +0000 (20:03 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 6 Dec 2012 20:03:40 +0000 (20:03 +0000)
includes/filerepo/file/LocalFile.php

index 3525594..a9678b7 100644 (file)
@@ -771,8 +771,16 @@ class LocalFile extends File {
 
                // Delete thumbnails
                $files = $this->getThumbnails();
+               // Always purge all files from squid regardless of handler filters
+               if ( $wgUseSquid ) {
+                       $urls = array();
+                       foreach( $files as $file ) {
+                               $urls[] = $this->getThumbUrl( $file );
+                       }
+                       array_shift( $urls ); // don't purge directory
+               }
 
-               // Give media handler a chance to filter the purge list
+               // Give media handler a chance to filter the file purge list
                if ( !empty( $options['forThumbRefresh'] ) ) {
                        $handler = $this->getHandler();
                        if ( $handler ) {
@@ -788,10 +796,6 @@ class LocalFile extends File {
 
                // Purge the squid
                if ( $wgUseSquid ) {
-                       $urls = array();
-                       foreach( $files as $file ) {
-                               $urls[] = $this->getThumbUrl( $file );
-                       }
                        SquidUpdate::purge( $urls );
                }