aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/ApplicationUtils.php
diff options
context:
space:
mode:
authorVirtualTam <virtualtam+github@flibidi.net>2017-10-06 14:32:07 +0200
committerGitHub <noreply@github.com>2017-10-06 14:32:07 +0200
commitc8d96b4729a96ff2321862ca13a727658860e7a5 (patch)
treeb9d19abb6351f972027dc8301d9869ba04ae45ea /application/ApplicationUtils.php
parentb3e39bf57ecf0f92357b1f15051cf2e9d3f1b267 (diff)
parentb3e1f92e9cd0cae35bc726ca3a2356b4e631ccfa (diff)
downloadShaarli-c8d96b4729a96ff2321862ca13a727658860e7a5.tar.gz
Shaarli-c8d96b4729a96ff2321862ca13a727658860e7a5.tar.zst
Shaarli-c8d96b4729a96ff2321862ca13a727658860e7a5.zip
Merge pull request #979 from ArthurHoaro/feature/assets-cache-version
Add a version hash for asset loading to prevent browser's cache issue
Diffstat (limited to 'application/ApplicationUtils.php')
-rw-r--r--application/ApplicationUtils.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/application/ApplicationUtils.php b/application/ApplicationUtils.php
index 123cc0b3..5643f4a0 100644
--- a/application/ApplicationUtils.php
+++ b/application/ApplicationUtils.php
@@ -221,4 +221,19 @@ class ApplicationUtils
221 221
222 return $errors; 222 return $errors;
223 } 223 }
224
225 /**
226 * Returns a salted hash representing the current Shaarli version.
227 *
228 * Useful for assets browser cache.
229 *
230 * @param string $currentVersion of Shaarli
231 * @param string $salt User personal salt, also used for the authentication
232 *
233 * @return string version hash
234 */
235 public static function getVersionHash($currentVersion, $salt)
236 {
237 return hash_hmac('sha256', $currentVersion, $salt);
238 }
224} 239}