function locale_uninstall in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/locale/locale.install \locale_uninstall()
Implements hook_uninstall().
File
- core/
modules/ locale/ locale.install, line 26 - Install, update, and uninstall functions for the Locale module.
Code
function locale_uninstall() {
$config = \Drupal::config('locale.settings');
// Delete all JavaScript translation files.
$locale_js_directory = 'public://' . $config
->get('javascript.directory');
if (is_dir($locale_js_directory)) {
$locale_javascripts = \Drupal::state()
->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.
\Drupal::state()
->delete('system.javascript_parsed');
\Drupal::state()
->delete('locale.translation.plurals');
\Drupal::state()
->delete('locale.translation.javascript');
}