Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F7612
wgExcludeFromThumbnailPurge.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Authored By
•
bzimport
Nov 21 2014, 11:29 PM
2014-11-21 23:29:32 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
wgExcludeFromThumbnailPurge.patch
View Options
Index: includes/DefaultSettings.php
===================================================================
--- includes/DefaultSettings.php (revision 83265)
+++ includes/DefaultSettings.php (working copy)
@@ -4619,6 +4619,12 @@
);
/**
+ * Extension of "thumbnails" that are very expensive to regenerate and should be
+ * excluded from normal action=purge thumbnail removal.
+ */
+$wgExcludeFromThumbnailPurge = array();
+
+/**
* Additional functions to be performed with updateSpecialPages.
* Expensive Querypages are already updated.
*/
Index: includes/filerepo/LocalFile.php
===================================================================
--- includes/filerepo/LocalFile.php (revision 83265)
+++ includes/filerepo/LocalFile.php (working copy)
@@ -659,7 +659,7 @@
* Delete cached transformed files
*/
function purgeThumbnails() {
- global $wgUseSquid;
+ global $wgUseSquid, $wgExcludeFromThumbnailPurge;
// Delete thumbnails
$files = $this->getThumbnails();
@@ -667,6 +667,12 @@
$urls = array();
foreach ( $files as $file ) {
+ // Only remove files not in the $wgExcludeFromThumbnailPurge configuration variable
+ $ext = pathinfo("$dir/$file", PATHINFO_EXTENSION);
+ if( in_array( $ext, $wgExcludeFromThumbnailPurge ) ){
+ continue;
+ }
+
# Check that the base file name is part of the thumb name
# This is a basic sanity check to avoid erasing unrelated directories
if ( strpos( $file, $this->getName() ) !== false ) {
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
7141
Default Alt Text
wgExcludeFromThumbnailPurge.patch (1 KB)
Attached To
Mode
T29641: purgeThumbnails should support exclusion of expensive files
Attached
Detach File
Event Timeline
Log In to Comment