You are here

function opigno_tincan_activity_file_delete in Opigno module 3.x

Same name and namespace in other branches
  1. 8 ActivityTypes/opigno_tincan_activity/opigno_tincan_activity.module \opigno_tincan_activity_file_delete()

Implements hook_file_delete().

File

ActivityTypes/opigno_tincan_activity/opigno_tincan_activity.module, line 17
The main module file which contains the main drupal hooks.

Code

function opigno_tincan_activity_file_delete($file) {

  // Delete the extracted files that are in the extracted folder.
  $tincan_content_service = \Drupal::service('opigno_tincan_activity.tincan');
  $len = strlen($tincan_content_service->PATH_PUBLIC_PACKAGE_FOLDER);
  if (substr($file
    ->getFileUri(), 0, $len) === $tincan_content_service->PATH_PUBLIC_PACKAGE_FOLDER) {
    \Drupal::service('file_system')
      ->deleteRecursive($tincan_content_service
      ->getExtractPath($file));
  }
}