You are here

function _update_status_process_info_list in Update Status 5.2

1 call to _update_status_process_info_list()
update_status_get_projects in ./update_status.module
Fetch an array of installed and enabled projects.

File

./update_status.module, line 741

Code

function _update_status_process_info_list(&$projects, $list, $project_type) {
  $module_target_status = $project_type == 'module' ? 1 : 0;
  foreach ($list as $file) {
    if ($file->status != $module_target_status) {
      continue;
    }
    $info_filename = dirname($file->filename) . '/' . $file->name . '.info';
    $file->info = _module_parse_info_file($info_filename);

    // Skip if this is broken.
    if (empty($file->info)) {
      continue;
    }

    // Record the change time on the .info file itself. Note: we need to use
    // the ctime, not the mtime (modification time) since many (all?) tar
    // implementations will go out of their way to set the mtime on the files
    // it creates to the timestamps recorded in the tarball. We want to see
    // the last time the file was changed on disk, which is left alone by tar
    // and correctly set to the time the .info file was unpacked.
    $file->info['_info_file_ctime'] = filectime($info_filename);
    $info = $file->info;
    $info['check'] = TRUE;
    if (!isset($info['project'])) {
      $info['project'] = update_status_get_project($file);
    }

    // Give other modules a chance to fill-in and clean the version,
    // datestamp, or any other data from the .info file they need to alter.
    // We can't use module_invoke_all() since we pass a reference to the hook
    // so it can modify the info array.
    $project = array();
    $project['name'] = $file->name;
    $project['project'] = $info['project'];
    $project['filename'] = $file->filename;
    foreach (module_implements('system_info_alter') as $module) {
      $function = $module . '_system_info_alter';
      $function($info, $project);
    }

    // If we still don't know the 'project', give up.
    if (empty($info['project'])) {
      continue;
    }
    if (!isset($info['datestamp'])) {
      $info['datestamp'] = 0;
    }
    $project_name = $info['project'];
    if (!isset($projects[$project_name])) {

      // Only process this if we haven't done this project, since a single
      // project can have multiple modules.
      $projects[$project_name] = array(
        'name' => $project_name,
        'info' => $info,
        'datestamp' => $info['datestamp'],
        'modules' => array(
          $file->name => $info['name'],
        ),
        'project_type' => $project_name == 'drupal' ? 'core' : $project_type,
      );
    }
    elseif ($projects[$project_name]['project_type'] == $project_type) {
      $projects[$project_name]['modules'][$file->name] = $info['name'];
      $projects[$project_name]['datestamp'] = max($projects[$project_name]['datestamp'], $info['datestamp']);
    }
  }
  return $projects;
}