function drush_pm_inject_info_file_metadata

8.0.x drush_pm_inject_info_file_metadata($project_dir, $project_name, $version, $datestamp)
6.x drush_pm_inject_info_file_metadata($project_dir, $project_name, $version)
7.x drush_pm_inject_info_file_metadata($project_dir, $project_name, $version, $datestamp)
5.x drush_pm_inject_info_file_metadata($project_dir, $project_name, $version)
master drush_pm_inject_info_file_metadata($project_dir, $project_name, $version, $datestamp)

Inject metadata into all .info files for a given project.


string $project_dir: The full path to the root directory of the project to operate on.

string $project_name: The project machine name (AKA shortname).

string $version: The version string to inject into the .info file(s).

int $datestamp: The datestamp of the last commit.

Return value

boolean TRUE on success, FALSE on any failures appending data to .info files.

2 calls to drush_pm_inject_info_file_metadata()
DrushMakeProject::processGitInfoFiles in commands/make/
Process info files when downloading things from git.
package_handler_post_download in commands/pm/package_handler/
Post download action.


commands/pm/, line 2214
The drush Project Manager


function drush_pm_inject_info_file_metadata($project_dir, $project_name, $version, $datestamp) {
  // `drush_drupal_major_version()` cannot be used here because this may be running
  // outside of a Drupal context.
  $yaml_format = substr($version, 0, 1) >= 8;
  $pattern = preg_quote($yaml_format ? '.info.yml' : '.info');
  $info_files = drush_scan_directory($project_dir, '/.*' . $pattern . '$/');
  if (!empty($info_files)) {
    // Construct the string of metadata to append to all the .info files.
    if ($yaml_format) {
      $info = _drush_pm_generate_info_yaml_metadata($version, $project_name, $datestamp);
    else {
      $info = _drush_pm_generate_info_ini_metadata($version, $project_name, $datestamp);
    foreach ($info_files as $info_file) {
      if (!drush_file_append_data($info_file->filename, $info)) {
        return FALSE;
  return TRUE;