Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/image/image.install @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | a9cd425dd02b |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
3 /** | 3 /** |
4 * @file | 4 * @file |
5 * Install, update and uninstall functions for the image module. | 5 * Install, update and uninstall functions for the image module. |
6 */ | 6 */ |
7 | 7 |
8 use Drupal\Core\File\Exception\FileException; | |
9 use Drupal\Core\File\FileSystemInterface; | |
10 | |
8 /** | 11 /** |
9 * Implements hook_install(). | 12 * Implements hook_install(). |
10 */ | 13 */ |
11 function image_install() { | 14 function image_install() { |
12 // Create the styles directory and ensure it's writable. | 15 // Create the styles directory and ensure it's writable. |
13 $directory = file_default_scheme() . '://styles'; | 16 $directory = file_default_scheme() . '://styles'; |
14 file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); | 17 \Drupal::service('file_system')->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS); |
15 } | 18 } |
16 | 19 |
17 /** | 20 /** |
18 * Implements hook_uninstall(). | 21 * Implements hook_uninstall(). |
19 */ | 22 */ |
20 function image_uninstall() { | 23 function image_uninstall() { |
21 // Remove the styles directory and generated images. | 24 // Remove the styles directory and generated images. |
22 file_unmanaged_delete_recursive(file_default_scheme() . '://styles'); | 25 /** @var \Drupal\Core\File\FileSystemInterface $file_system */ |
26 $file_system = \Drupal::service('file_system'); | |
27 try { | |
28 $file_system->deleteRecursive(file_default_scheme() . '://styles'); | |
29 } | |
30 catch (FileException $e) { | |
31 // Ignore failed deletes. | |
32 } | |
23 } | 33 } |
24 | 34 |
25 /** | 35 /** |
26 * Implements hook_requirements() to check the PHP GD Library. | 36 * Implements hook_requirements() to check the PHP GD Library. |
27 * | 37 * |