Purge videos from squid on action=purge
authorJan Gerber <jgerber@wikimedia.org>
Tue, 27 Nov 2012 05:41:56 +0000 (05:41 +0000)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 6 Dec 2012 19:58:14 +0000 (11:58 -0800)
While we don't want to re-encode videos on purge, they should still
be removed from squid; compute the list of all urls before extensions
can filter it to remove files that should not be deleted from the
file backend.

Change-Id: Id837843b5a203e49a8594439ce3620da9b3c7b6a

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 );
                }