You are here

public function ImageAPIOptimizePipeline::__destruct in Image Optimize (or ImageAPI Optimize) 4.x

Same name and namespace in other branches
  1. 8.3 src/Entity/ImageAPIOptimizePipeline.php \Drupal\imageapi_optimize\Entity\ImageAPIOptimizePipeline::__destruct()
  2. 8.2 src/Entity/ImageAPIOptimizePipeline.php \Drupal\imageapi_optimize\Entity\ImageAPIOptimizePipeline::__destruct()

Clean up any temporary files created in optimization.

File

src/Entity/ImageAPIOptimizePipeline.php, line 298

Class

ImageAPIOptimizePipeline
Defines an image optimize pipeline configuration entity.

Namespace

Drupal\imageapi_optimize\Entity

Code

public function __destruct() {
  foreach ($this->temporaryFiles as $file) {
    if (file_exists($file)) {
      \Drupal::service('file_system')
        ->delete($file);
    }
  }
}