Skip to content

Commit

Permalink
Fixes matomo-org#12002 and matomo-org#12030 - azure fallback to "sele…
Browse files Browse the repository at this point in the history
…ct @@Version" (matomo-org#12551)

* Fixes matomo-org#12002 and matomo-org#12030 - azure fallback to "select @@Version"

* Add comment for why @@Version is used instead of going through the connection object.
  • Loading branch information
robocoder authored and InfinityVoid committed Oct 11, 2018
1 parent e61c632 commit 8685db9
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
18 changes: 18 additions & 0 deletions core/Db/Adapter/Mysqli.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,24 @@ public function checkServerVersion()
}
}

/**
* Returns the MySQL server version
*
* @return null|string
*/
public function getServerVersion()
{
// prioritizing SELECT @@VERSION in case the connection version string is incorrect (which can
// occur on Azure)
$versionInfo = $this->fetchAll('SELECT @@VERSION');

if (count($versionInfo)) {
return $versionInfo[0]['@@VERSION'];
}

return parent::getServerVersion();
}

/**
* Check client version compatibility against database server
*
Expand Down
18 changes: 18 additions & 0 deletions core/Db/Adapter/Pdo/Mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,24 @@ public function checkServerVersion()
}
}

/**
* Returns the MySQL server version
*
* @return null|string
*/
public function getServerVersion()
{
// prioritizing SELECT @@VERSION in case the connection version string is incorrect (which can
// occur on Azure)
$versionInfo = $this->fetchAll('SELECT @@VERSION');

if (count($versionInfo)) {
return $versionInfo[0]['@@VERSION'];
}

return parent::getServerVersion();
}

/**
* Check client version compatibility against database server
*
Expand Down

0 comments on commit 8685db9

Please sign in to comment.