You are here

protected function DeprecationAnalyzer::prepareTempDirectory in Upgrade Status 8.3

Same name and namespace in other branches
  1. 8.2 src/DeprecationAnalyzer.php \Drupal\upgrade_status\DeprecationAnalyzer::prepareTempDirectory()

Prepare temporary directories for Upgrade Status.

The created directories in Drupal's temporary directory are needed to dynamically set a temporary directory for PHPStan's cache in the neon file provided by Upgrade Status.

Throws

\Exception If creating the temporary directory failed.

1 call to DeprecationAnalyzer::prepareTempDirectory()
DeprecationAnalyzer::initEnvironment in src/DeprecationAnalyzer.php
Initialize the external environment.

File

src/DeprecationAnalyzer.php, line 560

Class

DeprecationAnalyzer

Namespace

Drupal\upgrade_status

Code

protected function prepareTempDirectory() {
  $success = $this->fileSystem
    ->prepareDirectory($this->temporaryDirectory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS);
  if (!$success) {
    throw new \Exception('Unable to create temporary directory for Upgrade Status at ' . $this->temporaryDirectory);
  }
  $phpstan_cache_directory = $this->temporaryDirectory . '/phpstan';
  $success = $this->fileSystem
    ->prepareDirectory($phpstan_cache_directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS);
  if (!$success) {
    throw new \Exception('Unable to create temporary directory for PHPStan at ' . $phpstan_cache_directory);
  }
}