function drush_file_is_tarball

8.0.x drush.inc drush_file_is_tarball($path)
6.x drush.inc drush_file_is_tarball($path)
7.x drush.inc drush_file_is_tarball($path)
5.x drush.inc drush_file_is_tarball($path)
master drush.inc drush_file_is_tarball($path)

Check whether a file is a supported tarball.

Return value

mixed The file content type if it's a tarball. FALSE otherwise.

3 calls to drush_file_is_tarball()
drush_tarball_extract in includes/drush.inc
Extract a tarball.
make_download_file_unpack in commands/make/make.download.inc
Unpacks a file to the specified download location.
SqlBase::query in lib/Drush/Sql/SqlBase.php
Execute a SQL query.

File

includes/drush.inc, line 970
The drush API implementation and helpers.

Code

function drush_file_is_tarball($path) {
  $content_type = drush_attempt_mime_content_type($path);
  $supported = array(
    'application/x-bzip2',
    'application/x-gzip',
    'application/x-tar',
    'application/x-zip',
    'application/zip',
  );
  if (in_array($content_type, $supported)) {
    return $content_type;
  }
  return FALSE;
}