Adapter
3 years ago
Schema
3 years ago
Adapter.php
4 years ago
AdapterInterface.php
4 years ago
BatchInsert.php
4 years ago
Schema.php
5 years ago
SchemaInterface.php
5 years ago
Settings.php
4 years ago
TransactionLevel.php
4 years ago
Settings.php
47 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Matomo - free/libre analytics platform |
| 4 | * |
| 5 | * @link https://matomo.org |
| 6 | * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later |
| 7 | * |
| 8 | */ |
| 9 | |
| 10 | namespace Piwik\Db; |
| 11 | |
| 12 | use Piwik\Db; |
| 13 | |
| 14 | class Settings |
| 15 | { |
| 16 | public function getEngine() |
| 17 | { |
| 18 | return $this->getDbSetting('type'); |
| 19 | } |
| 20 | |
| 21 | public function getTablePrefix() |
| 22 | { |
| 23 | return $this->getDbSetting('tables_prefix'); |
| 24 | } |
| 25 | |
| 26 | public function getDbName() |
| 27 | { |
| 28 | return $this->getDbSetting('dbname'); |
| 29 | } |
| 30 | |
| 31 | public function getUsedCharset() |
| 32 | { |
| 33 | return strtolower($this->getDbSetting('charset')); |
| 34 | } |
| 35 | |
| 36 | public function getRowFormat() |
| 37 | { |
| 38 | return $this->getUsedCharset() === 'utf8mb4' ? 'ROW_FORMAT=DYNAMIC' : ''; |
| 39 | } |
| 40 | |
| 41 | private function getDbSetting($key) |
| 42 | { |
| 43 | $dbInfos = Db::getDatabaseConfig(); |
| 44 | return $dbInfos[$key] ?? null; |
| 45 | } |
| 46 | } |
| 47 |