/**
* 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 );
$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 ) );
}
}