mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-08 08:44:27 +00:00
Adjust magick version detection in admin panel (#30845)
This commit is contained in:
parent
8edd77a755
commit
91fbd5b422
|
@ -85,7 +85,14 @@ class Admin::Metrics::Dimension::SoftwareVersionsDimension < Admin::Metrics::Dim
|
||||||
def imagemagick_version
|
def imagemagick_version
|
||||||
return if Rails.configuration.x.use_vips
|
return if Rails.configuration.x.use_vips
|
||||||
|
|
||||||
version = `convert -version`.match(/Version: ImageMagick ([\d\.]+)/)[1]
|
imagemagick_binary = Paperclip.options[:is_windows] ? 'magick convert' : 'convert'
|
||||||
|
|
||||||
|
version_output = Terrapin::CommandLine.new(imagemagick_binary, '-version').run
|
||||||
|
version_match = version_output.match(/Version: ImageMagick (\S+)/)[1].strip
|
||||||
|
|
||||||
|
return nil unless version_match
|
||||||
|
|
||||||
|
version = version_match
|
||||||
|
|
||||||
{
|
{
|
||||||
key: 'imagemagick',
|
key: 'imagemagick',
|
||||||
|
@ -93,7 +100,7 @@ class Admin::Metrics::Dimension::SoftwareVersionsDimension < Admin::Metrics::Dim
|
||||||
value: version,
|
value: version,
|
||||||
human_value: version,
|
human_value: version,
|
||||||
}
|
}
|
||||||
rescue Errno::ENOENT
|
rescue Terrapin::CommandNotFoundError, Terrapin::ExitStatusError, Paperclip::Errors::CommandNotFoundError, Paperclip::Errors::CommandFailedError
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue