function locale_uninstall

Implements hook_uninstall().

File

drupal/core/modules/locale/locale.install, line 11
Install, update, and uninstall functions for the Locale module.

Code

function locale_uninstall() {

  // Delete all JavaScript translation files.
  $locale_js_directory = 'public://' . variable_get('locale_js_directory', 'languages');
  if (is_dir($locale_js_directory)) {
    $locale_javascripts = variable_get('locale_translation_javascript', array());
    foreach ($locale_javascripts as $langcode => $file_suffix) {
      if (!empty($file_suffix)) {
        file_unmanaged_delete($locale_js_directory . '/' . $langcode . '_' . $file_suffix . '.js');
      }
    }

    // Delete the JavaScript translations directory if empty.
    if (!file_scan_directory($locale_js_directory, '/.*/')) {
      drupal_rmdir($locale_js_directory);
    }
  }

  // Clear variables.
  variable_del('locale_cache_strings');
  variable_del('locale_js_directory');
  state()
    ->delete('system.javascript_parsed');
  variable_del('locale_cache_length');
  variable_del('locale_translation_plurals');
  variable_del('locale_translation_javascript');

  // Remove all node type language variables. Node module might have been
  // enabled, but may be disabled, so use a wildcard delete.
  db_delete('variable')
    ->condition('name', db_like('language_content_type_') . '%', 'LIKE')
    ->execute();
}