You are here

function yamlform_update_8057 in YAML Form 8

Issue #2817535: Drupal file upload by anonymous or untrusted users into public file systems -- PSA-2016-003.

File

includes/yamlform.update.inc, line 1182
YAML Form module update hooks.

Code

function yamlform_update_8057() {

  /** @var \Drupal\yamlform\YamlFormElementManagerInterface $element_manager */
  $element_manager = \Drupal::service('plugin.manager.yamlform.element');
  $element_plugins = $element_manager
    ->getInstances();
  $types = [];
  foreach ($element_plugins as $element_id => $element_plugin) {
    $types[$element_id] = $element_id;
  }
  $settings_config = \Drupal::configFactory()
    ->getEditable('yamlform.settings');
  $settings_config
    ->set('elements.types', $types);
  $settings_config
    ->set('elements.file_public', TRUE);
  $settings_config
    ->save();
}