diff --git a/libraries/classes/Controllers/Database/StructureController.php b/libraries/classes/Controllers/Database/StructureController.php index eb1a0a406f..0e40b6cd5c 100644 --- a/libraries/classes/Controllers/Database/StructureController.php +++ b/libraries/classes/Controllers/Database/StructureController.php @@ -66,6 +66,9 @@ class StructureController extends AbstractController /** @var bool whether stats show or not */ protected $isShowStats; + /** @var bool whether database details show or not */ + protected $isShowDbDetails; + /** @var Relation */ private $relation; @@ -106,6 +109,8 @@ class StructureController extends AbstractController $this->dbi = $dbi; $this->flash = $flash; + $this->isShowDbDetails = $GLOBALS['cfg']['PropertiesNumColumns'] < 2; + $this->replicationInfo = new ReplicationInfo($this->dbi); } @@ -380,6 +385,7 @@ class StructureController extends AbstractController 'replication' => $replicaInfo['status'], 'properties_num_columns' => $GLOBALS['cfg']['PropertiesNumColumns'], 'is_show_stats' => $this->isShowStats, + 'is_show_db_details' => $this->isShowDbDetails, 'show_charset' => $GLOBALS['cfg']['ShowDbStructureCharset'], 'show_comment' => $GLOBALS['cfg']['ShowDbStructureComment'], 'show_creation' => $GLOBALS['cfg']['ShowDbStructureCreation'], @@ -440,6 +446,7 @@ class StructureController extends AbstractController 'already_favorite' => $this->checkFavoriteTable($currentTable['TABLE_NAME']), 'num_favorite_tables' => $GLOBALS['cfg']['NumFavoriteTables'], 'properties_num_columns' => $GLOBALS['cfg']['PropertiesNumColumns'], + 'is_show_db_details' => $this->isShowDbDetails, 'limit_chars' => $GLOBALS['cfg']['LimitChars'], 'show_charset' => $GLOBALS['cfg']['ShowDbStructureCharset'], 'show_comment' => $GLOBALS['cfg']['ShowDbStructureComment'], @@ -468,11 +475,20 @@ class StructureController extends AbstractController $relationParameters = $this->relation->getRelationParameters(); + $defaultStorageEngine = ''; + if ($this->isShowDbDetails) { + $defaultStorageEngineVar = $this->dbi->getVersion() >= 50503 + ? '@@default_storage_engine' + : '@@storage_engine'; + $defaultStorageEngine = $this->dbi->fetchValue(sprintf('SELECT %s;', $defaultStorageEngineVar)); + } + return $html . $this->template->render('database/structure/table_header', [ 'db' => $this->db, 'db_is_system_schema' => $this->dbIsSystemSchema, 'replication' => $replicaInfo['status'], 'properties_num_columns' => $GLOBALS['cfg']['PropertiesNumColumns'], + 'is_show_db_details' => $this->isShowDbDetails, 'is_show_stats' => $this->isShowStats, 'show_charset' => $GLOBALS['cfg']['ShowDbStructureCharset'], 'show_comment' => $GLOBALS['cfg']['ShowDbStructureComment'], @@ -498,6 +514,8 @@ class StructureController extends AbstractController 'num_favorite_tables' => $GLOBALS['cfg']['NumFavoriteTables'], 'db' => $GLOBALS['db'], 'properties_num_columns' => $GLOBALS['cfg']['PropertiesNumColumns'], + 'is_show_db_details' => $this->isShowDbDetails, + 'default_storage_engine' => $defaultStorageEngine, 'dbi' => $this->dbi, 'show_charset' => $GLOBALS['cfg']['ShowDbStructureCharset'], 'show_comment' => $GLOBALS['cfg']['ShowDbStructureComment'], diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 60a5e8909c..075747b204 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -5037,7 +5037,7 @@ parameters: - message: "#^Cannot access offset 'PropertiesNumColumns' on mixed\\.$#" - count: 1 + count: 2 path: libraries/classes/Controllers/Database/StructureController.php - diff --git a/templates/database/structure/body_for_table_summary.twig b/templates/database/structure/body_for_table_summary.twig index 2bb026994c..0d354bc86b 100644 --- a/templates/database/structure/body_for_table_summary.twig +++ b/templates/database/structure/body_for_table_summary.twig @@ -35,16 +35,10 @@ {% set cell_text = row_count_sum %} {% endif %}