Clean-up after #946968.

From: Damien Tournoud <damien@commerceguys.com>


---
 bootstrap.inc               |   15 ---------------
 database/mysql/install.inc  |    7 +++----
 database/pgsql/install.inc  |    4 ++--
 database/sqlite/install.inc |   11 +++++++++--
 install.inc                 |   31 +++++++++++++++++++++++++++----
 5 files changed, 41 insertions(+), 27 deletions(-)

diff --git includes/bootstrap.inc includes/bootstrap.inc
index 810de99..0938c89 100644
--- includes/bootstrap.inc
+++ includes/bootstrap.inc
@@ -27,21 +27,6 @@ define('DRUPAL_MINIMUM_PHP',    '5.2.4');
 define('DRUPAL_MINIMUM_PHP_MEMORY_LIMIT',    '32M');
 
 /**
- * Minimum supported version of MySQL, if it is used.
- */
-define('DRUPAL_MINIMUM_MYSQL',  '5.0.15');
-
-/**
- * Minimum supported version of PostgreSQL, if it is used.
- */
-define('DRUPAL_MINIMUM_PGSQL',  '8.3');
-
-/**
- * Minimum supported version of SQLite, if it is used.
- */
-define('DRUPAL_MINIMUM_SQLITE',  '3.3.7');
-
-/**
  * Indicates that the item should never be removed unless explicitly selected.
  *
  * The item may be removed using cache_clear_all() with a cache ID.
diff --git includes/database/mysql/install.inc includes/database/mysql/install.inc
index eda4f70..c735329 100644
--- includes/database/mysql/install.inc
+++ includes/database/mysql/install.inc
@@ -10,7 +10,6 @@
  * Specifies installation tasks for MySQL and equivalent databases.
  */
 class DatabaseTasks_mysql extends DatabaseTasks {
-
   /**
    * The PDO driver name for MySQL and equivalent databases.
    *
@@ -26,10 +25,10 @@ class DatabaseTasks_mysql extends DatabaseTasks {
   }
 
   /**
-   * Returns the minimum version for mysql.
+   * Returns the minimum version for MySQL.
    */
-  protected function minimumVersion() {
-    return DRUPAL_MINIMUM_MYSQL;
+  public function minimumVersion() {
+    return '5.0.15';
   }
 }
 
diff --git includes/database/pgsql/install.inc includes/database/pgsql/install.inc
index 120f399..7b8b722 100644
--- includes/database/pgsql/install.inc
+++ includes/database/pgsql/install.inc
@@ -31,8 +31,8 @@ class DatabaseTasks_pgsql extends DatabaseTasks {
     return 'PostgreSQL';
   }
 
-  protected function minimumVersion() {
-    return DRUPAL_MINIMUM_PGSQL;
+  public function minimumVersion() {
+    return '8.3';
   }
 
   /**
diff --git includes/database/sqlite/install.inc includes/database/sqlite/install.inc
index 0d11f7a..72ebfa0 100644
--- includes/database/sqlite/install.inc
+++ includes/database/sqlite/install.inc
@@ -8,11 +8,18 @@
 
 class DatabaseTasks_sqlite extends DatabaseTasks {
   protected $pdoDriver = 'sqlite';
+
   public function name() {
     return 'SQLite';
   }
-  protected function minimumVersion() {
-    return DRUPAL_MINIMUM_SQLITE;
+
+  /**
+   * Minimum engine version.
+   *
+   * @TODO: consider upping to 3.6.8 in Drupal 8 to get SAVEPOINT support.
+   */
+  public function minimumVersion() {
+    return '3.3.7';
   }
 }
 
diff --git includes/install.inc includes/install.inc
index 2d8bc44..bba73a7 100644
--- includes/install.inc
+++ includes/install.inc
@@ -277,6 +277,10 @@ abstract class DatabaseTasks {
    */
   protected $tasks = array(
     array(
+      'function'    => 'checkEngineVersion',
+      'arguments'   => array(),
+    ),
+    array(
       'arguments'   => array(
         'CREATE TABLE drupal_install_test (id int NULL)',
         'Drupal can use CREATE TABLE database commands.',
@@ -348,8 +352,21 @@ abstract class DatabaseTasks {
     return $this->hasPdoDriver() && empty($this->error);
   }
 
+  /**
+   * Return the human-readable name of the driver.
+   */
   abstract public function name();
-  abstract protected function minimumVersion();
+
+  /**
+   * Return the minimum required version of the engine.
+   *
+   * @return
+   *   A version string. If not NULL, it will be checked against the version
+   *   reported by the Database engine using version_compare().
+   */
+  public function minimumVersion() {
+    return NULL;
+  }
 
   /**
    * Run database tasks and tests to see if Drupal can run on the database.
@@ -357,9 +374,6 @@ abstract class DatabaseTasks {
   public function runTasks() {
     // We need to establish a connection before we can run tests.
     if ($this->connect()) {
-      if (version_compare(Database::getConnection()->version(), $this->minimumVersion()) < 0) {
-        throw new DatabaseTaskException(st("The database version %version is less than the minimum required version %minimum_version.", array('%version' => Database::getConnection()->version(), '%minimum_version' => $this->minimumVersion())));
-      }
       foreach ($this->tasks as $task) {
         if (!isset($task['function'])) {
           $task['function'] = 'runTestQuery';
@@ -419,6 +433,15 @@ abstract class DatabaseTasks {
       return !$fatal;
     }
   }
+
+  /**
+   * Check the engine version.
+   */
+  protected function checkEngineVersion() {
+    if ($this->minimumVersion() && version_compare(Database::getConnection()->version(), $this->minimumVersion()) < 0) {
+      $this->fail(st("The database version %version is less than the minimum required version %minimum_version.", array('%version' => Database::getConnection()->version(), '%minimum_version' => $this->minimumVersion())));
+    }
+  }
 }
 /**
  * @class Exception class used to throw error if the DatabaseInstaller fails.
