Skip to content

Commit

Permalink
Deterministic hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
timkelty committed Dec 14, 2023
1 parent be6d855 commit cb9ba2a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/AssetManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,19 @@ protected function preparePaths(): void
$this->baseUrl = (new CpResourcesFs())->getRootUrl();
}
}

protected function hash($path): string
{
$dir = is_file($path) ? dirname($path) : $path;
$data = [
// @phpstan-ignore-next-line
Craft::alias($dir),
$this->linkAssets,
];

return sprintf(
'%x',
crc32(implode('|', $data)),
);
}
}

0 comments on commit cb9ba2a

Please sign in to comment.