From 534c17bb7317b9dfecc5afda6fac50d135b6c18b Mon Sep 17 00:00:00 2001 From: Christian Rijke Date: Thu, 18 Jul 2013 11:02:52 +0200 Subject: [PATCH] The MySQL has been fixed. Update the version check to enforce the correct patch level. --- lib/reporting_engine/engine.rb | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/reporting_engine/engine.rb b/lib/reporting_engine/engine.rb index 40ef975b83..8346af1ce3 100644 --- a/lib/reporting_engine/engine.rb +++ b/lib/reporting_engine/engine.rb @@ -14,12 +14,20 @@ module ReportingEngine connection = ActiveRecord::Base.connection adapter_name = connection.adapter_name.to_s.downcase.to_sym if [:mysql, :mysql2].include?(adapter_name) + # The reporting engine is incompatible with the + # following mysql versions due to a bug in MySQL itself: + # 5.6.0 - 5.6.12 + # 5.7.0 - 5.7.1 + # see https://www.openproject.org/issues/967 for details. + required_patch_levels = { "5.6" => 13, "5.7" => 2 } + mysql_version = connection.show_variable("VERSION") - if mysql_version.start_with?("5.6") - # The reporting engine is not compatible with mysql version 5.6 - # due to a bug in MySQL itself. - # see https://www.openproject.org/issues/967 for details. - raise "MySQL 5.6 is not yet supported." + release_version, patch_level = mysql_version.match(/(\d*\.\d*)\.(\d*)/).captures + required_patch_level = required_patch_levels[release_version] + + if required_patch_level && (patch_level.to_i < required_patch_level) + raise "MySQL #{mysql_version} is not supported. Version #{release_version} \ + requires patch level >= #{required_patch_level}." end end end