From 4a5442edaa5d598eea969ac023dc394761f38d7b Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Fri, 14 Jun 2024 10:36:57 -0500 Subject: [PATCH] Add ffmpeg and ImageMagick versions to admin dashboard (#30710) --- .../dimension/software_versions_dimension.rb | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/app/lib/admin/metrics/dimension/software_versions_dimension.rb b/app/lib/admin/metrics/dimension/software_versions_dimension.rb index 9dd0d393f..8a9183db3 100644 --- a/app/lib/admin/metrics/dimension/software_versions_dimension.rb +++ b/app/lib/admin/metrics/dimension/software_versions_dimension.rb @@ -10,7 +10,7 @@ class Admin::Metrics::Dimension::SoftwareVersionsDimension < Admin::Metrics::Dim protected def perform_query - [mastodon_version, ruby_version, postgresql_version, redis_version, elasticsearch_version, libvips_version].compact + [mastodon_version, ruby_version, postgresql_version, redis_version, elasticsearch_version, libvips_version, imagemagick_version, ffmpeg_version].compact end def mastodon_version @@ -82,6 +82,34 @@ class Admin::Metrics::Dimension::SoftwareVersionsDimension < Admin::Metrics::Dim } end + def imagemagick_version + return if Rails.configuration.x.use_vips + + version = `convert -version`.match(/Version: ImageMagick ([\d\.]+)/)[1] + + { + key: 'imagemagick', + human_key: 'ImageMagick', + value: version, + human_value: version, + } + rescue Errno::ENOENT + nil + end + + def ffmpeg_version + version = `ffmpeg -version`.match(/ffmpeg version ([\d\.]+)/)[1] + + { + key: 'ffmpeg', + human_key: 'FFmpeg', + value: version, + human_value: version, + } + rescue Errno::ENOENT + nil + end + def redis_info @redis_info ||= if redis.is_a?(Redis::Namespace) redis.redis.info