Reorder remaining code in Msf::DBManager

MSP-11124
This commit is contained in:
Luke Imhoff 2014-10-13 15:13:28 -05:00
parent acdf6e7dbf
commit 4371254dd2
No known key found for this signature in database
GPG Key ID: 5B1FB01FB33356F8
1 changed files with 30 additions and 18 deletions

View File

@ -142,21 +142,19 @@ class DBManager
# Provides :framework and other accessors
include Msf::Framework::Offspring
# Mainly, it's Ruby 1.9.1 that cause a lot of problems now, along with Ruby 1.8.6.
# Ruby 1.8.7 actually seems okay, but why tempt fate? Let's say 1.9.3 and beyond.
def warn_about_rubies
if ::RUBY_VERSION =~ /^1\.9\.[012]($|[^\d])/
$stderr.puts "**************************************************************************************"
$stderr.puts "Metasploit requires at least Ruby 1.9.3. For an easy upgrade path, see https://rvm.io/"
$stderr.puts "**************************************************************************************"
end
end
#
# Attributes
#
# Stores the error message for why the db was not loaded
attr_accessor :error
# Returns true if the prerequisites have been installed
attr_accessor :usable
# Stores the error message for why the db was not loaded
attr_accessor :error
#
# iniitialize
#
def initialize(framework, opts = {})
@ -176,6 +174,19 @@ class DBManager
initialize_database_support
end
#
# Instance Methods
#
#
# Determines if the database is functional
#
def check
::ActiveRecord::Base.connection_pool.with_connection {
res = ::Mdm::Host.find(:first)
}
end
#
# Do what is necessary to load our database support
#
@ -207,13 +218,14 @@ class DBManager
true
end
#
# Determines if the database is functional
#
def check
::ActiveRecord::Base.connection_pool.with_connection {
res = ::Mdm::Host.find(:first)
}
# Mainly, it's Ruby 1.9.1 that cause a lot of problems now, along with Ruby 1.8.6.
# Ruby 1.8.7 actually seems okay, but why tempt fate? Let's say 1.9.3 and beyond.
def warn_about_rubies
if ::RUBY_VERSION =~ /^1\.9\.[012]($|[^\d])/
$stderr.puts "**************************************************************************************"
$stderr.puts "Metasploit requires at least Ruby 1.9.3. For an easy upgrade path, see https://rvm.io/"
$stderr.puts "**************************************************************************************"
end
end
end
end