function csp_update_8102 in Content-Security-Policy 8
Update configuration with per-policy reporting settings.
File
- ./
csp.install, line 160 - Installation hooks for csp.module.
Code
function csp_update_8102() {
$config = \Drupal::configFactory()
->getEditable('csp.settings');
$reportingOptions = $config
->get('report');
$config
->clear('report');
foreach ([
'enforce',
'report-only',
] as $policyType) {
if (!$config
->get($policyType . '.enable')) {
continue;
}
$config
->set($policyType . '.reporting', $reportingOptions);
}
$config
->save();
}