https://www.mediawiki.org/wiki/Special:Code/MediaWiki/109664
Revision: 109664
Author: aaron
Date: 2012-01-21 00:04:09 +0000 (Sat, 21 Jan 2012)
Log Message:
-----------
* r109659: actually return the exact type we say we do
* Made use of FileRepo::cleanupBatch() in ForeignAPIFile::purgeThumbnails()
Modified Paths:
--------------
trunk/phase3/includes/filerepo/backend/FileBackend.php
trunk/phase3/includes/filerepo/file/ForeignAPIFile.php
Modified: trunk/phase3/includes/filerepo/backend/FileBackend.php
===================================================================
--- trunk/phase3/includes/filerepo/backend/FileBackend.php 2012-01-20
23:56:21 UTC (rev 109663)
+++ trunk/phase3/includes/filerepo/backend/FileBackend.php 2012-01-21
00:04:09 UTC (rev 109664)
@@ -1247,10 +1247,10 @@
/**
* 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 );
Modified: trunk/phase3/includes/filerepo/file/ForeignAPIFile.php
===================================================================
--- trunk/phase3/includes/filerepo/file/ForeignAPIFile.php 2012-01-20
23:56:21 UTC (rev 109663)
+++ trunk/phase3/includes/filerepo/file/ForeignAPIFile.php 2012-01-21
00:04:09 UTC (rev 109664)
@@ -231,19 +231,22 @@
$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 ) );
}
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs