1 updater.inc public static Updater::findInfoFile($directory)

Figure out what the most important (or only) info file is in a directory.

Since there is no enforcement of which info file is the project's "main" info file, this will get one with the same name as the directory, or the first one it finds. Not ideal, but needs a larger solution.

Parameters

string $directory: Directory to search in.

Return value

string: Path to the info file.

File

core/includes/updater.inc, line 141
Classes used for updating various files in the Backdrop webroot. These classes use a FileTransfer object to actually perform the operations. Normally, the FileTransfer is provided when the site owner is redirected to authorize.php as part of a…

Class

Updater
Base class for Updaters used in Backdrop.

Code

public static function findInfoFile($directory) {
  $info_files = file_scan_directory($directory, '/.*\.info$/');
  if (!$info_files) {
    return FALSE;
  }
  foreach ($info_files as $info_file) {
    // Exclude info files for tests.
    if (backdrop_substr($info_file->filename, -11) == '.tests.info') {
      unset($info_files[$info_file->uri]);
      continue;
    }
    if (backdrop_substr($info_file->filename, 0, -5) == backdrop_basename($directory)) {
      // Info file Has the same name as the directory, return it.
      return $info_file->uri;
    }
  }
  // Otherwise, return the first one.
  $info_file = array_shift($info_files);
  return $info_file->uri;
}