Skip to content
Snippets Groups Projects

database_dashboard-3422911/3422911-fix-the-issues - Fix the Phpcs isseue and...

4 files
+ 117
4
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -4,6 +4,7 @@ namespace Drupal\database_dashboard\Controller;
@@ -4,6 +4,7 @@ namespace Drupal\database_dashboard\Controller;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Database\Connection;
use Drupal\Core\Database\Connection;
 
use Drupal\Core\Database\Database;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
/**
@@ -41,7 +42,7 @@ class DatabaseDashboardController extends ControllerBase {
@@ -41,7 +42,7 @@ class DatabaseDashboardController extends ControllerBase {
public function dashboard() {
public function dashboard() {
$databaseName = $this->connection->getConnectionOptions()['database'];
$databaseName = $this->connection->getConnectionOptions()['database'];
$data = [];
$data = [];
$con = \Drupal\Core\Database\Database::getConnection('default','schema');
$con = Database::getConnection('default', 'schema');
$res = $con->query('SELECT table_schema AS "Database name", SUM(data_length + index_length) / 1024 / 1024 / 1024 AS "Size (GB)" FROM TABLES where engine=\'InnoDB\' GROUP BY table_schema;');
$res = $con->query('SELECT table_schema AS "Database name", SUM(data_length + index_length) / 1024 / 1024 / 1024 AS "Size (GB)" FROM TABLES where engine=\'InnoDB\' GROUP BY table_schema;');
$data['database_size'] = $res->fetchAllKeyed();
$data['database_size'] = $res->fetchAllKeyed();
@@ -60,9 +61,9 @@ class DatabaseDashboardController extends ControllerBase {
@@ -60,9 +61,9 @@ class DatabaseDashboardController extends ControllerBase {
$build['content'] = [
$build['content'] = [
'#theme' => 'database_dashboard',
'#theme' => 'database_dashboard',
'#data' => $data,
'#data' => $data,
'#attached'=> [
'#attached' => [
'library' => [
'library' => [
'database_dashboard/dashboard'
'database_dashboard/dashboard',
],
],
],
],
'#cache' => ['max-age' => 0],
'#cache' => ['max-age' => 0],
Loading