You are here

function _demo_get_database in Demonstration site (Sandbox / Snapshot) 8

Same name and namespace in other branches
  1. 5 database_mysql_dump.inc \_demo_get_database()
  2. 6 database_mysql_dump.inc \_demo_get_database()
  3. 7 database_mysql_dump.inc \_demo_get_database()

Returns the name of the active database.

1 call to _demo_get_database()
demo_dump_db in ./demo.module
Dump active database.

File

./demo.module, line 212

Code

function _demo_get_database() {

  // TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
  // You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
  $database = array_keys(\Drupal::database()
    ->query('SHOW TABLES')
    ->fetchAssoc());
  $database = preg_replace('/^Tables_in_/i', '', $database[0]);
  return $database;
}