feat(legacy): invalidate cached assets using md5sum (#2161)

* feat(legacy): invalidate cached assets  using md5sum

Don't rely on version to invalidate cached assets

* use Assets::url() when loading legacy pages

* fix script docs
This commit is contained in:
Jonas L 2022-09-19 11:58:31 +02:00 committed by GitHub
parent 1edcbc0657
commit 23578da4e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 457 additions and 271 deletions

View file

@ -0,0 +1,22 @@
<?php
class Assets
{
private static $cache;
private static function getChecksum($path)
{
if (is_null(self::$cache)) {
self::$cache = json_decode(@file_get_contents(APPLICATION_PATH . '/assets.json'), true);
}
return self::$cache[$path];
}
public static function url($path)
{
$base_url = Config::getBasePath();
return $base_url . $path . '?' . self::getChecksum($path);
}
}