PackageGenerator::getPackageFilename PHP Method

getPackageFilename() public method

Generate or retrieve a package from the cache
public getPackageFilename ( string $identifier, string $sha, string $repositoryDir, DeploynautLogFile $log ) : string
$identifier string A unique identifier for the generator; used to partition the cache
$sha string The SHA of the commit to be deployed
$repositoryDir string The directory where the repository resides
$log DeploynautLogFile The log to write status output to, including package-generation commands
return string
    public function getPackageFilename($identifier, $sha, $repositoryDir, \DeploynautLogFile $log)
    {
        // Fetch through the cache
        if ($this->cache) {
            $identifier .= '-' . get_class($this) . '-' . $this->getIdentifier();
            return $this->cache->getPackageFilename($this, $identifier, $sha, $repositoryDir, $log);
            // Default, cacheless implementation
        } else {
            $filename = TEMP_FOLDER . '/' . $sha . '.tar.gz';
            if ($this->generatePackage($sha, $repositoryDir, $filename, $log)) {
                return $filename;
            }
        }
    }