You are here

function DrupalSystem::getActiveExtensions in X Autoload 7.5

Same name and namespace in other branches
  1. 7.4 lib/DrupalSystem/DrupalSystem.php \Drupal\xautoload\DrupalSystem\DrupalSystem::getActiveExtensions()

Gets active extensions directly from the system table.

Return value

string[] Extension types by extension name.

Overrides DrupalSystemInterface::getActiveExtensions

File

src/DrupalSystem/DrupalSystem.php, line 55

Class

DrupalSystem

Namespace

Drupal\xautoload\DrupalSystem

Code

function getActiveExtensions() {
  try {

    // Doing this directly tends to be a lot faster than system_list().
    return db_query("SELECT name, type from {system} WHERE status = 1")
      ->fetchAllKeyed();
  } catch (\DatabaseConnectionNotDefinedException $e) {

    // During install, the database is not available.
    // At this time only the system module is "installed".

    /** See https://www.drupal.org/node/2393205 */
    return array(
      'system' => 'module',
    );
  } catch (\PDOException $e) {

    // Some time later during install, there is a database but not yet a system table.
    // At this time only the system module is "installed".
    // @todo Check if this is really a "Table 'system' doesn't exist'" exception.
    return array(
      'system' => 'module',
    );
  }
}