A platform for community discussion. Free, open, simple.
FIX: Make themes:update work with multisites (#14082)
Dan Ungureanuc0ec1e931e4c
diff --git a/lib/tasks/themes.rake b/lib/tasks/themes.rakeindex 51746bd268b..1e2fdfacc03 100644--- a/lib/tasks/themes.rake+++ b/lib/tasks/themes.rake@@ -52,21 +52,20 @@ task "themes:install" => :environment do |task, args|endend-desc "Update themes & theme components"-task "themes:update" => :environment do |task, args|+def update_themesTheme.where(auto_update: true, enabled: true).find_each do |theme|beginif theme.remote_theme.present?- puts "Updating #{theme.name}..."+ puts "Updating '#{theme.name}' for '#{RailsMultisite::ConnectionManagement.current_db}'..."theme.remote_theme.update_from_remotetheme.save!unless theme.remote_theme.last_error_text.nil?- puts "Error updating #{theme.name}: #{theme.remote_theme.last_error_text}"+ puts "Error updating '#{theme.name}': #{theme.remote_theme.last_error_text}"exit 1endendrescue => e- STDERR.puts "Failed to update #{theme.name}"+ STDERR.puts "Failed to update '#{theme.name}'"STDERR.puts eSTDERR.puts e.backtraceexit 1@@ -74,6 +73,17 @@ task "themes:update" => :environment do |task, args|endend+desc "Update themes & theme components"+task "themes:update" => :environment do+ if ENV['RAILS_DB'].present?+ update_themes+ else+ RailsMultisite::ConnectionManagement.each_connection do+ update_themes+ end+ end+end+desc "List all the installed themes on the site"task "themes:audit" => :environment docomponents = Set.new