Commit db927005 authored by catch's avatar catch

Issue #3186999 by alexpott, neclimdul, longwave: Make the version a private class property

(cherry picked from commit 702514c1)
parent cce00b6b
......@@ -65,6 +65,15 @@ class Connection extends DatabaseConnection {
*/
protected $needsCleanup = FALSE;
/**
* Stores the server version after it has been retrieved from the database.
*
* @var string
*
* @see \Drupal\Core\Database\Driver\mysql\Connection::version
*/
private $serverVersion;
/**
* The minimal possible value for the max_allowed_packet setting of MySQL.
*
......@@ -290,11 +299,10 @@ protected function getMariaDbVersionMatch(): ?string {
* The PDO server version.
*/
protected function getServerVersion(): string {
static $server_version;
if (!$server_version) {
$server_version = $this->connection->query('SELECT VERSION()')->fetchColumn();
if (!$this->serverVersion) {
$this->serverVersion = $this->connection->query('SELECT VERSION()')->fetchColumn();
}
return $server_version;
return $this->serverVersion;
}
public function databaseType() {
......
......@@ -10,7 +10,6 @@
*
* @coversDefaultClass \Drupal\Core\Database\Driver\mysql\Connection
* @group Database
* @runTestsInSeparateProcesses
*/
class ConnectionTest extends UnitTestCase {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment