AppserverIo\Appserver\Core\AbstractExtractor::restoreBackup PHP Method

restoreBackup() public method

Restores the backup files from the backup directory.
public restoreBackup ( AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface $containerNode, SplFileInfo $archive ) : void
$containerNode AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface The container the archive belongs to
$archive SplFileInfo To restore the files for
return void
    public function restoreBackup(ContainerNodeInterface $containerNode, \SplFileInfo $archive)
    {
        // if we don't want create backups we can't restore them, so do nothing
        if ($this->getExtractorNode()->isCreateBackups() === false || $this->getExtractorNode()->isRestoreBackups() === false) {
            return;
        }
        // create tmp & webapp folder name based on the archive's basename
        $webappFolderName = $this->getWebappsDir($containerNode, basename($archive->getFilename(), $this->getExtensionSuffix()));
        $tmpFolderName = $this->getTmpDir($containerNode, md5(basename($archive->getFilename(), $this->getExtensionSuffix())));
        // copy backup to webapp directory
        $this->copyDir($tmpFolderName, $webappFolderName);
    }