Page MenuHomePhabricator

"config-outdated-sqlite" i18n message wrong
Closed, ResolvedPublicBUG REPORT

Description

Steps to Reproduce:
php maintenance/install.php --env-checks

Actual Results:

Warning: you have SQLite 3.8.0, which is lower than minimum required version 3.7.17. SQLite will be unavailable.

Expected Results:

Warning: you have SQLite 3.7.17, which is lower than minimum required version 3.8.0. SQLite will be unavailable.

// includes/installer/DatabaseInstaller.php
public static function meetsMinimumRequirement( $serverVersion ) {
    if ( version_compare( $serverVersion, static::$minimumVersion ) < 0 ) {
        return Status::newFatal(
            static::$notMiniumumVerisonMessage, static::$minimumVersion, $serverVersion
        );
    }
    return Status::newGood();
}
// includes/installer/SqliteInstaller.php
public function checkPrerequisites() {
    // Bail out if SQLite is too old
    $db = DatabaseSqlite::newStandaloneInstance( ':memory:' );
    $result = static::meetsMinimumRequirement( $db->getServerVersion() );
    // more code...
}
// includes/installer/i18n/en.json
"config-outdated-sqlite": "<strong>Warning:</strong> you have SQLite $1, which is lower than minimum required version $2. SQLite will be unavailable.",

Due the logic of DatabaseInstaller::meetsMinimumRequirement(), $1 is the minimum version and $2 is the server version. The variable positions for the i18n message is exactly the opposite.

Event Timeline

This bug has existed since 1.30 (introduced in b907358). The patch should be ported backwards into REL1_31, REL1_32 and REL1_33.

Change 512548 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/core@master] Make config-outdated-sqlite parameter numbers consistent with config-*-old

https://gerrit.wikimedia.org/r/512548

@Reedy I don't know what happened. I ran php maintenance/install.php --env-checks again today and found that the output text was as expected. I am pretty sure that I am running on master branch.

Screenshot_20190527_230958.jpg (901×1 px, 257 KB)

It is very likely that I ignored something and I apologize.

I don't think it can be, though...

	"config-outdated-sqlite": "<strong>Warning:</strong> you have SQLite $1, which is lower than minimum required version $2. SQLite will be unavailable.",
	"config-mysql-old": "MySQL $1 or later is required. You have $2.",
	"config-postgres-old": "PostgreSQL $1 or later is required. You have $2.",
	"config-mssql-old": "Microsoft SQL Server $1 or later is required. You have $2.",

They all use the same PHP function for it

	/**
	 * Whether the provided version meets the necessary requirements for this type
	 *
	 * @param string $serverVersion Output of Database::getServerVersion()
	 * @return Status
	 * @since 1.30
	 */
	public static function meetsMinimumRequirement( $serverVersion ) {
		if ( version_compare( $serverVersion, static::$minimumVersion ) < 0 ) {
			return Status::newFatal(
				static::$notMinimumVerisonMessage, static::$minimumVersion, $serverVersion
			);
		}

		return Status::newGood();
	}

Related 008428c. It swap the incoming variable of static::$minimumVersion and $serverVersion, made this bug fixed. But also caused an warming on config-*-old i18n messages. In config-*-old, the minimum version is in front, the system version is behind. In config-outdated-sqlite, quite the opposite.

Related 008428c. It swap the incoming variable of static::$minimumVersion and $serverVersion, made this bug fixed. But also caused an warming on config-*-old i18n messages. In config-*-old, the minimum version is in front, the system version is behind. In config-outdated-sqlite, quite the opposite.

That commit is not related...

Related 008428c. It swap the incoming variable of static::$minimumVersion and $serverVersion, made this bug fixed. But also caused an warming on config-*-old i18n messages. In config-*-old, the minimum version is in front, the system version is behind. In config-outdated-sqlite, quite the opposite.

That commit is not related...

Sorry, is a469e81 :) I copied its parent before.

Related 008428c. It swap the incoming variable of static::$minimumVersion and $serverVersion, made this bug fixed. But also caused an warming on config-*-old i18n messages. In config-*-old, the minimum version is in front, the system version is behind. In config-outdated-sqlite, quite the opposite.

That commit is not related...

Sorry, is a469e81 :) I copied its parent before.

Ugh. That line wasn't supposed to make it through, as it breaks the rest

Change 512548 merged by jenkins-bot:
[mediawiki/core@master] Make config-outdated-sqlite parameter numbers consistent with config-*-old

https://gerrit.wikimedia.org/r/512548

Change 512928 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/core@REL1_33] Make config-outdated-sqlite parameter numbers consistent with config-*-old

https://gerrit.wikimedia.org/r/512928

Change 512929 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/core@REL1_32] Make config-outdated-sqlite parameter numbers consistent with config-*-old

https://gerrit.wikimedia.org/r/512929

Change 512930 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/core@REL1_31] Make config-outdated-sqlite parameter numbers consistent with config-*-old

https://gerrit.wikimedia.org/r/512930

Change 512931 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/core@REL1_30] Make config-outdated-sqlite parameter numbers consistent with config-*-old

https://gerrit.wikimedia.org/r/512931

Change 512928 merged by jenkins-bot:
[mediawiki/core@REL1_33] Make config-outdated-sqlite parameter numbers consistent with config-*-old

https://gerrit.wikimedia.org/r/512928

Change 512929 merged by jenkins-bot:
[mediawiki/core@REL1_32] Make config-outdated-sqlite parameter numbers consistent with config-*-old

https://gerrit.wikimedia.org/r/512929

Change 512930 merged by jenkins-bot:
[mediawiki/core@REL1_31] Make config-outdated-sqlite parameter numbers consistent with config-*-old

https://gerrit.wikimedia.org/r/512930

Change 512931 merged by Reedy:
[mediawiki/core@REL1_30] Make config-outdated-sqlite parameter numbers consistent with config-*-old

https://gerrit.wikimedia.org/r/512931

Reedy claimed this task.
Reedy edited projects, added MW-1.30-release; removed Patch-For-Review.