/** * Removes the template update initiated file, indicating updates have completed. * * @param $path */ private function removePackageUpdateInitiatedFile($path) { $this->log->info('Removing package templating update initiated file', ['path' => $path]); $updateInitiatedFile = $path . DIRECTORY_SEPARATOR . '_newup_update_initiated'; if ($this->files->exists($updateInitiatedFile)) { $this->files->delete($updateInitiatedFile); } }
/** * Removes all files and directories that are set to be * automatically removed. * * @param $destinationDirectory * @return array */ private function removeFilesAndDirectories($destinationDirectory) { $currentStructure = $this->fileSystem->allFiles($destinationDirectory); $removedPaths = []; foreach ($currentStructure as $file) { /* @var SplFileInfo $file */ $directoryPath = $this->normalizePath($destinationDirectory . DIRECTORY_SEPARATOR . $file->getRelativePath()); $fullPath = $this->normalizePath($destinationDirectory . DIRECTORY_SEPARATOR . $file->getRelativePathname()); if ($this->shouldBeRemoved($directoryPath)) { $removedPaths[] = $directoryPath; $this->fileSystem->deleteDirectory($directoryPath, false); } if ($this->shouldBeRemoved($fullPath)) { $removedPaths[] = $fullPath; $this->fileSystem->delete($fullPath); } } return $removedPaths; }