Skip to content
Snippets Groups Projects
Commit c96f9f0c authored by Calvin Walton's avatar Calvin Walton
Browse files

Add a function to compare BBB version numbers

This can be used to check if e.g. recording is from a 0.9.0 or newer server
parent 18bbf0c3
No related branches found
No related tags found
No related merge requests found
......@@ -450,5 +450,52 @@ module BigBlueButton
recording['bbb_version']
end
# Compare version numbers
# Returns true if version is newer than requested version
def self.bbb_version_compare(events_xml, major, minor=nil, micro=nil)
bbb_version = self.bbb_version(events_xml)
if bbb_version.nil?
# BigBlueButton 0.81 or earler
return false
end
# Split the version string
match = /^(\d+)\.(\d+)\.(\d+)/.match(bbb_version)
if !match
raise "bbb_version #{bbb_version} is not in the correct format"
end
# Check major version mismatch
if match[1].to_i > major
return true
end
if match[1].to_i < major
return false
end
# Check minor version mismatch
if minor.nil?
return true
else
if match[2].to_i > minor
return true
end
if match[2].to_i < minor
return false
end
end
# Check micro version mismatch
if micro.nil?
return true
else
if match[3].to_i >= micro
return true
else
return false
end
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment