Skip to content

Commit

Permalink
Invalidate cache upon update
Browse files Browse the repository at this point in the history
  • Loading branch information
xdpirate committed Mar 12, 2024
1 parent 5c27f30 commit 0e07a69
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 9 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@
error_reporting(E_ERROR | E_WARNING | E_PARSE);
ini_set("display_errors", 1);

if(isset($_GET['invalidateCache'])) {
header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ./");
}

$platformList = ["PS5", "PS4", "XSX", "XB1", "Switch", "PC", "Android", "PSVR2", "iOS"];
sort($platformList);

Expand Down
4 changes: 1 addition & 3 deletions php/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@
print("
<div>
Success! This installation of GameHorizon has been updated to <a href='https://github.com/xdpirate/gamehorizon/commit/$commitHash' target='_blank'><b><code>$commitHash</code></b></a>.<br /><br />
To avoid errors from stale cache entries in your browser, it's a good idea to clear the cache once you exit the updater. You can do this by pressing Ctrl+F5, or by holding down Shift, then clicking the Refresh button in your browser toolbar with the cursor.<br /><br />
<a href='https://github.com/xdpirate/gamehorizon/commits/main' target='_blank'>See commit history</a><br /><br />
<input type='button' value='Return to GameHorizon' onclick='window.location.href=\".\";'>
<a href='https://github.com/xdpirate/gamehorizon/commits/main' target='_blank'>See commit history</a> (opens in a new tab) or <input type='button' value='Return to GameHorizon' onclick='window.location.href='./?invalidateCache';'>
</div>
");
}
Expand Down

0 comments on commit 0e07a69

Please sign in to comment.