You are here

cdn.install in CDN 8.3

Same filename and directory in other branches
  1. 6.2 cdn.install
  2. 7.2 cdn.install

Update functions for the CDN module.

File

cdn.install
View source
<?php

/**
 * @file
 * Update functions for the CDN module.
 */

/**
 * Update the default settings if they are not modified by the user.
 */
function cdn_update_8001() {
  $cdn_settings = \Drupal::configFactory()
    ->getEditable('cdn.settings');
  $mapping = $cdn_settings
    ->get('mapping');
  if ($mapping['type'] === 'simple' && $mapping['conditions'] === []) {
    $cdn_settings
      ->set('mapping.conditions', [
      'not' => [
        'extensions' => [
          'css',
          'js',
        ],
      ],
    ]);
    $cdn_settings
      ->save();
  }
}

/**
 * Add the new "stream wrappers" setting, set it to its default initial value.
 */
function cdn_update_8002() {
  \Drupal::configFactory()
    ->getEditable('cdn.settings')
    ->set('stream_wrappers', [
    'public',
  ])
    ->save();
}

/**
 * Add the new "scheme" setting, set it to its default initial value.
 */
function cdn_update_8003() {
  \Drupal::configFactory()
    ->getEditable('cdn.settings')
    ->set('scheme', '//')
    ->save();
}

Functions

Namesort descending Description
cdn_update_8001 Update the default settings if they are not modified by the user.
cdn_update_8002 Add the new "stream wrappers" setting, set it to its default initial value.
cdn_update_8003 Add the new "scheme" setting, set it to its default initial value.