You are here

protected function DeprecationAnalyser::prepareTempDirectory in Upgrade Status 8

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.

Return value

bool True if the temporary directory is created, false if not.

1 call to DeprecationAnalyser::prepareTempDirectory()
DeprecationAnalyser::__construct in src/DeprecationAnalyser.php
Constructs a \Drupal\upgrade_status\DeprecationAnalyser.

File

src/DeprecationAnalyser.php, line 362

Class

DeprecationAnalyser

Namespace

Drupal\upgrade_status

Code

protected function prepareTempDirectory() {
  $success = $this->fileSystem
    ->prepareDirectory($this->upgradeStatusTemporaryDirectory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS);
  if (!$success) {
    $this->logger
      ->error($this
      ->t("Unable to create temporary directory for Upgrade Status: @directory.", [
      '@directory' => $this->upgradeStatusTemporaryDirectory,
    ]));
    return $success;
  }
  $phpstan_cache_directory = $this->upgradeStatusTemporaryDirectory . '/phpstan';
  $success = $this->fileSystem
    ->prepareDirectory($phpstan_cache_directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS);
  if (!$success) {
    $this->logger
      ->error($this
      ->t("Unable to create temporary directory for PHPStan: @directory.", [
      '@directory' => $phpstan_cache_directory,
    ]));
  }
  return $success;
}