Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#35 | 946968-cleanup-v2.patch | 4.87 KB | marvil07 |
#29 | 946968-cleanup_1.patch | 5.97 KB | carlos8f |
#24 | 946968-cleanup.patch | 6.03 KB | dmitrig01 |
#22 | 946968-cleanup.patch | 5.94 KB | dmitrig01 |
#20 | 946968-cleanup.patch | 5.97 KB | dmitrig01 |
Comments
Comment #1
webchickchx and crell and I discussed, bumping priority to critical.
Comment #2
dmitrig01 CreditAttribution: dmitrig01 commentedthis 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
Comment #3
Crell CreditAttribution: Crell commentedYeah, not the right approach at all. :-)
Comment #4
dmitrig01 CreditAttribution: dmitrig01 commentedHere's something more robust and tested, probably closer to working.
Comment #5
dmitrig01 CreditAttribution: dmitrig01 commentedupping min sqlite
Comment #6
dmitrig01 CreditAttribution: dmitrig01 commentedFrom IRC:
Comment #7
Dries CreditAttribution: Dries commentedThis looks good. Committed to CVS HEAD! :)
Comment #8
int CreditAttribution: int commentedShould't we move the constants DB version to the correspondent drivers?
Comment #9
Damien Tournoud CreditAttribution: Damien Tournoud commentedErm. This is seriously messy.
Comment #10
Damien Tournoud CreditAttribution: Damien Tournoud commentedWorking on a clean-up.
Comment #11
Damien Tournoud CreditAttribution: Damien Tournoud commentedHere.
- 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
Comment #12
Damien Tournoud CreditAttribution: Damien Tournoud commentedComment #13
chx CreditAttribution: chx commentedVery nicely done. (Minor nitpick, i dislike the return NULL function body but that's a stable of DBTNG and does not belong here.)
Comment #14
Stevel CreditAttribution: Stevel commentedI'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.
Comment #15
chx CreditAttribution: chx commentedWhat.Ever.
Comment #16
Damien Tournoud CreditAttribution: Damien Tournoud commentedI uploaded the wrong patch. This one actually removes the SQLite constant too.
Comment #17
carlos8f CreditAttribution: carlos8f commentedWhy? 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.
Comment #18
EvanDonovan CreditAttribution: EvanDonovan commentedI think the constants should be removed. It's cleaner to keep it as a property of the database.
Comment #19
tstoecklerOnly in case of a reroll:
+ * @TODO: consider upping to 3.6.8 in Drupal 8 to get SAVEPOINT support.
"@TODO:" -> "@todo"
Comment #20
dmitrig01 CreditAttribution: dmitrig01 commentedDone, @tstoeckler.
Comment #21
dmitrig01 CreditAttribution: dmitrig01 commentedThe 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.
Comment #22
dmitrig01 CreditAttribution: dmitrig01 commentedAfter 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).
Comment #23
Damien Tournoud CreditAttribution: Damien Tournoud commented*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.Comment #24
dmitrig01 CreditAttribution: dmitrig01 commentedUpdated the docs too. I think it's good to go, setting to CNR for final review.
Comment #25
carlos8f CreditAttribution: carlos8f commentedReturning 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.
Comment #26
Crell CreditAttribution: Crell commentedversion_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.
Comment #27
carlos8f CreditAttribution: carlos8f commentedversion_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.
Comment #28
Damien Tournoud CreditAttribution: Damien Tournoud commentedEither we do a version_compare() or we don't. Doing a version_compare() against 0 makes 0 sense. *sigh*
Comment #29
carlos8f CreditAttribution: carlos8f commentedLet'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)."
Comment #30
markshust CreditAttribution: markshust commentedAbsolutely agree with #29
Comment #31
EvanDonovan CreditAttribution: EvanDonovan commentedI 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:
"Database engine" should be "database engine", I think, unless you're referring to the class or something.
Comment #32
mfer CreditAttribution: mfer commentedFrom 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.Comment #33
mfer CreditAttribution: mfer commentedComment #34
carlos8f CreditAttribution: carlos8f commented@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.
Comment #35
marvil07 CreditAttribution: marvil07 commentedre #34: yep, but maybe it's a minor improve since you are using C comparison, so attaching the patch that do mfer suggestion.
Comment #36
carlos8f CreditAttribution: carlos8f commentedLooks like 6 of us agree on NULL instead of 0, RTBC then.
Comment #37
webchickCommitted #35 to HEAD.
A-w-e-s-o-m-e! Beta3 comin' up.
Comment #38
webchick