DEV: Add site's DB name in themes:update rake task when printing error (#26749)

This is essential for us to determine which site is encountering an
error while updating remote themes. We are also including the theme's id
because themes can have the same name.
This commit is contained in:
Alan Guo Xiang Tan 2024-04-25 12:41:14 +08:00 committed by GitHub
parent 1f73e7d039
commit 9b829216b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -67,7 +67,9 @@ def update_themes
next if remote_theme.blank? || remote_theme.remote_url.blank? next if remote_theme.blank? || remote_theme.remote_url.blank?
print "Checking '#{theme.name}' for '#{RailsMultisite::ConnectionManagement.current_db}'... " print "Checking '#{theme.name}' for '#{RailsMultisite::ConnectionManagement.current_db}'... "
remote_theme.update_remote_version remote_theme.update_remote_version
if remote_theme.out_of_date? if remote_theme.out_of_date?
puts "updating from #{remote_theme.local_version[0..7]} to #{remote_theme.remote_version[0..7]}" puts "updating from #{remote_theme.local_version[0..7]} to #{remote_theme.remote_version[0..7]}"
remote_theme.update_from_remote(already_in_transaction: true) remote_theme.update_from_remote(already_in_transaction: true)
@ -79,7 +81,7 @@ def update_themes
raise RemoteTheme::ImportError.new(remote_theme.last_error_text) raise RemoteTheme::ImportError.new(remote_theme.last_error_text)
end end
rescue => e rescue => e
STDERR.puts "Failed to update '#{theme.name}': #{e}" STDERR.puts "[#{RailsMultisite::ConnectionManagement.current_db}] Failed to update '#{theme.name}' (#{theme.id}): #{e}"
raise if ENV["RAISE_THEME_ERRORS"] == "1" raise if ENV["RAISE_THEME_ERRORS"] == "1"
end end
end end