We have some nice constants on top of bootstrap.inc, and those are simply not used:

/**
 * 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');

We need to move them to the drivers and start checking the version of the servers. We do have a nice ->version() method, after all.

Bumping to major because I saw bug reports from people trying to install on MySQL < 5.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

webchick’s picture

Priority: Major » Critical

chx and crell and I discussed, bumping priority to critical.

dmitrig01’s picture

Status: Active » Needs review
FileSize
1.52 KB

this is for sure untested and probably doesn't work, and also is probably the wrong approach and only implemented for mysql, but here's something

Crell’s picture

Status: Needs review » Needs work

Yeah, not the right approach at all. :-)

dmitrig01’s picture

Status: Needs work » Needs review
FileSize
3.63 KB

Here's something more robust and tested, probably closer to working.

dmitrig01’s picture

FileSize
3.82 KB

upping min sqlite

dmitrig01’s picture

From IRC:

<dmitrig01>  Crell: the documentation for the function says " Run database tasks and tests to see if Drupal can run on the database."
<dmitrig01> Crell: this is technically a test to see if drupal can run on the database
Dries’s picture

Status: Needs review » Fixed

This looks good. Committed to CVS HEAD! :)

int’s picture

Priority: Critical » Minor
Status: Fixed » Active

Should't we move the constants DB version to the correspondent drivers?

Damien Tournoud’s picture

Priority: Minor » Critical

Erm. This is seriously messy.

Damien Tournoud’s picture

Assigned: Unassigned » Damien Tournoud

Working on a clean-up.

Damien Tournoud’s picture

Status: Active » Needs review
FileSize
5.05 KB

Here.

- removed the constants and fold everything in the database layer where it belongs
- removed the hardcoded check on top of runTests() and implement is as a proper test
- remove the API change: the DatabaseTasks::minimumVersion() method doesn't need to be implemented by all the existing drivers now. If not implemented, no version check will be performed.
- added/tighten-up documentation

Damien Tournoud’s picture

Assigned: Damien Tournoud » Unassigned
chx’s picture

Status: Needs review » Reviewed & tested by the community

Very nicely done. (Minor nitpick, i dislike the return NULL function body but that's a stable of DBTNG and does not belong here.)

Stevel’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
5.93 KB

I'm not sure about removing the constants (which have been around at least since drupal 5) this late in the development process. I would recommend keeping the constants here but mark them as deprecated instead.
(At least some consistency among the constants is required, DRUPAL_MINIMUM_SQLITE is left in by the patch in #11, but the other two are removed.)

Points 2 to 4 of #11 remain valid though.

A modified patch is attached.

chx’s picture

Status: Needs review » Reviewed & tested by the community

What.Ever.

Damien Tournoud’s picture

FileSize
5.24 KB

I uploaded the wrong patch. This one actually removes the SQLite constant too.

carlos8f’s picture

I would recommend keeping the constants here but mark them as deprecated instead.

Why? These constants should be internal to the installation process, anyway. bootstrap.inc has no business saying what the db layer supports in terms of versions. Let's go with Damien's patch in #16.

EvanDonovan’s picture

I think the constants should be removed. It's cleaner to keep it as a property of the database.

tstoeckler’s picture

Only in case of a reroll:
+ * @TODO: consider upping to 3.6.8 in Drupal 8 to get SAVEPOINT support.
"@TODO:" -> "@todo"

dmitrig01’s picture

FileSize
5.97 KB

Done, @tstoeckler.

dmitrig01’s picture

The only thing blocking this is the discussion on whether the constants belong in the db layer or in the bootstrap.inc. It seems that everyone agrees about this except for Stevel, for the sake of backwards compatibility. However, I can't think of any realistic use case for using depending these constants from an outside perspective, and these also really don't belong in bootstrap.inc (they're part of the database layer, not bootstrapping). This issue is RTBC and 5/6 of the issue participants agree that the constants should be removed.

dmitrig01’s picture

FileSize
5.94 KB

After discussing with Crell, the default version number should be 0 and not NULL, so we can carry out a real version check (comparing the version to 0).

Damien Tournoud’s picture

*Hgggg* No.

There is no point in doing a version_compare() just for the sake of it, and I'm not sure that database drivers are forced to return a significant version number *anyway*. Big -1 to #22.

dmitrig01’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
6.03 KB

Updated the docs too. I think it's good to go, setting to CNR for final review.

carlos8f’s picture

Returning 0 doesn't make sense as a version (it is not even a string, like the comment says), and seems instead just for the sake of saving lines of code. Doing a version compare with 0 is pointless :) Let's do #20, please.

Crell’s picture

Status: Needs review » Reviewed & tested by the community

version_compare() is a perfectly appropriate tool here; it's for just this sort of comparison. There's lots of weirdness in the way version strings could hypothetically be defined and version_compare() is a good-faith attempt to handle all of them. If a given driver has to do something totally different it can override the method and do whatever it needs.

We also have no need for the constants anymore, I agree.

Assuming the testbot likes #24, so do I.

carlos8f’s picture

version_compare() is only useful when you have two version strings to compare. I don't see why we should invoke it if we already know it will return -1. This is a minor issue though, it's just annoying that we are confusing integers with strings here. I still vote for #20.

Damien Tournoud’s picture

Status: Reviewed & tested by the community » Needs work

Either we do a version_compare() or we don't. Doing a version_compare() against 0 makes 0 sense. *sigh*

carlos8f’s picture

Status: Needs work » Needs review
FileSize
5.97 KB

Let's not get in a deadlock over such things. However we have a perfectly good patch in #20 that I am re-uploading. There is simply no logic in this statement (from #22): "so we can carry out a real version check (comparing the version to 0)."

markshust’s picture

Absolutely agree with #29

EvanDonovan’s picture

I think this approach (#20/#29) makes more sense than comparing against 0 (which is not a string anyway), but it doesn't seem like a huge problem either way.

Nitpick on documentation:

+   *   A version string. If not NULL, it will be checked against the version
+   *   reported by the Database engine using version_compare().

"Database engine" should be "database engine", I think, unless you're referring to the class or something.

mfer’s picture

Status: Needs review » Needs work

From a logic standpoint I like the solution in #29. We are not saying there is a minimum version of 0 in cases where there isn't a version. Instead, if there is a version then we test to make sure the minimum is met. If no minimum is supplied we do not check. This makes logical sense.

Why are we not using the optional 3rd paramater in version_compare? Wouldn't it make more sense to use version_compare(Database::getConnection()->version(), $this->minimumVersion(), '<'). In this case it returns TRUE or FALSE depending on the operator.

mfer’s picture

Status: Needs work » Needs review
carlos8f’s picture

@mfer, makes no difference in functionality, personally I don't see why version_compare() even has the $operator argument, because it doesn't do anything you can't do with standard PHP operators.

marvil07’s picture

FileSize
4.87 KB

re #34: yep, but maybe it's a minor improve since you are using C comparison, so attaching the patch that do mfer suggestion.

carlos8f’s picture

Status: Needs review » Reviewed & tested by the community

Looks like 6 of us agree on NULL instead of 0, RTBC then.

webchick’s picture

Committed #35 to HEAD.

A-w-e-s-o-m-e! Beta3 comin' up.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.