From 88797f80e1c9a23c84be6df52946d799e19147aa Mon Sep 17 00:00:00 2001 From: Mitch Ray <5735900+mitchray@users.noreply.github.com> Date: Wed, 13 Oct 2021 16:14:28 +1100 Subject: [PATCH] Cache bust some frequently updated assets (#3042) * Cache bust some frequently updated assets * Clear asset cache during AutoUpdate --- .gitignore | 1 + public/templates/header.inc.php | 7 +- public/templates/install_footer.inc.php | 2 +- public/templates/show_debug.inc.php | 3 + .../show_html5_player_headers.inc.php | 7 +- .../show_registration_confirmation.inc.php | 5 +- public/templates/show_user_activate.inc.php | 5 +- .../templates/show_user_registration.inc.php | 5 +- public/templates/stylesheets.inc.php | 11 +- public/themes/reborn/templates/dark.css | 14 +-- public/themes/reborn/templates/default.css | 8 +- public/themes/reborn/templates/light.css | 18 ++-- .../Admin/System/ClearCacheAction.php | 4 + src/Module/System/AutoUpdate.php | 2 + src/Module/Util/AssetCache.php | 100 ++++++++++++++++++ 15 files changed, 154 insertions(+), 38 deletions(-) create mode 100644 src/Module/Util/AssetCache.php diff --git a/.gitignore b/.gitignore index 6c045b07b2..74350c1e2d 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ public/develop public/master public/foam public/ample +public/cached_assets/ storage/ tmp/ /vendor/ diff --git a/public/templates/header.inc.php b/public/templates/header.inc.php index 3283adf77e..6113d28138 100644 --- a/public/templates/header.inc.php +++ b/public/templates/header.inc.php @@ -28,6 +28,7 @@ use Ampache\Module\System\AutoUpdate; use Ampache\Module\System\Core; use Ampache\Module\Util\AjaxUriRetrieverInterface; +use Ampache\Module\Util\AssetCache; use Ampache\Module\Util\Mailer; use Ampache\Module\Util\Ui; use Ampache\Repository\PrivateMessageRepositoryInterface; @@ -99,9 +100,9 @@ - - - + + + - + +
  • + +
  • diff --git a/public/templates/show_html5_player_headers.inc.php b/public/templates/show_html5_player_headers.inc.php index 55c895ba2c..a1cfe6b132 100644 --- a/public/templates/show_html5_player_headers.inc.php +++ b/public/templates/show_html5_player_headers.inc.php @@ -4,6 +4,7 @@ use Ampache\Module\Broadcast\Broadcast_Server; use Ampache\Module\Playback\Stream; use Ampache\Module\Util\AjaxUriRetrieverInterface; +use Ampache\Module\Util\AssetCache; use Ampache\Module\Util\Ui; global $dic; @@ -29,9 +30,9 @@ - - - + + + - - + +
    .
    - - + +
    - - + +