@@ -17,55 +17,55 @@ |
||
| 17 | 17 | use OCP\SetupCheck\SetupResult; |
| 18 | 18 | |
| 19 | 19 | class MysqlRowFormat implements ISetupCheck { |
| 20 | - public function __construct( |
|
| 21 | - private IL10N $l10n, |
|
| 22 | - private IConfig $config, |
|
| 23 | - private Connection $connection, |
|
| 24 | - private IURLGenerator $urlGenerator, |
|
| 25 | - ) { |
|
| 26 | - } |
|
| 20 | + public function __construct( |
|
| 21 | + private IL10N $l10n, |
|
| 22 | + private IConfig $config, |
|
| 23 | + private Connection $connection, |
|
| 24 | + private IURLGenerator $urlGenerator, |
|
| 25 | + ) { |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - public function getName(): string { |
|
| 29 | - return $this->l10n->t('MySQL row format'); |
|
| 30 | - } |
|
| 28 | + public function getName(): string { |
|
| 29 | + return $this->l10n->t('MySQL row format'); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - public function getCategory(): string { |
|
| 33 | - return 'database'; |
|
| 34 | - } |
|
| 32 | + public function getCategory(): string { |
|
| 33 | + return 'database'; |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - public function run(): SetupResult { |
|
| 37 | - $provider = $this->connection->getDatabaseProvider(); |
|
| 38 | - if (!in_array($provider, [IDBConnection::PLATFORM_MYSQL, IDBConnection::PLATFORM_MARIADB], true)) { |
|
| 39 | - return SetupResult::success($this->l10n->t('You are not using MySQL')); |
|
| 40 | - } |
|
| 36 | + public function run(): SetupResult { |
|
| 37 | + $provider = $this->connection->getDatabaseProvider(); |
|
| 38 | + if (!in_array($provider, [IDBConnection::PLATFORM_MYSQL, IDBConnection::PLATFORM_MARIADB], true)) { |
|
| 39 | + return SetupResult::success($this->l10n->t('You are not using MySQL')); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - $wrongRowFormatTables = $this->getRowNotDynamicTables(); |
|
| 43 | - if (empty($wrongRowFormatTables)) { |
|
| 44 | - return SetupResult::success($this->l10n->t('None of your tables use ROW_FORMAT=Compressed')); |
|
| 45 | - } |
|
| 42 | + $wrongRowFormatTables = $this->getRowNotDynamicTables(); |
|
| 43 | + if (empty($wrongRowFormatTables)) { |
|
| 44 | + return SetupResult::success($this->l10n->t('None of your tables use ROW_FORMAT=Compressed')); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - return SetupResult::warning( |
|
| 48 | - $this->l10n->t( |
|
| 49 | - 'Incorrect row format found in your database. ROW_FORMAT=Dynamic offers the best database performances for Nextcloud. Please update row format on the following list: %s.', |
|
| 50 | - [implode(', ', $wrongRowFormatTables)], |
|
| 51 | - ), |
|
| 52 | - 'https://dev.mysql.com/doc/refman/en/innodb-row-format.html', |
|
| 53 | - ); |
|
| 54 | - } |
|
| 47 | + return SetupResult::warning( |
|
| 48 | + $this->l10n->t( |
|
| 49 | + 'Incorrect row format found in your database. ROW_FORMAT=Dynamic offers the best database performances for Nextcloud. Please update row format on the following list: %s.', |
|
| 50 | + [implode(', ', $wrongRowFormatTables)], |
|
| 51 | + ), |
|
| 52 | + 'https://dev.mysql.com/doc/refman/en/innodb-row-format.html', |
|
| 53 | + ); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * @return string[] |
|
| 58 | - */ |
|
| 59 | - private function getRowNotDynamicTables(): array { |
|
| 60 | - $sql = "SELECT table_name |
|
| 56 | + /** |
|
| 57 | + * @return string[] |
|
| 58 | + */ |
|
| 59 | + private function getRowNotDynamicTables(): array { |
|
| 60 | + $sql = "SELECT table_name |
|
| 61 | 61 | FROM information_schema.tables |
| 62 | 62 | WHERE table_schema = ? |
| 63 | 63 | AND table_name LIKE '*PREFIX*%' |
| 64 | 64 | AND row_format != 'Dynamic';"; |
| 65 | 65 | |
| 66 | - return $this->connection->executeQuery( |
|
| 67 | - $sql, |
|
| 68 | - [$this->config->getSystemValueString('dbname')], |
|
| 69 | - )->fetchFirstColumn(); |
|
| 70 | - } |
|
| 66 | + return $this->connection->executeQuery( |
|
| 67 | + $sql, |
|
| 68 | + [$this->config->getSystemValueString('dbname')], |
|
| 69 | + )->fetchFirstColumn(); |
|
| 70 | + } |
|
| 71 | 71 | } |