You are here

public function ContentSynchronizerCommands::synchronizerCleanTemporaryFiles in Content Synchronizer 8.2

Same name and namespace in other branches
  1. 8 src/Commands/ContentSynchronizerCommands.php \Drupal\content_synchronizer\Commands\ContentSynchronizerCommands::synchronizerCleanTemporaryFiles()

Delete temporary files.

@command content:synchronizer-clean-temporary-files @aliases csctf,content-synchronizer-clean-temporary-files

File

src/Commands/ContentSynchronizerCommands.php, line 111

Class

ContentSynchronizerCommands
A Drush commandfile.

Namespace

Drupal\content_synchronizer\Commands

Code

public function synchronizerCleanTemporaryFiles() {
  $path = $this->fileSystem
    ->realpath(ExportEntityWriter::GENERATOR_DIR);

  /** @var \Drupal\Core\File\FileSystemInterface $fileSystem */
  $fileSystem = \Drupal::service('file_system');
  foreach (glob($path . '/*') as $file) {
    if (is_dir($file)) {
      $fileSystem
        ->deleteRecursive($file);
    }
  }
}