You are here

function image_uninstall in Drupal 8

Same name and namespace in other branches
  1. 7 modules/image/image.install \image_uninstall()
  2. 9 core/modules/image/image.install \image_uninstall()
  3. 10 core/modules/image/image.install \image_uninstall()

Implements hook_uninstall().

File

core/modules/image/image.install, line 23
Install, update and uninstall functions for the image module.

Code

function image_uninstall() {

  // Remove the styles directory and generated images.

  /** @var \Drupal\Core\File\FileSystemInterface $file_system */
  $file_system = \Drupal::service('file_system');
  try {
    $file_system
      ->deleteRecursive(\Drupal::config('system.file')
      ->get('default_scheme') . '://styles');
  } catch (FileException $e) {

    // Ignore failed deletes.
  }
}