You are here

function acquia_spi_get_modules in Acquia Connector 7.3

Same name and namespace in other branches
  1. 6.2 acquia_spi/acquia_spi.module \acquia_spi_get_modules()
  2. 6 acquia_spi/acquia_spi.module \acquia_spi_get_modules()
  3. 7 acquia_spi/acquia_spi.module \acquia_spi_get_modules()
  4. 7.2 acquia_spi/acquia_spi.module \acquia_spi_get_modules()

Gather information about modules on the site.

Return value

array An associative array keyed by filename of associative arrays with information on the modules.

1 call to acquia_spi_get_modules()
acquia_spi_get in acquia_spi/acquia_spi.module
Gather site profile information about this site.

File

acquia_spi/acquia_spi.module, line 1625
Send site profile information (NSPI) and system data to Acquia Insight.

Code

function acquia_spi_get_modules() {

  // Only do a full rebuild of the module cache every 1 at the most.
  $last_build = variable_get('acquia_spi_module_rebuild', 0);
  if ($last_build < REQUEST_TIME - 86400) {
    $modules = system_rebuild_module_data();
    variable_set('acquia_spi_module_rebuild', REQUEST_TIME);
  }
  else {
    $result = db_query("SELECT filename, name, type, status, schema_version, info FROM {system} WHERE type = 'module'");
    foreach ($result as $file) {
      $file->info = unserialize($file->info);
      $modules[$file->filename] = $file;
    }
  }
  $result = array();
  $keys_to_send = array(
    'name',
    'version',
    'package',
    'core',
    'project',
  );
  foreach ($modules as $filename => $file) {
    $info = array();
    $info['status'] = $file->status;
    foreach ($keys_to_send as $key) {
      $info[$key] = isset($file->info[$key]) ? $file->info[$key] : '';
    }
    $info['filename'] = $file->filename;
    $result[] = $info;
  }
  return $result;
}