From: Aaron Schulz Date: Sat, 21 Jan 2012 00:04:09 +0000 (+0000) Subject: * r109659: actually return the exact type we say we do X-Git-Tag: 1.31.0-rc.0~25155 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=abed714fee2a186484faf6778d073963b75b2f5b;p=lhc%2Fweb%2Fwiklou.git * r109659: actually return the exact type we say we do * Made use of FileRepo::cleanupBatch() in ForeignAPIFile::purgeThumbnails() --- diff --git a/includes/filerepo/backend/FileBackend.php b/includes/filerepo/backend/FileBackend.php index 1e9455d840..97ab13d3ac 100644 --- a/includes/filerepo/backend/FileBackend.php +++ b/includes/filerepo/backend/FileBackend.php @@ -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 ); diff --git a/includes/filerepo/file/ForeignAPIFile.php b/includes/filerepo/file/ForeignAPIFile.php index bd895393ad..0e71075599 100644 --- a/includes/filerepo/file/ForeignAPIFile.php +++ b/includes/filerepo/file/ForeignAPIFile.php @@ -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 ) ); } }