You are here

function seckit_update_7105 in Security Kit 7

Update saved instances of the old (deprecated) CSP report URI.

File

./seckit.install, line 129
Install/update/uninstall actions for SecKit.

Code

function seckit_update_7105() {

  // We only care about variable values which are saved in the database.
  $variables = variable_initialize(array());
  if (!empty($variables['seckit_xss']['csp']['report-uri'])) {
    $seckit_xss = $variables['seckit_xss'];
    $deprecated = 'admin/config/system/seckit/csp-report';
    if ($seckit_xss['csp']['report-uri'] === $deprecated) {
      $seckit_xss['csp']['report-uri'] = SECKIT_CSP_REPORT_URL;
      variable_set('seckit_xss', $seckit_xss);
      return t("Changed CSP violation report path from '@old' to '@new'.", array(
        '@old' => $deprecated,
        '@new' => SECKIT_CSP_REPORT_URL,
      ));
    }
  }
}