You are here

function archiver_get_extensions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/includes/common.inc \archiver_get_extensions()

Returns a string of supported archive extensions.

Return value

A space-separated string of extensions suitable for use by the file validation system.

3 calls to archiver_get_extensions()
UpdateManagerInstall::buildForm in core/modules/update/src/Form/UpdateManagerInstall.php
Form constructor.
UpdateManagerInstall::submitForm in core/modules/update/src/Form/UpdateManagerInstall.php
Form submission handler.
UpdateUploadTest::testUploadModule in core/modules/update/src/Tests/UpdateUploadTest.php
Tests upload, extraction, and update of a module.

File

core/includes/common.inc, line 1220
Common functions that many Drupal modules will need to reference.

Code

function archiver_get_extensions() {
  $valid_extensions = array();
  foreach (\Drupal::service('plugin.manager.archiver')
    ->getDefinitions() as $archive) {
    foreach ($archive['extensions'] as $extension) {
      foreach (explode('.', $extension) as $part) {
        if (!in_array($part, $valid_extensions)) {
          $valid_extensions[] = $part;
        }
      }
    }
  }
  return implode(' ', $valid_extensions);
}