function _l10n_update_project_info_list in Localization update 7.2
Same name and namespace in other branches
- 6 l10n_update.project.inc \_l10n_update_project_info_list()
- 7 l10n_update.project.inc \_l10n_update_project_info_list()
Populate an array of project data.
Based on _update_process_info_list()
Parameters
array $projects: The list of projects to populate.
array $list: System module list as returned by system_rebuild_module_data() or system_rebuild_theme_data().
string $project_type: The project type to process: 'theme' or 'module'.
bool $disabled: TRUE to include disabled projects too.
1 call to _l10n_update_project_info_list()
- l10n_update_project_list in ./
l10n_update.compare.inc - Get update module's project list.
File
- ./
l10n_update.compare.inc, line 150 - The API for comparing project translation status with available translation.
Code
function _l10n_update_project_info_list(array &$projects, array $list, $project_type, $disabled = FALSE) {
foreach ($list as $file) {
if (!$disabled && empty($file->status)) {
// Skip disabled modules or themes.
continue;
}
// Skip if the .info file is broken.
if (empty($file->info)) {
continue;
}
// If the .info doesn't define the 'project', try to figure it out.
if (!isset($file->info['project'])) {
$file->info['project'] = l10n_update_get_project_name($file);
}
// If the .info defines the 'interface translation project', this value will
// override the 'project' value.
if (isset($file->info['interface translation project'])) {
$file->info['project'] = $file->info['interface translation project'];
}
// If we still don't know the 'project', give up.
if (empty($file->info['project'])) {
continue;
}
// If we don't already know it, grab 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.
if (!isset($file->info['_info_file_ctime'])) {
$info_filename = dirname($file->uri) . '/' . $file->name . '.info';
$file->info['_info_file_ctime'] = filectime($info_filename);
}
$project_name = $file->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 or themes.
$projects[$project_name] = array(
'name' => $project_name,
'info' => $file->info,
'datestamp' => isset($file->info['datestamp']) ? $file->info['datestamp'] : 0,
'includes' => array(
$file->name => isset($file->info['name']) ? $file->info['name'] : $file->name,
),
'project_type' => $project_name == 'drupal' ? 'core' : $project_type,
);
}
else {
$projects[$project_name]['includes'][$file->name] = $file->info['name'];
$projects[$project_name]['info']['_info_file_ctime'] = max($projects[$project_name]['info']['_info_file_ctime'], $file->info['_info_file_ctime']);
}
}
}