AcsfDuplicationScrubTemporaryFilesHandler.php in Acquia Cloud Site Factory Connector 8.2
File
src/Event/AcsfDuplicationScrubTemporaryFilesHandler.php
View source
<?php
namespace Drupal\acsf\Event;
class AcsfDuplicationScrubTemporaryFilesHandler extends AcsfEventHandler {
public function handle() {
$this
->consoleLog(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();
}
}
}