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:
parent
1edcbc0657
commit
23578da4e2
24 changed files with 457 additions and 271 deletions
22
legacy/application/common/Assets.php
Normal file
22
legacy/application/common/Assets.php
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue