Skip to content

Commit

Permalink
Fix : get asset version with symbolic link
Browse files Browse the repository at this point in the history
  • Loading branch information
lennyrouanet committed Nov 2, 2023
1 parent 8c09915 commit 422e6be
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions component/AssetsVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,25 +109,28 @@ private function getFromPath(string $assetPath): ?AssetVersion

private function getAssetVersionFromGitRevisions(string $assetPath): ?AssetVersion
{
$command = sprintf('git log --oneline %s | wc -l', escapeshellarg($this->pathToBeProcessed . $assetPath));
$revision = exec($command);
$realPath = realpath($this->pathToBeProcessed . $assetPath);

$command = sprintf('git log --oneline %s | wc -l', escapeshellarg($realPath));
$revision = (int) exec($command);

if (!$revision) {
return null;
}

return new AssetVersion($assetPath, AssetVersion::TYPE_VERSION, (int) $revision);
return new AssetVersion($assetPath, AssetVersion::TYPE_VERSION, $revision);
}

private function getAssetVersionFromFileUpdateTime(string $assetPath): ?AssetVersion
{
$modificationTime = filemtime($this->pathToBeProcessed . $assetPath);
$realPath = realpath($this->pathToBeProcessed . $assetPath);
$modificationTime = (int) filemtime($realPath);

if (!$modificationTime) {
return null;
}

return new AssetVersion($assetPath, AssetVersion::TYPE_MODIFICATION_TIME, (int) $modificationTime);
return new AssetVersion($assetPath, AssetVersion::TYPE_MODIFICATION_TIME, $modificationTime);
}

private function getAssetPathList(string $subpath = ''): array
Expand Down

0 comments on commit 422e6be

Please sign in to comment.