Made installer not install on SQLite less than 3.3.7, would prevent stuff like bug...
authorMax Semenik <maxsem@users.mediawiki.org>
Wed, 4 Jan 2012 10:41:39 +0000 (10:41 +0000)
committerMax Semenik <maxsem@users.mediawiki.org>
Wed, 4 Jan 2012 10:41:39 +0000 (10:41 +0000)
RELEASE-NOTES-1.19
includes/installer/DatabaseInstaller.php
includes/installer/Installer.i18n.php
includes/installer/Installer.php
includes/installer/SqliteInstaller.php

index 8edb4ae..b80b52e 100644 (file)
@@ -295,13 +295,13 @@ MediaWiki 1.19 requires PHP 5.2.3. PHP 4 is no longer supported.
 
 MySQL is the recommended DBMS. PostgreSQL or SQLite can also be used, but
 support for them is somewhat less mature. There is experimental support for IBM
-DB2 and Microsoft SQL Server.
+DB2 and Oracle.
 
 The supported versions are:
 
 * MySQL 5.0.2 or later
 * PostgreSQL 8.3 or later
-* SQLite 3
+* SQLite 3.3.7 or later
 * Oracle 9.0.1 or later
 
 == Upgrading ==
index fca8661..b086478 100644 (file)
@@ -54,6 +54,15 @@ abstract class DatabaseInstaller {
         */
        public abstract function isCompiled();
 
+       /**
+        * Checks for installation prerequisites other than those checked by isCompiled()
+        * @since 1.19
+        * @return Status
+        */
+       public function checkPrerequisites() {
+               return Status::newGood();
+       }
+
        /**
         * Get HTML for a web form that configures this database. Configuration
         * at this time should be the minimum needed to connect and test
index ad0b546..67f92e9 100644 (file)
@@ -103,6 +103,7 @@ The following database types are supported: $1.
 If you are on shared hosting, ask your hosting provider to install a suitable database driver.
 If you compiled PHP yourself, reconfigure it with a database client enabled, for example using <code>./configure --with-mysql</code>.
 If you installed PHP from a Debian or Ubuntu package, then you also need install the php5-mysql module.',
+       'config-outdated-sqlite'          => "'''Warning''': you have SQLite $1, which is lower than minimum required version $2. SQLite will be unavailable.",
        'config-no-fts3'                  => "'''Warning''': SQLite is compiled without the [//sqlite.org/fts3.html FTS3 module], search features will be unavailable on this backend.",
        'config-register-globals'         => "'''Warning: PHP's <code>[http://php.net/register_globals register_globals]</code> option is enabled.'''
 '''Disable it if you can.'''
index 1c2cbff..0b7979d 100644 (file)
@@ -634,19 +634,32 @@ abstract class Installer {
                        $allNames[] = wfMsg( "config-type-$name" );
                }
 
-               if ( !$this->getVar( '_CompiledDBs' ) ) {
+               // cache initially available databases to make sure that everything will be displayed correctly
+               // after a refresh on env checks page
+               $databases = $this->getVar( '_CompiledDBs-preFilter' );
+               if ( !$databases ) {
+                       $databases = $this->getVar( '_CompiledDBs' );
+                       $this->setVar( '_CompiledDBs-preFilter', $databases );
+               }
+
+               $databases = array_flip ( $databases );
+               foreach ( array_keys( $databases ) as $db ) {
+                       $installer = $this->getDBInstaller( $db );
+                       $status = $installer->checkPrerequisites();
+                       if ( !$status->isGood() ) {
+                               $this->showStatusMessage( $status );
+                       }
+                       if ( !$status->isOK() ) {
+                               unset( $databases[$db] );
+                       }
+               }
+               $databases = array_flip( $databases );
+               if ( !$databases ) {
                        $this->showError( 'config-no-db', $wgLang->commaList( $allNames ) );
                        // @todo FIXME: This only works for the web installer!
                        return false;
                }
-
-               // Check for FTS3 full-text search module
-               $sqlite = $this->getDBInstaller( 'sqlite' );
-               if ( $sqlite->isCompiled() ) {
-                       if( DatabaseSqlite::getFulltextSearchModule() != 'FTS3' ) {
-                               $this->showMessage( 'config-no-fts3' );
-                       }
-               }
+               $this->setVar( '_CompiledDBs', $databases );
        }
 
        /**
index 67dd1ba..658a3b1 100644 (file)
@@ -13,6 +13,7 @@
  * @since 1.17
  */
 class SqliteInstaller extends DatabaseInstaller {
+       const MINIMUM_VERSION = '3.3.7';
 
        /**
         * @var DatabaseSqlite
@@ -32,6 +33,24 @@ class SqliteInstaller extends DatabaseInstaller {
                return self::checkExtension( 'pdo_sqlite' );
        }
 
+       /**
+        *
+        * @return Status:
+        */
+       public function checkPrerequisites() {
+               $result = Status::newGood();
+               // Bail out if SQLite is too old
+               $db = new DatabaseSqliteStandalone( ':memory:' );
+               if ( version_compare( $db->getServerVersion(), self::MINIMUM_VERSION, '<' ) ) {
+                       $result->fatal( 'config-outdated-sqlite', $db->getServerVersion(), self::MINIMUM_VERSION );
+               }
+               // Check for FTS3 full-text search module
+               if( DatabaseSqlite::getFulltextSearchModule() != 'FTS3' ) {
+                       $result->warning( 'config-no-fts3' );
+               }
+               return $result;
+       }
+
        public function getGlobalDefaults() {
                if ( isset( $_SERVER['DOCUMENT_ROOT'] ) ) {
                        $path = str_replace(