Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F7614
MediaHandlers.filterThumbPurge.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 11:29 PM
2014-11-21 23:29:32 (UTC+0)
Size
3 KB
Referenced Files
None
Subscribers
None
MediaHandlers.filterThumbPurge.patch
View Options
Index: .buildpath
===================================================================
--- .buildpath (revision 0)
+++ .buildpath (revision 0)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<buildpath>
+ <buildpathentry kind="src" path=""/>
+ <buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
+</buildpath>
Index: includes/media/Generic.php
===================================================================
--- includes/media/Generic.php (revision 104407)
+++ includes/media/Generic.php (working copy)
@@ -504,6 +504,15 @@
}
return false;
}
+ /**
+ * Remove files from the purge list
+ *
+ * @param array $files
+ * @param array $options
+ */
+ public function filterThumbnailPurgeList( &$files, $options ) {
+ // Do nothing
+ }
}
/**
Index: includes/filerepo/file/File.php
===================================================================
--- includes/filerepo/file/File.php (revision 104407)
+++ includes/filerepo/file/File.php (working copy)
@@ -863,8 +863,9 @@
* Purge shared caches such as thumbnails and DB data caching
* STUB
* Overridden by LocalFile
+ * @param array $options Array with options, currently undefined
*/
- function purgeCache() {}
+ function purgeCache( $options = array() ) {}
/**
* Purge the file description page, but don't go after
Index: includes/filerepo/file/ForeignAPIFile.php
===================================================================
--- includes/filerepo/file/ForeignAPIFile.php (revision 104407)
+++ includes/filerepo/file/ForeignAPIFile.php (working copy)
@@ -214,8 +214,11 @@
return $files;
}
- function purgeCache() {
- $this->purgeThumbnails();
+ /**
+ * @see File::purgeCache()
+ */
+ function purgeCache( $options = array() ) {
+ $this->purgeThumbnails( $options );
$this->purgeDescriptionPage();
}
@@ -226,11 +229,17 @@
$wgMemc->delete( $key );
}
- function purgeThumbnails() {
+ function purgeThumbnails( $options = array() ) {
global $wgMemc;
$key = $this->repo->getLocalCacheKey( 'ForeignAPIRepo', 'ThumbUrl', $this->getName() );
$wgMemc->delete( $key );
$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() );
foreach ( $files as $file ) {
unlink( $dir . $file );
Index: includes/filerepo/file/LocalFile.php
===================================================================
--- includes/filerepo/file/LocalFile.php (revision 104407)
+++ includes/filerepo/file/LocalFile.php (working copy)
@@ -675,12 +675,12 @@
/**
* Delete all previously generated thumbnails, refresh metadata in memcached and purge the squid
*/
- function purgeCache() {
+ function purgeCache( $options = array() ) {
// Refresh metadata cache
$this->purgeMetadataCache();
// Delete thumbnails
- $this->purgeThumbnails();
+ $this->purgeThumbnails( $options );
// Purge squid cache for this file
SquidUpdate::purge( array( $this->getURL() ) );
@@ -723,11 +723,18 @@
/**
* Delete cached transformed files for the current version only.
*/
- function purgeThumbnails() {
+ function purgeThumbnails( $options ) {
global $wgUseSquid;
// Delete thumbnails
$files = $this->getThumbnails();
+
+ // Give media handler a chance to filter the purge list
+ $handler = $this->getHandler();
+ if ( $handler ) {
+ $handler->filterThumbnailPurgeList( $files, $options );
+ }
+
$dir = array_shift( $files );
$this->purgeThumbList( $dir, $files );
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
7143
Default Alt Text
MediaHandlers.filterThumbPurge.patch (3 KB)
Attached To
Mode
T29641: purgeThumbnails should support exclusion of expensive files
Attached
Detach File
Event Timeline
Log In to Comment