r108009 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108008‎ | r108009 | r108010 >
Date:10:41, 4 January 2012
Author:maxsem
Status:ok
Tags:
Comment:
Made installer not install on SQLite less than 3.3.7, would prevent stuff like bug 25746. Also, threw MSSQL out of release notes - it can't be installed through the usual means.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/installer/DatabaseInstaller.php (modified) (history)
  • /trunk/phase3/includes/installer/Installer.i18n.php (modified) (history)
  • /trunk/phase3/includes/installer/Installer.php (modified) (history)
  • /trunk/phase3/includes/installer/SqliteInstaller.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -295,13 +295,13 @@
296296
297297 MySQL is the recommended DBMS. PostgreSQL or SQLite can also be used, but
298298 support for them is somewhat less mature. There is experimental support for IBM
299 -DB2 and Microsoft SQL Server.
 299+DB2 and Oracle.
300300
301301 The supported versions are:
302302
303303 * MySQL 5.0.2 or later
304304 * PostgreSQL 8.3 or later
305 -* SQLite 3
 305+* SQLite 3.3.7 or later
306306 * Oracle 9.0.1 or later
307307
308308 == Upgrading ==
Index: trunk/phase3/includes/installer/Installer.php
@@ -634,19 +634,32 @@
635635 $allNames[] = wfMsg( "config-type-$name" );
636636 }
637637
638 - if ( !$this->getVar( '_CompiledDBs' ) ) {
 638+ // cache initially available databases to make sure that everything will be displayed correctly
 639+ // after a refresh on env checks page
 640+ $databases = $this->getVar( '_CompiledDBs-preFilter' );
 641+ if ( !$databases ) {
 642+ $databases = $this->getVar( '_CompiledDBs' );
 643+ $this->setVar( '_CompiledDBs-preFilter', $databases );
 644+ }
 645+
 646+ $databases = array_flip ( $databases );
 647+ foreach ( array_keys( $databases ) as $db ) {
 648+ $installer = $this->getDBInstaller( $db );
 649+ $status = $installer->checkPrerequisites();
 650+ if ( !$status->isGood() ) {
 651+ $this->showStatusMessage( $status );
 652+ }
 653+ if ( !$status->isOK() ) {
 654+ unset( $databases[$db] );
 655+ }
 656+ }
 657+ $databases = array_flip( $databases );
 658+ if ( !$databases ) {
639659 $this->showError( 'config-no-db', $wgLang->commaList( $allNames ) );
640660 // @todo FIXME: This only works for the web installer!
641661 return false;
642662 }
643 -
644 - // Check for FTS3 full-text search module
645 - $sqlite = $this->getDBInstaller( 'sqlite' );
646 - if ( $sqlite->isCompiled() ) {
647 - if( DatabaseSqlite::getFulltextSearchModule() != 'FTS3' ) {
648 - $this->showMessage( 'config-no-fts3' );
649 - }
650 - }
 663+ $this->setVar( '_CompiledDBs', $databases );
651664 }
652665
653666 /**
Index: trunk/phase3/includes/installer/Installer.i18n.php
@@ -103,6 +103,7 @@
104104 If you are on shared hosting, ask your hosting provider to install a suitable database driver.
105105 If you compiled PHP yourself, reconfigure it with a database client enabled, for example using <code>./configure --with-mysql</code>.
106106 If you installed PHP from a Debian or Ubuntu package, then you also need install the php5-mysql module.',
 107+ 'config-outdated-sqlite' => "'''Warning''': you have SQLite $1, which is lower than minimum required version $2. SQLite will be unavailable.",
107108 'config-no-fts3' => "'''Warning''': SQLite is compiled without the [//sqlite.org/fts3.html FTS3 module], search features will be unavailable on this backend.",
108109 'config-register-globals' => "'''Warning: PHP's <code>[http://php.net/register_globals register_globals]</code> option is enabled.'''
109110 '''Disable it if you can.'''
Index: trunk/phase3/includes/installer/SqliteInstaller.php
@@ -13,6 +13,7 @@
1414 * @since 1.17
1515 */
1616 class SqliteInstaller extends DatabaseInstaller {
 17+ const MINIMUM_VERSION = '3.3.7';
1718
1819 /**
1920 * @var DatabaseSqlite
@@ -32,6 +33,24 @@
3334 return self::checkExtension( 'pdo_sqlite' );
3435 }
3536
 37+ /**
 38+ *
 39+ * @return Status:
 40+ */
 41+ public function checkPrerequisites() {
 42+ $result = Status::newGood();
 43+ // Bail out if SQLite is too old
 44+ $db = new DatabaseSqliteStandalone( ':memory:' );
 45+ if ( version_compare( $db->getServerVersion(), self::MINIMUM_VERSION, '<' ) ) {
 46+ $result->fatal( 'config-outdated-sqlite', $db->getServerVersion(), self::MINIMUM_VERSION );
 47+ }
 48+ // Check for FTS3 full-text search module
 49+ if( DatabaseSqlite::getFulltextSearchModule() != 'FTS3' ) {
 50+ $result->warning( 'config-no-fts3' );
 51+ }
 52+ return $result;
 53+ }
 54+
3655 public function getGlobalDefaults() {
3756 if ( isset( $_SERVER['DOCUMENT_ROOT'] ) ) {
3857 $path = str_replace(
Index: trunk/phase3/includes/installer/DatabaseInstaller.php
@@ -55,6 +55,15 @@
5656 public abstract function isCompiled();
5757
5858 /**
 59+ * Checks for installation prerequisites other than those checked by isCompiled()
 60+ * @since 1.19
 61+ * @return Status
 62+ */
 63+ public function checkPrerequisites() {
 64+ return Status::newGood();
 65+ }
 66+
 67+ /**
5968 * Get HTML for a web form that configures this database. Configuration
6069 * at this time should be the minimum needed to connect and test
6170 * whether install or upgrade is required.

Status & tagging log