AcsfDuplicationScrubTemporaryFilesHandler.php in Acquia Cloud Site Factory Connector 8
File
src/Event/AcsfDuplicationScrubTemporaryFilesHandler.php
View source
<?php
namespace Drupal\acsf\Event;
class AcsfDuplicationScrubTemporaryFilesHandler extends AcsfEventHandler {
public function handle() {
drush_print(dt('Entered @class', [
'@class' => get_class($this),
]));
$file_storage = \Drupal::entityTypeManager()
->getStorage('file');
$fids = $file_storage
->getQuery()
->condition('status', FILE_STATUS_PERMANENT, '<>')
->range(0, 1000)
->execute();
$files = $file_storage
->loadMultiple($fids);
foreach ($files as $file) {
$file
->delete();
}
}
}