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