| <?php |
|
|
| |
| |
| |
| |
| |
| |
|
|
| namespace Piwik\Db\Schema; |
|
|
| use Piwik\Date; |
|
|
| |
| |
| |
| class Mariadb extends Mysql |
| { |
| protected $minimumSupportedVersion = '5.5'; |
|
|
| public function getDatabaseType(): string |
| { |
| return 'MariaDB'; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| public function addMaxExecutionTimeHintToQuery(string $sql, float $limit): string |
| { |
| if ($limit <= 0) { |
| return $sql; |
| } |
|
|
| $sql = trim($sql); |
| $pos = stripos($sql, 'SELECT'); |
| $isMaxExecutionTimeoutAlreadyPresent = (stripos($sql, 'max_statement_time=') !== false); |
| if ($pos !== false && !$isMaxExecutionTimeoutAlreadyPresent) { |
| $maxExecutionTimeHint = 'SET STATEMENT max_statement_time=' . ceil($limit) . ' FOR '; |
| $sql = substr_replace($sql, $maxExecutionTimeHint . 'SELECT', $pos, strlen('SELECT')); |
| } |
|
|
| return $sql; |
| } |
|
|
| public function isOptimizeInnoDBSupported(): bool |
| { |
| $version = strtolower($this->getVersion()); |
| $semanticVersion = strstr($version, '-', $beforeNeedle = true); |
| return version_compare($semanticVersion, '10.1.1', '>='); |
| } |
|
|
| public function supportsRankingRollupWithoutExtraSorting(): bool |
| { |
| return false; |
| } |
|
|
| public function hasReachedEOL(): bool |
| { |
| $currentVersion = $this->getVersion(); |
|
|
| |
|
|
| |
| if ( |
| version_compare($currentVersion, '10.6', '>=') && |
| version_compare($currentVersion, '10.7', '<') && |
| Date::today()->isEarlier(Date::factory('2026-07-07')) |
| ) { |
| return false; |
| } |
|
|
| |
| if ( |
| version_compare($currentVersion, '10.11', '>=') && |
| version_compare($currentVersion, '10.12', '<') && |
| Date::today()->isEarlier(Date::factory('2028-02-17')) |
| ) { |
| return false; |
| } |
|
|
| |
| if ( |
| version_compare($currentVersion, '11.4', '>=') && |
| version_compare($currentVersion, '11.5', '<') && |
| Date::today()->isEarlier(Date::factory('2029-05-30')) |
| ) { |
| return false; |
| } |
|
|
| |
| if (version_compare($currentVersion, '11.8', '<')) { |
| return true; |
| } |
|
|
| return false; |
| } |
| } |
|
|