From 8e9c9e21a5fc964dde220cfa0e99d98bd3739c0a Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 28 Oct 2021 12:27:59 +0100 Subject: [PATCH] Enable thumbnail caching for images from wikimedia commons --- .../templates/default/LocalSettings.php.erb | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/cookbooks/mediawiki/templates/default/LocalSettings.php.erb b/cookbooks/mediawiki/templates/default/LocalSettings.php.erb index 2bd1a7297..8b29cc7c4 100644 --- a/cookbooks/mediawiki/templates/default/LocalSettings.php.erb +++ b/cookbooks/mediawiki/templates/default/LocalSettings.php.erb @@ -111,11 +111,20 @@ $wgSVGConverters = array( 'rsvg' => '/usr/bin/rsvg-convert -w $width -h $height $wgSVGConverter = 'rsvg'; $wgSVGMaxSize = 2000; -# InstantCommons allows wiki to use images from https://commons.wikimedia.org <% if @mediawiki[:commons] -%> -$wgUseInstantCommons = true; -<% else -%> -$wgUseInstantCommons = false; +# Enable use of images from https://commons.wikimedia.org +$wgForeignFileRepos[] = [ + 'class' => ForeignAPIRepo::class, + 'name' => 'wikimediacommons', + 'apibase' => 'https://commons.wikimedia.org/w/api.php', + 'url' => 'https://upload.wikimedia.org/wikipedia/commons', + 'thumbUrl' => 'https://upload.wikimedia.org/wikipedia/commons/thumb', + 'hashLevels' => 2, + 'transformVia404' => true, + 'fetchDescription' => true, + 'descriptionCacheExpiry' => 43200, + 'apiThumbCacheExpiry' => 86400, +]; <% end -%> ## If you use ImageMagick (or any other shell command) on a -- 2.43.2