You are here

public function Cleaner::clean in Automatic Updates 8.2

File

src/ComposerStager/Cleaner.php, line 56

Class

Cleaner
Defines a cleaner service that makes the staged site directory writable.

Namespace

Drupal\automatic_updates\ComposerStager

Code

public function clean(string $stagingDir, ?ProcessOutputCallbackInterface $callback = NULL, ?int $timeout = 120) : void {

  // Ensure that the staged site directory is writable so we can delete it.
  $site_dir = implode(DIRECTORY_SEPARATOR, [
    $stagingDir,
    $this->pathLocator
      ->getWebRoot() ?: '.',
    $this->sitePath,
  ]);
  if ($this
    ->directoryExists($site_dir)) {
    (new Filesystem())
      ->chmod($site_dir, 0777);
  }
  $this->decorated
    ->clean($stagingDir, $callback, $timeout);
}