* r109659: actually return the exact type we say we do
authorAaron Schulz <aaron@users.mediawiki.org>
Sat, 21 Jan 2012 00:04:09 +0000 (00:04 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Sat, 21 Jan 2012 00:04:09 +0000 (00:04 +0000)
* Made use of FileRepo::cleanupBatch() in ForeignAPIFile::purgeThumbnails()

includes/filerepo/backend/FileBackend.php
includes/filerepo/file/ForeignAPIFile.php

index 1e9455d..97ab13d 100644 (file)
@@ -1247,10 +1247,10 @@ abstract class FileBackend extends FileBackendBase {
        /**
         * Get the parent storage directory of a storage path.
         * This returns a path like "mwstore://backend/container",
-        * "mwstore://backend/container/...", or false if there is no parent.
+        * "mwstore://backend/container/...", or null if there is no parent.
         * 
         * @param $storagePath string
-        * @return string|false
+        * @return string|null
         */
        final public static function parentStoragePath( $storagePath ) {
                $storagePath = dirname( $storagePath );
index bd89539..0e71075 100644 (file)
@@ -231,19 +231,22 @@ class ForeignAPIFile extends File {
                $key = $this->repo->getLocalCacheKey( 'ForeignAPIRepo', 'ThumbUrl', $this->getName() );
                $wgMemc->delete( $key );
 
-               $backend = $this->repo->getBackend();
                $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() );
+               $purgeList = array();
                foreach ( $files as $file ) {
-                       $op = array( 'op' => 'delete', 'src' => "{$dir}{$file}" );
-                       $backend->doOperation( $op );
+                       $purgeList[] = "{$dir}{$file}";
                }
-               $backend->clean( array( 'dir' => $dir ) );
+
+               # Delete the thumbnails
+               $this->repo->cleanupBatch( $purgeList );
+               # Clear out the thumbnail directory if empty
+               $this->repo->getBackend()->clean( array( 'dir' => $dir ) );
        }
 }