You are here

config_update_ui.module in Configuration Update Manager 8

Configuration Update Reports module.

File

config_update_ui/config_update_ui.module
View source
<?php

/**
 * @file
 * Configuration Update Reports module.
 */
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;

/**
 * Implements hook_help().
 */
function config_update_ui_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.config_update_ui':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('The Configuration Update Reports module provides a report that allows you to see the differences between the default configuration provided by the current versions of your installed modules, themes, and install profile, and the active configuration of your site. From this report, you can also import new configuration provided by updates, and revert your active configuration to the provided default values.') . '</p>';
      $output .= '<h3>' . t('Uses') . '</h3>';
      $output .= '<dl>';
      $output .= '<dt>' . t('Checking for configuration differences') . '</dd>';
      $output .= '<dd>' . t('The <a href=":report">Updates report</a> shows you configuration that differs between your site\'s active configuration and the installed modules, themes, and install profile. Choose a particular configuration type (or All), or run the report for a particular module, theme, or your install profile.', [
        ':report' => Url::fromRoute('config_update_ui.report')
          ->toString(),
      ]) . '</dd>';
      $output .= '</dl>';
      return $output;
    case 'config_update_ui.report':
      $output = '';
      $output .= '<p>' . t('This report shows which default configuration items provided by the current versions of your installed modules, themes, and install profile differ from the active configuration of your site. You can generate the report for all configuration of a certain type; for a particular installed module, theme, or your install profile (only modules, themes, and install profiles that actually provide configuration are listed); or for all configuration.') . '</p>';
      $output .= '<p>' . t('Some configuration provided by modules has dependencies, and is only added to your system when all the dependencies are satisfied. This is known as <em>optional</em> configuration.') . '</p>';
      $output .= '<p>' . t('Differences, including missing and added configuration, can be due to either an updated module or theme providing different configuration from when you installed it, or to changes made by site administrators. This report does not differentiate between these two sources for differences, and note that an install profile can also silently override module/theme configuration. Overrides (such as those in your settings.php file) and translations are not considered when looking at differences.') . '</p>';
      return $output;
    case 'config_update_ui.diff':
      return '<p>' . t('Most configuration is organized into a hierarchy of settings; at a minimum, it is a one-level hierarchy where each setting has a name and a value, and the hierarchy comes in when some of the settings have multiple components.') . '</p><p>' . t('Configuration items are normalized and formatted before computing differences. The normalization step alphabetizes the components at each level of the hierarchy, and removes a few components whose differences should be ignored, such as the UUID. The formatting step shows the full hierarchy of each configuration value with :: separators for the hierarchy levels, and a : separator between the lowest-level setting name and the value, so that in a line-by-line diff you can always see which values are actually different. Green lines with + signs have been added, and yellow lines with - signs have been removed.') . '</p><p>' . t('Note that differences are considering the base configuration, without overrides from your settings.php file, or translations.') . '</p>';
  }
}

/**
 * Implements hook_menu_links_discovered_alter().
 */
function config_update_ui_menu_links_discovered_alter(&$links) {
  if (\Drupal::moduleHandler()
    ->moduleExists('admin_toolbar_tools')) {

    // Add the Updates report link to the Tools menu, but only if the
    // Admin Toolbar Extra Tools module is present.
    $links['admin_toolbar_tools.config.update'] = [
      'title' => t('Updates report'),
      'route_name' => 'config_update_ui.report',
      'menu_name' => 'admin',
      'parent' => 'config.sync',
      'weight' => 3,
    ];
  }
}