From 925707a3e834925ac70c1b429c41559790e0c2a8 Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Thu, 4 Aug 2022 03:25:04 +0300 Subject: [PATCH] mediawiki: enable QuickInstantCommons --- cookbooks/mediawiki/resources/site.rb | 16 +++++++++++----- .../templates/default/LocalSettings.php.erb | 16 ---------------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/cookbooks/mediawiki/resources/site.rb b/cookbooks/mediawiki/resources/site.rb index 0508bcbad..03f57faa6 100644 --- a/cookbooks/mediawiki/resources/site.rb +++ b/cookbooks/mediawiki/resources/site.rb @@ -508,11 +508,17 @@ action :create do update_site false end - # Broken Extension - 3 April 2022 - Remove. See https://github.com/openstreetmap/chef/pull/491#issuecomment-1086759504 - mediawiki_extension "QuickInstantCommons" do - site new_resource.site - update_site false - action :delete + if new_resource.commons + mediawiki_extension "QuickInstantCommons" do + site new_resource.site + update_site false + end + else + mediawiki_extension "QuickInstantCommons" do + site new_resource.site + update_site false + action :delete + end end cookbook_file "#{site_directory}/cc-wiki.png" do diff --git a/cookbooks/mediawiki/templates/default/LocalSettings.php.erb b/cookbooks/mediawiki/templates/default/LocalSettings.php.erb index d5bbf71a7..5c88ccce5 100644 --- a/cookbooks/mediawiki/templates/default/LocalSettings.php.erb +++ b/cookbooks/mediawiki/templates/default/LocalSettings.php.erb @@ -112,22 +112,6 @@ $wgSVGConverters = array( 'rsvg' => '/usr/bin/rsvg-convert -w $width -h $height $wgSVGConverter = 'rsvg'; $wgSVGMaxSize = 2000; -<% if @mediawiki[:commons] -%> -# 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' => 604800, - 'apiThumbCacheExpiry' => 604800, -]; -<% end -%> - ## If you use ImageMagick (or any other shell command) on a ## Linux server, this will need to be set to the name of an ## available UTF-8 locale -- 2.39.5