Skip to content

A platform for community discussion. Free, open, simple.

DEV: Stop if theme:update fails for default site (#15090)

Dan Ungureanub1844c45c389
diff --git a/lib/tasks/themes.rake b/lib/tasks/themes.rake
index ddc3abb4e3f..5dbcae6367c 100644
--- a/lib/tasks/themes.rake
+++ b/lib/tasks/themes.rake
@@ -52,24 +52,23 @@ task "themes:install" => :environment do |task, args|
end
end
-def update_themes(fail_stop: true)
+def update_themes
Theme.includes(:remote_theme).where(enabled: true, auto_update: true).find_each do |theme|
begin
- next if theme.remote_theme.blank?
+ remote_theme = theme.remote_theme
+ next if remote_theme.blank?
puts "Updating '#{theme.name}' for '#{RailsMultisite::ConnectionManagement.current_db}'..."
- theme.remote_theme.update_from_remote
+ remote_theme.update_from_remote
- if theme.remote_theme.last_error_text.present?
- puts "Error updating '#{theme.name}': #{theme.remote_theme.last_error_text}"
- exit 1 if fail_stop
- end
+ raise RemoteTheme::ImportError.new(remote_theme.last_error_text) if remote_theme.last_error_text.present?
rescue => e
STDERR.puts "Failed to update '#{theme.name}': #{e}"
- STDERR.puts e.backtrace
- exit 1 if fail_stop
+ raise if RailsMultisite::ConnectionManagement.current_db == "default"
end
end
+
+ true
end
desc "Update themes & theme components"
@@ -78,7 +77,7 @@ task "themes:update" => :environment do
update_themes
else
RailsMultisite::ConnectionManagement.each_connection do
- update_themes(fail_stop: false)
+ update_themes
end
end
end