(dev/core#1926) MySQL SSL - Fixes for Backdrop, Drupal 7, Standalone #31912
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This addresses connectivity issue where MySQL-SSL may not work in some environments/call-paths.
(This is an off-shoot from https://lab.civicrm.org/dev/core/-/issues/1926.)
Before
set global require_secure_transport = 1;
)bin/cron.php?name=...&pass=...&key=...
via HTTP.DB::connect()
code pattern, it appears the same problem would also affect Backdrop'scron.php
and Standalone's session-handler.After
All three of these should work with MySQL-SSL. (Specifically, I've tested D7 cron.)
Technical Details
The clearest way to understand the problem is to consider: How do you issue a PHP call to connect to the database? This has evolved over various releases of CiviCRM:
DB::connect()
with a connection string ($dsn
), eg$dsn
strings using a mix ofmysql://
(deprecated) andmysqli://
(maintained) drivers, but we needed all of them to start using themysqli://
driver. So the idiom changed:$dsn
involves SSL, thenDB::connect()
requires an extra hint.If
DB::connect()
were called in a single spot, then this evolution would be simple. However, in reality, there are several places which useDB::connect()
. And all of them needed these updates.But several of them are harder to see, so they've been addressed in whack-a-mole fashion. This PR does a little refactoring to ensure that they all work the same.