You are here

function l10n_update_system_remove in Localization update 7.2

Delete translation history of modules and themes.

Only the translation history is removed, not the source strings or translations. This is not possible because strings are shared between modules and we have no record of which string is used by which module.

Parameters

array $components: An array of arrays of component (theme and/or module) names to import translations for, indexed by type.

1 call to l10n_update_system_remove()
l10n_update_modules_uninstalled in ./l10n_update.module
Implements hook_modules_uninstalled().

File

./l10n_update.module, line 544
Download translations from remote localization server.

Code

function l10n_update_system_remove(array $components) {
  $components += array(
    'module' => array(),
    'theme' => array(),
  );
  $list = array_merge($components['module'], $components['theme']);
  if ($language_list = l10n_update_translatable_language_list()) {
    module_load_include('compare.inc', 'l10n_update');
    module_load_include('bulk.inc', 'l10n_update');

    // Only when projects are removed, the translation files and records will be
    // deleted. Not each disabled module will remove a project. E.g. sub
    // modules.
    $projects = array_keys(l10n_update_get_projects());
    if ($list = array_intersect($list, $projects)) {
      l10n_update_file_history_delete($list);

      // Remove translation files.
      l10n_update_delete_translation_files($list, array());

      // Remove translatable projects.
      // Followup issue https://www.drupal.org/node/1842362 to replace the
      // {l10n_update_project} table. Then change this to a function call.
      db_delete('l10n_update_project')
        ->condition('name', $list)
        ->execute();

      // Clear the translation status.
      l10n_update_status_delete_projects($list);
    }
  }
}